Documentation ¶
Index ¶
- type Config
- type MQTTGateway
- func (g *MQTTGateway) HandleControlCommand(command string, args ...string) string
- func (g *MQTTGateway) Hostname() string
- func (g *MQTTGateway) IsTLS() bool
- func (g *MQTTGateway) MQTTVersion() string
- func (g *MQTTGateway) Port() uint16
- func (g *MQTTGateway) SendVehicleETAForStationToClient(client *gmqtt.Client, topicID, networkID, stationID string) error
- func (g *MQTTGateway) SendVehicleETAs(client *gmqtt.Client, sendAll bool) error
- func (g *MQTTGateway) SendVehiclePositions() error
- func (g *MQTTGateway) Start() error
- func (g *MQTTGateway) Stats() *MQTTGatewayStats
- func (g *MQTTGateway) Stop() error
- type MQTTGatewayStats
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) Stats ¶
func (g *MQTTGateway) Stats() *MQTTGatewayStats
Stats returns stats about the MQTT gateway