123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870 |
- /**
- * 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.<br>
- * <b>Used in: </b>#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.<br>
- * <b>Used in: </b>#AL_DB_MoveRecord().
- */
- typedef enum
- {
- /**
- * Move current record to the first place in its database, others go backward one by one.<br>
- * <b>No need referenced record.</b>
- */
- AL_DB_MV_FIRST,
- /**
- * Move current record to the last place in its database, others go forward one by one.<br>
- * <b>No need referenced record.</b>
- */
- 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.<br>
- * <b>Used Funcs: </b>#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;<br>
- * 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__*/
|