Documentation ¶
Index ¶
- Constants
- func NewDevices(conf config.Config, brokers []*broker.Broker) ([]Devicer, []DeviceChannel, error)
- type CPUStatus
- type DeviceChannel
- 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 InputPortType
- type InterfaceAddress
- type IpAddressStatus
- type MemoryStatus
- type SerialDevice
- type Status
Constants ¶
View Source
const (
MaxDeviceChanBufferSize = 20
)
Variables ¶
This section is empty.
Functions ¶
func NewDevices ¶
NewDevices is a factory method to create various kind of devices from config.Config
Types ¶
type DeviceChannel ¶
func NewDeviceChannel ¶
func NewDeviceChannel() DeviceChannel
NewDeviceChannel is a factory method to return DeviceChannel
func NewDeviceChannels ¶
func NewDeviceChannels() []DeviceChannel
type Devicer ¶
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 InputPortType Interval int `validate:"min=1"` Payload []byte `validate:"max=4096"` Type string `validate:"max=256"` Retain bool Subscribe bool DeviceChan DeviceChannel // GW -> device }
DummyDevice is an dummy device which outputs only specified payload.
func NewDummyDevice ¶
func NewDummyDevice(section config.ConfigSection, brokers []*broker.Broker, devChan DeviceChannel) (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 InputPortType ¶
type InputPortType int
InputPortType defines port type used by gateway
const ( INPUT_PORT_SERIAL InputPortType = 0 INPUT_PORT_DUMMY InputPortType = 1 )
type InterfaceAddress ¶
type IpAddressStatus ¶
func (IpAddressStatus) Get ¶
func (i IpAddressStatus) Get() []message.Message
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 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 DeviceChannel // GW -> device }
func NewSerialDevice ¶
func NewSerialDevice(section config.ConfigSection, brokers []*broker.Broker, devChan DeviceChannel) (SerialDevice, error)
NewSerialDevice read config.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 IpAddress IpAddressStatus }
func (Status) AddSubscribe ¶
func (Status) DeviceType ¶
Click to show internal directories.
Click to hide internal directories.