save
This commit is contained in:
59
lib/Core/States/State_Battery.h
Normal file
59
lib/Core/States/State_Battery.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @file State_Battery.h
|
||||
* @brief Defines the BatteryState class for the device.
|
||||
* @author Emmanuel Hernandez Cruz
|
||||
* @date 2025-09-05
|
||||
*
|
||||
* This file contains the definition for the BatteryState, which represents
|
||||
* the state where the equipment is actively performing its primary function.
|
||||
*/
|
||||
#ifndef Battery_State_h
|
||||
#define Battery_State_h
|
||||
|
||||
#include "State.h" // Include the base class header
|
||||
template<typename T> class Equipment;
|
||||
|
||||
/**
|
||||
* @class BatteryState
|
||||
* @brief Represents the active Battery state of the equipment.
|
||||
*
|
||||
* In this state, the equipment is fully operational and performing its main
|
||||
* tasks. It applies a set of predefined strategies to its Modbus points to
|
||||
* simulate active behavior (e.g., fans Battery at various speeds) and waits
|
||||
* for a command to transition to another state.
|
||||
*/
|
||||
template<typename T>
|
||||
class BatteryState : public State<T> {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs a new BatteryState object.
|
||||
* Initializes the strategies for various Modbus points that are active
|
||||
* during the Battery state, such as setting fan speed behaviors.
|
||||
*/
|
||||
BatteryState();
|
||||
|
||||
/**
|
||||
* @brief Executes the Battery state's logic for one update cycle.
|
||||
* This method applies all active strategies (e.g., for fan speeds, temperatures)
|
||||
* and checks for conditions that would trigger a state transition, such as a
|
||||
* command to stop or a fault condition.
|
||||
* @param equipment Pointer to the Equipment instance.
|
||||
* @return A pointer to a new State if a transition should occur, otherwise nullptr.
|
||||
*/
|
||||
State<T>* update(Equipment<T>* equipment) override;
|
||||
/**
|
||||
* @brief Logic to execute once when entering the Battery state.
|
||||
* Typically sets status bits to indicate the equipment is active (e.g.,
|
||||
* setting an "On/Off" point to 1).
|
||||
* @param equipment Pointer to the Equipment instance.
|
||||
*/
|
||||
void enterState(Equipment<T>* equipment) override;
|
||||
/**
|
||||
* @brief Logic to execute once when exiting the Battery state.
|
||||
* Typically resets status bits to indicate the equipment is no longer
|
||||
* active before transitioning to the next state.
|
||||
* @param equipment Pointer to the Equipment instance.
|
||||
*/
|
||||
void exitState(Equipment<T>* equipment) override;
|
||||
};
|
||||
#endif
|
||||
59
lib/Core/States/State_Bypass.h
Normal file
59
lib/Core/States/State_Bypass.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @file State_Bypass.h
|
||||
* @brief Defines the BypassState class for the device.
|
||||
* @author Emmanuel Hernandez Cruz
|
||||
* @date 2025-09-05
|
||||
*
|
||||
* This file contains the definition for the BypassState, which represents
|
||||
* the state where the equipment is actively performing its primary function.
|
||||
*/
|
||||
#ifndef Bypass_State_h
|
||||
#define Bypass_State_h
|
||||
|
||||
#include "State.h" // Include the base class header
|
||||
template<typename T> class Equipment;
|
||||
|
||||
/**
|
||||
* @class BypassState
|
||||
* @brief Represents the active Bypass state of the equipment.
|
||||
*
|
||||
* In this state, the equipment is fully operational and performing its main
|
||||
* tasks. It applies a set of predefined strategies to its Modbus points to
|
||||
* simulate active behavior (e.g., fans Bypass at various speeds) and waits
|
||||
* for a command to transition to another state.
|
||||
*/
|
||||
template<typename T>
|
||||
class BypassState : public State<T> {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructs a new BypassState object.
|
||||
* Initializes the strategies for various Modbus points that are active
|
||||
* during the Bypass state, such as setting fan speed behaviors.
|
||||
*/
|
||||
BypassState();
|
||||
|
||||
/**
|
||||
* @brief Executes the Bypass state's logic for one update cycle.
|
||||
* This method applies all active strategies (e.g., for fan speeds, temperatures)
|
||||
* and checks for conditions that would trigger a state transition, such as a
|
||||
* command to stop or a fault condition.
|
||||
* @param equipment Pointer to the Equipment instance.
|
||||
* @return A pointer to a new State if a transition should occur, otherwise nullptr.
|
||||
*/
|
||||
State<T>* update(Equipment<T>* equipment) override;
|
||||
/**
|
||||
* @brief Logic to execute once when entering the Bypass state.
|
||||
* Typically sets status bits to indicate the equipment is active (e.g.,
|
||||
* setting an "On/Off" point to 1).
|
||||
* @param equipment Pointer to the Equipment instance.
|
||||
*/
|
||||
void enterState(Equipment<T>* equipment) override;
|
||||
/**
|
||||
* @brief Logic to execute once when exiting the Bypass state.
|
||||
* Typically resets status bits to indicate the equipment is no longer
|
||||
* active before transitioning to the next state.
|
||||
* @param equipment Pointer to the Equipment instance.
|
||||
*/
|
||||
void exitState(Equipment<T>* equipment) override;
|
||||
};
|
||||
#endif
|
||||
Reference in New Issue
Block a user