Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AMQP ¶
type AMQP struct {
// contains filtered or unexported fields
}
AMQP is the AMQP client.
func (*AMQP) Close ¶
Close will close the channel to the AMQP broker. It will return an error if the channel fails to gracefully close.
func (*AMQP) GetRouting ¶
GetRouting returns the list queues and the list of routing queues binded to each queue.
func (*AMQP) Init ¶
Init will attempt to initialize the AMQP client. It requires the AMQP broker's ID string and formatted AMQP host string. It will return the output channel or an error.
type AMQPMessage ¶
AMQPMessage is a message sent over AMQP.
type Config ¶
type Config struct { AMQPUser string // AMQPUser is AMQP username AMQPPass string // AMQPPass is AMQP password MQTTUser string // MQTTUser is MQTT username MQTTPass string // MQTTPass is MQTT password SQLUser string // SQLUser is SQL username SQLPass string // SQLPass is SQL password }
Config is the environment variable configuration for the controller.
type MQTT ¶
type MQTT struct {
// contains filtered or unexported fields
}
MQTT is the MQTT client.
func (*MQTT) Connect ¶
Connect will attempt to establish a connection with the MQTT broker. It will return an error if the connection fails to establish.
func (*MQTT) Init ¶
Init will attempt to initialize the MQTT client. It requires the MQTT broker's host, username, and password. It will return the output channel or an error.
func (*MQTT) Publish ¶
Publish will publish a payload on the provided topic. It will return an error if the payload fails to publish.
func (*MQTT) UpdateTopics ¶
UpdateTopics repleaces the subscribe topics list with the one provided. It will notify the MQTT broker of the changes. It may return an error if the transaction fails to complete.
type MQTTMessage ¶
type MQTTMessage struct { Topic string // Topic is the topic the message was published on Payload []byte // Payload is the message payload }
MQTTMessage is a message sent over MQTT.
type State ¶
type State struct { Log *log.Logger // Log is a structured event logger IsDocker bool // IsDocker indicates if running inside Docker Config *Config // Config contains global configuration MQTT *MQTT // MQTT is the MQTT client MQTTCh chan MQTTMessage // MQTTCh is the MQTT output channel AMQP [2]*AMQP // AMQP is the AMQP client (two for duplex) AMQPCh [2]chan AMQPMessage // AMQPCh is the AMQP output channel SQL *sql.DB // SQL is the SQL client Data chan []byte // Data channel is populated by AMQP and consumed by websockets }
State is the global state for the controller.
type WebsocketFrame ¶
type WebsocketFrame struct { UUID string `json:"uuid"` // UUID is the UUID of the microcontroller BusAddr int `json:"busAddr"` // BusAddr is the bus address where data was collected Timestamp string `json:"timestamp"` // Timestamp is time which data was received by peripheral controller Data interface{} `json:"data"` // Data is the JSON payload from peripheral controller }
WebsocketFrame is a frame emitted on the websocket connection.