speaker

package
v0.0.0-...-084e4ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithSpeakerApiClientFactory

func WithSpeakerApiClientFactory(f func(name string) (traits.SpeakerApiClient, error)) router.Option

WithSpeakerApiClientFactory instructs the router to create a new client the first time Get is called for that name.

func WithSpeakerInfoClientFactory

func WithSpeakerInfoClientFactory(f func(name string) (traits.SpeakerInfoClient, error)) router.Option

WithSpeakerInfoClientFactory instructs the router to create a new client the first time Get is called for that name.

func WrapApi

WrapApi adapts a traits.SpeakerApiServer and presents it as a traits.SpeakerApiClient

func WrapInfo

WrapInfo adapts a traits.SpeakerInfoServer and presents it as a traits.SpeakerInfoClient

Types

type ApiRouter

ApiRouter is a traits.SpeakerApiServer that allows routing named requests to specific traits.SpeakerApiClient

func NewApiRouter

func NewApiRouter(opts ...router.Option) *ApiRouter

func (*ApiRouter) Add

func (r *ApiRouter) Add(name string, client any) any

Add extends Router.Add to panic if client is not of type traits.SpeakerApiClient.

func (*ApiRouter) AddSpeakerApiClient

func (r *ApiRouter) AddSpeakerApiClient(name string, client traits.SpeakerApiClient) traits.SpeakerApiClient

func (*ApiRouter) GetSpeakerApiClient

func (r *ApiRouter) GetSpeakerApiClient(name string) (traits.SpeakerApiClient, error)

func (*ApiRouter) GetVolume

func (r *ApiRouter) GetVolume(ctx context.Context, request *traits.GetSpeakerVolumeRequest) (*types.AudioLevel, error)

func (*ApiRouter) HoldsType

func (r *ApiRouter) HoldsType(client any) bool

func (*ApiRouter) PullVolume

func (*ApiRouter) Register

func (r *ApiRouter) Register(server *grpc.Server)

func (*ApiRouter) RemoveSpeakerApiClient

func (r *ApiRouter) RemoveSpeakerApiClient(name string) traits.SpeakerApiClient

func (*ApiRouter) UpdateVolume

func (r *ApiRouter) UpdateVolume(ctx context.Context, request *traits.UpdateSpeakerVolumeRequest) (*types.AudioLevel, error)

type InfoRouter

type InfoRouter struct {
	traits.UnimplementedSpeakerInfoServer

	router.Router
}

InfoRouter is a traits.SpeakerInfoServer that allows routing named requests to specific traits.SpeakerInfoClient

func NewInfoRouter

func NewInfoRouter(opts ...router.Option) *InfoRouter

func (*InfoRouter) Add

func (r *InfoRouter) Add(name string, client any) any

Add extends Router.Add to panic if client is not of type traits.SpeakerInfoClient.

func (*InfoRouter) AddSpeakerInfoClient

func (r *InfoRouter) AddSpeakerInfoClient(name string, client traits.SpeakerInfoClient) traits.SpeakerInfoClient

func (*InfoRouter) DescribeVolume

func (r *InfoRouter) DescribeVolume(ctx context.Context, request *traits.DescribeVolumeRequest) (*traits.VolumeSupport, error)

func (*InfoRouter) GetSpeakerInfoClient

func (r *InfoRouter) GetSpeakerInfoClient(name string) (traits.SpeakerInfoClient, error)

func (*InfoRouter) HoldsType

func (r *InfoRouter) HoldsType(client any) bool

func (*InfoRouter) Register

func (r *InfoRouter) Register(server *grpc.Server)

func (*InfoRouter) RemoveSpeakerInfoClient

func (r *InfoRouter) RemoveSpeakerInfoClient(name string) traits.SpeakerInfoClient

type MemoryDevice

type MemoryDevice struct {
	traits.UnimplementedSpeakerApiServer
	// contains filtered or unexported fields
}

func NewMemoryDevice

func NewMemoryDevice(initialState *types.AudioLevel) *MemoryDevice

func (*MemoryDevice) GetVolume

func (*MemoryDevice) PullVolume

func (*MemoryDevice) Register

func (s *MemoryDevice) Register(server *grpc.Server)

func (*MemoryDevice) UpdateVolume

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL