modbus_client_pdu.h
Go to the documentation of this file.
1 /**
2  * @file modbus_client_pdu.h
3  * @brief Modbus PDU formatting and parsing
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _MODBUS_CLIENT_PDU_H
30 #define _MODBUS_CLIENT_PDU_H
31 
32 //Dependencies
33 #include "core/net.h"
34 #include "modbus/modbus_client.h"
35 
36 //C++ guard
37 #ifdef __cplusplus
38  extern "C" {
39 #endif
40 
41 //Modbus/TCP client related functions
43  uint16_t address, uint_t quantity);
44 
46  uint16_t address, uint_t quantity);
47 
49  uint16_t address, uint_t quantity);
50 
52  uint16_t address, uint_t quantity);
53 
55  uint16_t address, bool_t value);
56 
58  uint16_t address, uint16_t value);
59 
61  uint16_t address, uint_t quantity, const uint8_t *value);
62 
64  uint16_t address, uint_t quantity, const uint16_t *value);
65 
67  uint16_t address, uint16_t andMask, uint16_t orMask);
68 
70  uint16_t readAddress, uint16_t readQuantity, uint16_t writeAddress,
71  uint16_t writeQuantity, const uint16_t *writeValue);
72 
74  uint_t quantity, uint8_t *value);
75 
77  uint_t quantity, uint8_t *value);
78 
80  uint_t quantity, uint16_t *value);
81 
83  uint_t quantity, uint16_t *value);
84 
86  uint16_t address, bool_t value);
87 
89  uint16_t address, uint16_t value);
90 
92  uint16_t address, uint_t quantity);
93 
95  uint16_t address, uint_t quantity);
96 
98  uint16_t address, uint16_t andMask, uint16_t orMask);
99 
101  uint_t readQuantity, uint16_t *readValue);
102 
104 
105 //C++ guard
106 #ifdef __cplusplus
107  }
108 #endif
109 
110 #endif
error_t modbusClientParseReadDiscreteInputsResp(ModbusClientContext *context, uint_t quantity, uint8_t *value)
Parse Discrete Inputs response.
error_t modbusClientFormatReadHoldingRegsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Holding Registers request.
TCP/IP stack core.
error_t modbusClientFormatWriteMultipleRegsReq(ModbusClientContext *context, uint16_t address, uint_t quantity, const uint16_t *value)
Format Write Multiple Registers request.
error_t modbusClientFormatWriteSingleRegReq(ModbusClientContext *context, uint16_t address, uint16_t value)
Format Write Single Register request.
uint16_t orMask
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.
error_t modbusClientFormatReadCoilsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Coils request.
error_t modbusClientParseExceptionResp(ModbusClientContext *context)
Parse Exception response.
error_t modbusClientParseReadWriteMultipleRegsResp(ModbusClientContext *context, uint_t readQuantity, uint16_t *readValue)
Parse Read/Write Multiple Registers response.
error_t modbusClientFormatReadDiscreteInputsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Discrete Inputs request.
error_t modbusClientParseWriteMultipleRegsResp(ModbusClientContext *context, uint16_t address, uint_t quantity)
Parse Write Multiple Registers response.
error_t modbusClientFormatReadInputRegsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Input Registers request.
error_t modbusClientParseReadHoldingRegsResp(ModbusClientContext *context, uint_t quantity, uint16_t *value)
Parse Read Holding Registers response.
error_t modbusClientParseMaskWriteRegResp(ModbusClientContext *context, uint16_t address, uint16_t andMask, uint16_t orMask)
Parse Mask Write Register response.
error_t modbusClientParseReadInputRegsResp(ModbusClientContext *context, uint_t quantity, uint16_t *value)
Parse Read Input Registers response.
error_t modbusClientParseWriteSingleRegResp(ModbusClientContext *context, uint16_t address, uint16_t value)
Parse Write Single Register response.
Ipv6Addr address
Modbus/TCP client context.
Definition: modbus_client.h:75
error_t
Error codes.
Definition: error.h:40
error_t modbusClientParseWriteSingleCoilResp(ModbusClientContext *context, uint16_t address, bool_t value)
Parse Write Single Coil response.
unsigned int uint_t
Definition: compiler_port.h:43
error_t modbusClientParseReadCoilsResp(ModbusClientContext *context, uint_t quantity, uint8_t *value)
Parse Read Coils response.
Modbus/TCP client.
uint8_t value[]
Definition: dtls_misc.h:141
error_t modbusClientFormatMaskWriteRegReq(ModbusClientContext *context, uint16_t address, uint16_t andMask, uint16_t orMask)
Format Mask Write Register request.
uint16_t andMask
error_t modbusClientFormatWriteMultipleCoilsReq(ModbusClientContext *context, uint16_t address, uint_t quantity, const uint8_t *value)
Format Write Multiple Coils request.
error_t modbusClientParseWriteMultipleCoilsResp(ModbusClientContext *context, uint16_t address, uint_t quantity)
Parse Write Multiple Coils response.
error_t modbusClientFormatWriteSingleCoilReq(ModbusClientContext *context, uint16_t address, bool_t value)
Format Write Single Coil request.
int bool_t
Definition: compiler_port.h:47