Documentation
¶
Overview ¶
Package gateway provides a pico-cs MQTT broker gateway.
Index ¶
Constants ¶
const ( DefaultTopicRoot = "pico-cs" DefaultHost = "localhost" DefaultPort = "1883" )
Default values.
Variables ¶
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 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 // filter of devices for which this command station should be a primary device Primary Filter // filter of devices for which this command station should be a secondary device Secondary Filter }
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 // Logger Logger *log.Logger }
Config represents configuration data for the gateway.
type Filter ¶ added in v0.4.0
type Filter struct { // list of regular expressions defining which set of devices should be included Incls []string // list of regular expressions defining which set of devices should be excluded // excluding regular expressions do have precedence over including regular expressions Excls []string }
Filter represents an including and excluding list of device names.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway represents a MQTT broker gateway.
func (*Gateway) AddCS ¶ added in v0.4.0
AddCS adds a command station to the gateway via a command station configuration.
func (*Gateway) AddLoco ¶ added in v0.4.0
func (gw *Gateway) AddLoco(config *LocoConfig) (*Loco, error)
AddLoco adds a loco to the gateway via a loco configuration.
func (*Gateway) CSList ¶ added in v0.4.0
CSList returns the list of command stations assigned to this gateway.
type Loco ¶ added in v0.4.0
type Loco struct {
// contains filtered or unexported fields
}
A Loco represents a loco.
func (*Loco) SecondaryList ¶ added in v0.4.0
SecondaryList returns the list of secondary command stations.