mqtthandler

package
v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 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"`
	LocationTopicTemplate   string `mapstructure:"location_topic_template"`
	UplinkRetainedMessage   bool   `mapstructure:"uplink_retained_message"`
	JoinRetainedMessage     bool   `mapstructure:"join_retained_message"`
	AckRetainedMessage      bool   `mapstructure:"ack_retained_message"`
	ErrorRetainedMessage    bool   `mapstructure:"error_retained_message"`
	StatusRetainedMessage   bool   `mapstructure:"status_retained_message"`
	LocationRetainedMessage bool   `mapstructure:"location_retained_message"`
}

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) SendLocationNotification

func (h *MQTTHandler) SendLocationNotification(payload handler.LocationNotification) error

SendLocationNotification sends a LocationNotification.

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