Dynamic Modbus Master
A dynamic wrapper for the modbus master part of esp-modbus written in C++.
 
Loading...
Searching...
No Matches
dynamic_modbus_master::DynamicModbusMaster Class Reference

Modbus Master Controller. More...

#include <DynamicModbusMaster.h>

+ Collaboration diagram for dynamic_modbus_master::DynamicModbusMaster:

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
 

Detailed Description

Modbus Master Controller.

Dynamic Modbus Master Class to manage the initialisation, starting and destroying of the underlying esp_modbus library.

Member Function Documentation

◆ initialise()

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.

Parameters
configThe configuration of the Modbus connection.
Returns
An instance of ModbusError representing the result of the initialization.
Possible Results:

◆ start()

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.

Returns
An instance of ModbusError representing the result of the start process.
Possible Results:

◆ stop()

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.

Returns
An instance of ModbusError representing the result of the stop process.
Possible Results:

Member Data Documentation

◆ m_config

ModbusConfig dynamic_modbus_master::DynamicModbusMaster::m_config
private

◆ m_handle

void* dynamic_modbus_master::DynamicModbusMaster::m_handle
private

The documentation for this class was generated from the following files: