mqtt

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandler added in v0.10.0

type AuthHandler struct {
	Store *rtcfg.Store
}

AuthHandler handles MQTT client authentication.

func (*AuthHandler) Authenticate added in v0.10.0

func (a *AuthHandler) Authenticate(id string, cred interface{}) error

Authenticate implements auth.Authenticator.

type Broker

type Broker struct {
	// Binding address for serving MQTT.
	Addr string
	// Binding address for serving Secure MQTT.
	AddrTLS string
	// Certificate file for Secure MQTT.
	CertFile string
	// Private key file for Secure MQTT.
	KeyFile string
	// Authenticator specifies the authenticator. Default is "mockSuccess".
	Authenticator string
	// When an error happens while serving (e.g. binding of port fails), this
	// error is sent to the channel ServeErr.
	ServeErr chan<- error
	// Service is used to write device data points and read/write system variables.
	Service veap.Service
	// contains filtered or unexported fields
}

Broker for MQTT. Broker implements itf.Receiver to receive XML-RPC events.

func (*Broker) Publish

func (b *Broker) Publish(topic string, payload []byte, qos byte, retain bool) error

Publish publishes a generic payload.

func (*Broker) PublishPV

func (b *Broker) PublishPV(topic string, pv veap.PV, qos byte, retain bool) error

PublishPV publishes a PV.

func (*Broker) Start

func (b *Broker) Start()

Start starts the MQTT broker.

func (*Broker) Stop

func (b *Broker) Stop()

Stop stops the MQTT broker.

func (*Broker) Subscribe added in v0.9.0

func (b *Broker) Subscribe(topic string, qos byte, onPublish *service.OnPublishFunc) error

Subscribe subscribes a topic.

func (*Broker) Unsubscribe added in v0.9.0

func (b *Broker) Unsubscribe(topic string, onPublish *service.OnPublishFunc) error

Unsubscribe unsubscribes a topic.

type EventReceiver added in v0.7.2

type EventReceiver struct {
	// Broker for publishing events.
	Broker *Broker

	// Next handler for XML-RPC events.
	Next itf.LogicLayer
}

EventReceiver accepts XMLRPC events, publishes them to the broker and then forwards them to the next receiver.

func (*EventReceiver) DeleteDevices added in v0.7.2

func (r *EventReceiver) DeleteDevices(interfaceID string, addresses []string) error

DeleteDevices implements itf.Receiver.

func (*EventReceiver) Event added in v0.7.2

func (r *EventReceiver) Event(interfaceID, address, valueKey string, value interface{}) error

Event implements itf.Receiver.

func (*EventReceiver) NewDevices added in v0.7.2

func (r *EventReceiver) NewDevices(interfaceID string, devDescriptions []*itf.DeviceDescription) error

NewDevices implements itf.Receiver.

func (*EventReceiver) ReaddedDevice added in v0.7.2

func (r *EventReceiver) ReaddedDevice(interfaceID string, deletedAddresses []string) error

ReaddedDevice implements itf.Receiver.

func (*EventReceiver) ReplaceDevice added in v0.7.2

func (r *EventReceiver) ReplaceDevice(interfaceID, oldDeviceAddress, newDeviceAddress string) error

ReplaceDevice implements itf.Receiver.

func (*EventReceiver) UpdateDevice added in v0.7.2

func (r *EventReceiver) UpdateDevice(interfaceID, address string, hint int) error

UpdateDevice implements itf.Receiver.

type SysVarReader added in v1.0.0

type SysVarReader struct {
	// Service is used to explore the system variables.
	Service veap.Service
	// ScriptClient is used to bulk read system variables.
	ScriptClient *script.Client
	// Broker is used for publishing value changes.
	Broker *Broker
	// contains filtered or unexported fields
}

SysVarReader reads cyclic system variables.

func (*SysVarReader) Start added in v1.0.0

func (r *SysVarReader) Start()

Start starts the system variable reader.

func (*SysVarReader) Stop added in v1.0.0

func (r *SysVarReader) Stop()

Stop stops the system variable reader.

Jump to

Keyboard shortcuts

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