/**
* Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved.
*
* @file ai_ews_monitor.h
*
* @brief this file defines ews monitor function.
*
* The file supports the ews monitor functions by used for app layer.
* The ews monitor monitor Announcement support descriptor and Adaptation field data descriptor, 
* notify special audio monitor af flag to change audio or service
*
*/

#ifndef __AI_EWS_MONITOR_H__
#define __AI_EWS_MONITOR_H__

#include "al_basictypes.h"
#include "mid_siutil_13818.h"
#include "mid_siutil_dvb.h"
#include "db_common.h"

#ifdef __cplusplus
	extern "C"{
#endif

/**
* @brief Define message type of dvb monitor component, usted to notify framwork.
*/
typedef enum
{
	AI_EWS_MONITOR_RECV_ANC, /**< received anountment support descriptor */
	AI_EWS_MONITOR_FIND_AUD, /**< find out need to monitor audio */
	AI_EWS_MONITOR_NON_ANC, /**< none received anountment support descriptor */

	AI_EWS_MONITOR_MAX,
} AI_EWSMon_Message_Type_t;

/**
* @brief call back function prototype for framwork to register.
*/
typedef	al_int32 (* AI_pfEWSMonCallback)(AI_EWSMon_Message_Type_t EventType, al_uint32 u32Param);

al_void AI_EWS_Monitor_OtherPmtCallBK(al_void *pData);

/**
* @brief get EWS announcement support data.
*
* parse sdt service list, get annoumcement data.
*
* @ param pSdtDescr[input] descriptor in sdt service list.
*
* @return AL_SUCCESS  is successful, AL_FAILURE otherwise.
*/
AL_Return_t AI_EWS_Monitor_InSdtEWSDispose(MID_SiutilSdtServiceDescr_t *pSdtDescr);

/**
* @brief find need to monitor audio pid.
*
* find need to monitor audio pid according to anouncement data.
*
* @ param pAudioPid[output] audio pid.
*
* @return AL_SUCCESS  is successful, AL_FAILURE otherwise.
*/
AL_Return_t AI_EWS_Monitor_FindAudioPid(DBPIDInfo_t *pAudioPid);

/**
* @brief ews monitor init function.
*
* @param pfEwsMonCallbks[input] ews monitor notify framwork callback function.
*
* @return AL_SUCCESS if initialization is successful, AL_FAILURE otherwise.
*/
AL_Return_t AI_EWS_Monitor_Init(AI_pfEWSMonCallback pfEwsMonCallbks);

/**
* @brief ews monitor init function.
*
* @param al_void.
*
* @return AL_SUCCESS if uninitialization is successful, AL_FAILURE otherwise.
*/
AL_Return_t AI_EWS_Monitor_Uninit(al_void);


/**
* @brief start mid ews for other service.
*
* start mid ews for find audio pid in other services.
*
* @ param None.
*
* @return AL_SUCCESS  is successful, AL_FAILURE otherwise.
*/
AL_Return_t AI_EWS_Monitor_Start(al_void);

/**
* @brief stop mid ews for other service.
*
* stop mid ews for find audio pid in other services.
*
* @ param bExit[input] exit mid ews task flag.
*
* @return AL_SUCCESS  is successful, AL_FAILURE otherwise.
*/
AL_Return_t AI_EWS_Monitor_Stop(al_bool bExit);

#ifdef __cplusplus
}
#endif
#endif