/**
* Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved.
*
* @file al_database.h
*
* The common interface to manipulate database record.
*
* @brief Gives the functionalities for quering as well as manipulating
* the database record.
*
* @note .
*/
#ifndef __AL_DATABASE_DBMERGE_H__
#define __AL_DATABASE_DBMERGE_H__
#include "al_basictypes.h"
#include "cdbi.h"
#include "db_lcn.h"
#ifdef __cplusplus
extern "C"{
#endif
/****************************************************
* Macros definition
****************************************************//**
* @addtogroup MacrosDef Macros definition
* @{
********************************************************/
/**
* @brief Macros of invalid record handle
*
*/
#define AL_DB_INVALIDHDL CDBI_INVALID_HDL
/**
* @brief Get offset of detail field
*/
#define FIELD_OFFSET(type, field) ((al_long)&(((type *)0)->field))
#define FIELD_SIZEOF(type, field) (sizeof(((type *)0)->field))
/****************************************************
* Enumeration definition
****************************************************//**
* @}
* @addtogroup EnumDef Enumeration definition
* @{
********************************************************/
/**
* @brief Enumeration of all the supported database type
*
*/
typedef enum
{
AL_DBTYPE_DVB_ATV = CDBI_DBTYPE_DVB_ATV, /**< Analog channel database */
AL_DBTYPE_DVB_T = CDBI_DBTYPE_DVB_T, /**< DVB Terrestrial channel database */
AL_DBTYPE_DVB_C = CDBI_DBTYPE_DVB_C, /**< DVB Cable channel database */
AL_DBTYPE_DVB_S = CDBI_DBTYPE_DVB_S, /**< DVB Satellite channel database */
#ifdef CONFIG_ISDB_SYSTEM
AL_DBTYPE_DVB_SBTVD = CDBI_DBTYPE_DVB_SBTVD,
#endif
AL_DBTYPE_ATSC = CDBI_DBTYPE_ATSC_NTSC, /**< DVB Satellite channel database */
AL_DBTYPE_DVB_DTVALL = (AL_DBTYPE_DVB_T
| AL_DBTYPE_DVB_C
| AL_DBTYPE_DVB_S
#ifdef CONFIG_ISDB_SYSTEM
| AL_DBTYPE_DVB_SBTVD
#endif
),
AL_DBTYPE_MAX,
} AL_DB_EDBType_t;
/**
* @brief Enumeration of all the supported record type
*
*/
typedef enum
{
AL_RECTYPE_DVBTV = CDBI_RECTYPE_DVBTV, /**< DVB TV record*/
AL_RECTYPE_DVBRADIO = CDBI_RECTYPE_DVBRADIO, /**< DVB Radio record*/
AL_RECTYPE_DVBDATA = CDBI_RECTYPE_DVBDATA, /**< DVB Data service record*/
AL_RECTYPE_DVBSERVICE = CDBI_RECTYPE_DVBSERVICE, /**< DVB TV or Radio or data record*/
AL_RECTYPE_DVBNETWORK = CDBI_RECTYPE_DVBNETWORK , /**< DVB Network record*/
AL_RECTYPE_DVBMULTIPLEX = CDBI_RECTYPE_DVBMULTIPLEX, /**< DVB Mulitplex record*/
AL_RECTYPE_ATVSERVICE = CDBI_RECTYPE_ATVSERVICE, /**< ATV channel record*/
AL_RECTYPE_MAX,
} AL_DB_ERecordType_t;
/**
* @brief Enumeration of record operation request type.
* Used in: #AL_DB_GetRecord().
*/
typedef enum
{
AL_DB_REQ_GETFIRST, /**< Getting first record handle, no need referenced handle.*/
AL_DB_REQ_GETLAST, /**< Getting last record handle, no need referenced handle.*/
AL_DB_REQ_GETNEXT, /**< Getting the next record handle of referenced handle.*/
AL_DB_REQ_GETPREV, /**< Getting the previous record handle of referenced handle.*/
AL_DB_REQ_GETPARENT, /**< Getting the parent record handle of referenced handle.*/
} AL_DB_ERecordRequest_t;
/**
* @brief Enumeration of record move operation type.
* Used in: #AL_DB_MoveRecord().
*/
typedef enum
{
/**
* Move current record to the first place in its database, others go backward one by one.
* No need referenced record.
*/
AL_DB_MV_FIRST,
/**
* Move current record to the last place in its database, others go forward one by one.
* No need referenced record.
*/
AL_DB_MV_LAST,
/**
* Move current record to the front of the referenced service:
* @li if current record locates front of the referenced service, others between them go forward one by one;
* @li if current record locates behind of the referenced service, others between them go backward one by one.
*/
AL_DB_MV_FRONT,
/**
* Move current record to the behind of the referenced service:
* @li if current record locates front of the referenced service, others between them go forward one by one;
* @li if current record locates behind of the referenced service, others between them go backward one by one.
*/
AL_DB_MV_BEHIND,
/**Swap current record and refereced record.*/
AL_DB_MV_SWAP,
} AL_DB_EMoveType_t;
/**
* @brief Enumeration of record sort operation type.
* Used Funcs: #AL_DB_SortRecords().
*/
typedef enum
{
AL_DB_SORTBY_NONE, /**< No sort.*/
AL_DB_SORTBY_NO, /**< Sort by program number.*/
AL_DB_SORTBY_TYPE_INNER_NO, /**< Sort by program number within a service type. */
AL_DB_SORTBY_NAME, /**< Sort by program name.*/
AL_DB_SORTBY_ID, /**< Sort by service ID.*/
AL_DB_SORTBY_FREQ_INNER_NAME, /**< Sort by frequency.*/
AL_DB_SORTBY_FREQ, /**< Sort by frequency(if rec is service, all services within one freq will be list with its position in SDT).*/
AL_DB_SORTBY_FREQ_OCA, /**< same with AL_DB_SORTBY_FREQ, and put the duplicate service to the list tail also.*/
AL_DB_SORTBY_SERVTYPE, /**< Sort by service type.*/
AL_DB_SORTBY_USER, /**< Sort by user defined method.*/
AL_DB_SORT_ALL,
} AL_DB_ESortType_t;
/** Tune type define */
typedef enum
{
AL_DB_MANUAL_SEARCH,
AL_DB_AUTO_SEARCH,
} AL_DBTuneType_t;
/**< DVB private spec type define */
typedef enum
{
AL_DB_DVB_PRISPEC_DBOOK = 0, /**< for UK, except ireland */
AL_DB_DVB_PRISPEC_ZBOOK, /**< Italy */
AL_DB_DVB_PRISPEC_AUS, /**< Australia */
AL_DB_DVB_PRISPEC_NORDIG, /**< Nordig */
AL_DB_DVB_PRISPEC_EBOOK, /**< pan Europe */
AL_DB_DVB_PRISPEC_SBTVD, /**< Brazil */
AL_DB_DVB_PRISPEC_OCA, /**< (Spain)Engel OCA need to save all Dupli service */
} AL_DBPrivateSpec_t;
/****************************************************
* Structure definition
****************************************************//**
* @}
* @addtogroup StructDef Structure definition
* @{
********************************************************/
/**
* @brief Structure of record handle
*/
typedef CDBIHandle_t AL_RecHandle_t;
/**
* @brief Structure of record handle
*/
typedef CDBICapability_t AL_DBCapability_t;
/**
* @brief Union of service detail.
*/
typedef union
{
SADBServInfo_t stAnalogServ;
STDBServInfo_t stDVBTServ;
SCDBServInfo_t stDVBCServ;
SDBServInfo_t stDVBSServ;
#ifdef CONFIG_ISDB_SYSTEM
SSBTVDDBServInfo_t stSBTVDServ;
#endif
} AL_ServiceDetail_t;
/**
* @brief Union of multiplex detail.
*/
typedef union
{
STDBMultiplexInfo_t stDVBTMultiplex;
SCDBMultiplexInfo_t stDVBCMultiplex;
SDBMultiplexInfo_t stDVBSMultiplex;
#ifdef CONFIG_ISDB_SYSTEM
SSBTVDDBMultiplexInfo_t stSBTVDMultiplex;
#endif
} AL_MultiplexDetail_t;
/**
* @brief Union of network detail.
*/
typedef union
{
STDBNetworkInfo_t stDVBTNetwork;
SCDBNetworkInfo_t stDVBCNetwork;
SDBNetworkInfo_t stDVBSNetwork;
#ifdef CONFIG_ISDB_SYSTEM
SSBTVDDBNetworkInfo_t stSBTVDNetwork;
#endif
} AL_NetworkDetail_t;
/**
* @brief Union record detail.
*/
typedef union
{
AL_ServiceDetail_t stServInfo;
AL_MultiplexDetail_t stTPInfo;
AL_NetworkDetail_t stNetInfo;
} AL_RecordDetail_t;
/**
* @brief User defined reset function to set default value after reset, refers to the usage of its prototype.
*/
typedef CDBISetRec2DefVal_t AL_DB_ResetDefValFunc;
/**
* @brief User defined match function, refers to the usage of its prototype.
*/
typedef fpCDBIRecMatch AL_DB_RecordMatchFunc;
/**
* @brief User defined record compare function, refers to the usage of its prototype.
*/
typedef fpCDBIRecUserCmp AL_DB_RecordUserCmp;
/**
* @brief User defined group of match function for upper layer
*/
typedef struct
{
AL_DB_RecordMatchFunc pNetMatch; /**< Network Match function callback */
AL_DB_RecordMatchFunc pMulitplexMatch; /**< Multiplex Match function callback */
AL_DB_RecordMatchFunc pServMatch; /**< Service Match function callback */
} AL_DB_RecDupliChkFunc_t;
/**
* @brief start address for database in nonvolatile device.
*/
typedef struct
{
pfNVMRead fNVMRead;
pfNVMWrite fNVMWrite;
} AL_DB_Init_t;
/**
* @brief Prototype define for create channel list with special attribute quickly
*/
typedef struct
{
AL_DB_EDBType_t enDBType;
AL_DB_ERecordType_t enRecType;
BOOL bUsrSort; /* sort method */
union
{
AL_DB_ESortType_t enSortType;
AL_DB_RecordUserCmp pUserCmpCB;
};
AL_DB_RecordMatchFunc fpMatchFunc; /* record match function */
void *pMatchParam;
} AL_DB_SearchParam_t;
/****************************************************
* API definition - Component Operation
****************************************************//**
* @}
* @addtogroup COMAPI Component APIs
* @{
********************************************************/
/**
* @brief Initialise database module
*
* @note This API must be called before any other APIs of this module
*
* @param pstInitParam [in] specify the start address of the database in
* nonvolatile device, such as flash, EEPROM
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_Init(const AL_DB_Init_t *pstInitParam);
/**
* @brief Synchronize data to physical storage .
*
* @note This API must be called after initialize function is called,
* and must be called before terminate function is called.
*
* @param eDBType [in]Database type.
* @param bIsBlocking [in]If set al_true, this API will not return until saving
* data to flash is finished;if set al_false, no need to wait.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_Sync(AL_DB_EDBType_t eDBType, al_bool bIsBlocking);
/**
* @brief Synchronize data to physical storage .
*
* @note This API must be called after initialize function is called,
* and must be called before terminate function is called.
*
* @param eDBType [in]Database type.
* @param pstMatchFuc [in]pionter to Match function for each record type
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_RegisterDupliChkFunc(AL_DB_EDBType_t eDBType, const AL_DB_RecDupliChkFunc_t *pstMatchFuc);
/****************************************************//**
* @brief Register callback to process duplicate service
*
* @param pFunc[in] Function Pointer to get the process strategy when duplicate services exist.
* @param peTuneType[in] Current tune type.
* @param pePriSpec[in] Private spec.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
********************************************************/
AL_Return_t AL_DB_RegisterDupliRecStrategy(fpCDBIGetDupliRecStrategy pFunc, AL_DBTuneType_t *peTuneType, AL_DBPrivateSpec_t *pePriSpec);
/**
* @brief Register Reset default value function
*
* @note Only used for ATV service at now.
*
* @param eDBType [in]Database type.
* @param pfResetFuc [in]pionter to Reset function
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_RegisterResetDefValFunc(AL_DB_ResetDefValFunc *pfResetFuc);
/**
* @brief Load deafault data setting to database.
*
* @note This API must be called after initialize function is called,
* and must be called before terminate function is called.
*
* @param eDBType [in]Database type.
* @param bIsBlocking [in]If set al_true, this API will not return until saving
* data to flash is finished;if set al_false, no need to wait.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_SetDefault(AL_DB_EDBType_t eDBType, al_bool bIsBlocking);
/**
* @brief Reset database to empty.
*
* @note This API must be called after initialize function is called,
* and must be called before terminate function is called.
*
* @param eDBType [in]Database type.
* @param bIsBlocking [in]If set al_true, this API will not return until saving
* data to flash is finished;if set al_false, no need to wait.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_Reset(AL_DB_EDBType_t eDBType, al_bool bIsBlocking);
/**
* @brief Get every component capabitlity of databse
*
* @param eDBType [in]Record handle.
* @param pstCapability [in]Offset of field item in record detail.
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_GetCapability(
AL_DB_EDBType_t eDBType,
AL_DBCapability_t *pstCapability);
/**
* @brief Add new record to database.
*
* @param eDBType [in]Database type.
* @param eRecType [in]Record type.
* @param pstRecDetail [in]Added record detail, depend on practical detail type.
* @param hParentHdl [in]If adding service record, the param must be multiplex handle;
* if adding multiplex record, the param must be network handle
* others, it will be ignored and assigned default #AL_DB_INVALIDHDL.
* @param phRecHdl [out]Record handle, return #AL_DB_INVALIDHDL when adding failed.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_AddRecord(
AL_DB_EDBType_t eDBType,
AL_DB_ERecordType_t eRecType,
const al_void * pstRecDetail,
AL_RecHandle_t hParentHdl,
AL_RecHandle_t *phRecHdl);
/**
* @brief Sort record logical sequence by specified command.
*
* @note This operation can not influence record physical sequence.
*
* @param eDBType [in]Databse type.
* @param eDBType [in]Record type.
* @param eSortCmd [in]Specify sort command type.
* @param bAscending [in]al_true indecates sort by ascending,
* and sort by descending will be set al_false.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_SortRecords(
AL_DB_EDBType_t eDBType,
AL_DB_ERecordType_t eRecType,
AL_DB_ESortType_t eSortCmd,
al_bool bAscending);
/**
* @brief Sort record logical sequence by specified sorting method provide by user.
*
* @note This operation can not influence record physical sequence.
*
* @param eDBType [in]Databse type.
* @param eDBType [in]Record type.
* @param fRecUserCmpCB [in]Specify sort method provided by user.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_SortRecordsByUser(
AL_DB_EDBType_t eDBType,
AL_DB_ERecordType_t eRecType,
AL_DB_RecordUserCmp fRecUserCmpCB);
/**
* @brief Get children record number by its parent handle.
*
* @param hParentHdl [in]Parent record handle.
* @param puiRecCnt [out]Record number.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_GetChildRecordNum(
AL_RecHandle_t hParentHdl,
al_uint32 *puiRecCnt);
/**
* @brief Get record handle without deleted record.
*
* @param eRequetCmd [in]Getting request command.
* @param eDBType [in]Database type.
* @param eRecType [in]Record type.
* @param phRecHdl [in/out]Record handle.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_GetRecord(
AL_DB_ERecordRequest_t eRequetCmd,
AL_DB_EDBType_t eDBType,
AL_DB_ERecordType_t eRecType,
AL_RecHandle_t *phRecHdl);
/****************************************************//**
* @brief Get record handle by Index.
*
* @param eDBType [in]Database type.
* @param eRecType [in]Record type.
* @param bIndex [in]Record Index.
* @param phRecHdl [out]Record handle.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
********************************************************/
AL_Return_t AL_DB_GetRecordByIndex(AL_DB_EDBType_t eDBType, AL_DB_ERecordType_t eRecType,
al_uint8 bIndex, AL_RecHandle_t *phRecHdl);
/****************************************************//**
* @brief Get sorted record list.
*
* @note If wanna get service list, it will get all type services.
*
* @param eDBType [in]Databse type.
* @param eRecType [in]Record type.
* @param pRecList [in]Record list.
* @param pRecNum [in]Number of records in list.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
********************************************************/
AL_Return_t AL_DB_GetRecordList (
AL_DB_EDBType_t eDBType,
AL_DB_ERecordType_t eRecType,
AL_RecHandle_t *pRecList,
al_uint16 *pRecNum);
/**
* @brief Get record handle by its parent handle.
*
* @note
* If the input record is invalid record, will return the first child handle;@n
* and if the input record is one valid child record, will return the next child handle.
* @param hParentHdl [in]Parent record handle.
* @param phRecHdl [in/out]Record handle.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_GetChildRecord(
AL_RecHandle_t hParentHdl,
AL_RecHandle_t *phRecHdl);
/**
* @brief check whether has child record.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_HasChildRecord(AL_RecHandle_t hRecHdl, al_bool *bHasChild, al_bool *bHasGrandChild);
/**
* @brief Get record handle by user-defined matching function.
*
* @param fRecMatch [in]Record matching function, implemented by user.
* @param pMatchParam [in]Needed parameters of match function.
* @param eDBType [in]Database tuye.
* @param eRecType [in]Record type.
* @param phRecHdl [out]The first matched record which behind of the referenced record;
* if hRefHdl = AL_DB_INVALIDHDL, indicates getting first matched record in database.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_GetMatchedRecord(
AL_DB_RecordMatchFunc fRecMatch,
al_void *pMatchParam,
AL_DB_EDBType_t eDBType,
AL_DB_ERecordType_t eRecType,
AL_DB_ERecordRequest_t eReqCmd,
AL_RecHandle_t *phRecHdl);
/**
* @brief Get database type and record type of record.
*
* @param hRecHdl [in]Record handle.
* @param peDBType [out]Database type.
* @param peRecType [out]Record type.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_GetRecordType(
AL_RecHandle_t hRecHdl,
AL_DB_EDBType_t *peDBType,
AL_DB_ERecordType_t *peRecType);
/**
* @brief Move record to another place on logical sequence (in sorted list).
*
* @note
* 1.Move record, the rest of records will be moved;
* 2.Swap record, the rest of records won't be moved.
*
* @param eMoveCmd [in]Specify move command, contain move and swap commands.
* @param hCurrRecHdl [in]Current rec handle.
* @param hRefRecHdl [in]Referenced service handle,
* its using depends on move command.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_MoveRecord(
AL_DB_EMoveType_t eMoveCmd,
AL_RecHandle_t hCurrRecHdl,
AL_RecHandle_t hRefRecHdl);
/**
* @brief Remove record from physical storage.
*
* @note
* 1.When remove one multiplex, all services belonged it will be removed;
* 2.when remove one network, all muliplexes and services belonged it will be removed.
*
* @param hRecHdl [in]Record handle.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_RemoveRecord(AL_RecHandle_t hRecHdl);
/**
* @brief Get total number of records, without deleted records.
*
* @note
* 1.For Analog service, get number of all inused services;
* 2.For DVB service, get number of all undeleted services.
*
* @param eDBType [in]Databse type.
* @param eRecType [in]Record type.
* @param pu32Num [out]Total number of records.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_GetRecordsTotalNum(
AL_DB_EDBType_t eDBType,
AL_DB_ERecordType_t eRecType,
al_uint32 *pu32Num);
/****************************************************//**
* @brief Get searched service list which match the searching condition.
*
* @param fRecMatch [in]Match function, refers to prototype #AL_DB_RecordMatchFunc.
* @param pMatchParam [in]Parameter provided for match function, the type indicated by user.
* @param eDBType [in]Database type.
* @param eRecType [in]Record type.
* @param hRecHdl [in]Record handle.
* @param u32NeedNum [in]Specify upper limitation of searched records number.
* @param u32SearchOffset [in]Specify passed records number,
* and the rest of matched records will be add to the list.
* @param pu32TotalNum [out]Total number of matched records.
* @param pu32GotNum [out]The number of gotten records.
* @param pstRecList [out]Searched records list.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*
********************************************************/
AL_Return_t AL_DB_SearchChildRecords(
AL_DB_RecordMatchFunc fRecMatch,
al_void *pMatchParam,
AL_DB_EDBType_t eDBType,
AL_DB_ERecordType_t eRecType,
AL_RecHandle_t hRecHdl,
al_uint32 u32NeedNum,
al_uint32 u32SearchOffset,
al_uint32 *pu32TotalNum,
al_uint32 *pu32GotNum,
AL_RecHandle_t *pstRecList);
/**
* @brief Get searched service list which match the searching condition.
*
* @param fRecMatch [in]Match function, refers to prototype #AL_DB_RecordMatchFunc.
* @param pMatchParam [in]Parameter provided for match function, the type indicated by user.
* @param eDBType [in]Database type.
* @param eRecType [in]Record type.
* @param u32NeedNum [in]Specify upper limitation of searched records number.
* @param u32SearchOffset [in]Specify passed records number,
* and the rest of matched records will be add to the list.
* @param pu32TotalNum [out]Total number of matched records.
* @param pu32GotNum [out]The number of gotten records.
* @param pstRecList [out]Searched records list.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_SearchRecords(
AL_DB_RecordMatchFunc fRecMatch,
al_void *pMatchParam,
AL_DB_EDBType_t eDBType,
AL_DB_ERecordType_t eRecType,
al_uint32 u32NeedNum,
al_uint32 u32SearchOffset,
al_uint32 *pu32TotalNum,
al_uint32 *pu32GotNum,
AL_RecHandle_t *pstRecList);
AL_Return_t AL_DB_SearchRecordsExt(AL_DB_RecordMatchFunc fRecMatch, al_void *pMatchParam,
AL_DB_EDBType_t eDBType, AL_DB_ERecordType_t eRecType, al_uint32 uiSkipNum, AL_RecHandle_t *pstRecList, al_uint32 *puiRecNum);
/**
* @brief Querys record detail.
*
* @param hRecHdl [in]Record handle.
* @param pItemData [out]Record detail data.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_QueryDetail(AL_RecHandle_t hRecHdl, al_void *pDetailData);
/**
* @brief Update record detail.
*
* @param hRecHdl [in]Record handle.
* @param pItemData [in]Record detail data.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_UpdateDetail(AL_RecHandle_t hRecHdl, const al_void *pDetailData);
/**
* @brief Query any one field of detail.
*
* @param hRecHdl [in]Record handle.
* @param u32ItemOffset [in]Offset of field item in record detail.
* @param u16ItemBytes [in]Byte length of field data.
* @param pItemData [out]Specified detail field data.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_QueryDetailField(
AL_RecHandle_t hRecHdl,
al_uint16 u16ItemOffset,
al_uint16 u16ItemBytes,
al_void *pItemData);
/**
* @brief Query any one field of detail by field name.
*
* @param hRecHdl [in]Record handle.
* @param pItemName [in]Field name, defined in detail structure.
* @param pItemData [in]Specified detail field data.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_QueryDetailFieldByName(
AL_RecHandle_t hRecHdl,
al_uint8 *pItemName,
al_void *pItemData);
/**
* @brief Update any one field of detail.
*
* @param hRecHdl [in]Record handle.
* @param u32ItemOffset [in]Offset of field item in record detail.
* @param u16ItemBytes [in]Byte length of field data.
* @param pItemData [in]Specified detail field data.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_UpdateDetailField(
AL_RecHandle_t hRecHdl,
al_uint16 u16ItemOffset,
al_uint16 u16ItemBytes,
al_void *pItemData);
/**
* @brief Update any one field of detail by field name.
*
* @param hRecHdl [in]Record handle.
* @param pItemName [in]Field name, defined in detail structure.
* @param pItemData [in]Specified detail field data.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
*/
AL_Return_t AL_DB_UpdateDetailFieldByName(
AL_RecHandle_t hRecHdl,
al_uint8 *pItemName,
al_void *pItemData);
/****************************************************//**
* @brief check whether has valid services.
*
* @param eDBType [in]Database type.
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
********************************************************/
al_bool AL_DB_HasVisibleService(AL_DB_EDBType_t eDBType);
/****************************************************//**
* @brief Get channel list with special attributs(like scramble channel list, free channel list etc.)
*
* @param pSortParam sort parameters
*
* @param phRec input buffer
*
* @param uiRecNum buffer size
*
* @retval DB_SUCCESS means succss. DB_FAILURE means failed.
********************************************************/
AL_Return_t AL_DB_GetRecSortListWithGivenParams(
AL_DB_SearchParam_t *pSortParam, AL_RecHandle_t **phRec, UINT32 *puiRecNum);
/****************************************************//**
* @brief check record handle is valid
*
* @param hRecHdl [in]record handle
*
* @return
* #AL_SUCCESS indicates success,
* On failure, #AL_FAILURE is returned.
********************************************************/
al_bool AL_DB_CheckRecValid(AL_RecHandle_t hRecHdl);
/****************************************************//**
* @}
********************************************************/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __AL_DATABASE_COMMON_H__*/