Modbus Master Controller. More...
#include <DynamicModbusMaster.h>
Public Member Functions | |
ModbusError | initialise (ModbusConfig config) |
Initialize the Modbus Master controller and set up the communication parameters. | |
ModbusError | start () |
Start the Modbus communication stack. | |
ModbusError | stop () |
Stop the Modbus communication stack. | |
Private Attributes | |
ModbusConfig | m_config |
void * | m_handle |
Modbus Master Controller.
Dynamic Modbus Master Class to manage the initialisation, starting and destroying of the underlying esp_modbus library.
ModbusError dynamic_modbus_master::DynamicModbusMaster::initialise | ( | ModbusConfig | config | ) |
Initialize the Modbus Master controller and set up the communication parameters.
This function initializes the Modbus Master controller and sets up the communication parameters for the Modbus connection.
config | The configuration of the Modbus connection. |
ModbusError dynamic_modbus_master::DynamicModbusMaster::start | ( | ) |
Start the Modbus communication stack.
This function starts the Modbus communication stack by calling the mbc_master_start()
function. If an error occurs during the start process, an error log is generated using the ESP_LOGE
macro with the tag "DynamicModbusMaster" and the error name is printed using the esp_err_to_name()
function. The function returns ModbusError::INVALID_ARG
to indicate an invalid argument error. If the start process is successful, the function returns ModbusError::OK
.
ModbusError dynamic_modbus_master::DynamicModbusMaster::stop | ( | ) |
Stop the Modbus communication stack.
This function stops the Modbus communication stack by calling the mbc_master_destroy()
function. If an error occurs during the stop process, an error log is generated using the ESP_LOGE
macro with the tag "DynamicModbusMaster" and the error name is printed using the esp_err_to_name()
function. The function returns ModbusError::INVALID_STATE
to indicate an invalid state error. If the stop process is successful, the function returns ModbusError::OK
.
|
private |
|
private |