Documentation ¶
Index ¶
- Variables
- func WithAirQualityOption(opts ...resource.Option) resource.Option
- func WithAirQualitySensorApiClientFactory(f func(name string) (traits.AirQualitySensorApiClient, error)) router.Option
- func WithAirQualitySensorInfoClientFactory(f func(name string) (traits.AirQualitySensorInfoClient, error)) router.Option
- func WithInitialAirQuality(airQuality *traits.AirQuality) resource.Option
- type ApiRouter
- func (r *ApiRouter) Add(name string, client any) any
- func (r *ApiRouter) AddAirQualitySensorApiClient(name string, client traits.AirQualitySensorApiClient) traits.AirQualitySensorApiClient
- func (r *ApiRouter) GetAirQuality(ctx context.Context, request *traits.GetAirQualityRequest) (*traits.AirQuality, error)
- func (r *ApiRouter) GetAirQualitySensorApiClient(name string) (traits.AirQualitySensorApiClient, error)
- func (r *ApiRouter) HoldsType(client any) bool
- func (r *ApiRouter) PullAirQuality(request *traits.PullAirQualityRequest, ...) error
- func (r *ApiRouter) Register(server grpc.ServiceRegistrar)
- func (r *ApiRouter) RemoveAirQualitySensorApiClient(name string) traits.AirQualitySensorApiClient
- type ApiWrapper
- type InfoRouter
- func (r *InfoRouter) Add(name string, client any) any
- func (r *InfoRouter) AddAirQualitySensorInfoClient(name string, client traits.AirQualitySensorInfoClient) traits.AirQualitySensorInfoClient
- func (r *InfoRouter) DescribeAirQuality(ctx context.Context, request *traits.DescribeAirQualityRequest) (*traits.AirQualitySupport, error)
- func (r *InfoRouter) GetAirQualitySensorInfoClient(name string) (traits.AirQualitySensorInfoClient, error)
- func (r *InfoRouter) HoldsType(client any) bool
- func (r *InfoRouter) Register(server grpc.ServiceRegistrar)
- func (r *InfoRouter) RemoveAirQualitySensorInfoClient(name string) traits.AirQualitySensorInfoClient
- type InfoWrapper
- type Model
- func (m *Model) GetAirQuality(opts ...resource.ReadOption) (*traits.AirQuality, error)
- func (m *Model) PullAirQuality(ctx context.Context, opts ...resource.ReadOption) <-chan PullAirQualityChange
- func (m *Model) UpdateAirQuality(airTemperature *traits.AirQuality, opts ...resource.WriteOption) (*traits.AirQuality, error)
- type ModelOption
- type ModelServer
- func (s *ModelServer) GetAirQuality(ctx context.Context, req *traits.GetAirQualityRequest) (*traits.AirQuality, error)
- func (s *ModelServer) PullAirQuality(request *traits.PullAirQualityRequest, ...) error
- func (s *ModelServer) Register(server grpc.ServiceRegistrar)
- func (s *ModelServer) Unwrap() any
- type PullAirQualityChange
Constants ¶
This section is empty.
Variables ¶
var DefaultModelOptions = []resource.Option{ WithInitialAirQuality(&traits.AirQuality{}), }
DefaultModelOptions holds the default options for the model.
Functions ¶
func WithAirQualityOption ¶
WithAirQualityOption configures the airQuality resource of the model.
func WithAirQualitySensorApiClientFactory ¶
func WithAirQualitySensorApiClientFactory(f func(name string) (traits.AirQualitySensorApiClient, error)) router.Option
WithAirQualitySensorApiClientFactory instructs the router to create a new client the first time Get is called for that name.
func WithAirQualitySensorInfoClientFactory ¶
func WithAirQualitySensorInfoClientFactory(f func(name string) (traits.AirQualitySensorInfoClient, error)) router.Option
WithAirQualitySensorInfoClientFactory instructs the router to create a new client the first time Get is called for that name.
func WithInitialAirQuality ¶
func WithInitialAirQuality(airQuality *traits.AirQuality) resource.Option
WithInitialAirQuality returns an option that configures the model to initialise with the given air quality.
Types ¶
type ApiRouter ¶
type ApiRouter struct { traits.UnimplementedAirQualitySensorApiServer router.Router }
ApiRouter is a traits.AirQualitySensorApiServer that allows routing named requests to specific traits.AirQualitySensorApiClient
func NewApiRouter ¶
func (*ApiRouter) Add ¶
Add extends Router.Add to panic if client is not of type traits.AirQualitySensorApiClient.
func (*ApiRouter) AddAirQualitySensorApiClient ¶
func (r *ApiRouter) AddAirQualitySensorApiClient(name string, client traits.AirQualitySensorApiClient) traits.AirQualitySensorApiClient
func (*ApiRouter) GetAirQuality ¶
func (r *ApiRouter) GetAirQuality(ctx context.Context, request *traits.GetAirQualityRequest) (*traits.AirQuality, error)
func (*ApiRouter) GetAirQualitySensorApiClient ¶
func (r *ApiRouter) GetAirQualitySensorApiClient(name string) (traits.AirQualitySensorApiClient, error)
func (*ApiRouter) PullAirQuality ¶
func (r *ApiRouter) PullAirQuality(request *traits.PullAirQualityRequest, server traits.AirQualitySensorApi_PullAirQualityServer) error
func (*ApiRouter) Register ¶
func (r *ApiRouter) Register(server grpc.ServiceRegistrar)
func (*ApiRouter) RemoveAirQualitySensorApiClient ¶
func (r *ApiRouter) RemoveAirQualitySensorApiClient(name string) traits.AirQualitySensorApiClient
type ApiWrapper ¶
type ApiWrapper struct { traits.AirQualitySensorApiClient // contains filtered or unexported fields }
func WrapApi ¶
func WrapApi(server traits.AirQualitySensorApiServer) *ApiWrapper
WrapApi adapts a traits.AirQualitySensorApiServer and presents it as a traits.AirQualitySensorApiClient
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.AirQualitySensorApiServer
UnwrapServer returns the underlying server instance.
func (*ApiWrapper) UnwrapService ¶
func (w *ApiWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)
type InfoRouter ¶
type InfoRouter struct { traits.UnimplementedAirQualitySensorInfoServer router.Router }
InfoRouter is a traits.AirQualitySensorInfoServer that allows routing named requests to specific traits.AirQualitySensorInfoClient
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.AirQualitySensorInfoClient.
func (*InfoRouter) AddAirQualitySensorInfoClient ¶
func (r *InfoRouter) AddAirQualitySensorInfoClient(name string, client traits.AirQualitySensorInfoClient) traits.AirQualitySensorInfoClient
func (*InfoRouter) DescribeAirQuality ¶
func (r *InfoRouter) DescribeAirQuality(ctx context.Context, request *traits.DescribeAirQualityRequest) (*traits.AirQualitySupport, error)
func (*InfoRouter) GetAirQualitySensorInfoClient ¶
func (r *InfoRouter) GetAirQualitySensorInfoClient(name string) (traits.AirQualitySensorInfoClient, error)
func (*InfoRouter) HoldsType ¶
func (r *InfoRouter) HoldsType(client any) bool
func (*InfoRouter) Register ¶
func (r *InfoRouter) Register(server grpc.ServiceRegistrar)
func (*InfoRouter) RemoveAirQualitySensorInfoClient ¶
func (r *InfoRouter) RemoveAirQualitySensorInfoClient(name string) traits.AirQualitySensorInfoClient
type InfoWrapper ¶
type InfoWrapper struct { traits.AirQualitySensorInfoClient // contains filtered or unexported fields }
func WrapInfo ¶
func WrapInfo(server traits.AirQualitySensorInfoServer) *InfoWrapper
WrapInfo adapts a traits.AirQualitySensorInfoServer and presents it as a traits.AirQualitySensorInfoClient
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.AirQualitySensorInfoServer
UnwrapServer returns the underlying server instance.
func (*InfoWrapper) UnwrapService ¶
func (w *InfoWrapper) UnwrapService() (grpc.ClientConnInterface, grpc.ServiceDesc)
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func (*Model) GetAirQuality ¶
func (m *Model) GetAirQuality(opts ...resource.ReadOption) (*traits.AirQuality, error)
func (*Model) PullAirQuality ¶
func (m *Model) PullAirQuality(ctx context.Context, opts ...resource.ReadOption) <-chan PullAirQualityChange
func (*Model) UpdateAirQuality ¶
func (m *Model) UpdateAirQuality(airTemperature *traits.AirQuality, opts ...resource.WriteOption) (*traits.AirQuality, error)
type ModelOption ¶
ModelOption defined the base type for all options that apply to this traits model.
type ModelServer ¶
type ModelServer struct { traits.UnimplementedAirQualitySensorApiServer // contains filtered or unexported fields }
func NewModelServer ¶
func NewModelServer(model *Model) *ModelServer
func (*ModelServer) GetAirQuality ¶
func (s *ModelServer) GetAirQuality(ctx context.Context, req *traits.GetAirQualityRequest) (*traits.AirQuality, error)
func (*ModelServer) PullAirQuality ¶
func (s *ModelServer) PullAirQuality(request *traits.PullAirQualityRequest, server traits.AirQualitySensorApi_PullAirQualityServer) error
func (*ModelServer) Register ¶
func (s *ModelServer) Register(server grpc.ServiceRegistrar)
func (*ModelServer) Unwrap ¶
func (s *ModelServer) Unwrap() any
type PullAirQualityChange ¶
type PullAirQualityChange struct { Value *traits.AirQuality ChangeTime time.Time }