Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { Topic string `json:"topic"` Name string `json:"name"` Manufacturer string `json:"manufacturer"` Model string `json:"model"` SerialNumber string `json:"serialNumber"` Type string `json:"type"` LastWillID string `json:"lastWillID,omitempty"` Features map[string]*Feature `json:"feature"` Reachable bool `json:"-"` sync.RWMutex // contains filtered or unexported fields }
func (*Device) AddFeature ¶
AddFeature adds a feature to the device. It ensures the devRef, GetTopic and SetTopic are correctly populated
func (*Device) GetFeature ¶
GetFeature returns a *Feature if a feature by that name is found on the device.
func (*Device) HasFeature ¶
func (*Device) PublishMeta ¶
func (*Device) RemoveFeature ¶
RemoveFeature removes a feature by that name from the device. It returns an error if you try to remove a feature that does not exist.
func (*Device) UnmarshalJSON ¶
UnmarshalJSON unmarshals the JSON representation of a device. This is a custom implementation so that we can correctly call .AddFeature() for every feature. This guarantees that the devRef is properly set and that the GetTopic and SetTopic are always set.
type Feature ¶
type Manager ¶
func NewManager ¶
func NewManager(c messaging.PublishSubscriber, initChan chan bool) *Manager
func (*Manager) AddHandler ¶
type TestingDeviceHandler ¶
type TestingDeviceHandler struct{}
TestingDeviceHandler is a noop device handler. It is meant to be used in tests.
func (*TestingDeviceHandler) Removed ¶
func (t *TestingDeviceHandler) Removed(*Device)
func (*TestingDeviceHandler) Updated ¶
func (t *TestingDeviceHandler) Updated(*Device)