mqtt_generic

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScriptKeyDataIn   = "dataIn"
	ScriptKeyDataOut  = "dataOut"
	ScriptKeyTopicIn  = "topicIn"
	ScriptKeyTopicOut = "topicOut"
	ScriptKeyConfigIn = "configIn"

	DefaultNode = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MqttNode

type MqttNode struct {
	Topic  string `json:"topic" yaml:"topic"`
	QoS    int    `json:"qos" yaml:"qos"`
	Script string `json:"script" yaml:"script"`
}

mqtt node config

func (*MqttNode) Clone

func (mn *MqttNode) Clone() *MqttNode

Clone cones the MqttNode

type MqttProtocol

type MqttProtocol struct {
	GatewayCfg *gwTY.Config
	Protocol   gwPtl.Protocol
	Config     *MqttProtocolConf
	// contains filtered or unexported fields
}

func New

func New(logger *zap.Logger, gwCfg *gwTY.Config, protocol cmap.CustomMap, rxMsgFunc func(rm *msgTY.RawMessage) error, bus busTY.Plugin, logRootDir string) (*MqttProtocol, error)

returns a new generic mqtt protocol

func (*MqttProtocol) Close

func (mp *MqttProtocol) Close() error

closes the protocol

func (*MqttProtocol) Post

func (mp *MqttProtocol) Post(msg *msgTY.Message) error

posts a message to a topic

type MqttProtocolConf

type MqttProtocolConf struct {
	mqtt.Config
	Nodes map[string]MqttNode `json:"nodes" yaml:"nodes"`
}

Jump to

Keyboard shortcuts

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