Documentation ¶
Index ¶
- Constants
- type InfoServer
- type Model
- func (m *Model) GetMeterReading(opts ...resource.ReadOption) (*gen.MeterReading, error)
- func (m *Model) PullMeterReadings(ctx context.Context, opts ...resource.ReadOption) <-chan PullMeterReadingChange
- func (m *Model) RecordReading(val float32) (*gen.MeterReading, error)
- func (m *Model) Reset() (*gen.MeterReading, error)
- func (m *Model) UpdateMeterReading(meterReading *gen.MeterReading, opts ...resource.WriteOption) (*gen.MeterReading, error)
- type ModelServer
- type PullMeterReadingChange
Constants ¶
View Source
const TraitName trait.Name = "smartcore.bos.Meter"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InfoServer ¶
type InfoServer struct { gen.UnimplementedMeterInfoServer MeterReading *gen.MeterReadingSupport }
func (*InfoServer) DescribeMeterReading ¶
func (i *InfoServer) DescribeMeterReading(_ context.Context, _ *gen.DescribeMeterReadingRequest) (*gen.MeterReadingSupport, error)
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func (*Model) GetMeterReading ¶
func (m *Model) GetMeterReading(opts ...resource.ReadOption) (*gen.MeterReading, error)
func (*Model) PullMeterReadings ¶
func (m *Model) PullMeterReadings(ctx context.Context, opts ...resource.ReadOption) <-chan PullMeterReadingChange
func (*Model) RecordReading ¶
func (m *Model) RecordReading(val float32) (*gen.MeterReading, error)
RecordReading records a new usage value, updating end time to now.
func (*Model) Reset ¶
func (m *Model) Reset() (*gen.MeterReading, error)
Reset resets the meter to zero, updating both start and end times to now.
func (*Model) UpdateMeterReading ¶
func (m *Model) UpdateMeterReading(meterReading *gen.MeterReading, opts ...resource.WriteOption) (*gen.MeterReading, error)
type ModelServer ¶
type ModelServer struct { gen.UnimplementedMeterApiServer // contains filtered or unexported fields }
func NewModelServer ¶
func NewModelServer(model *Model) *ModelServer
func (*ModelServer) GetMeterReading ¶
func (m *ModelServer) GetMeterReading(_ context.Context, request *gen.GetMeterReadingRequest) (*gen.MeterReading, error)
func (*ModelServer) PullMeterReadings ¶
func (m *ModelServer) PullMeterReadings(request *gen.PullMeterReadingsRequest, server gen.MeterApi_PullMeterReadingsServer) error
func (*ModelServer) Register ¶
func (m *ModelServer) Register(server *grpc.Server)
func (*ModelServer) Unwrap ¶
func (m *ModelServer) Unwrap() any
type PullMeterReadingChange ¶
type PullMeterReadingChange struct { Value *gen.MeterReading ChangeTime time.Time }
Click to show internal directories.
Click to hide internal directories.