/**
 * @file hv_mw_PowerManager.h
 * @brief Header file of PowerManager module.
 * 
 * @verbatim
 * ==============================================================================
 *                        ##### How to use #####
 * ==============================================================================
 * (+) At first, use Hv_Mw_Power_GetManagerPtr(...) create PowerManager object.
 * (+) Use Hv_Mw_Power_ManagerInit(...) to initial ChannelManager.
 * (+) Use Hv_Mw_Power_SystemQueueMsgProc(...) will process one Message from SystemQueue. 
 * 
 * @endverbatim
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-26
 */

#ifndef __SDK_MIDDLEWARE_RUNTIME_SYSTEMMANAGER_INC_POWERMANAGER_INC_PWOERMANAGER_H__
#define __SDK_MIDDLEWARE_RUNTIME_SYSTEMMANAGER_INC_POWERMANAGER_INC_PWOERMANAGER_H__

#include "hv_comm_DataType.h"
#include "hv_comm_Define.h"
#include "hv_comm_Event.h"
#include "hv_comm_Timer.h"
#include "hv_mw_StateMachine.h"


typedef struct _PowerManager
{  
    PowerState         enCurrentPowerState;       /*当前power状态机处于的电源状态*/

    PowerOnReasonType  enPowerOnReasonType;       /*记录的从EventHub从mailbox获取的上电原因*/

    HV_TIMER_S*        pstTypeCParseProtectTimer; /*上电typec解析保护定时器*/
    HV_TIMER_S*        pstSignalCheckTimer; /*上电typec解析保护定时器*/

    BOOL               bPowerDeliveryFlag;        /*0-未处于Typec电源充电状态, 1-Typec电源充电状态*/
    BOOL               bSystemInit;               /*记录是否已经走过上电流程*/
    BOOL               bPowerOffFlag;             /*待机或关机标志，1为关机*/
    BOOL               bFakeStandy;               /*充电时的假待机标志，1为假待机*/
    USHORT16           usSignalChecker;           /*待机之前再次检测信号，解决部分设备启动慢导致提示无信号问题*/
}__attribute__((aligned(4)))PowerManager;


VOID Hv_Mw_Power_TimerStart(UINT32 uiHours);

const PowerManager* Hv_Mw_Power_GetManagerPtr(VOID);

Status Hv_Mw_Power_ManagerInit(VOID);

Status Hv_Mw_Power_SystemQueueMsgProc(const SystemEvent* pstSystemEvent);

PowerOnReasonType Hv_Mw_Power_GetPowerOnReasonType(VOID);

Status Hv_Mw_Power_UpdatePowerManagerInfo(PowerManager stPowerManager);

BOOL Hv_Mw_Power_GetPowerManagerFakeStandyFlag(VOID);

Status Hv_Mw_Power_SendPoweroffToPowerManager(VOID);

VOID Hv_Mw_Power_WakeUpFromStandby(VOID);
#endif
