/*
* Brief:	The header file of MsgHndlr_SensorEvent packet.
* Author:	Jimbo_Zhang@outlook.com
* Date:		2019-9-16
*/

#ifndef __MSG_HNDLR_SENSOR_EVENT_H__
#define __MSG_HNDLR_SENSOR_EVENT_H__

#include "MsgHndlr.h"
//#include "SensorMonitor.h"


/**
 * @var g_SensorEvent_CmdHndlr
 * @brief Sensor event command handler map.
**/
extern const CmdHndlrMap_T  g_SensorEvent_CmdHndlr [];



/*** External Definitions ***/

/*** Global definitions ***/

/* SEL Sensor */
#define EVENT_LOG_AREA_RESET					0x2
#define EVENT_SEL_ALMOST_FULL					0x5
#define EVENT_SEL_IS_FULL					0x4	



/* Watchdog Sensor */
#define EVENT_TIMER_EXPIRED					0x00
#define EVENT_HARD_RESET					0x01
#define EVENT_POWER_DOWN					0x02
#define EVENT_POWER_CYCLE					0x03
#define EVENT_TIMER_INT						0x08


//typedef struct
//{
//    uint8_t                       SensorTypeCode;     /* Sensor Type code      */
//    uint16_t                      SensorReading;      /* Sensor Reading        */
//    uint8_t                       SensorNum;          /* Sensor Number         */	
//    uint16_t                      u16AssertionHistory;/* Assertion tracking    */
//    uint8_t                       u8TmrUse;           /* WDT use               */
//    uint8_t                       u8TmrActions;       /* WDT actions           */
//    uint8_t                       u8Restarted;        /* WDT restarted         */
//    pPDK_SensorInitHook_T       pInitSensor;        /* Init Sensor hook      */
//    pPDK_MonitorHook_T          pPreMonitor;        /* Pre monitor hook      */
//    pPDK_MonitorHook_T          pPostMonitor;       /* Post monitor hook     */
//    pPDK_MonitorExtHook_T       pPostMonitorExt;    /* Post monitor Ext hook */
//    uint8_t                       EntityID;           /* Entity ID             */
//    uint8_t                       EntityInst;         /* Entity Instance       */
//    uint32_t                       FeatureSupport;     /* Feature Supported or not*/
//	uint8_t                       SensorOwnerLun;     /* OwnerLUN            */
//} InternalSensorTbl_T;


///*** Prototype Declaration ***/

///* Functions for SEL Sensor Implementation */
//int SELSensorInit (void*  pSensorInfo);
//int SELMonitor (void* pSenInfo, uint8_t* pReadFlags);
//int SELEventLog (void* pSenInfo, uint8_t* pReadFlags);
//int SELEventLogExt (void* pSenInfo, uint8_t* pReadFlags);

///* Functions for Watchdog Sensor Implementation */
//int WD2SensorInit (void*  pSensorInfo);
//int WD2Monitor (void* pSenInfo, uint8_t* pReadFlags);
//int WD2DummyEventLog (void* pSenInfo, uint8_t* pReadFlags);
//int WD2EventLog (void* pSenInfo, uint8_t* pReadFlags);
//int WD2EventLogExt (void* pSenInfo, uint8_t* pReadFlags);

///* Functions for SSI Compute Blade Operational State Sensor Implementation */
//int OpStateSensorInit (void* pSenInfo);
//int OpStateMonitor (void *pSenInfo, uint8_t* pReadFlags);
//int OpStateEventLog (void *pSenInfo, uint8_t* pReadFlags);
//int OpStateEventLogExt (void* pSenInfo, uint8_t* pReadFlags);

///* Functions for SSI Compute Blade Aggregated Thermal Sensor Implementation */
//int AggregateThermalSensorInit (void* pSenInfo);
//int AggregateThermalMonitor (void *pSenInfo, uint8_t* pReadFlags);
//int AggregateThermalEventLog (void *pSenInfo, uint8_t* pReadFlags);
//int AggregateThermalEventLogExt (void* pSenInfo, uint8_t* pReadFlags);

///* Functions for SSI Compute Blade Aggregated Fault Sensor Implementation */
//int AggregateFaultSensorInit (void* pSenInfo);
//int AggregateFaultMonitor (void *pSenInfo, uint8_t* pReadFlags);
//int AggregateFaultEventLog (void *pSenInfo, uint8_t* pReadFlags);
//int AggregateFaultEventLogExt (void* pSenInfo, uint8_t* pReadFlags);

///* Functions for SSI Compute Blade Service State Sensor Implementation */
//int ServiceStateSensorInit (void* pSenInfo);
//int ServiceStateMonitor (void *pSenInfo, uint8_t* pReadFlags);
//int ServiceStateEventLog (void *pSenInfo, uint8_t* pReadFlags);
//int ServiceStateEventLogExt (void* pSenInfo, uint8_t* pReadFlags);


/*-----------------------------------------
 * GetSELFullPercentage
 *-----------------------------------------*/
extern uint8_t  GetSELFullPercentage(void);
	
/**
 * @brief GetSensorNumFromSensorType.
 * @param  SensorType       - Sensor Type of the sensor.
 * @return SensorInfo if success, 0xFF if error.
**/
extern void* GetSensorInfoFromSensorType(uint8_t SensorType);


///**
// * @brief SetSELSensorReading.
// * @param Res       - Sensor reading to be set.
// * @return 0 if success, -1 if error.
//**/
//extern int  SetSELSensorReading (uint16_t Reading);

///**
// * @brief SetWD2SensorReading.
// * @param Res       - Sensor reading to be set.
// * @return 0 if success, -1 if error.
//**/
//extern int  SetWD2SensorReading (uint16_t Reading, uint8_t u8TmrUse, uint8_t u8TmrActions); 

//extern int  RestartWD2Sensor(int BMCInst);

//extern int  WD2SELLog (uint8_t Action);

#endif /* __MSG_HNDLR_SENSOR_EVENT_H__ */
