device

package
v0.0.0-...-bfe5d0e Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device interface {
	GetInformation(ctx context.Context) (*Information, error)
	// Heartbeat checks the connectivity
	// and returns what state the device is in.
	Heartbeat(ctx context.Context) (State, error)
	// Power will turn on or off the device
	Power(ctx context.Context, on bool) error
}

Device represents an IoT device information

type Group

type Group interface {
	List
	// GetName returns the anme of the group
	GetName() string
}

Group extends a list make a named list

func NewGroup

func NewGroup(name string, devices ...Device) Group

type Information

type Information struct {
	Name        string
	Model       string
	Vendor      string
	Properities map[string]string
}

type List

type List interface {
	Append(devices ...Device)

	Range(fn func(d Device) (more bool))

	Devices() []Device
}

func NewList

func NewList(devices ...Device) List

type MonitoredDevice

type MonitoredDevice interface {
	Device
	// GetStatstics returns all avaliable statistics from the device
	// to be reported back to a telemetry provider
	GetStatistics(ctx context.Context) ([]data.Statistic, error)
}

MonitoredDevice allows for the device to report statitics that would be collected by it

type State

type State int
const (
	Unconfigured State = iota
	PoweredOff
	PoweredOn
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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