Documentation
¶
Overview ¶
Package config contains all the configuration related components
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ScrapeInterval time.Duration
ScrapeInterval is the time between every scrapeing if data
Functions ¶
func ValidateSlave ¶
ValidateSlave tries to find inconsistencies in the parameters of a Slave. The port must be valid. If present: -Baudrate and Timeout must be positive. -Stopbits must be 1 or 2. -Databits must be 5, 6, 7 or 8. -Parity has to be "N", "E" or "O". The use of no parity requires 2 stop bits.
Types ¶
type ListSlaves ¶
ListSlaves is the list of configurations of the slaves from the configuration file.
func LoadSlaves ¶
func LoadSlaves(pathToSlaves string) (ListSlaves, error)
LoadSlaves unmarshals the slaves configuration file.
type ParsedSlave ¶
type ParsedSlave struct { Name string DigitalInput []Register DigitalOutput []Register AnalogInput []Register AnalogOutput []Register }
ParsedSlave contains all the I/O registers of one slave
type PortType ¶
type PortType int
PortType represents the type of the port of a Slave.
func CheckPortSlave ¶
CheckPortSlave indetifies the port as a PortType in order to identify the type of connection to stqablish in the Modbus Manager. Returns Invalid or IP, and Invalid when the Port property has an inidentifiable content.
type Slave ¶
type Slave struct { Port string `yaml:"port"` ID byte `yaml:"id"` Timeout int `yaml:"timeout"` Baudrate int `yaml:"baudrate"` Databits int `yaml:"databits"` Stopbits int `yaml:"stopbits"` Parity string `yaml:"parity"` KeepAlive bool `yaml:"keepAlive"` DigitalInput []string `yaml:"digitalIn"` DigitalOutput []string `yaml:"digitalOut"` AnalogInput []string `yaml:"analogIn"` AnalogOutput []string `yaml:"analogOut"` }
Slave defines the configuration parameters of a single slave. Parity Values => N (None), E (Even), O (Odd)
Default serial: Baudrate: 19200, Databits: 8, Stopbits: 1, Parity: E
func (*Slave) PrettyString ¶
PrettyString prints only the initialized values