/**
* Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved.
*
* @file al_multiplex.h
*
* The interface to init, uninit and manipulate transponder.
*
* @brief Gives the functionalities for quering as well as manipulating
* 		the database on transponder related data.
*
* @note .
*/

#ifndef __AL_MULTIPLEX_DBMERGE_H__
#define __AL_MULTIPLEX_DBMERGE_H__

#include "al_basictypes.h"
#include "al_database.h"


#ifdef __cplusplus
	extern "C"{
#endif

/****************************************************
 * Enumeration definition
 ****************************************************//**
 * @addtogroup EnumDef Enumeration definition
 * @{
 ********************************************************/
/**
* @brief Enumeration of search field.
*/
typedef enum
{
	AL_MULTIPLEX_SEARCHFIELD_NETID = 1 << 1,
	AL_MULTIPLEX_SEARCHFIELD_TSID = 1 << 2,
	AL_MULTIPLEX_SEARCHFIELD_FREQ = 1 << 3,
	AL_MULTIPLEX_SEARCHFIELD_SYMRATE = 1 << 4,
} AL_Multiplex_ESearchField_t;

/****************************************************
 * Structure definition
 ****************************************************//**
 * @}
 * @addtogroup StructDef Structure definition
 * @{
 ********************************************************/
/**
* @brief Structure for searching multiplex.
*/
typedef struct
{
	AL_DB_EDBType_t eDBType;
	AL_Multiplex_ESearchField_t eSearchField;
	al_uint16 u16NetId;
	al_uint16 u16TsId;
	al_uint32 u32Frequency;
	al_uint32 u32SymbolRate;
} AL_Multiplex_SearchKey_t;

/****************************************************
 * API definition - Internal Operation
 ****************************************************//**
 * @}
 * @addtogroup InterAPI Internal Interface
 * @{
 ********************************************************/
/**
* @brief Initialize Multiplex component.
*
* The implementation may perform appropriate Multiplex initialisation when this
* call is made, if required.
*
* @note 
*		1.This API must be called before any multiplex-related function is called; <br>
* 		2.Must be called once successfully, and still return success when called again.
*
* @param eDBType [in]select one or more database to initialize multiplex component.
*
* @return 
* 	#AL_SUCCESS indicates success, 
* 	On failure, #AL_FAILURE is returned.
*/
AL_Return_t AI_Multiplex_Init(
	AL_DB_EDBType_t eDBType);

/**
* @brief Terminate Multiplex commponent.
*
* The implementation may perform appropriate Multiplex termination when this
* call is made, if required.
*
* @note 
* 		1.This API must be called after any multiplex-related function is called, <br>
* 		2.Must be called once successfully, and still return success when called again.
*
* @param eDBType [in]select one or more database to terminate component.
*
* @return 
* 	#AL_SUCCESS indicates success, 
* 	On failure, #AL_FAILURE is returned.
*/
AL_Return_t AI_Multiplex_Term(
	AL_DB_EDBType_t eDBType);

/****************************************************
 * API definition - Multiplex Operation
 ****************************************************//**
 * @}
 * @addtogroup COMAPI  Component APIs
 * @{
 ********************************************************/
/**
* @brief Match multiplex by specified search field.
*
* @note Refers to the prototype #AL_DB_RecordMatchFunc.
*
* @param param		[in]Search key, type: #AL_Multiplex_SearchKey_t.
* @param pRec		[in]Multiplex Info.
*
* @return 
* 	#AL_SUCCESS indicates success, 
* 	On failure, #AL_FAILURE is returned.
*/
al_bool AL_Multiplex_MatchRecBySearchKey(al_void *param, al_void const*pRec);
 
/****************************************************//**
  * @}
  ********************************************************/
#ifdef __cplusplus
	}
#endif /* __cplusplus */

#endif /* __AL_MULTIPLEX_H__ */

