Documentation
¶
Overview ¶
Package mqtt wraps the Eclipse Paho code for handling paho messaging
Index ¶
- Constants
- Variables
- func NewConnection() (paho.Client, error)
- type BrokerConfig
- type SampleMessage
- func SampleGatewayStatus(timestamp time.Time) SampleMessage
- func SampleRain(timestamp time.Time) SampleMessage
- func SampleSensorHardReset(timestamp time.Time) SampleMessage
- func SampleSensorPause(timestamp time.Time) SampleMessage
- func SampleSensorSoftReset(timestamp time.Time) SampleMessage
- func SampleSensorStatus(timestamp time.Time) SampleMessage
- func SampleSensorUnpause(timestamp time.Time) SampleMessage
- func SampleTemp(timestamp time.Time) SampleMessage
Constants ¶
const ( GatewayStatusTopic = "status/gateway" SensorStatusTopic = "status/sensor" TemperatureTopic = "measurement/temperature" RainTopic = "measurement/rain" SensorEventTopic = "sensor/event" )
mqtt topics for events, measurements, status
const ( SensorPauseEvent = "sensorPause" SensorUnpauseEvent = "sensorUnpause" SensorSoftResetEvent = "sensorSoftReset" SensorHardResetEvent = "sensorHardReset" )
mqtt event tags
Variables ¶
var SampleCelsius = 23
SampleCelsius is a random temperature value picked for no reason
Functions ¶
func NewConnection ¶
NewConnection creates a new MQTT connection or error
Types ¶
type BrokerConfig ¶
type BrokerConfig struct {
// contains filtered or unexported fields
}
BrokerConfig configures the mqtt connection
type SampleMessage ¶
SampleMessage is a dummy message
func SampleGatewayStatus ¶
func SampleGatewayStatus(timestamp time.Time) SampleMessage
SampleGatewayStatus is a test mqtt message for a gateway status message
func SampleRain ¶
func SampleRain(timestamp time.Time) SampleMessage
SampleRain is a test mqtt message for a rain event
func SampleSensorHardReset ¶
func SampleSensorHardReset(timestamp time.Time) SampleMessage
SampleSensorHardReset is a test mqtt message for a hard reset event
func SampleSensorPause ¶
func SampleSensorPause(timestamp time.Time) SampleMessage
SampleSensorPause is a test mqtt message for a pause event
func SampleSensorSoftReset ¶
func SampleSensorSoftReset(timestamp time.Time) SampleMessage
SampleSensorSoftReset is a test mqtt message for a soft reset event
func SampleSensorStatus ¶
func SampleSensorStatus(timestamp time.Time) SampleMessage
SampleSensorStatus is a test mqtt message for a sensor status message
func SampleSensorUnpause ¶
func SampleSensorUnpause(timestamp time.Time) SampleMessage
SampleSensorUnpause is a test mqtt message for an unpause event
func SampleTemp ¶
func SampleTemp(timestamp time.Time) SampleMessage
SampleTemp is a test mqtt message for a temperature measurement in C