Documentation updated

This commit is contained in:
2025-09-15 09:19:13 -05:00
parent ac20b82496
commit 5a0b02ccdf
41 changed files with 673 additions and 377 deletions

View File

@@ -29,13 +29,14 @@ template<typename T> class ModbusPoint;
* Standby, Running) by delegating actions to a concrete State object.
*/
template<typename T>
class Equipment{
class Equipment {
public:
/**
* @brief Constructs a new Equipment object.
* Initializes the device in the default initial state (Standby).
*/
Equipment();
Equipment(T* server);
/** @brief The main update loop for the equipment, called repeatedly. Delegates to the current state. */
void update();
@@ -53,14 +54,6 @@ public:
* @return The integer ID of the state.
*/
int getState();
/**
* @brief Reads all the points generated for the equipment from the Modbus server to the objects
*/
void readAllPoints();
/**
* @brief Writes all the points generated for the equipment from the objects to the Modbus server
*/
void writeAllPoints();
/**
* @brief Transitions the equipment to a new state.
* Handles exiting the old state, deleting it, and entering the new one.
@@ -82,15 +75,15 @@ public:
/**
* @brief Sets the value of a specific Modbus point.
* @param description The string key for the Modbus point.
* @param value The value to set.
* @param value The value to set. Note: This float may be truncated or cast
* depending on the underlying point's `setValue` implementation.
*/
void setModbusPoint(const std::string& description, float value);
private:
State<T>* _state; /**< @brief Pointer to the current state object. */
std::map<std::string, ModbusPoint<T>*> _points;/**< @brief Map of all Modbus points, keyed by description. */
int _stateId; /**< @brief A simple integer identifier for the current state. */
std::vector<ModbusPoint<T>*> _allPoints; /**< @brief Vector of all Modbus points. */
int _stateId; /**< @brief A simple integer identifier for the current state. */
T* _server;
};
@@ -100,6 +93,10 @@ Equipment<T>::Equipment() : _server(nullptr) {
this->_state->enterState(this);
}
/**
* @brief Constructs a new Equipment object with a server instance.
* @param server Pointer to the Modbus server instance (e.g., ModbusIP, ModbusRTU).
*/
template<typename T>
Equipment<T>::Equipment(T* server)
: _server(server)
@@ -149,7 +146,6 @@ void Equipment<T>::exitState() {
template<typename T>
void Equipment<T>::addModbusPoint(const std::string& description, ModbusPoint<T>* point) {
this->_points[description] = point;
this->_allPoints.push_back(point);
}
/**
@@ -168,8 +164,9 @@ ModbusPoint<T>* Equipment<T>::getModbusPoint(const std::string& description) {
/**
* @brief Sets the value of a specific Modbus point.
* Finds the point by its description and calls its `setValue` method.
* @param description The string key for the Modbus point.
* @param value The value to set.
* @param value The value to set. This float is cast to an int before being passed.
*/
template<typename T>
void Equipment<T>::setModbusPoint(const std::string& description, float value) {