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  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _MODBUS_CLIENT_PDU_H
32 #define _MODBUS_CLIENT_PDU_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "modbus/modbus_client.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //Modbus/TCP client related functions
45  uint16_t address, uint_t quantity);
46 
48  uint16_t address, uint_t quantity);
49 
51  uint16_t address, uint_t quantity);
52 
54  uint16_t address, uint_t quantity);
55 
57  uint16_t address, bool_t value);
58 
60  uint16_t address, uint16_t value);
61 
63  uint16_t address, uint_t quantity, const uint8_t *value);
64 
66  uint16_t address, uint_t quantity, const uint16_t *value);
67 
69  uint16_t address, uint16_t andMask, uint16_t orMask);
70 
72  uint16_t readAddress, uint16_t readQuantity, uint16_t writeAddress,
73  uint16_t writeQuantity, const uint16_t *writeValue);
74 
76  uint_t quantity, uint8_t *value);
77 
79  uint_t quantity, uint8_t *value);
80 
82  uint_t quantity, uint16_t *value);
83 
85  uint_t quantity, uint16_t *value);
86 
88  uint16_t address, bool_t value);
89 
91  uint16_t address, uint16_t value);
92 
94  uint16_t address, uint_t quantity);
95 
97  uint16_t address, uint_t quantity);
98 
100  uint16_t address, uint16_t andMask, uint16_t orMask);
101 
103  uint_t readQuantity, uint16_t *readValue);
104 
106 
107 //C++ guard
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif
Modbus/TCP client.
int bool_t
Definition: compiler_port.h:53
error_t modbusClientFormatWriteSingleCoilReq(ModbusClientContext *context, uint16_t address, bool_t value)
Format Write Single Coil request.
uint16_t andMask
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 modbusClientFormatWriteMultipleRegsReq(ModbusClientContext *context, uint16_t address, uint_t quantity, const uint16_t *value)
Format Write Multiple Registers request.
error_t modbusClientParseReadDiscreteInputsResp(ModbusClientContext *context, uint_t quantity, uint8_t *value)
Parse Discrete Inputs response.
#define ModbusClientContext
Definition: modbus_client.h:86
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 modbusClientParseExceptionResp(ModbusClientContext *context)
Parse Exception response.
error_t modbusClientParseReadHoldingRegsResp(ModbusClientContext *context, uint_t quantity, uint16_t *value)
Parse Read Holding Registers response.
error_t modbusClientFormatWriteSingleRegReq(ModbusClientContext *context, uint16_t address, uint16_t value)
Format Write Single Register request.
error_t
Error codes.
Definition: error.h:43
error_t modbusClientParseReadWriteMultipleRegsResp(ModbusClientContext *context, uint_t readQuantity, uint16_t *readValue)
Parse Read/Write Multiple Registers response.
error_t modbusClientParseReadInputRegsResp(ModbusClientContext *context, uint_t quantity, uint16_t *value)
Parse Read Input Registers response.
error_t modbusClientParseMaskWriteRegResp(ModbusClientContext *context, uint16_t address, uint16_t andMask, uint16_t orMask)
Parse Mask Write Register response.
error_t modbusClientFormatReadCoilsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Coils request.
error_t modbusClientFormatReadDiscreteInputsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Discrete Inputs request.
error_t modbusClientFormatMaskWriteRegReq(ModbusClientContext *context, uint16_t address, uint16_t andMask, uint16_t orMask)
Format Mask Write Register request.
uint16_t orMask
error_t modbusClientParseWriteMultipleCoilsResp(ModbusClientContext *context, uint16_t address, uint_t quantity)
Parse Write Multiple Coils response.
error_t modbusClientParseReadCoilsResp(ModbusClientContext *context, uint_t quantity, uint8_t *value)
Parse Read Coils response.
Ipv6Addr address[]
Definition: ipv6.h:325
uint8_t value[]
Definition: tcp.h:369
error_t modbusClientParseWriteSingleCoilResp(ModbusClientContext *context, uint16_t address, bool_t value)
Parse Write Single Coil response.
error_t modbusClientParseWriteSingleRegResp(ModbusClientContext *context, uint16_t address, uint16_t value)
Parse Write Single Register response.
unsigned int uint_t
Definition: compiler_port.h:50
TCP/IP stack core.
error_t modbusClientFormatWriteMultipleCoilsReq(ModbusClientContext *context, uint16_t address, uint_t quantity, const uint8_t *value)
Format Write Multiple Coils request.
error_t modbusClientFormatReadHoldingRegsReq(ModbusClientContext *context, uint16_t address, uint_t quantity)
Format Read Holding Registers request.