Documentation ¶
Index ¶
Constants ¶
const ( Read ModbusMode = "R" // Read-only ReadWrite = "RW" // Both read and write allowed Write = "W" // Write-only. Added for own purposes )
Modbus mode constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByAddress ¶
type ByAddress []Coil
ByAddress implements sorter interface, for sorting an array of coils based on Address
type CoilConfig ¶
type CoilConfig struct { Address uint16 Mode ModbusMode Slug string }
CoilConfig holds the description of the coil part of a device modbus map
type CoilGroup ¶
type CoilGroup struct { ModbusClient modbus.Client MQTTClient mqtt.Client // contains filtered or unexported fields }
CoilGroup represents an array of coils which have contiguous Addresses
func GroupCoils ¶
GroupCoils groups an array of coils into an array coil groups
type CoilGroupUpdater ¶
type CoilGroupUpdater interface {
Update() (err error)
}
CoilGroupUpdater exposes the required interfaces for polling CoilGroups
type CoilUpdater ¶
type CoilUpdater interface {
Update()
}
CoilUpdater represents a coil to be polled
type Configuration ¶
type Configuration struct { Coils []CoilConfig MQTTBrokerURI string `yaml:"mqtt_broker_uri"` MQTTClientID string `yaml:"mqtt_client_id"` ModbusServerURI string `yaml:"modbus_server_uri"` }
Configuration of modbridge
func (*Configuration) CoilGroupsList ¶
func (c *Configuration) CoilGroupsList() []CoilGroup
CoilGroupsList generates a list of groups, out of the filtered list obtained from the config
func (*Configuration) CoilsList ¶
func (c *Configuration) CoilsList() (coils []Coil)
CoilsList generates a list of non-write only coils from a configuration object
func (*Configuration) CoilsMap ¶
func (c *Configuration) CoilsMap() (coils map[string]Coil)
CoilsMap generates a reverse mapping of the Slugs back to the original coil
type ModbusMode ¶
type ModbusMode string
ModbusMode indicates whether the involved register or coil is read-only or read and write allowed
type SwitchType ¶
type SwitchType int
SwitchType indicates how to interpret the switch
const ( NO SwitchType = iota // Normally Open NC // Normally Closed )
Switch type constants