Documentation
¶
Overview ¶
Package config provides the config file schema and utilities to load the config into concrete outlet and outlet group types.
Index ¶
Constants ¶
View Source
const ( // DefaultListenAddress defines the default address to listen on. DefaultListenAddress = ":3333" // DefaultTransmitPin defines the default gpio pin for transmitting rf codes. DefaultTransmitPin uint = 17 // DefaultReceivePin defines the default gpio pin for receiving rf codes. DefaultReceivePin uint = 27 // DefaultProtocol defines the default rf protocol. DefaultProtocol int = 1 // DefaultPulseLength defines the default pulse length. DefaultPulseLength uint = 189 )
Variables ¶
View Source
var DefaultConfig = Config{ ListenAddress: DefaultListenAddress, GPIO: GPIOConfig{ ReceivePin: DefaultReceivePin, TransmitPin: DefaultTransmitPin, DefaultPulseLength: DefaultPulseLength, DefaultProtocol: DefaultProtocol, TransmissionCount: gpio.DefaultTransmissionCount, }, }
DefaultConfig contains the default values which are chosen if a file is omitted in the config file.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ListenAddress string `json:"listenAddress"` StateFile string `json:"stateFile"` DetectStateDrift bool `json:"detectStateDrift"` GPIO GPIOConfig `json:"gpio"` OutletGroups []OutletGroupConfig `json:"outletGroups"` }
Config is the structure of the config file.
func LoadWithDefaults ¶
LoadWithDefaults loads config from file and merges in the default config for unset fields.
func LoadWithReader ¶
LoadWithReader loads the config using reader.
func (Config) BuildOutletGroups ¶
BuildOutletGroups builds outlet groups from c.
type GPIOConfig ¶
type GPIOConfig struct { ReceivePin uint `json:"receivePin"` TransmitPin uint `json:"transmitPin"` DefaultPulseLength uint `json:"defaultPulseLength"` DefaultProtocol int `json:"defaultProtocol"` TransmissionCount int `json:"transmissionCount"` }
GPIOConfig is the structure of the gpio config section.
type OutletConfig ¶
type OutletConfig struct { ID string `json:"id"` DisplayName string `json:"displayName"` CodeOn uint64 `json:"codeOn"` CodeOff uint64 `json:"codeOff"` Protocol int `json:"protocol"` PulseLength uint `json:"pulseLength"` }
OutletConfig is the structure of the config for a single outlet.
type OutletGroupConfig ¶
type OutletGroupConfig struct { ID string `json:"id"` DisplayName string `json:"displayName"` Outlets []OutletConfig `json:"outlets"` }
OutletGroupConfig is the structure of the config for a single outlet group.
Click to show internal directories.
Click to hide internal directories.