Documentation ¶
Index ¶
- func WithSpeakerApiClientFactory(f func(name string) (traits.SpeakerApiClient, error)) router.Option
- func WithSpeakerInfoClientFactory(f func(name string) (traits.SpeakerInfoClient, error)) router.Option
- type ApiRouter
- func (r *ApiRouter) Add(name string, client any) any
- func (r *ApiRouter) AddSpeakerApiClient(name string, client traits.SpeakerApiClient) traits.SpeakerApiClient
- func (r *ApiRouter) GetSpeakerApiClient(name string) (traits.SpeakerApiClient, error)
- func (r *ApiRouter) GetVolume(ctx context.Context, request *traits.GetSpeakerVolumeRequest) (*types.AudioLevel, error)
- func (r *ApiRouter) HoldsType(client any) bool
- func (r *ApiRouter) PullVolume(request *traits.PullSpeakerVolumeRequest, ...) error
- func (r *ApiRouter) Register(server grpc.ServiceRegistrar)
- func (r *ApiRouter) RemoveSpeakerApiClient(name string) traits.SpeakerApiClient
- func (r *ApiRouter) UpdateVolume(ctx context.Context, request *traits.UpdateSpeakerVolumeRequest) (*types.AudioLevel, error)
- type ApiWrapper
- type InfoRouter
- func (r *InfoRouter) Add(name string, client any) any
- func (r *InfoRouter) AddSpeakerInfoClient(name string, client traits.SpeakerInfoClient) traits.SpeakerInfoClient
- func (r *InfoRouter) DescribeVolume(ctx context.Context, request *traits.DescribeVolumeRequest) (*traits.VolumeSupport, error)
- func (r *InfoRouter) GetSpeakerInfoClient(name string) (traits.SpeakerInfoClient, error)
- func (r *InfoRouter) HoldsType(client any) bool
- func (r *InfoRouter) Register(server grpc.ServiceRegistrar)
- func (r *InfoRouter) RemoveSpeakerInfoClient(name string) traits.SpeakerInfoClient
- type InfoWrapper
- type MemoryDevice
- func (s *MemoryDevice) GetVolume(_ context.Context, req *traits.GetSpeakerVolumeRequest) (*types.AudioLevel, error)
- func (s *MemoryDevice) PullVolume(request *traits.PullSpeakerVolumeRequest, ...) error
- func (s *MemoryDevice) Register(server grpc.ServiceRegistrar)
- func (s *MemoryDevice) UpdateVolume(_ context.Context, request *traits.UpdateSpeakerVolumeRequest) (*types.AudioLevel, error)
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.
Types ¶
type ApiRouter ¶
type ApiRouter struct { traits.UnimplementedSpeakerApiServer router.Router }
ApiRouter is a traits.SpeakerApiServer that allows routing named requests to specific traits.SpeakerApiClient
func NewApiRouter ¶
func (*ApiRouter) Add ¶
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) PullVolume ¶
func (r *ApiRouter) PullVolume(request *traits.PullSpeakerVolumeRequest, server traits.SpeakerApi_PullVolumeServer) error
func (*ApiRouter) Register ¶
func (r *ApiRouter) Register(server grpc.ServiceRegistrar)
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 ApiWrapper ¶
type ApiWrapper struct { traits.SpeakerApiClient // contains filtered or unexported fields }
func WrapApi ¶
func WrapApi(server traits.SpeakerApiServer) *ApiWrapper
WrapApi adapts a traits.SpeakerApiServer and presents it as a traits.SpeakerApiClient
func (*ApiWrapper) Unwrap ¶
func (w *ApiWrapper) Unwrap() any
Unwrap implements wrap.Unwrapper and returns the underlying server instance as an unknown type.
func (*ApiWrapper) UnwrapServer ¶
func (w *ApiWrapper) UnwrapServer() traits.SpeakerApiServer
UnwrapServer returns the underlying server instance.
func (*ApiWrapper) UnwrapService ¶
func (w *ApiWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)
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.ServiceRegistrar)
func (*InfoRouter) RemoveSpeakerInfoClient ¶
func (r *InfoRouter) RemoveSpeakerInfoClient(name string) traits.SpeakerInfoClient
type InfoWrapper ¶
type InfoWrapper struct { traits.SpeakerInfoClient // contains filtered or unexported fields }
func WrapInfo ¶
func WrapInfo(server traits.SpeakerInfoServer) *InfoWrapper
WrapInfo adapts a traits.SpeakerInfoServer and presents it as a traits.SpeakerInfoClient
func (*InfoWrapper) Unwrap ¶
func (w *InfoWrapper) Unwrap() any
Unwrap implements wrap.Unwrapper and returns the underlying server instance as an unknown type.
func (*InfoWrapper) UnwrapServer ¶
func (w *InfoWrapper) UnwrapServer() traits.SpeakerInfoServer
UnwrapServer returns the underlying server instance.
func (*InfoWrapper) UnwrapService ¶
func (w *InfoWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)
type MemoryDevice ¶
type MemoryDevice struct { traits.UnimplementedSpeakerApiServer // contains filtered or unexported fields }
func NewMemoryDevice ¶
func NewMemoryDevice(initialState *types.AudioLevel) *MemoryDevice
func (*MemoryDevice) GetVolume ¶
func (s *MemoryDevice) GetVolume(_ context.Context, req *traits.GetSpeakerVolumeRequest) (*types.AudioLevel, error)
func (*MemoryDevice) PullVolume ¶
func (s *MemoryDevice) PullVolume(request *traits.PullSpeakerVolumeRequest, server traits.SpeakerApi_PullVolumeServer) error
func (*MemoryDevice) Register ¶
func (s *MemoryDevice) Register(server grpc.ServiceRegistrar)
func (*MemoryDevice) UpdateVolume ¶
func (s *MemoryDevice) UpdateVolume(_ context.Context, request *traits.UpdateSpeakerVolumeRequest) (*types.AudioLevel, error)