Back to godoc.org

Package drivers

v0.3.9
Latest Go to latest

The highest tagged major version is .

Published: Jun 19, 2020 | License: Apache-2.0 | Module: github.com/byuoitav/av-control-api

Overview

Package drivers provides the interfaces that driver libraries implement to simplify the library code as well as the server code for the driver server.

Each interface has an associated create function:

type Create(Interface)Func func(context.Context, string) ((Interface), error)

as well as an associated function to create a HTTP server:

func Create(Interface)Server(create Create(Interface)Func) (Server, error)

A driver library provides a struct that implements the appropriate interface. For example, a driver library for the QSC DSP should implement the DSP interface.

This package includes subdirectories with all of the driver servers that BYU maintains. A driver server puts together dependencies (a driver library, logging libraries, auth libraries, etc) and runs an HTTP server using standard endpoints for each device type. It will provide a Create... function and should have its own go mod file to manage its dependencies versions. The examples below are examples of the main function of a driver server.

Index

Variables

var Config zap.Config

Config is the logger config used for P

var File_driver_proto protoreflect.FileDescriptor
var Log *zap.SugaredLogger

Log is a plain zap logger

func RegisterDriverServer

func RegisterDriverServer(s *grpc.Server, srv DriverServer)

type Blank

type Blank struct {
	Blanked bool `protobuf:"varint,1,opt,name=blanked,proto3" json:"blanked,omitempty"`
	// contains filtered or unexported fields
}

func (*Blank) Descriptor

func (*Blank) Descriptor() ([]byte, []int)

Deprecated: Use Blank.ProtoReflect.Descriptor instead.

func (*Blank) GetBlanked

func (x *Blank) GetBlanked() bool

func (*Blank) ProtoMessage

func (*Blank) ProtoMessage()

func (*Blank) ProtoReflect

func (x *Blank) ProtoReflect() protoreflect.Message

func (*Blank) Reset

func (x *Blank) Reset()

func (*Blank) String

func (x *Blank) String() string

type Capabilities

type Capabilities struct {
	Capabilities []string `protobuf:"bytes,1,rep,name=capabilities,proto3" json:"capabilities,omitempty"`
	// contains filtered or unexported fields
}

func (*Capabilities) Descriptor

func (*Capabilities) Descriptor() ([]byte, []int)

Deprecated: Use Capabilities.ProtoReflect.Descriptor instead.

func (*Capabilities) GetCapabilities

func (x *Capabilities) GetCapabilities() []string

func (*Capabilities) ProtoMessage

func (*Capabilities) ProtoMessage()

func (*Capabilities) ProtoReflect

func (x *Capabilities) ProtoReflect() protoreflect.Message

func (*Capabilities) Reset

func (x *Capabilities) Reset()

func (*Capabilities) String

func (x *Capabilities) String() string

type Capability

type Capability string
const (
	CapabilityPower           Capability = "Power"
	CapabilityAudioInput      Capability = "AudioInput"
	CapabilityVideoInput      Capability = "VideoInput"
	CapabilityAudioVideoInput Capability = "AudioVideoInput"
	CapabilityBlank           Capability = "Blank"
	CapabilityVolume          Capability = "Volume"
	CapabilityMute            Capability = "Mute"
	CapabilityInfo            Capability = "Info"
)

type Device

type Device interface{}

type DeviceInfo

type DeviceInfo struct {
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceInfo) Descriptor

func (*DeviceInfo) Descriptor() ([]byte, []int)

Deprecated: Use DeviceInfo.ProtoReflect.Descriptor instead.

func (*DeviceInfo) GetAddress

func (x *DeviceInfo) GetAddress() string

func (*DeviceInfo) ProtoMessage

func (*DeviceInfo) ProtoMessage()

func (*DeviceInfo) ProtoReflect

func (x *DeviceInfo) ProtoReflect() protoreflect.Message

func (*DeviceInfo) Reset

func (x *DeviceInfo) Reset()

func (*DeviceInfo) String

func (x *DeviceInfo) String() string

type DeviceWithAudioInput

type DeviceWithAudioInput interface {
	GetAudioInputs(ctx context.Context) (map[string]string, error)
	SetAudioInput(ctx context.Context, output, input string) error
}

