modbus_client.c
error_t modbusClientParseWriteMultipleRegsResp(ModbusClientContext *context, uint16_t address, uint_t quantity)
Parse Write Multiple Registers response.
Definition: modbus_client_pdu.c:746
error_t modbusClientWriteSingleReg(ModbusClientContext *context, uint16_t address, uint16_t value)
Write single register.
Definition: modbus_client.c:611
Modbus/TCP client.
error_t modbusClientReadWriteMultipleRegs(ModbusClientContext *context, uint16_t readAddress, uint_t readQuantity, uint16_t *readValue, uint16_t writeAddress, uint_t writeQuantity, const uint16_t *writeValue)
Read/write multiple registers.
Definition: modbus_client.c:877
error_t modbusClientConnect(ModbusClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort)
Establish connection with the Modbus/TCP server.
Definition: modbus_client.c:187
error_t modbusClientParseReadHoldingRegsResp(ModbusClientContext *context, uint_t quantity, uint16_t *value)
Parse Read Holding Registers response.
Definition: modbus_client_pdu.c:533
error_t modbusClientParseWriteMultipleCoilsResp(ModbusClientContext *context, uint16_t address, uint_t quantity)
Parse Write Multiple Coils response.
Definition: modbus_client_pdu.c:708
error_t modbusClientRegisterTlsInitCallback(ModbusClientContext *context, ModbusClientTlsInitCallback callback)
Register TLS initialization callback function.
Definition: modbus_client.c:98
error_t modbusClientOpenConnection(ModbusClientContext *context)
Open network connection.
Definition: modbus_client_transport.c:50
error_t modbusClientReadInputRegs(ModbusClientContext *context, uint16_t address, uint_t quantity, uint16_t *value)
Read input registers.
Definition: modbus_client.c:483
error_t modbusClientFormatReadWriteMultipleRegsReq(ModbusClientContext *context, uint16_t readAddress, uint16_t readQuantity, uint16_t writeAddress, uint16_t writeQuantity, const uint16_t *writeValue)
Format Read/Write Multiple Registers request.
Definition: modbus_client_pdu.c:405
error_t modbusClientParseWriteSingleCoilResp(ModbusClientContext *context, uint16_t address, bool_t value)
Parse Write Single Coil response.
Definition: modbus_client_pdu.c:629
error_t modbusClientFormatWriteMultipleRegsReq(ModbusClientContext *context, uint16_t address, uint_t quantity, const uint16_t *value)
Format Write Multiple Registers request.
Definition: modbus_client_pdu.c:322
error_t modbusClientFormatMaskWriteRegReq(ModbusClientContext *context, uint16_t address, uint16_t andMask, uint16_t orMask)
Format Mask Write Register request.
Definition: modbus_client_pdu.c:366
error_t modbusClientMaskWriteReg(ModbusClientContext *context, uint16_t address, uint16_t andMask, uint16_t orMask)
Apply AND/OR bitmask to a register.
Definition: modbus_client.c:810
error_t modbusClientEstablishConnection(ModbusClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort)
Establish network connection.
Definition: modbus_client_transport.c:129
void tlsFreeSessionState(TlsSessionState *session)
Properly dispose a session state.
Definition: tls.c:2753
error_t modbusClientInit(ModbusClientContext *context)
Initialize Modbus/TCP client context.
Definition: modbus_client.c:51
error_t modbusClientFormatReadCoilsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Coils request.
Definition: modbus_client_pdu.c:53
error_t modbusClientFormatReadInputRegsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Input Registers request.
Definition: modbus_client_pdu.c:158
error_t modbusClientFormatWriteSingleCoilReq(ModbusClientContext *context, uint16_t address, bool_t value)
Format Write Single Coil request.
Definition: modbus_client_pdu.c:193
void modbusClientCloseConnection(ModbusClientContext *context)
Close network connection.
Definition: modbus_client_transport.c:206
error_t modbusClientGetExceptionCode(ModbusClientContext *context, ModbusExceptionCode *exceptionCode)
Retrieve exception code.
Definition: modbus_client.c:943
error_t modbusClientParseReadInputRegsResp(ModbusClientContext *context, uint_t quantity, uint16_t *value)
Parse Read Input Registers response.
Definition: modbus_client_pdu.c:581
error_t modbusClientBindToInterface(ModbusClientContext *context, NetInterface *interface)
Bind the Modbus/TCP client to a particular network interface.
Definition: modbus_client.c:164
error_t modbusClientParseReadDiscreteInputsResp(ModbusClientContext *context, uint_t quantity, uint8_t *value)
Parse Discrete Inputs response.
Definition: modbus_client_pdu.c:492
error_t modbusClientSetTimeout(ModbusClientContext *context, systime_t timeout)
Set timeout value for blocking operations.
Definition: modbus_client.c:122
error_t modbusClientCheckTimeout(ModbusClientContext *context)
Determine whether a timeout error has occurred.
Definition: modbus_client_misc.c:417
error_t modbusClientWriteMultipleRegs(ModbusClientContext *context, uint16_t address, uint_t quantity, const uint16_t *value)
Write multiple registers.
Definition: modbus_client.c:741
Modbus PDU formatting and parsing.
void modbusClientDeinit(ModbusClientContext *context)
Release Modbus/TCP client context.
Definition: modbus_client.c:1062
Transport protocol abstraction layer.
error_t modbusClientClose(ModbusClientContext *context)
Close the connection with the Modbus/TCP server.
Definition: modbus_client.c:1041
error_t(* ModbusClientTlsInitCallback)(ModbusClientContext *context, TlsContext *tlsContext)
TLS initialization callback function.
Definition: modbus_client.h:117
error_t modbusClientWriteMultipleCoils(ModbusClientContext *context, uint16_t address, uint_t quantity, const uint8_t *value)
Write multiple coils.
Definition: modbus_client.c:673
error_t modbusClientReadCoils(ModbusClientContext *context, uint16_t address, uint_t quantity, uint8_t *value)
Read coils.
Definition: modbus_client.c:279
error_t modbusClientFormatWriteSingleRegReq(ModbusClientContext *context, uint16_t address, uint16_t value)
Format Write Single Register request.
Definition: modbus_client_pdu.c:238
error_t modbusClientParseReadCoilsResp(ModbusClientContext *context, uint_t quantity, uint8_t *value)
Parse Read Coils response.
Definition: modbus_client_pdu.c:451
error_t modbusClientFormatWriteMultipleCoilsReq(ModbusClientContext *context, uint16_t address, uint_t quantity, const uint8_t *value)
Format Write Multiple Coils request.
Definition: modbus_client_pdu.c:274
error_t modbusClientSetUnitId(ModbusClientContext *context, uint8_t unitId)
Set unit identifier.
Definition: modbus_client.c:143
error_t modbusClientFormatReadDiscreteInputsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Discrete Inputs request.
Definition: modbus_client_pdu.c:88
error_t modbusClientParseReadWriteMultipleRegsResp(ModbusClientContext *context, uint_t readQuantity, uint16_t *readValue)
Parse Read/Write Multiple Registers response.
Definition: modbus_client_pdu.c:823
error_t modbusClientParseWriteSingleRegResp(ModbusClientContext *context, uint16_t address, uint16_t value)
Parse Write Single Register response.
Definition: modbus_client_pdu.c:671
error_t modbusClientWriteSingleCoil(ModbusClientContext *context, uint16_t address, bool_t value)
Write single coil.
Definition: modbus_client.c:550
error_t modbusClientShutdownConnection(ModbusClientContext *context)
Shutdown network connection.
Definition: modbus_client_transport.c:169
error_t modbusClientDisconnect(ModbusClientContext *context)
Gracefully disconnect from the Modbus/TCP server.
Definition: modbus_client.c:964
error_t modbusClientParseMaskWriteRegResp(ModbusClientContext *context, uint16_t address, uint16_t andMask, uint16_t orMask)
Parse Mask Write Register response.
Definition: modbus_client_pdu.c:785
error_t modbusClientReadHoldingRegs(ModbusClientContext *context, uint16_t address, uint_t quantity, uint16_t *value)
Read holding registers.
Definition: modbus_client.c:415
error_t tlsInitSessionState(TlsSessionState *session)
Initialize session state.
Definition: tls.c:2610
error_t modbusClientFormatReadHoldingRegsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Holding Registers request.
Definition: modbus_client_pdu.c:123
Helper functions for Modbus/TCP client.
Debugging facilities.
error_t modbusClientTransaction(ModbusClientContext *context)
Perform Modbus transaction.
Definition: modbus_client_misc.c:52
error_t modbusClientReadDiscreteInputs(ModbusClientContext *context, uint16_t address, uint_t quantity, uint8_t *value)
Read discrete inputs.
Definition: modbus_client.c:347