/************************************************************************** * * Copyright (c) 2024-2024 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file OperationModes.h * * @author (last) Sean * @date (last) 30-Jul-2024 * * @author (original) Sean * @date (original) 30-Jul-2024 * ***************************************************************************/ #ifndef __OP_MODES_H__ #define __OP_MODES_H__ #include "TDCommon.h" #include "TDDefs.h" /** * @defgroup TDOperationModes TDOperationModes * @brief Operation Modes unit. * * @addtogroup TDOperationModes * @{ */ // ********** public definitions ********** #define NO_SUB_STATE 0xFF ///< value for when submode does not have specific substates and is not applicable. /// Payload record structure for op mode broadcast message typedef struct { U32 opMode; ///< Current operating mode U32 subMode; ///< Current sub-mode of current operating mode } OP_MODE_PAYLOAD_T; // ********** public function prototypes ********** void initOperationModes( void ); // Initialize this unit void execOperationModes( void ); // Execute the operation modes state machine (scheduled periodic call) void requestNewOperationMode( TD_OP_MODE_T newMode ); // Request a transition to a new operation mode TD_OP_MODE_T getCurrentOperationMode( void ); // Get the current operation mode TD_OP_MODE_T getPreviousOperationMode( void ); // Get the previous operation mode U32 getCurrentSubMode( void ); // Get the current sub-mode void initiateAlarmAction( ALARM_ACTION_T action ); // Initiate an alarm or alarm recovery action according to current op mode CONFIRMATION_REQUEST_STATUS_T getConfirmationRequestStatus( GENERIC_CONFIRM_ID_T requestID ); // Get the current confirmation request status void setConfirmationRequestStatus( GENERIC_CONFIRM_ID_T requestID, CONFIRMATION_REQUEST_STATUS_T status ); // Set the confirmation request status GENERIC_CONFIRM_ID_T addConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ); // Add a new confirmation request void setCurrentSubState( U32 subState ); // Set the current substate. void setCurrent4thLevelState( U32 state ); // Set the current 4th level state. void sendOperationStatusEvent( void ); // Constructs and sends operation status event //BOOL testSetOperationMode( TD_OP_MODE_T newMode ); // Force transition to a given mode (if allowed) //BOOL testSetOpModePublishIntervalOverride( U32 ms ); /**@}*/ #endif