/************************************************************************** * * Copyright (c) 2019-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) Michael Garthwaite * @date (last) 14-Jun-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 * ***************************************************************************/ #ifndef __OP_MODES_H__ #define __OP_MODES_H__ #include "HDCommon.h" #include "HDDefs.h" /** * @defgroup HDOperationModes HDOperationModes * @brief Operation Modes module. * * @addtogroup HDOperationModes * @{ */ // ********** 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; /// Payload structure for generic confirmation request typedef struct { U32 requestID; ///< Generic request ID. U32 requestType; ///< Generic request type. U32 rejectReason; ///< Reject reason. F32 genericPayload1; ///< Generic payload 1. F32 genericPayload2; ///< Generic payload 2. F32 genericPayload3; ///< Generic payload 3. F32 genericPayload4; ///< Generic payload 4. } GENERIC_CONFIRMATION_REQUEST_T; // ********** public function prototypes ********** void initOperationModes( void ); // Initialize this module void execOperationModes( void ); // Execute the operation modes state machine (scheduled periodic call) void requestNewOperationMode( HD_OP_MODE_T newMode ); // Request a transition to a new operation mode HD_OP_MODE_T getCurrentOperationMode( void ); // Get the current operation mode HD_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, F32 payload1, F32 payload2, F32 payload3, F32 payload4 ); // 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_CONFIRMATION_REQUEST_T *request ); // 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( HD_OP_MODE_T newMode ); // Force transition to a given mode (if allowed) BOOL testSetOpModePublishIntervalOverride( U32 ms ); BOOL testResetOpModePublishIntervalOverride( void ); /**@}*/ #endif