driver

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropertyCacheExpiration      = 30 * time.Second
	PropertyCacheCleanupInterval = 2 * PropertyCacheExpiration
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceDriver

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

func NewDeviceDriver

func NewDeviceDriver(ctx context.Context, cancel context.CancelFunc,
	protocol *models.Protocol, twinBuilder models.DeviceTwinBuilder) (*DeviceDriver, error)

func (*DeviceDriver) Initialize

func (d *DeviceDriver) Initialize() error

func (*DeviceDriver) Serve

func (d *DeviceDriver) Serve() error

type TwinRunner added in v0.2.2

type TwinRunner interface {
	Initialize(ctx context.Context) error
	Start() error
	Stop(force bool) error
	HealthCheck() (*models.DeviceStatus, error)

	// Read indicates soft read, it will read the specified property from the cache with TTL.
	// Specially, when propertyID is "*", it indicates read all properties.
	Read(propertyID models.ProductPropertyID) (map[models.ProductPropertyID]*models.DeviceData, error)
	// HardRead indicates head read, it will read the specified property from the real device.
	// Specially, when propertyID is "*", it indicates read all properties.
	HardRead(propertyID models.ProductPropertyID) (map[models.ProductPropertyID]*models.DeviceData, error)
	Write(propertyID models.ProductPropertyID, values map[models.ProductPropertyID]*models.DeviceData) error
	Call(methodID models.ProductMethodID, ins map[models.ProductPropertyID]*models.DeviceData) (outs map[models.ProductPropertyID]*models.DeviceData, err error)
}

func NewTwinRunner added in v0.2.2

func NewTwinRunner(driver *DeviceDriver, device *models.Device) (TwinRunner, error)

Jump to

Keyboard shortcuts

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