/** * Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved. * * @file * * @brief The header file of al time module * */ #ifndef _AI_TIME_H_ #define _AI_TIME_H_ #ifdef __cplusplus extern "C" { #endif #include "al_basictypes.h" /** * @brief Define message type of time component, usted to notify framwork. */ typedef enum { AI_TIME_UPDATE, /**< Received TOT or TDT */ AI_MAX, } AI_Time_Message_Type_t; /** * @brief Call back function prototype for framwork to register. */ typedef al_int32 (* AI_pfTimeCallback)(AI_Time_Message_Type_t EventType, al_uint32 u32Param); /** * @brief Init al time module * * @param none * * @retval AL_SUCCESS means succss. AL_INITIALIZE_ALREADY means already initialised. * AL_FAILURE means failed */ AL_Return_t AI_Time_Init(AI_pfTimeCallback pfTimeCallbks); /** * @brief Terminate al time module * * @param none * * @retval AL_SUCCESS means succss. lised. AL_FAILURE means failed * */ AL_Return_t AI_Time_Term(al_void); /** * @brief This API is used to store next time offset, and it will be applied when time of change is met * * @param usMjd MJD * * @param ucHour Hour * * @param ucMin Minute * * @param ucSec Second * * @retval None */ void AI_Time_UpdateNextTime(al_uint32 usMjd,al_uint8 ucHour, al_uint8 ucMin, al_uint8 ucSec); /** * @brief This API is used to set current system time, it's applied right after this API is called * * @param usMjd MJD * * @param ucHour Hour * * @param ucMin Minute * * @param ucSec Second * * @retval None */ void AI_Time_UpdateTime(al_uint32 usMjd, al_uint8 ucHour, al_uint8 ucMin, al_uint8 ucSec); /** * @brief This API is used to set next time offset value which is used for tot update * * @param iTimeOffset time offset applied to * * @retval None */ void AI_Time_SetNextTimeOffset(al_int32 iTimeOffset); /** * === Time Related With Time-zone and Daylight Saving etc=== */ /** * @brief :This API is used to get time sync status which indicates if TDT or TOT is received * * @param None * * @retval al_true means TOT or TDT is received and al_false otherwise. */ al_bool AI_Time_GetTimeSync(void); /** * @brief This API is used to set time sync status if TDT or TOT is recieved * * @param bTimeSync al_true mean set, and al_false mean unset * * @retval None */ void AI_Time_SetTimeSync(al_bool bTimeSync); /** * @brief :This API is used to get time sync status which indicates if (TDT or TOT is received/get system time by use set )from boot. * System time may vary depending on the stream of time, can vary depending on the manual setting. * @param None * * @retval al_true means TOT or TDT first is received and al_false otherwise.. */ al_bool AI_Time_GetTimeFristPowerON(void); /** * @brief This API is used to set time sync status if (TDT or TOT is recieved/get system time by use set) from boot. *System time may vary depending on the stream of time, can vary depending on the manual setting. * @param bTimeSync al_true mean TOT or TDT first is received from boot , and al_false mean unset * * @retval None */ void AI_Time_SetTimeFristPowerON(al_bool bTimeSync); /** * @brief This API is used to get next time in seconds * * @param None * * @retval Next time second */ al_uint32 AI_Time_GetNextTimeSec(void); /** * @brief This API is used to get nex raw MJD * * @param None * * @retval next raw MJD */ al_uint32 AI_Time_GetNextRawMjd(void); /** * @brief This API is used to set old time offset * * @param iOffset offset defined by time zone * * @retval none */ void AI_Time_SetOldTimeOffset(al_int32 iOffset); /** * @brief This API is used to set time sync status if TDT or TOT is recieved * * @param bTimeSync al_true mean set, and al_false mean unset * * @retval None */ al_int32 AI_Time_GetOldTimeOffset(void); /** * @brief This API is used to record the difference of time changing * in TOD/TDT callback. * * @param iOffset offset get from TOT callback * * @retval none */ al_int32 AI_Time_GetTimeDiff(al_void); al_void AI_Time_SetTimeDiff(al_int32 diff); void AI_Time_SetForceUpdateOffset(al_uint8 bForceUpdate); #ifdef __cplusplus } #endif #endif /* _AI_TIME_H_ */