meter

package
v0.2024.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

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

type Model

type Model struct {
	// contains filtered or unexported fields
}

func NewModel

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

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
}

Jump to

Keyboard shortcuts

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