Documentation ¶
Index ¶
- type CPUStatus
- type Devicer
- type DummyDevice
- func (device DummyDevice) AddSubscribe() error
- func (device DummyDevice) DeviceType() string
- func (device DummyDevice) MainLoop(channel chan message.Message) error
- func (device DummyDevice) Start(channel chan message.Message) error
- func (device DummyDevice) Stop() error
- func (dummyDevice *DummyDevice) String() string
- func (device *DummyDevice) Validate() error
- type MemoryStatus
- type SerialDevice
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Devicer ¶
type Devicer interface { Start(chan message.Message) error DeviceType() string Stop() error AddSubscribe() error }
type DummyDevice ¶
type DummyDevice struct { Name string `validate:"max=256,regexp=[^/]+,validtopic"` Broker []*broker.Broker BrokerName string QoS byte `validate:"min=0,max=2"` InputPort inidef.InputPortType Interval int `validate:"min=1"` Payload []byte `validate:"max=4096"` Type string `validate:"max=256"` Retain bool Subscribe bool DeviceChan chan message.Message // GW -> device }
DummyDevice is an dummy device which outputs only specified payload.
func NewDummyDevice ¶
func NewDummyDevice(section inidef.ConfigSection, brokers []*broker.Broker, devChan chan message.Message) (DummyDevice, error)
NewDummyDevice creates dummy device which outputs specified string/binary payload.
func (DummyDevice) AddSubscribe ¶
func (device DummyDevice) AddSubscribe() error
func (DummyDevice) DeviceType ¶
func (device DummyDevice) DeviceType() string
DeviceType retunes device type.
func (DummyDevice) MainLoop ¶
func (device DummyDevice) MainLoop(channel chan message.Message) error
MainLoop is an mainloop of dummy device.
func (DummyDevice) Start ¶
func (device DummyDevice) Start(channel chan message.Message) error
Start starts dummy goroutine
func (DummyDevice) Stop ¶
func (device DummyDevice) Stop() error
func (*DummyDevice) String ¶
func (dummyDevice *DummyDevice) String() string
String retruns dummy device information
func (*DummyDevice) Validate ¶
func (device *DummyDevice) Validate() error
type MemoryStatus ¶
func (MemoryStatus) Get ¶
func (m MemoryStatus) Get() []message.Message
type SerialDevice ¶
type SerialDevice struct { Name string `validate:"max=256,regexp=[^/]+,validtopic"` Broker []*broker.Broker BrokerName string QoS byte `validate:"min=0,max=2"` InputPort inidef.InputPortType Serial string `validate:"max=256"` Baud int `validate:"min=0"` Size int `validate:"min=0,max=256"` Type string `validate:"max=256"` Interval int `validate:"min=0"` Retain bool Subscribe bool DeviceChan chan message.Message // GW -> device }
func NewSerialDevice ¶
func NewSerialDevice(section inidef.ConfigSection, brokers []*broker.Broker, devChan chan message.Message) (SerialDevice, error)
NewSerialDevice read inidef.ConfigSection and returnes SerialDevice. If config validation failed, return error
func (SerialDevice) AddSubscribe ¶
func (device SerialDevice) AddSubscribe() error
func (SerialDevice) DeviceType ¶
func (device SerialDevice) DeviceType() string
func (SerialDevice) Stop ¶
func (device SerialDevice) Stop() error
func (SerialDevice) String ¶
func (device SerialDevice) String() string
func (*SerialDevice) Validate ¶
func (device *SerialDevice) Validate() error
type Status ¶
type Status struct { Name string `validate:"max=256,regexp=[^/]+,validtopic"` GatewayName string BrokerName string Interval int CPU CPUStatus Memory MemoryStatus }
func (Status) AddSubscribe ¶
func (Status) DeviceType ¶
Click to show internal directories.
Click to hide internal directories.