gateway

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMQTTBackend

func NewMQTTBackend(redisPool *redis.Pool, c MQTTBackendConfig) (backend.Gateway, error)

NewMQTTBackend creates a new Backend.

Types

type MQTTBackend

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

MQTTBackend implements a MQTT pub-sub backend.

func (*MQTTBackend) Close

func (b *MQTTBackend) Close() error

Close closes the backend. Note that this closes the backend one-way (gateway to backend). This makes it possible to perform a graceful shutdown (e.g. when there are still packets to send back to the gateway).

func (*MQTTBackend) RXPacketChan

func (b *MQTTBackend) RXPacketChan() chan gw.RXPacket

RXPacketChan returns the RXPacket channel.

func (*MQTTBackend) SendGatewayConfigPacket

func (b *MQTTBackend) SendGatewayConfigPacket(configPacket gw.GatewayConfigPacket) error

SendGatewayConfigPacket sends the given GatewayConfigPacket to the gateway.

func (*MQTTBackend) SendTXPacket

func (b *MQTTBackend) SendTXPacket(txPacket gw.TXPacket) error

SendTXPacket sends the given TXPacket to the gateway.

func (*MQTTBackend) StatsPacketChan

func (b *MQTTBackend) StatsPacketChan() chan gw.GatewayStatsPacket

StatsPacketChan returns the gateway stats channel.

type MQTTBackendConfig

type MQTTBackendConfig 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"`
	StatsTopicTemplate    string `mapstructure:"stats_topic_template"`
	AckTopicTemplate      string `mapstructure:"ack_topic_template"`
	ConfigTopicTemplate   string `mapstructure:"config_topic_template"`
}

MQTTBackendConfig holds the MQTT backend configuration.

Jump to

Keyboard shortcuts

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