Agile Modbus  1.1.4
Lightweight modbus protocol stack.
Master Raw Operation Functions
Collaboration diagram for Master Raw Operation Functions:

Functions

int agile_modbus_compute_response_length_from_request (agile_modbus_t *ctx, uint8_t *req)
 Calculate the expected response data length. More...
 
int agile_modbus_serialize_raw_request (agile_modbus_t *ctx, const uint8_t *raw_req, int raw_req_length)
 Pack the original data into a request message. More...
 
int agile_modbus_deserialize_raw_response (agile_modbus_t *ctx, int msg_length)
 parses the original response data More...
 

Detailed Description

Function Documentation

◆ agile_modbus_compute_response_length_from_request()

int agile_modbus_compute_response_length_from_request ( agile_modbus_t ctx,
uint8_t *  req 
)

Calculate the expected response data length.

Note
If it is a special function code, AGILE_MODBUS_MSG_LENGTH_UNDEFINED is returned, but this does not mean an exception. When agile_modbus_check_confirmation calls this API processing, it is considered that the return value of AGILE_MODBUS_MSG_LENGTH_UNDEFINED is also valid.
Parameters
ctxmodbus handle
reqrequest data pointer
Returns
expected response data length

Definition at line 984 of file agile_modbus.c.

Here is the caller graph for this function:

◆ agile_modbus_serialize_raw_request()

int agile_modbus_serialize_raw_request ( agile_modbus_t ctx,
const uint8_t *  raw_req,
int  raw_req_length 
)

Pack the original data into a request message.

Parameters
ctxmodbus handle
raw_reqoriginal message (PDU + Slave address)
raw_req_lengthoriginal message length
Returns
>0: Request data length; Others: Exception

Definition at line 1031 of file agile_modbus.c.

◆ agile_modbus_deserialize_raw_response()

int agile_modbus_deserialize_raw_response ( agile_modbus_t ctx,
int  msg_length 
)

parses the original response data

Parameters
ctxmodbus handle
msg_lengthreceived data length
Returns
>=0: The length of the corresponding function code response object (such as 03 function code, the value represents the number of registers); Others: exception (-1: message error; others: exception code can be obtained according to -128 -$return value)

Definition at line 1073 of file agile_modbus.c.

Here is the call graph for this function: