liblightmodbus 3.0
A lightweight, header-only, hardware-agnostic Modbus RTU/TCP library
Loading...
Searching...
No Matches
slave_func.h File Reference

Slave's functions for parsing requests (header) More...

#include "base.h"
#include "slave.h"
+ Include dependency graph for slave_func.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ModbusErrorInfo modbusParseRequest01020304 (ModbusSlave *status, uint8_t function, const uint8_t *requestPDU, uint8_t requestLength)
 Handles requests 01, 02, 03 and 04 (Read Multiple XX) and generates response.
 
ModbusErrorInfo modbusParseRequest0506 (ModbusSlave *status, uint8_t function, const uint8_t *requestPDU, uint8_t requestLength)
 Handles requests 05 and 06 (Write Single XX) and generates response.
 
ModbusErrorInfo modbusParseRequest1516 (ModbusSlave *status, uint8_t function, const uint8_t *requestPDU, uint8_t requestLength)
 Handles requests 15 and 16 (Write Multiple XX) and generates response.
 
ModbusErrorInfo modbusParseRequest22 (ModbusSlave *status, uint8_t function, const uint8_t *requestPDU, uint8_t requestLength)
 Handles request 22 (Mask Write Register) and generates response.
 

Detailed Description

Slave's functions for parsing requests (header)

Function Documentation

◆ modbusParseRequest01020304()

ModbusErrorInfo modbusParseRequest01020304 ( ModbusSlave status,
uint8_t  function,
const uint8_t *  requestPDU,
uint8_t  requestLength 
)

Handles requests 01, 02, 03 and 04 (Read Multiple XX) and generates response.

Parameters
functionfunction code
requestPDUpointer to the PDU section of the request
requestLengthlength of the PDU section in bytes
Returns
MODBUS_GENERAL_ERROR(ALLOC) on memory allocation error
MODBUS_GENERAL_ERROR(FUNCTION) if function is not 1, 2, 3 or 4
MODBUS_NO_ERROR() on success
+ Here is the call graph for this function:

◆ modbusParseRequest0506()

ModbusErrorInfo modbusParseRequest0506 ( ModbusSlave status,
uint8_t  function,
const uint8_t *  requestPDU,
uint8_t  requestLength 
)

Handles requests 05 and 06 (Write Single XX) and generates response.

Parameters
functionfunction code
requestPDUpointer to the PDU section of the request
requestLengthlength of the PDU section in bytes
Returns
MODBUS_GENERAL_ERROR(ALLOC) on memory allocation error
MODBUS_NO_ERROR() on success
+ Here is the call graph for this function:

◆ modbusParseRequest1516()

ModbusErrorInfo modbusParseRequest1516 ( ModbusSlave status,
uint8_t  function,
const uint8_t *  requestPDU,
uint8_t  requestLength 
)

Handles requests 15 and 16 (Write Multiple XX) and generates response.

Parameters
functionfunction code
requestPDUpointer to the PDU section of the request
requestLengthlength of the PDU section in bytes
Returns
MODBUS_GENERAL_ERROR(ALLOC) on memory allocation error
MODBUS_NO_ERROR() on success
+ Here is the call graph for this function:

◆ modbusParseRequest22()

ModbusErrorInfo modbusParseRequest22 ( ModbusSlave status,
uint8_t  function,
const uint8_t *  requestPDU,
uint8_t  requestLength 
)

Handles request 22 (Mask Write Register) and generates response.

Parameters
functionfunction code
requestPDUpointer to the PDU section of the request
requestLengthlength of the PDU section in bytes
Returns
MODBUS_GENERAL_ERROR(ALLOC) on memory allocation error
MODBUS_NO_ERROR() on success
+ Here is the call graph for this function: