mqtthandler

package
v2.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(p *redis.Pool, c Config) (handler.Handler, error)

NewHandler creates a new MQTT handler.

Types

type Config

type Config struct {
	Server                string
	Username              string
	Password              string
	QOS                   uint8  `mapstructure:"qos"`
	CleanSession          bool   `mapstructure:"clean_session"`
	ClientID              string `mapstructure:"client_id"`
	CACert                string `mapstructure:"ca_cert"`
	TLSCert               string `mapstructure:"tls_cert"`
	TLSKey                string `mapstructure:"tls_key"`
	UplinkTopicTemplate   string `mapstructure:"uplink_topic_template"`
	DownlinkTopicTemplate string `mapstructure:"downlink_topic_template"`
	JoinTopicTemplate     string `mapstructure:"join_topic_template"`
	AckTopicTemplate      string `mapstructure:"ack_topic_template"`
	ErrorTopicTemplate    string `mapstructure:"error_topic_template"`
	StatusTopicTemplate   string `mapstructure:"status_topic_template"`
}

Config holds the configuration for the MQTT handler.

type MQTTHandler

type MQTTHandler struct {
	// contains filtered or unexported fields
}

MQTTHandler implements a MQTT handler for sending and receiving data by an application.

func (*MQTTHandler) Close

func (h *MQTTHandler) Close() error

Close stops the handler.

func (*MQTTHandler) DataDownChan

func (h *MQTTHandler) DataDownChan() chan handler.DataDownPayload

DataDownChan returns the channel containing the received DataDownPayload.

func (*MQTTHandler) SendACKNotification

func (h *MQTTHandler) SendACKNotification(payload handler.ACKNotification) error

SendACKNotification sends an ACKNotification.

func (*MQTTHandler) SendDataUp

func (h *MQTTHandler) SendDataUp(payload handler.DataUpPayload) error

SendDataUp sends a DataUpPayload.

func (*MQTTHandler) SendErrorNotification

func (h *MQTTHandler) SendErrorNotification(payload handler.ErrorNotification) error

SendErrorNotification sends an ErrorNotification.

func (*MQTTHandler) SendJoinNotification

func (h *MQTTHandler) SendJoinNotification(payload handler.JoinNotification) error

SendJoinNotification sends a JoinNotification.

func (*MQTTHandler) SendStatusNotification

func (h *MQTTHandler) SendStatusNotification(payload handler.StatusNotification) error

SendStatusNotification sends a StatusNotification.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL