al_service.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. /**
  2. * Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved.
  3. *
  4. * @file al_service.h
  5. *
  6. * The interface to init, uninit and manipulate service.
  7. *
  8. * @brief Gives the functionalities for quering as well as manipulating
  9. * the database on service related data.
  10. *
  11. * @note .
  12. */
  13. #ifndef __AL_SERVICE_DBMERGE_H__
  14. #define __AL_SERVICE_DBMERGE_H__
  15. #include "al_basictypes.h"
  16. #include "al_database.h"
  17. #ifdef __cplusplus
  18. extern "C"{
  19. #endif
  20. /****************************************************
  21. * Enumeration definition
  22. ****************************************************//**
  23. * @addtogroup EnumDef Enumeration definition
  24. * @{
  25. ********************************************************/
  26. /**
  27. * @brief Enumeration of DVB service attribute.
  28. */
  29. typedef enum
  30. {
  31. AL_SRV_DATTRIB_FAV1 = 1 << 1, /**< fave 1 bit*/
  32. AL_SRV_DATTRIB_FAV2 = 1 << 2, /**< fave 2 bit*/
  33. AL_SRV_DATTRIB_FAV3 = 1 << 3, /**< fave 3 bit*/
  34. AL_SRV_DATTRIB_FAV4 = 1 << 4, /**< fave 4 bit*/
  35. AL_SRV_DATTRIB_FAV5 = 1 << 5, /**< fave 5 bit */
  36. AL_SRV_DATTRIB_FAV6 = 1 << 6, /**< fave 6 bit*/
  37. AL_SRV_DATTRIB_FAV7 = 1 << 7, /**< fave 7 bit*/
  38. AL_SRV_DATTRIB_FAV8 = 1 << 8, /**< fave 8 bit*/
  39. AL_SRV_DATTRIB_MOVE = 1 << 9, /**< move bit*/
  40. AL_SRV_DATTRIB_SKIP = 1 << 10, /**< skip bit*/
  41. AL_SRV_DATTRIB_DEL = 1 << 11, /**< delete bit*/
  42. AL_SRV_DATTRIB_UNSTABLE = 1 << 12, /**< unstable bit*/
  43. AL_SRV_DATTRIB_LOCK = 1 << 13, /**< parental lock bit*/
  44. AL_SRV_DATTRIB_SCAMBLE = 1 << 14, /**< scramble bit*/
  45. AL_SRV_DATTRIB_NOTRUN = 1 << 15, /**< */
  46. AL_SRV_DATTRIB_TMPSRV = 1 << 16, /**< temp service type */
  47. AL_SRV_DATTRIB_MPEG4TYPE = 1 << 17, /**< mpeg4 type */
  48. AL_SRV_DATTRIB_VIDEOAVC = 1 << 18, /**< avc type */
  49. AL_SRV_DATTRIB_NOTVISIBLE = 1 << 19, /**< not visible */
  50. AL_SRV_DATTRIB_NOTSELETECTABLE = 1 << 20, /**< not selectable type */
  51. AL_SRV_DATTRIB_FREECA = 1 << 21, /**< free CA type */
  52. AL_SRV_DATTRIB_NAMEMODIFIED = 1 << 22, /**< program name modified by user */
  53. AL_SRV_DATTRIB_NITMATCH = 1 <<23, /**< network id matched */
  54. AL_SRV_DATTRIB_ONIDMATCH = 1 << 24, /**< origine network matched */
  55. AL_SRV_DATTRIB_PROGNAMEMATCH = 1 << 25, /**< program name matched */
  56. AL_SRV_DATTRIB_CIPLUSUSED = 1 << 26, /**< only ci plus direct tune and play used */
  57. AL_SRV_DATTRIB_MAX = 1 << 31,
  58. } AL_Serv_EDigitalAttrib_t;
  59. /**
  60. * @brief Enumeration of Analog service attribute.
  61. */
  62. typedef enum
  63. {
  64. AL_SRV_AATTRIB_FAV1 = 1 << 1, /**< fave 1 bit*/
  65. AL_SRV_AATTRIB_FAV2 = 1 << 2, /**< fave 2 bit*/
  66. AL_SRV_AATTRIB_FAV3 = 1 << 3, /**< fave 3 bit*/
  67. AL_SRV_AATTRIB_FAV4 = 1 << 4, /**< fave 4 bit*/
  68. AL_SRV_AATTRIB_FAV5 = 1 << 5, /**< fave 5 bit */
  69. AL_SRV_AATTRIB_FAV6 = 1 << 6, /**< fave 6 bit*/
  70. AL_SRV_AATTRIB_FAV7 = 1 << 7, /**< fave 7 bit*/
  71. AL_SRV_AATTRIB_FAV8 = 1 << 8, /**< fave 8 bit*/
  72. AL_SRV_AATTRIB_INUSE = 1 << 9, /**< inuse bit*/
  73. AL_SRV_AATTRIB_SKIP = 1 << 10, /**< skip bit*/
  74. AL_SRV_AATTRIB_DEL = 1 << 11, /**< delete bit*/
  75. AL_SRV_AATTRIB_LOCK = 1 << 12, /**< parental lock bit*/
  76. AL_SRV_AATTRIB_AFC = 1 << 13, /**< AFC bit*/
  77. AL_SRV_AATTRIB_TVTYPE = 1 << 14,
  78. AL_SRV_AVATTRIB_VALID = 1 << 15,
  79. AL_SRV_AATTRIB_MAX = 1 << 31,
  80. } AL_Serv_EAnalogAttrib_t;
  81. /**
  82. * @brief Enumeration of search field.
  83. */
  84. typedef enum
  85. {
  86. AL_SRV_SEARCHFIELD_TSID = 1 << 1,
  87. AL_SRV_SEARCHFIELD_SRVID = 1 << 2,
  88. AL_SRV_SEARCHFIELD_ORIGNETID = 1 << 3,
  89. AL_SRV_SEARCHFIELD_PROGNO = 1 << 4,
  90. AL_SRV_SEARCHFIELD_FREQ = 1 << 5,
  91. AL_SRV_SEARCHFIELD_SYMRATE = 1 << 6,
  92. AL_SRV_SEARCHFIELD_NETID = 1 << 7,
  93. } AL_Serv_ESearchField_t;
  94. /****************************************************
  95. * Structure definition
  96. ****************************************************//**
  97. * @}
  98. * @defgroup StructDef Structure definition
  99. * @{
  100. ********************************************************/
  101. /**
  102. * @brief Structure of service attribute filter.
  103. */
  104. typedef struct
  105. {
  106. AL_DB_EDBType_t eDBType;
  107. AL_DB_ERecordType_t eRecType;
  108. AL_Serv_EAnalogAttrib_t eAPositive;
  109. AL_Serv_EAnalogAttrib_t eANegative;
  110. AL_Serv_EDigitalAttrib_t eDPositive;
  111. AL_Serv_EDigitalAttrib_t eDNegative;
  112. al_uint8 szProgName[DB_DVB_MAX_CHNAME_LEN]; /**< program name*/
  113. } AL_Serv_AttribFilter_t;
  114. /**
  115. * @brief Structure for searching services.
  116. */
  117. typedef struct
  118. {
  119. AL_DB_EDBType_t eDBType;
  120. AL_DB_ERecordType_t eRecType;
  121. AL_Serv_ESearchField_t eSearchField;
  122. al_uint16 u16ServId;
  123. al_uint16 u16TsId;
  124. al_uint16 u16OrigNetId;
  125. al_uint32 u32ProgNo;
  126. al_uint32 u32Frequency;
  127. al_uint32 u32SymbolRate;
  128. al_uint16 u16NetId;
  129. /**
  130. * zhongbaoxing added this element to consider the attrib
  131. * in AL_Serv_MatchRecBySearchKey @20120204
  132. */
  133. AL_Serv_EDigitalAttrib_t eIncludeAttrib;
  134. } AL_Serv_SearchKey_t;
  135. #ifdef CONFIG_ISDB_SYSTEM
  136. typedef enum
  137. {
  138. ATVDB_AIR = 0,
  139. ATVDB_CABLE,
  140. }APP_AtvDb_Type;
  141. void APP_Database_SwitchATVDB(APP_AtvDb_Type type);
  142. void APP_Database_SetCareIsValid(al_bool care);
  143. #endif
  144. #ifdef CONFIG_SUPPORT_ATV_SCAN_NTSCM_PALM_N
  145. typedef enum
  146. {
  147. ATVDB_AIR = 0,
  148. ATVDB_CABLE,
  149. }APP_AtvDb_Type;
  150. void APP_Database_SwitchATVDB(APP_AtvDb_Type type);
  151. void APP_Database_SetCareIsValid(al_bool care);
  152. #endif
  153. /****************************************************
  154. * API definition - Internal Operation
  155. ****************************************************//**
  156. * @}
  157. * @addtogroup InterAPI Internal Interface
  158. * @{
  159. ********************************************************/
  160. /**
  161. * @brief Initialize service component.
  162. *
  163. * The implementation may perform appropriate service initialisation when this
  164. * call is made, if required.
  165. *
  166. * @note
  167. * 1.This API must be called before any service-related function is called; <br>
  168. * 2.Must be called once successfully, and still return success when called again.
  169. *
  170. * @param eDBType [in]select one or more database to initialize service component.
  171. *
  172. * @return
  173. * #AL_SUCCESS indicates success,
  174. * On failure, #AL_FAILURE is returned.
  175. */
  176. AL_Return_t AI_Service_Init(
  177. AL_DB_EDBType_t eDBType);
  178. /**
  179. * @brief Terminate service commponent.
  180. *
  181. * The implementation may perform appropriate service termination when this
  182. * call is made, if required.
  183. *
  184. * @note
  185. * 1.This API must be called after any service-related function is called, <br>
  186. * 2.Must be called once successfully, and still return success when called again.
  187. *
  188. * @param eDBType [in]Select one or more database to terminate service component.
  189. *
  190. * @return
  191. * #AL_SUCCESS indicates success,
  192. * On failure, #AL_FAILURE is returned.
  193. *
  194. */
  195. AL_Return_t AI_Service_Term(
  196. AL_DB_EDBType_t eDBType);
  197. /****************************************************
  198. * API definition - Service Operation
  199. ****************************************************//**
  200. * @}
  201. * @addtogroup COMAPI Component APIs
  202. * @{
  203. ********************************************************/
  204. /**
  205. * @brief Match service by specified attribute flag.
  206. *
  207. * @note Refers to the prototype #AL_DB_RecordMatchFunc.
  208. *
  209. * @param param [in]Service attributes filter, type: #AL_Serv_AttribFilter_t.
  210. * @param pRec [in]Servie Info.
  211. *
  212. * @return
  213. * #AL_SUCCESS indicates success,
  214. * On failure, #AL_FAILURE is returned.
  215. */
  216. al_bool AL_Serv_MatchRecByAttribute(al_void *param, al_void const*pRec);
  217. /**
  218. * @brief Match service by specified search field.
  219. *
  220. * @note Refers to the prototype #AL_DB_RecordMatchFunc.
  221. *
  222. * @param param [in]Search key, type: #AL_Serv_SearchKey_t.
  223. * @param pRec [in]Service detail.
  224. *
  225. * @return
  226. * #AL_SUCCESS indicates success,
  227. * On failure, #AL_FAILURE is returned.
  228. */
  229. al_bool AL_Serv_MatchRecBySearchKey(al_void *param, al_void const*pRec);
  230. #ifdef SUPPORT_GHANA_LCN
  231. AL_Return_t AL_Serv_BackupUserServsLCN( al_uint8 country );
  232. #endif
  233. AL_Return_t AL_Serv_StoreUserServs(AL_DB_EDBType_t eDBType);
  234. AL_Return_t AL_Serv_RetrieveUserServs(AL_DB_EDBType_t eDBType);
  235. /****************************************************//**
  236. * @}
  237. ********************************************************/
  238. #ifdef __cplusplus
  239. }
  240. #endif /* __cplusplus */
  241. #endif /* __AL_SERVICE_H__ */