type DeviceWithAudioVideoInput

type DeviceWithAudioVideoInput interface {
	GetAudioVideoInputs(ctx context.Context) (map[string]string, error)
	SetAudioVideoInput(ctx context.Context, output, input string) error
}

type DeviceWithBlank

type DeviceWithBlank interface {
	GetBlank(context.Context) (bool, error)
	SetBlank(context.Context, bool) error
}

type DeviceWithInfo

type DeviceWithInfo interface {
	GetInfo(context.Context) (interface{}, error)
}

type DeviceWithMute

type DeviceWithMute interface {
	GetMutes(ctx context.Context, blocks []string) (map[string]bool, error)
	SetMute(context.Context, string, bool) error
}

type DeviceWithPower

type DeviceWithPower interface {
	GetPower(context.Context) (bool, error)
	SetPower(context.Context, bool) error
}

type DeviceWithVideoInput

type DeviceWithVideoInput interface {
	GetVideoInputs(ctx context.Context) (map[string]string, error)
	SetVideoInput(ctx context.Context, output, input string) error
}

type DeviceWithVolume

type DeviceWithVolume interface {
	GetVolumes(ctx context.Context, blocks []string) (map[string]int, error)
	SetVolume(context.Context, string, int) error
}

type DriverClient

type DriverClient interface {
	GetCapabilities(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*Capabilities, error)
	GetPower(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*Power, error)
	SetPower(ctx context.Context, in *SetPowerRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	GetAudioInputs(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*Inputs, error)
	SetAudioInput(ctx context.Context, in *SetInputRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	GetVideoInputs(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*Inputs, error)
	SetVideoInput(ctx context.Context, in *SetInputRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	GetAudioVideoInputs(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*Inputs, error)
	SetAudioVideoInput(ctx context.Context, in *SetInputRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	GetBlank(ctx context.Context, in *DeviceInfo, opts ...grpc.CallOption) (*Blank, error)
	SetBlank(ctx context.Context, in *SetBlankRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	GetVolumes(ctx context.Context, in *GetAudioInfo, opts ...grpc.CallOption) (*Volumes, error)
	SetVolume(ctx context.Context, in *SetVolumeRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	GetMutes(ctx context.Context, in *GetAudioInfo, opts ...grpc.CallOption) (*Mutes, error)
	SetMute(ctx context.Context, in *SetMuteRequest, opts ...grpc.CallOption) (*empty.Empty, error)
}

DriverClient is the client API for Driver service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewDriverClient

func NewDriverClient(cc grpc.ClientConnInterface) DriverClient

type DriverServer

type DriverServer interface {
	GetCapabilities(context.Context, *DeviceInfo) (*Capabilities, error)
	GetPower(context.Context, *DeviceInfo) (*Power, error)
	SetPower(context.Context, *SetPowerRequest) (*empty.Empty, error)
	GetAudioInputs(context.Context, *DeviceInfo) (*Inputs, error)
	SetAudioInput(context.Context, *SetInputRequest) (*empty.Empty, error)
	GetVideoInputs(context.Context, *DeviceInfo) (*Inputs, error)
	SetVideoInput(context.Context, *SetInputRequest) (*empty.Empty, error)
	GetAudioVideoInputs(context.Context, *DeviceInfo) (*Inputs, error)
	SetAudioVideoInput(context.Context, *SetInputRequest) (*empty.Empty, error)
	GetBlank(context.Context, *DeviceInfo) (*Blank, error)
	SetBlank(context.Context, *SetBlankRequest) (*empty.Empty, error)
	GetVolumes(context.Context, *GetAudioInfo) (*Volumes, error)
	SetVolume(context.Context, *SetVolumeRequest) (*empty.Empty, error)
	GetMutes(context.Context, *GetAudioInfo) (*Mutes, error)
	SetMute(context.Context, *SetMuteRequest) (*empty.Empty, error)
}

DriverServer is the server API for Driver service.

type GetAudioInfo

type GetAudioInfo struct {
	Info   *DeviceInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	Blocks []string    `protobuf:"bytes,2,rep,name=blocks,proto3" json:"blocks,omitempty"`
	// contains filtered or unexported fields
}

func (*GetAudioInfo) Descriptor

func (*GetAudioInfo) Descriptor() ([]byte, []int)

Deprecated: Use GetAudioInfo.ProtoReflect.Descriptor instead.

func (*GetAudioInfo) GetBlocks

func (x *GetAudioInfo) GetBlocks() []string

func (*GetAudioInfo) GetInfo

func (x *GetAudioInfo) GetInfo() *DeviceInfo

func (*GetAudioInfo) ProtoMessage

func (*GetAudioInfo) ProtoMessage()

func (*GetAudioInfo) ProtoReflect

func (x *GetAudioInfo) ProtoReflect() protoreflect.Message

func (*GetAudioInfo) Reset

func (x *GetAudioInfo) Reset()

func (*GetAudioInfo) String

func (x *GetAudioInfo) String() string

type Inputs

type Inputs struct {
	Inputs map[string]string "" /* 153 byte string literal not displayed */

}

func (*Inputs) Descriptor

func (*Inputs) Descriptor() ([]byte, []int)

Deprecated: Use Inputs.ProtoReflect.Descriptor instead.

func (*Inputs) GetInputs

func (x *Inputs) GetInputs() map[string]string

func (*Inputs) ProtoMessage

func (*Inputs) ProtoMessage()

func (*Inputs) ProtoReflect

func (x *Inputs) ProtoReflect() protoreflect.Message

func (*Inputs) Reset

func (x *Inputs) Reset()

func (*Inputs) String

func (x *Inputs) String() string

type Mutes

type Mutes struct {
	Mutes map[string]bool "" /* 152 byte string literal not displayed */

}

func (*Mutes) Descriptor

func (*Mutes) Descriptor() ([]byte, []int)

Deprecated: Use Mutes.ProtoReflect.Descriptor instead.

func (*Mutes) GetMutes

func (x *Mutes) GetMutes() map[string]bool

func (*Mutes) ProtoMessage

func (*Mutes) ProtoMessage()

func (*Mutes) ProtoReflect

func (x *Mutes) ProtoReflect() protoreflect.Message

func (*Mutes) Reset

func (x *Mutes) Reset()

func (*Mutes) String

func (x *Mutes) String() string

type NewDeviceFunc

type NewDeviceFunc func(context.Context, string) (Device, error)

NewDeviceFunc is passed to NewServer and is called to create a new Device struct whenever the Server needs to control with a new Device.

type Power

type Power struct {
	On bool `protobuf:"varint,1,opt,name=on,proto3" json:"on,omitempty"`
	// contains filtered or unexported fields
}

func (*Power) Descriptor

func (*Power) Descriptor() ([]byte, []int)

Deprecated: Use Power.ProtoReflect.Descriptor instead.

func (*Power) GetOn

func (x *Power) GetOn() bool

func (*Power) ProtoMessage

func (*Power) ProtoMessage()

func (*Power) ProtoReflect

func (x *Power) ProtoReflect() protoreflect.Message

func (*Power) Reset

func (x *Power) Reset()

func (*Power) String

func (x *Power) String() string

type Server

type Server interface {
	Serve(lis net.Listener) error
	Stop(ctx context.Context) error
}

func NewServer

func NewServer(newDev NewDeviceFunc) (Server, error)

type SetBlankRequest

type SetBlankRequest struct {
	Info  *DeviceInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	Blank *Blank      `protobuf:"bytes,2,opt,name=blank,proto3" json:"blank,omitempty"`
	// contains filtered or unexported fields
}

func (*SetBlankRequest) Descriptor

func (*SetBlankRequest) Descriptor() ([]byte, []int)

Deprecated: Use SetBlankRequest.ProtoReflect.Descriptor instead.

func (*SetBlankRequest) GetBlank

func (x *SetBlankRequest) GetBlank() *Blank

func (*SetBlankRequest) GetInfo

func (x *SetBlankRequest) GetInfo() *DeviceInfo

func (*SetBlankRequest) ProtoMessage

func (*SetBlankRequest) ProtoMessage()

func (*SetBlankRequest) ProtoReflect

func (x *SetBlankRequest) ProtoReflect() protoreflect.Message

func (*SetBlankRequest) Reset

func (x *SetBlankRequest) Reset()

func (*SetBlankRequest) String

func (x *SetBlankRequest) String() string

type SetInputRequest

type SetInputRequest struct {
	Info   *DeviceInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	Output string      `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"`
	Input  string      `protobuf:"bytes,3,opt,name=input,proto3" json:"input,omitempty"`
	// contains filtered or unexported fields
}

func (*SetInputRequest) Descriptor

func (*SetInputRequest) Descriptor() ([]byte, []int)

Deprecated: Use SetInputRequest.ProtoReflect.Descriptor instead.

func (*SetInputRequest) GetInfo

func (x *SetInputRequest) GetInfo() *DeviceInfo

func (*SetInputRequest) GetInput

func (x *SetInputRequest) GetInput() string

func (*SetInputRequest) GetOutput

func (x *SetInputRequest) GetOutput() string

func (*SetInputRequest) ProtoMessage

func (*SetInputRequest) ProtoMessage()

func (*SetInputRequest) ProtoReflect

func (x *SetInputRequest) ProtoReflect() protoreflect.Message

func (*SetInputRequest) Reset

func (x *SetInputRequest) Reset()

func (*SetInputRequest) String

func (x *SetInputRequest) String() string

type SetMuteRequest

type SetMuteRequest struct {
	Info  *DeviceInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	Block string      `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"`
	Muted bool        `protobuf:"varint,3,opt,name=muted,proto3" json:"muted,omitempty"`
	// contains filtered or unexported fields
}

func (*SetMuteRequest) Descriptor

func (*SetMuteRequest) Descriptor() ([]byte, []int)

Deprecated: Use SetMuteRequest.ProtoReflect.Descriptor instead.

func (*SetMuteRequest) GetBlock

func (x *SetMuteRequest) GetBlock() string

func (*SetMuteRequest) GetInfo

func (x *SetMuteRequest) GetInfo() *DeviceInfo

func (*SetMuteRequest) GetMuted

func (x *SetMuteRequest) GetMuted() bool

func (*SetMuteRequest) ProtoMessage

func (*SetMuteRequest) ProtoMessage()

func (*SetMuteRequest) ProtoReflect

func (x *SetMuteRequest) ProtoReflect() protoreflect.Message

func (*SetMuteRequest) Reset

func (x *SetMuteRequest) Reset()

func (*SetMuteRequest) String

func (x *SetMuteRequest) String() string

type SetPowerRequest

type SetPowerRequest struct {
	Info  *DeviceInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	Power *Power      `protobuf:"bytes,2,opt,name=power,proto3" json:"power,omitempty"`
	// contains filtered or unexported fields
}

func (*SetPowerRequest) Descriptor

func (*SetPowerRequest) Descriptor() ([]byte, []int)

Deprecated: Use SetPowerRequest.ProtoReflect.Descriptor instead.

func (*SetPowerRequest) GetInfo

func (x *SetPowerRequest) GetInfo() *DeviceInfo

func (*SetPowerRequest) GetPower

func (x *SetPowerRequest) GetPower() *Power

func (*SetPowerRequest) ProtoMessage

func (*SetPowerRequest) ProtoMessage()

func (*SetPowerRequest) ProtoReflect

func (x *SetPowerRequest) ProtoReflect() protoreflect.Message

func (*SetPowerRequest) Reset

func (x *SetPowerRequest) Reset()

func (*SetPowerRequest) String

func (x *SetPowerRequest) String() string

type SetVolumeRequest

type SetVolumeRequest struct {
	Info  *DeviceInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
	Block string      `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"`
	Level int32       `protobuf:"zigzag32,3,opt,name=level,proto3" json:"level,omitempty"`
	// contains filtered or unexported fields
}

func (*SetVolumeRequest) Descriptor

func (*SetVolumeRequest) Descriptor() ([]byte, []int)

Deprecated: Use SetVolumeRequest.ProtoReflect.Descriptor instead.

func (*SetVolumeRequest) GetBlock

func (x *SetVolumeRequest) GetBlock() string

func (*SetVolumeRequest) GetInfo

func (x *SetVolumeRequest) GetInfo() *DeviceInfo

func (*SetVolumeRequest) GetLevel

func (x *SetVolumeRequest) GetLevel() int32

func (*SetVolumeRequest) ProtoMessage

func (*SetVolumeRequest) ProtoMessage()

func (*SetVolumeRequest) ProtoReflect

func (x *SetVolumeRequest) ProtoReflect() protoreflect.Message

func (*SetVolumeRequest) Reset

func (x *SetVolumeRequest) Reset()

func (*SetVolumeRequest) String

func (x *SetVolumeRequest) String() string

type UnimplementedDriverServer

type UnimplementedDriverServer struct {
}

UnimplementedDriverServer can be embedded to have forward compatible implementations.

func (*UnimplementedDriverServer) GetAudioInputs

func (*UnimplementedDriverServer) GetAudioInputs(context.Context, *DeviceInfo) (*Inputs, error)

func (*UnimplementedDriverServer) GetAudioVideoInputs

func (*UnimplementedDriverServer) GetAudioVideoInputs(context.Context, *DeviceInfo) (*Inputs, error)

func (*UnimplementedDriverServer) GetBlank

func (*UnimplementedDriverServer) GetBlank(context.Context, *DeviceInfo) (*Blank, error)

func (*UnimplementedDriverServer) GetCapabilities

func (*UnimplementedDriverServer) GetCapabilities(context.Context, *DeviceInfo) (*Capabilities, error)

func (*UnimplementedDriverServer) GetMutes

func (*UnimplementedDriverServer) GetMutes(context.Context, *GetAudioInfo) (*Mutes, error)

func (*UnimplementedDriverServer) GetPower

func (*UnimplementedDriverServer) GetPower(context.Context, *DeviceInfo) (*Power, error)

func (*UnimplementedDriverServer) GetVideoInputs

func (*UnimplementedDriverServer) GetVideoInputs(context.Context, *DeviceInfo) (*Inputs, error)

func (*UnimplementedDriverServer) GetVolumes

func (*UnimplementedDriverServer) GetVolumes(context.Context, *GetAudioInfo) (*Volumes, error)

func (*UnimplementedDriverServer) SetAudioInput

func (*UnimplementedDriverServer) SetAudioInput(context.Context, *SetInputRequest) (*empty.Empty, error)

func (*UnimplementedDriverServer) SetAudioVideoInput

func (*UnimplementedDriverServer) SetAudioVideoInput(context.Context, *SetInputRequest) (*empty.Empty, error)

func (*UnimplementedDriverServer) SetBlank

func (*UnimplementedDriverServer) SetBlank(context.Context, *SetBlankRequest) (*empty.Empty, error)

func (*UnimplementedDriverServer) SetMute

func (*UnimplementedDriverServer) SetMute(context.Context, *SetMuteRequest) (*empty.Empty, error)

func (*UnimplementedDriverServer) SetPower

func (*UnimplementedDriverServer) SetPower(context.Context, *SetPowerRequest) (*empty.Empty, error)

func (*UnimplementedDriverServer) SetVideoInput

func (*UnimplementedDriverServer) SetVideoInput(context.Context, *SetInputRequest) (*empty.Empty, error)

func (*UnimplementedDriverServer) SetVolume

func (*UnimplementedDriverServer) SetVolume(context.Context, *SetVolumeRequest) (*empty.Empty, error)

type Volumes

type Volumes struct {
	Volumes map[string]int32 "" /* 158 byte string literal not displayed */

}

func (*Volumes) Descriptor

func (*Volumes) Descriptor() ([]byte, []int)

Deprecated: Use Volumes.ProtoReflect.Descriptor instead.

func (*Volumes) GetVolumes

func (x *Volumes) GetVolumes() map[string]int32

func (*Volumes) ProtoMessage

func (*Volumes) ProtoMessage()

func (*Volumes) ProtoReflect

func (x *Volumes) ProtoReflect() protoreflect.Message

func (*Volumes) Reset

func (x *Volumes) Reset()

func (*Volumes) String

func (x *Volumes) String() string

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier