al_event.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. /*****************************************************************************
  2. ** al_event.h: AL Layer Event Header File
  3. **
  4. ** Description: Gives the functionalities for quering as well as manipulating
  5. ** the events data related to certail service.
  6. **
  7. ** Copyright(c) 2011 Sunmedia Technologies - All Rights Reserved
  8. **
  9. ** Author : anlzhao
  10. **
  11. ** $Id: al_event.h 1910 2011-01-24 05:05:35Z anlzhao_c1 $
  12. *****************************************************************************/
  13. #ifndef __AL_EVENT_H__
  14. #define __AL_EVENT_H__
  15. #include "al_basictypes.h"
  16. #if defined(CONFIG_DTV_SUPPORT) || defined(CONFIG_ATV_SUPPORT)
  17. #include "al_database.h"
  18. #endif
  19. #ifdef CONFIG_DTV_SUPPORT
  20. #include "dvb_epg.h"
  21. #endif
  22. #include "al_time.h"
  23. /*
  24. ** Marco define
  25. */
  26. #ifdef __cplusplus
  27. extern "C"{
  28. #endif
  29. #ifdef CONFIG_DTV_SUPPORT
  30. #define AL_EVENT_SHORTNAME_LEN (MAX_DATA_SIZE) /*!< \brief text length of event_name_char */
  31. #define AL_EVENT_TEXT_LEN (MAX_DATA_SIZE) /*!< \brief text length short event text_char */
  32. #define AL_EVENT_EXTEND_LEN (MAX_DATA_SIZE) /*!< \brief text length of extended event text_char */
  33. #define AL_EVENT_MAX_EVENT_DES (EPG_EXTEND_EVENT_DESC_NUM)
  34. #define ISO_639_LANGUAGE_CODE (4)
  35. /* Prototype of AL_Event_t */
  36. typedef MID_EPG_EventHandle_t AL_Event_t;
  37. /**
  38. * \brief event date and time discription
  39. */
  40. typedef struct _AL_Event_Time_Descript_t
  41. {
  42. AL_Time_t stStartTime; /*!< \brief start date */
  43. AL_Time_t stEndTime; /*!< \brief end time */
  44. } AL_Event_Time_Descript_t;
  45. /* Events details */
  46. typedef struct
  47. {
  48. AL_Event_t event_hdl;
  49. AL_Event_Time_Descript_t event_time;
  50. AL_Event_Time_Descript_t event_utc_time;
  51. al_uint8 event_name_length;
  52. al_uint8 event_text_length;
  53. al_uint8 event_rating;
  54. al_uint8 event_name[AL_EVENT_SHORTNAME_LEN];
  55. al_uint8 event_text[AL_EVENT_TEXT_LEN];
  56. al_uint8 event_langcode[ISO_639_LANGUAGE_CODE];
  57. al_uint16 event_Id;
  58. al_uint32 event_offset;
  59. al_uint32 extend_num;
  60. al_uint8 content_classify; //zhongbaoxing added for NorDig Test 08:42 @20120808
  61. } AL_Event_Details_t;
  62. /* extend event Events */
  63. typedef struct
  64. {
  65. al_uint8 item_description[AL_EVENT_EXTEND_LEN];
  66. al_uint8 extend_text[AL_EVENT_EXTEND_LEN];
  67. al_uint8 event_langcode[ISO_639_LANGUAGE_CODE];
  68. al_uint8 extend_text_exsit :4;
  69. al_uint8 item_description_exsit :4;
  70. al_uint8 item_description_length;
  71. al_uint8 extend_text_length;
  72. } AL_Event_Desciption_t;
  73. #endif
  74. /***************************************************************************
  75. ** FUNCTION : AL_Event_SetCountryCode
  76. **
  77. ** DESCRIPTION :
  78. ** Set country code.
  79. **
  80. ** PARAMETERS :
  81. ** countrycode -country code
  82. **
  83. ** RETURN VALUES : AL_Return_t
  84. ***************************************************************************/
  85. AL_Return_t AL_Event_SetCountryCode(al_int8 *countrycode);
  86. /***************************************************************************
  87. ** FUNCTION : AL_Event_SetDTGSupport
  88. **
  89. ** DESCRIPTION :
  90. ** set DTG support flag. This flag may used during parsing EIT process
  91. **
  92. ** PARAMETERS :
  93. ** flag -al_true means set, al_false means unset.
  94. **
  95. ** RETURN VALUES : AL_Return_t
  96. ***************************************************************************/
  97. AL_Return_t AL_Event_SetDTGSupport(al_bool flag);
  98. /***************************************************************************
  99. ** FUNCTION : AL_Event_SetDTGSupport
  100. **
  101. ** DESCRIPTION :
  102. ** set DTG support flag. This flag may used during parsing EIT process
  103. **
  104. ** PARAMETERS :
  105. ** flag - al_true means set, al_false means unset.
  106. **
  107. ** RETURN VALUES : AL_Return_t
  108. ***************************************************************************/
  109. al_bool AL_Event_GetEDTGSupport(al_void);
  110. /***************************************************************************
  111. ** FUNCTION : AL_Event_SetPreferLanguageCode
  112. **
  113. ** DESCRIPTION :
  114. ** Set prefer language code for event module. this may be useful for event
  115. ** to provide the event with prefer language code.
  116. ** PARAMETERS :
  117. ** langptr1 - prefer language code
  118. ** langptr2 - prefer language code
  119. **
  120. ** RETURN VALUES : AL_Return_t
  121. ***************************************************************************/
  122. AL_Return_t AL_Event_SetPreferLanguageCode(void * langptr1, void * langptr2);
  123. #if defined(CONFIG_DTV_SUPPORT) && !defined(CONFIG_USE_COMPRESSED_EPGMODULE)
  124. /***************************************************************************
  125. ** FUNCTION : AL_Event_GetEventRatingByHdl
  126. **
  127. ** DESCRIPTION :
  128. ** API fills details of First 'n' events of given service.
  129. **
  130. ** PARAMETERS :
  131. ** eventhdl - Events handle
  132. ** Rating - Event parental rating
  133. ** RETURN VALUES : AL_Return_t
  134. ***************************************************************************/
  135. AL_Return_t AL_Event_GetEventRatingByHdl(AL_Event_t eventhdl, al_uint8 *pRating);
  136. #endif
  137. #ifdef CONFIG_DTV_SUPPORT
  138. /***************************************************************************
  139. ** FUNCTION : AL_Event_Stop
  140. **
  141. ** DESCRIPTION :
  142. ** Stop the event component, collecting of EIT stops.
  143. **
  144. ** PARAMETERS :
  145. ** DBType: Specify database on which to stop.
  146. ** is_exit_task : al_true: exit EPG task, else no exit
  147. **
  148. ** RETURN VALUES : AL_Return_t
  149. ***************************************************************************/
  150. AL_Return_t AL_Event_Stop(AL_DB_EDBType_t DBType, al_bool is_exit_task);
  151. /***************************************************************************
  152. ** FUNCTION : AL_Event_LockChannels
  153. **
  154. ** DESCRIPTION :
  155. ** start channels by given network id, ts id and serivce.
  156. **
  157. ** PARAMETERS :
  158. ** DBType -Specify database on which to stop.
  159. ** net_id - network id
  160. ** trans_id -ts id
  161. ** serv_id - service id
  162. ** chan_num - tells how many channels to open simultaneously
  163. ** focus_index- tells which channel has higher priority. it's useful when cache
  164. ** is not enough, events with lower priority will be replaced by higher ones.
  165. ** RETURN VALUES : AL_Return_t
  166. ***************************************************************************/
  167. AL_Return_t AL_Event_LockChannels(AL_DB_EDBType_t DBType, al_uint16 *net_id,
  168. al_uint16 *trans_id, al_uint16 *serv_id, al_uint8 chan_num, al_int32 focus_index);
  169. /***************************************************************************
  170. ** FUNCTION : AL_Event_UnLockChannels
  171. **
  172. ** DESCRIPTION :
  173. ** unlock channels by given network id, ts id and serivce. this API will
  174. ** clear cache that pre-occupied by the channel. Note: Set both
  175. ** net_id 0XFF and trans_id 0xFF for clear entire cache.
  176. **
  177. ** PARAMETERS :
  178. ** DBType -Specify database on which to stop.
  179. ** net_id - network id. clear entire cache if set 0xFF
  180. ** trans_id -ts id. clear entire cache if set 0xFF
  181. ** serv_id - service id
  182. **
  183. ** RETURN VALUES : AL_Return_t
  184. ***************************************************************************/
  185. AL_Return_t AL_Event_UnLockChannels(AL_DB_EDBType_t DBType, al_uint16 net_id,
  186. al_uint16 trans_id, al_uint16 serv_id);
  187. /***************************************************************************
  188. ** FUNCTION : AL_Event_GetEventHdlByStartTime
  189. **
  190. ** DESCRIPTION :
  191. ** API fills details of First 'n' events of given service.
  192. **
  193. ** PARAMETERS :
  194. ** DBType - Database type(DVB_T/DVB_C etc)
  195. ** net_id - Network ID
  196. ** trans_id- Transport Stream ID
  197. ** serv_id - Service ID
  198. ** event_start_time - the start time of the event
  199. ** duration - duration in minutes
  200. ** events_req - Events required
  201. ** eventhdl_list - Event handles to be filled into
  202. ** events_fnd - Events handle found
  203. **
  204. ** RETURN VALUES : AL_Return_t
  205. ***************************************************************************/
  206. AL_Return_t AL_Event_GetEventHdlByStartTime(AL_DB_EDBType_t DBType,
  207. al_uint16 net_id, al_uint16 trans_id, al_uint16 serv_id,
  208. AL_Time_t *event_start_time, al_uint32 duration,
  209. al_uint16 events_req, AL_Event_t *eventhdl_list, al_uint16 *events_fnd);
  210. /***************************************************************************
  211. ** FUNCTION : AL_Event_GetNextNumofEvents
  212. **
  213. ** DESCRIPTION :
  214. ** API fills details of Next 'n' events of given service, including current one
  215. ** indicated by event_hdl
  216. **
  217. ** PARAMETERS :
  218. ** DBType - Database type(DVB_T/DVB_C etc)
  219. ** net_id - Network ID
  220. ** trans_id- Transport Stream ID
  221. ** serv_id - Service ID
  222. ** event_ref - Ref Event
  223. ** events_req - Events required
  224. ** events_detail - Event data structure to be filled
  225. ** events_fnd - Events found
  226. **
  227. ** RETURN VALUES : AL_Return_t
  228. ***************************************************************************/
  229. AL_Return_t AL_Event_GetNextNumofEvents(AL_DB_EDBType_t DBType,
  230. al_uint16 net_id, al_uint16 trans_id, al_uint16 serv_id,
  231. AL_Event_t event_hdl, al_uint16 events_req,
  232. AL_Event_Details_t *events_detail, al_uint16 *events_fnd);
  233. /***************************************************************************
  234. ** FUNCTION : AL_Event_GetPrevNumofEvents
  235. **
  236. ** DESCRIPTION :
  237. ** API fills details of previous 'n' events of given service.
  238. **
  239. ** PARAMETERS :
  240. ** DBType - Database type(DVB_T/DVB_C etc)
  241. ** net_id - Network ID
  242. ** trans_id- Transport Stream ID
  243. ** serv_id - Service ID
  244. ** event_ref - Ref Event
  245. ** events_req - Events required
  246. ** events_detail - Event data structure to be filled
  247. ** events_fnd - Events found
  248. **
  249. ** RETURN VALUES : AL_Return_t
  250. ***************************************************************************/
  251. AL_Return_t AL_Event_GetPrevNumofEvents(AL_DB_EDBType_t DBType,
  252. al_uint16 net_id, al_uint16 trans_id, al_uint16 serv_id,
  253. AL_Event_t event_hdl, al_uint16 events_req,
  254. AL_Event_Details_t *events_detail, al_uint16 *events_fnd);
  255. /***************************************************************************
  256. ** FUNCTION : AL_Event_GetLastNumofEvents
  257. **
  258. ** DESCRIPTION :
  259. ** API fills details of last 'n' events of given service.
  260. **
  261. ** PARAMETERS :
  262. ** DBType - Database type(DVB_T/DVB_C etc)
  263. ** net_id - Network ID
  264. ** trans_id- Transport Stream ID
  265. ** serv_id - Service ID
  266. ** event_ref - Ref Event
  267. ** events_req - Events required
  268. ** events_detail - Event data structure to be filled
  269. ** events_fnd - Events found
  270. **
  271. ** RETURN VALUES : AL_Return_t
  272. ***************************************************************************/
  273. AL_Return_t AL_Event_GetLastNumofEvents(AL_DB_EDBType_t DBType,
  274. al_uint16 net_id, al_uint16 trans_id, al_uint16 serv_id,
  275. al_uint16 events_req, AL_Event_Details_t *events_detail,
  276. al_uint16 *events_fnd);
  277. /***************************************************************************
  278. ** FUNCTION : AL_Event_GetCurrNextEvents
  279. **
  280. ** DESCRIPTION :
  281. ** API fill the details of current/next event of given Service.
  282. **
  283. ** PARAMETERS :
  284. ** DBType - Database type(DVB_T/DVB_C etc)
  285. ** net_id - Network ID
  286. ** trans_id- Transport Stream ID
  287. ** serv_id - Service ID
  288. ** event_cur - event structure to hold current event info
  289. ** event_next - event structure to hold next event info
  290. **
  291. ** RETURN VALUES : AL_Return_t
  292. ***************************************************************************/
  293. AL_Return_t AL_Event_GetCurrNextEvents(AL_DB_EDBType_t DBType,
  294. al_uint16 net_id, al_uint16 trans_id, al_uint16 serv_id,
  295. AL_Event_Details_t *event_cur, AL_Event_Details_t *event_next);
  296. /***************************************************************************
  297. ** FUNCTION : AL_Event_GetCurrNextEventsForCurrRating
  298. **
  299. ** DESCRIPTION :
  300. ** API fill the details of current/next event of given Service.
  301. **
  302. ** PARAMETERS :
  303. ** DBType - Database type(DVB_T/DVB_C etc)
  304. ** net_id - Network ID
  305. ** trans_id- Transport Stream ID
  306. ** serv_id - Service ID
  307. ** event_cur - event structure to hold current event info
  308. ** event_next - event structure to hold next event info
  309. **
  310. ** RETURN VALUES : AL_Return_t
  311. ***************************************************************************/
  312. AL_Return_t AL_Event_GetCurrNextEventsForCurrRating(AL_DB_EDBType_t DBType,
  313. al_uint16 net_id, al_uint16 trans_id, al_uint16 serv_id,
  314. AL_Event_Details_t *event_cur, AL_Event_Details_t *event_next);
  315. /***************************************************************************
  316. ** FUNCTION : AL_Event_GetEventsBetweenTime
  317. **
  318. ** DESCRIPTION :
  319. ** Provide events number between time for a service.
  320. ** Notice: when event_start_time or event_start_time
  321. ** is null, it means the user don't care about it. For example,
  322. ** both event_start_time and event_end_time is set to null,
  323. ** then, AL_Event_GetTotalEventsBetweentime returns the total
  324. ** events number of certail service.
  325. **
  326. ** PARAMETERS :
  327. ** DBType - Database type(DVB_T/DVB_C etc)
  328. ** net_id - Network ID
  329. ** trans_id- Transport Stream ID
  330. ** serv_id - Service ID
  331. ** event_start_time- Event start time(Not include offset)
  332. ** event_end_time - Event end time(Not include offset)
  333. ** offset - offset to get result in event list
  334. ** num_req - number required to get
  335. ** got_num - actual number has been got
  336. ** EventDetaillist - pointer to event list that contain detail information as required
  337. ** total_num - total number of the event that meet the requirment.
  338. ** RETURN VALUES : AL_Return_t
  339. ***************************************************************************/
  340. AL_Return_t AL_Event_GetEventsBetweenTime(AL_DB_EDBType_t DBType,
  341. al_uint16 net_id, al_uint16 trans_id, al_uint16 serv_id,
  342. AL_Time_t *event_start_time, AL_Time_t *event_end_time,
  343. al_uint16 offset, al_uint16 num_req, al_uint16 *got_num,
  344. AL_Event_Details_t *EventDetaillist, al_uint16 *total_num);
  345. /***************************************************************************
  346. ** FUNCTION : AL_Event_GetEventsBetweenTime
  347. **
  348. ** DESCRIPTION :
  349. ** Provide events number between time for a service.
  350. ** Notice: when event_start_time or event_start_time
  351. ** is null, it means the user don't care about it. For example,
  352. ** both event_start_time and event_end_time is set to null,
  353. ** then, AL_Event_GetTotalEventsBetweentime returns the total
  354. ** events number of certail service.
  355. **
  356. ** PARAMETERS :
  357. ** DBType - Database type(DVB_T/DVB_C etc)
  358. ** net_id - Network ID
  359. ** trans_id- Transport Stream ID
  360. ** serv_id - Service ID
  361. ** event_start_time- Event start time(Not include offset)
  362. ** event_end_time - Event end time(Not include offset)
  363. ** offset - offset to get result in event list
  364. ** num_req - number required to get
  365. ** got_num - actual number has been got
  366. ** EventDetaillist - pointer to event list that contain detail information as required
  367. ** total_num - total number of the event that meet the requirment.
  368. ** RETURN VALUES : AL_Return_t
  369. ***************************************************************************/
  370. AL_Return_t AL_Event_GetAllSchduleEventsBetweenTime(AL_DB_EDBType_t DBType,
  371. al_uint16 net_id, al_uint16 trans_id, al_uint16 serv_id,
  372. AL_Time_t *event_start_time, AL_Time_t *event_end_time,
  373. al_uint16 offset, al_uint16 num_req, al_uint16 *got_num,
  374. AL_Event_Details_t *EventDetaillist, al_uint16 *total_num);
  375. /***************************************************************************
  376. ** FUNCTION : AL_Event_GetEventsDescription
  377. **
  378. ** DESCRIPTION :
  379. ** Provide extend events details by given event.
  380. ** Notice: when ExtendEvent_t is null, means user only cares
  381. ** about total number of the extend event. For example,
  382. **
  383. ** PARAMETERS :
  384. ** DBType - Database type(DVB_T/DVB_C etc)
  385. ** net_id - Network ID
  386. ** trans_id- Transport Stream ID
  387. ** serv_id - Service ID
  388. ** event_hdl - event handle
  389. ** offset - tells the position to get the extend event
  390. ** num_req - number required to get
  391. ** got_num - actual number has been got
  392. ** ExtendDetail_list_t - pointer to list that contain extend detail information as required
  393. ** total_num - total number of the event that meet the requirment.
  394. ** RETURN VALUES : AL_Return_t
  395. ***************************************************************************/
  396. AL_Return_t AL_Event_GetEventsDescription(AL_DB_EDBType_t DBType,
  397. al_uint16 net_id, al_uint16 trans_id, al_uint16 serv_id, AL_Event_t event_hdl,
  398. al_uint16 offset, al_uint16 req_num, al_uint16 *got_num,
  399. AL_Event_Desciption_t *ExtendDetail_list_t, al_uint16 *total_num);
  400. #endif
  401. /**
  402. * @brief Get descriptor of the event by event id and tag
  403. *
  404. * @param event_hdl - event handle
  405. * @param tag - descriptor tag
  406. * @param offset - position to get the descriptor
  407. * @param pDesc - pointer to the descriptor data
  408. *
  409. * @retval AL_SUCCESS means succss. AL_INITIALIZE_ALREADY means already initialised.
  410. * AL_FAILURE means failed
  411. */
  412. #ifdef CONFIG_USE_COMPRESSED_EPGMODULE
  413. AL_Return_t AL_Event_GetDescriptor(AL_Event_t event_hdl, al_uint16 OrgNetId, al_uint16 TSId,
  414. al_uint16 SrvId, al_uint8 tag, al_uint16 *offset, void *pDesc);
  415. #else
  416. #ifdef CONFIG_DTV_SUPPORT
  417. AL_Return_t AL_Event_GetDescriptor(AL_Event_t event_hdl,
  418. al_uint8 tag, al_uint16 *offset, void *pDesc);
  419. #endif
  420. #endif
  421. /**
  422. * @brief according raw data to get code page and remove codepage data from raw data
  423. *
  424. * @param pCodePage, output defualt code page.
  425. *
  426. * @param rawchr, point to raw data.
  427. *
  428. * @param size, raw data size.
  429. *
  430. * @return AL_SUCCESS is successful, AL_FAILURE otherwise.
  431. */
  432. AL_Return_t AL_Event_GetCodePage(al_uint32 *pCodePage, UINT8 *rawchr, INT32 *size);
  433. /**
  434. * @brief if string not carry codepage, need to get defualt code page
  435. *
  436. * @param pCodePage, output defualt code page.
  437. *
  438. * @return AL_SUCCESS is successful, AL_FAILURE otherwise.
  439. */
  440. AL_Return_t AL_Event_GetDefaultCodePage(al_uint32 *pCodePage);
  441. al_uint32 AL_Event_MonUtf16IsBEorLE(UINT8 *rawchr, INT32 *size);
  442. #ifdef CONFIG_USE_COMPRESSED_EPGMODULE
  443. #ifdef SUPPORT_CLEAN_EX_DESCRIPTOR
  444. al_void AL_Event_CleanExDescriptor(al_void);
  445. al_void AL_Event_ReceiveExDescriptor(al_void);
  446. #endif
  447. #ifdef SUPPORT_CLEAN_EPG
  448. al_void AL_Event_CleanEPG(al_void);
  449. al_void AL_Event_ReceiveEPG(al_void);
  450. #endif
  451. #endif
  452. #ifdef __cplusplus
  453. }
  454. #endif /* __cplusplus */
  455. #endif /* __AL_EVENT_H__ */
  456. /*****************************************************************************
  457. ** $Rev: 1910 $
  458. **
  459. *****************************************************************************/