Versions in this module Expand all Collapse all v0 v0.1.0 Sep 19, 2018 Changes in this version + const ExceptionCodeAcknowledge + const ExceptionCodeGatewayPathUnavailable + const ExceptionCodeGatewayTargetDeviceFailedToRespond + const ExceptionCodeIllegalDataAddress + const ExceptionCodeIllegalDataValue + const ExceptionCodeIllegalFunction + const ExceptionCodeMemoryParityError + const ExceptionCodeServerDeviceBusy + const ExceptionCodeServerDeviceFailure + const FuncCodeMaskWriteRegister + const FuncCodeReadCoils + const FuncCodeReadDiscreteInputs + const FuncCodeReadFIFOQueue + const FuncCodeReadHoldingRegisters + const FuncCodeReadInputRegisters + const FuncCodeReadWriteMultipleRegisters + const FuncCodeWriteMultipleCoils + const FuncCodeWriteMultipleRegisters + const FuncCodeWriteSingleCoil + const FuncCodeWriteSingleRegister + type ASCIIClientHandler struct + func NewASCIIClientHandler(address string) *ASCIIClientHandler + func (mb *ASCIIClientHandler) Decode(adu []byte) (pdu *ProtocolDataUnit, err error) + func (mb *ASCIIClientHandler) Encode(pdu *ProtocolDataUnit) (adu []byte, err error) + func (mb *ASCIIClientHandler) Send(aduRequest []byte) (aduResponse []byte, err error) + func (mb *ASCIIClientHandler) Verify(aduRequest []byte, aduResponse []byte) (err error) + type Client interface + MaskWriteRegister func(address, andMask, orMask uint16) (results []byte, err error) + ReadCoils func(address, quantity uint16) (results []byte, err error) + ReadDiscreteInputs func(address, quantity uint16) (results []byte, err error) + ReadFIFOQueue func(address uint16) (results []byte, err error) + ReadHoldingRegisters func(address, quantity uint16) (results []byte, err error) + ReadInputRegisters func(address, quantity uint16) (results []byte, err error) + ReadWriteMultipleRegisters func(readAddress, readQuantity, writeAddress, writeQuantity uint16, value []byte) (results []byte, err error) + WriteMultipleCoils func(address, quantity uint16, value []byte) (results []byte, err error) + WriteMultipleRegisters func(address, quantity uint16, value []byte) (results []byte, err error) + WriteSingleCoil func(address, value uint16) (results []byte, err error) + WriteSingleRegister func(address, value uint16) (results []byte, err error) + func ASCIIClient(address string) Client + func NewClient(handler ClientHandler) Client + func NewClient2(packager Packager, transporter Transporter) Client + func RTUClient(address string) Client + func TCPClient(address string) Client + type ClientHandler interface + type ModbusError struct + ExceptionCode byte + FunctionCode byte + func (e *ModbusError) Error() string + type Packager interface + Decode func(adu []byte) (pdu *ProtocolDataUnit, err error) + Encode func(pdu *ProtocolDataUnit) (adu []byte, err error) + Verify func(aduRequest []byte, aduResponse []byte) (err error) + type ProtocolDataUnit struct + Data []byte + FunctionCode byte + type RTUClientHandler struct + func NewRTUClientHandler(address string) *RTUClientHandler + func (mb *RTUClientHandler) Decode(adu []byte) (pdu *ProtocolDataUnit, err error) + func (mb *RTUClientHandler) Encode(pdu *ProtocolDataUnit) (adu []byte, err error) + func (mb *RTUClientHandler) Send(aduRequest []byte) (aduResponse []byte, err error) + func (mb *RTUClientHandler) Verify(aduRequest []byte, aduResponse []byte) (err error) + type TCPClientHandler struct + func NewTCPClientHandler(address string) *TCPClientHandler + func (mb *TCPClientHandler) Close() error + func (mb *TCPClientHandler) Connect() error + func (mb *TCPClientHandler) Decode(adu []byte) (pdu *ProtocolDataUnit, err error) + func (mb *TCPClientHandler) Encode(pdu *ProtocolDataUnit) (adu []byte, err error) + func (mb *TCPClientHandler) Send(aduRequest []byte) (aduResponse []byte, err error) + func (mb *TCPClientHandler) Verify(aduRequest []byte, aduResponse []byte) (err error) + type Transporter interface + Send func(aduRequest []byte) (aduResponse []byte, err error)