mqttgateway

package
v0.0.0-...-30a0ae6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: Apache-2.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 Config

type Config struct {
	Keybox            *keybox.Keybox
	Log               *log.Logger
	Node              sqalx.Node
	AuthHashKey       []byte
	VehicleHandler    *compute.VehicleHandler
	VehicleETAHandler *compute.VehicleETAHandler
	StatsHandler      *compute.StatsHandler
}

Config contains runtime gateway configuration

type MQTTGateway

type MQTTGateway struct {
	Log  *log.Logger
	Node sqalx.Node
	// contains filtered or unexported fields
}

MQTTGateway is a real-time gateway that uses the MQTT protocol

func New

func New(c Config) (*MQTTGateway, error)

New returns a new MQTTGateway with the specified settings

func (*MQTTGateway) HandleControlCommand

func (g *MQTTGateway) HandleControlCommand(command string, args ...string) string

HandleControlCommand handles a human-issued command to control the behavior of the gateway It returns a human-readable with the result

func (*MQTTGateway) Hostname

func (g *MQTTGateway) Hostname() string

Hostname returns the hostname where the gateway can be contacted

func (*MQTTGateway) IsTLS

func (g *MQTTGateway) IsTLS() bool

IsTLS returns whether this gateway operates over TLS

func (*MQTTGateway) MQTTVersion

func (g *MQTTGateway) MQTTVersion() string

MQTTVersion returns the MQTT version supported by this gateway

func (*MQTTGateway) Port

func (g *MQTTGateway) Port() uint16

Port returns the port where the gateway can be contacted

func (*MQTTGateway) SendVehicleETAForStationToClient

func (g *MQTTGateway) SendVehicleETAForStationToClient(client *gmqtt.Client, topicID, networkID, stationID string) error

SendVehicleETAForStationToClient publishes, to the given client, vehicle ETAs for the specified station

func (*MQTTGateway) SendVehicleETAs

func (g *MQTTGateway) SendVehicleETAs(client *gmqtt.Client, sendAll bool) error

SendVehicleETAs publishes vehicle ETAs for all stations and directions in the respective topics

func (*MQTTGateway) SendVehiclePositions

func (g *MQTTGateway) SendVehiclePositions() error

SendVehiclePositions publishes all vehicle positions

func (*MQTTGateway) Start

func (g *MQTTGateway) Start() error

Start starts the MQTT gateway

func (*MQTTGateway) Stats

func (g *MQTTGateway) Stats() *MQTTGatewayStats

Stats returns stats about the MQTT gateway

func (*MQTTGateway) Stop

func (g *MQTTGateway) Stop() error

Stop stops the MQTT gateway

type MQTTGatewayStats

type MQTTGatewayStats struct {
	CurrentClients       int
	CurrentSubscriptions int
	TotalConnects        int
	TotalDisconnects     int
}

MQTTGatewayStats contains stats about the

Jump to

Keyboard shortcuts

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