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...
 

Detailed Description

Helper functions for Modbus/TCP client.

License

Copyright (C) 2010-2018 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
1.9.0

Definition in file modbus_client_misc.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   MODBUS_TRACE_LEVEL

Definition at line 30 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 225 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 285 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 389 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 403 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 334 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 49 of file modbus_client_misc.c.