Documentation ¶
Index ¶
- Constants
- type Device
- func (d *Device) Destroy()
- func (d *Device) GetName() string
- func (d *Device) IsConnected() bool
- func (device *Device) NewNode(id, name, nType string, ...) *Node
- func (d *Device) Run()
- func (d *Device) RunWithContext(runContext context.Context, waitChannel chan bool)
- func (d *Device) SetBroadcastHandler(handler func(d *Device, level, value string))
- func (d *Device) SetGlobalHandler(handler func(d *Device, n *Node, p *Property, value string) bool)
- func (d *Device) SetLoop(handler func(d *Device))
- func (d *Device) SetMqttBroker(broker string)
- func (d *Device) SetTopicBase(b string)
- type Node
- type Property
- type PropertyMessage
Constants ¶
View Source
const ( DtString = iota DtInteger DtFloat DtBoolean DtEnum DtColor )
These are the allow Property data types, as per v4.0.0 convention
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func (*Device) Destroy ¶
func (d *Device) Destroy()
to destroy a running device first cancel its context, then wait on its wait channel, then call here
func (*Device) IsConnected ¶
func (*Device) NewNode ¶
func (device *Device) NewNode(id, name, nType string, handler func(d *Device, n *Node, p *Property, a string) bool) *Node
Create and return a node
func (*Device) Run ¶
func (d *Device) Run()
Run the control loop All error conditions return by panic. No normaal return
func (*Device) RunWithContext ¶
func (*Device) SetBroadcastHandler ¶
func (*Device) SetGlobalHandler ¶
func (*Device) SetMqttBroker ¶
func (*Device) SetTopicBase ¶
type Property ¶
type Property struct {
// contains filtered or unexported fields
}
func (*Property) SetProperty ¶
func (p *Property) SetProperty() PropertyMessage
type PropertyMessage ¶
type PropertyMessage struct { Qos byte // default value is 1 Retained bool // default value is true // contains filtered or unexported fields }
func (PropertyMessage) Send ¶
func (m PropertyMessage) Send(value string) error
Returns an error if the property's value is wrong format, unit, or whatever. These errors are warnings only.
Click to show internal directories.
Click to hide internal directories.