modbus_client_misc.c File Reference

Helper functions for Modbus/TCP client. More...

Go to the source code of this file.

Macros

#define TRACE_LEVEL   MODBUS_TRACE_LEVEL
 

Functions

error_t modbusClientTransaction (ModbusClientContext *context)
 Perform Modbus transaction. More...
 
error_t modbusClientCheckResp (ModbusClientContext *context)
 Check whether the received response matches the request. More...
 
error_t modbusClientFormatMbapHeader (ModbusClientContext *context, size_t length)
 Format MBAP header. More...
 
error_t modbusClientParseMbapHeader (ModbusClientContext *context)
 Parse MBAP header. More...
 
void * modbusClientGetRequestPdu (ModbusClientContext *context)
 Retrieve request PDU. More...
 
void * modbusClientGetResponsePdu (ModbusClientContext *context, size_t *length)
 Retrieve response PDU. More...
 
error_t modbusClientCheckTimeout (ModbusClientContext *context)
 Determine whether a timeout error has occurred. More...
 

Detailed Description

Helper functions for Modbus/TCP client.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file modbus_client_misc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   MODBUS_TRACE_LEVEL

Definition at line 32 of file modbus_client_misc.c.

Function Documentation

◆ modbusClientCheckResp()

error_t modbusClientCheckResp ( ModbusClientContext context)

Check whether the received response matches the request.

Parameters
[in]contextPointer to the Modbus/TCP client context
Returns
Error code

Definition at line 211 of file modbus_client_misc.c.

◆ modbusClientCheckTimeout()

error_t modbusClientCheckTimeout ( ModbusClientContext context)

Determine whether a timeout error has occurred.

Parameters
[in]contextPointer to the Modbus/TCP client context
Returns
Error code

Definition at line 417 of file modbus_client_misc.c.

◆ modbusClientFormatMbapHeader()

error_t modbusClientFormatMbapHeader ( ModbusClientContext context,
size_t  length 
)

Format MBAP header.

Parameters
[in]contextPointer to the Modbus/TCP client context
[in]lengthLength of the PDU, in bytes
Returns
Error code

Definition at line 271 of file modbus_client_misc.c.

◆ modbusClientGetRequestPdu()

void* modbusClientGetRequestPdu ( ModbusClientContext context)

Retrieve request PDU.

Parameters
[in]contextPointer to the Modbus/TCP client context
Returns
Pointer to the request PDU

Definition at line 375 of file modbus_client_misc.c.

◆ modbusClientGetResponsePdu()

void* modbusClientGetResponsePdu ( ModbusClientContext context,
size_t *  length 
)

Retrieve response PDU.

Parameters
[in]contextPointer to the Modbus/TCP client context
[out]lengthLength of the response PDU, in bytes
Returns
Pointer to the response PDU

Definition at line 389 of file modbus_client_misc.c.

◆ modbusClientParseMbapHeader()

error_t modbusClientParseMbapHeader ( ModbusClientContext context)

Parse MBAP header.

Parameters
[in]contextPointer to the Modbus/TCP client context
Returns
Error code

Definition at line 320 of file modbus_client_misc.c.

◆ modbusClientTransaction()

error_t modbusClientTransaction ( ModbusClientContext context)

Perform Modbus transaction.

Parameters
[in]contextPointer to the Modbus/TCP client context
Returns
Error code

Definition at line 52 of file modbus_client_misc.c.