model

package
v0.0.0-...-04d676d Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 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 Cfg

type Cfg struct {
	DevID string          `json:"dev_id"`
	Data  json.RawMessage `json:"data"`
}

Cfg .

type Data

type Data struct {
	Time int64           `json:"time"`
	Meta Meta            `json:"meta"`
	Data json.RawMessage `json:"data"`
}

Data .

type Devicer

type Devicer interface {
	GetData() (*Data, error)
	SaveData(*Data) error

	GetCfg() (*Cfg, error)
	GetDefaultCfg() (*Cfg, error)
	SetCfg(*Cfg) error

	GetMeta() (*Meta, error)
	SetMeta(*Meta) error

	IsRegistered() (bool, error)
}

Devicer represents an interface to an abstract device.

func NewDevice

func NewDevice(devID string, t Type) (Devicer, error)

type Meta

type Meta struct {
	Type  Type   `json:"type"`
	Name  string `json:"name"`
	DevID string `json:"dev_id"`
}

Meta .

type Type

type Type string
const (
	Fridge Type = "fridge"
)

Jump to

Keyboard shortcuts

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