Documentation
¶
Overview ¶
Package gateway provides a pico-cs MQTT broker gateway.
Index ¶
Constants ¶
View Source
const ( DefaultTopicRoot = "pico-cs" DefaultHost = "localhost" DefaultPort = "1883" )
Default values.
Variables ¶
View Source
var ReservedFctNames = []string{"dir", "speed"}
ReservedFctNames is the list of reserved function names which cannot be used in loco configurations.
Functions ¶
This section is empty.
Types ¶
type CS ¶
type CS struct {
// contains filtered or unexported fields
}
A CS represents a gateway command station.
func (*CS) AddLoco ¶
func (cs *CS) AddLoco(config *LocoConfig) (bool, error)
AddLoco adds a loco via a loco configuration to the command station.
type CSConfig ¶
type CSConfig struct {
// command station name (used in topic)
Name string
// pico_w host in case of WiFi TCP/IP connection
Host string
// TCP/IP port (WiFi) or serial port (serial over USB)
Port string
// list of regular expressions defining which set of objects should be controlled by this command station
// as the primary command station
Incls []string
// list of regular expressions defining which set of objects should be controlled by this command station
// as a secondary command station
// excluding regular expressions do have precedence over including regular expressions
Excls []string // List of regular expressions defining
}
CSConfig represents configuration data for a command station.
type Config ¶
type Config struct {
// root part of all gateway MQTT topics
TopicRoot string
// MQTT broker host
Host string
// MQTT broker port
Port string
// MQTT authentication username
Username string
// MQTT authentication password
Password string
}
Config represents configuration data for the gateway.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway represents a MQTT broker gateway.
type LocoConfig ¶
type LocoConfig struct {
// loco name (used in topic)
Name string
// loco decoder address
Addr uint
// loco function mapping (key is used in topic)
Fcts map[string]LocoFctConfig
}
LocoConfig represents configuration data for a loco.
type LocoFctConfig ¶
type LocoFctConfig struct {
// loco decoder function number
No uint
}
LocoFctConfig represents configuration data for a loco function.
Click to show internal directories.
Click to hide internal directories.