airqualitysensor

package
v0.0.0-...-8846729 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 10 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultModelOptions = []resource.Option{
	WithInitialAirQuality(&traits.AirQuality{}),
}

DefaultModelOptions holds the default options for the model.

Functions

func WithAirQualityOption

func WithAirQualityOption(opts ...resource.Option) resource.Option

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

ApiRouter is a traits.AirQualitySensorApiServer that allows routing named requests to specific traits.AirQualitySensorApiClient

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.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) HoldsType

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

func (*ApiRouter) PullAirQuality

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

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

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

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 NewModel

func NewModel(opts ...resource.Option) *Model

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

type ModelOption interface {
	resource.Option
	// contains filtered or unexported methods
}

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 (*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
}

Jump to

Keyboard shortcuts

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