Documentation ¶
Index ¶
- Constants
- func IsRS485(model string) bool
- func NewDevice(model string, subdevice int, isRS485 bool) (device meters.Device, err error)
- func ParseOperation(dev meters.Device, measurement string, op *Operation) (err error)
- func ParsePoint(selector string) (model int, block int, point string, err error)
- func RS485FindDeviceOp(device *rs485.RS485, measurement meters.Measurement) (op rs485.Operation, err error)
- func ReadingName(val string) string
- func RegisterOperation(r Register) (rs485.Operation, error)
- type Connection
- func (mb *Connection) Delay(delay time.Duration)
- func (mb *Connection) Logger(logger meters.Logger)
- func (mb *Connection) MaskWriteRegister(address, andMask, orMask uint16) (results []byte, err error)
- func (mb *Connection) ReadCoils(address, quantity uint16) ([]byte, error)
- func (mb *Connection) ReadDiscreteInputs(address, quantity uint16) (results []byte, err error)
- func (mb *Connection) ReadFIFOQueue(address uint16) (results []byte, err error)
- func (mb *Connection) ReadHoldingRegisters(address, quantity uint16) ([]byte, error)
- func (mb *Connection) ReadInputRegisters(address, quantity uint16) ([]byte, error)
- func (mb *Connection) ReadWriteMultipleRegisters(readAddress, readQuantity, writeAddress, writeQuantity uint16, value []byte) (results []byte, err error)
- func (mb *Connection) Timeout(timeout time.Duration)
- func (mb *Connection) WriteMultipleCoils(address, quantity uint16, value []byte) (results []byte, err error)
- func (mb *Connection) WriteMultipleRegisters(address, quantity uint16, value []byte) ([]byte, error)
- func (mb *Connection) WriteSingleCoil(address, quantity uint16) ([]byte, error)
- func (mb *Connection) WriteSingleRegister(address, value uint16) ([]byte, error)
- type Operation
- type Register
- type Settings
- type SunSpecOperation
Constants ¶
const WriteSingleRegister = 6 // modbus.FuncCodeWriteSingleRegister
WriteSingleRegister 16-bit wise write access
Variables ¶
This section is empty.
Functions ¶
func ParseOperation ¶
ParseOperation parses an MBMD measurement or SunsSpec point definition into a modbus operation
func ParsePoint ¶
ParsePoint parses sunspec point from string
func RS485FindDeviceOp ¶
func RS485FindDeviceOp(device *rs485.RS485, measurement meters.Measurement) (op rs485.Operation, err error)
RS485FindDeviceOp checks is RS485 device supports operation
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection decorates a meters.Connection with transparent slave id and error handling
func NewConnection ¶
func NewConnection(uri, device, comset string, baudrate int, rtu bool, slaveID uint8) (*Connection, error)
NewConnection creates physical modbus device from config
func (*Connection) Delay ¶
func (mb *Connection) Delay(delay time.Duration)
Delay sets delay so use between subsequent modbus operations
func (*Connection) Logger ¶
func (mb *Connection) Logger(logger meters.Logger)
Logger sets logger implementation
func (*Connection) MaskWriteRegister ¶
func (mb *Connection) MaskWriteRegister(address, andMask, orMask uint16) (results []byte, err error)
MaskWriteRegister wraps the underlying implementation
func (*Connection) ReadCoils ¶
func (mb *Connection) ReadCoils(address, quantity uint16) ([]byte, error)
ReadCoils wraps the underlying implementation
func (*Connection) ReadDiscreteInputs ¶
func (mb *Connection) ReadDiscreteInputs(address, quantity uint16) (results []byte, err error)
ReadDiscreteInputs wraps the underlying implementation
func (*Connection) ReadFIFOQueue ¶
func (mb *Connection) ReadFIFOQueue(address uint16) (results []byte, err error)
ReadFIFOQueue wraps the underlying implementation
func (*Connection) ReadHoldingRegisters ¶
func (mb *Connection) ReadHoldingRegisters(address, quantity uint16) ([]byte, error)
ReadHoldingRegisters wraps the underlying implementation
func (*Connection) ReadInputRegisters ¶
func (mb *Connection) ReadInputRegisters(address, quantity uint16) ([]byte, error)
ReadInputRegisters wraps the underlying implementation
func (*Connection) ReadWriteMultipleRegisters ¶
func (mb *Connection) ReadWriteMultipleRegisters(readAddress, readQuantity, writeAddress, writeQuantity uint16, value []byte) (results []byte, err error)
ReadWriteMultipleRegisters wraps the underlying implementation
func (*Connection) Timeout ¶
func (mb *Connection) Timeout(timeout time.Duration)
Timeout sets the connection timeout (not idle timeout)
func (*Connection) WriteMultipleCoils ¶
func (mb *Connection) WriteMultipleCoils(address, quantity uint16, value []byte) (results []byte, err error)
WriteMultipleCoils wraps the underlying implementation
func (*Connection) WriteMultipleRegisters ¶
func (mb *Connection) WriteMultipleRegisters(address, quantity uint16, value []byte) ([]byte, error)
WriteMultipleRegisters wraps the underlying implementation
func (*Connection) WriteSingleCoil ¶
func (mb *Connection) WriteSingleCoil(address, quantity uint16) ([]byte, error)
WriteSingleCoil wraps the underlying implementation
func (*Connection) WriteSingleRegister ¶
func (mb *Connection) WriteSingleRegister(address, value uint16) ([]byte, error)
WriteSingleRegister wraps the underlying implementation
type Operation ¶
type Operation struct { MBMD rs485.Operation SunSpec SunSpecOperation }
Operation is a register-based or sunspec modbus operation
type Settings ¶
type Settings struct { ID uint8 SubDevice int URI, Device, Comset string Baudrate int RTU *bool // indicates RTU over TCP if true }
Settings contains the ModBus settings
type SunSpecOperation ¶
SunSpecOperation is a sunspec modbus operation