kb_machblue_client_data.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:24k
- /*---------------------------------------------------------------------------
- * mbtv_customer_struct_managemment.c
- *
- *--------------------------------------------------------------------------*/
- #include "db.h"
- #include "epg.h"
- #include "sipsi.h"
- #include "timeclk.h"
- #include "machblue_defines.h"
- #include "machblue_customer.h"
- #include "machblue_tv_defines.h"
- #include "machblue_tv_customer.h"
- #include "machblue_porting_core.h"
- #include "kb_machblue_client_data.h"
- #include "kb_machblue_client_define.h"
- #include "machblue_tv_porting.h"
- #include "appltype.h"
- #include "Demand.h"
- #include "sr_time.h"
- extern UINT16 KB_DBGetSvcIDByNO(UINT8 prgType, UINT16 prgInx);
- kb_movie_serviceList_t _kb_mb_serviceList[list_last];
- kb_movie_serviceContext_t _kb_mb_serviceContext;
- static kb_movie_stream_t _kb_mb_serviceStream;
- static unsigned long _kb_mb_service_id=0;
- static unsigned long _kb_mb_radio_service_id = 0;
- static unsigned long _kb_mb_NVOD_service_id = 0;
- static unsigned long _kb_mb_event_id=0;
- static mb_tv_notify_f *_kb_mb_tvNotifyFun=NULL;
- static void *_kb_mb_tvClientData=NULL;
- static mb_error_t kb_machblue_service_list_all_tv_init(void);
- static mb_error_t kb_machblue_service_list_radio_init(void);
- //void kb_machblue_search_schedule(void);
- extern int KB_TimeGetCurTime(time_t *plTime);
- unsigned short getServiceIndex(unsigned short serviceID)
- {
- unsigned short index, videoCnt;
- videoCnt=(unsigned short )_kb_mb_serviceList[all_tv_list].count;
- for(index=0;index<videoCnt;index++)
- {
-
- if(_kb_mb_serviceList[all_tv_list].services[index].info.display_id==serviceID)
- break;
- }
- return index;
- }
- /**
- *This function initialize the present and the following event
- *@return MB_SUCCESS on success, MB_FAILURE on failure.
- */
- mb_error_t KB_mb_PF_Update(KB_SIEitPF *Cur_ptEitPf,KB_SIEitPF *Fol_ptEitPf)
- {
- _kb_mb_serviceList[all_tv_list].services[getServiceIndex(Cur_ptEitPf->service_id)].current_event.attributes.start_time = Cur_ptEitPf->start_time;
- _kb_mb_serviceList[all_tv_list].services[getServiceIndex(Cur_ptEitPf->service_id)].current_event.attributes.event_info.duration= Cur_ptEitPf->duration;
- _kb_mb_serviceList[all_tv_list].services[getServiceIndex(Cur_ptEitPf->service_id)].current_event.attributes.event_info.id= Cur_ptEitPf->event_id;
- mb_memcpy(_kb_mb_serviceList[all_tv_list].services[getServiceIndex(Cur_ptEitPf->service_id)].current_event.attributes.event_info.name,Cur_ptEitPf->chinese.event_name,51);
- mb_memcpy(_kb_mb_serviceList[all_tv_list].services[getServiceIndex(Cur_ptEitPf->service_id)].current_event.attributes.event_info.short_desc,Cur_ptEitPf->chinese.text,128);
- _kb_mb_serviceList[all_tv_list].services[getServiceIndex(Cur_ptEitPf->service_id)].current_event.service=&_kb_mb_serviceList[all_tv_list].services[getServiceIndex(Cur_ptEitPf->service_id)];
- _kb_mb_serviceList[all_tv_list].services[getServiceIndex(Fol_ptEitPf->service_id)].following_event.attributes.start_time = Fol_ptEitPf->start_time;
- _kb_mb_serviceList[all_tv_list].services[getServiceIndex(Fol_ptEitPf->service_id)].following_event.attributes.event_info.duration= Fol_ptEitPf->duration;
- _kb_mb_serviceList[all_tv_list].services[getServiceIndex(Fol_ptEitPf->service_id)].following_event.attributes.event_info.id= Fol_ptEitPf->event_id;
- mb_memcpy(_kb_mb_serviceList[all_tv_list].services[getServiceIndex(Fol_ptEitPf->service_id)].following_event.attributes.event_info.name,Fol_ptEitPf->chinese.event_name,51);
- mb_memcpy(_kb_mb_serviceList[all_tv_list].services[getServiceIndex(Fol_ptEitPf->service_id)].following_event.attributes.event_info.short_desc,Fol_ptEitPf->chinese.text,128);
- _kb_mb_serviceList[all_tv_list].services[getServiceIndex(Fol_ptEitPf->service_id)].following_event.service= &_kb_mb_serviceList[all_tv_list].services[getServiceIndex(Fol_ptEitPf->service_id)];
- //KB_MB_lc_2_movie_Post_Task();
- KB_MB_lc_2_movie_word_Post_Task(1);
- return MB_SUCCESS;
- }
- /**
- * This function init the service list information.
- * @return MB_SUCCESS on success, MB_FAILURE on failure.
- */
- mb_error_t kb_mb_service_list_init(void)
- {
- kb_machblue_service_list_all_tv_init();
- kb_machblue_service_list_radio_init();
- return MB_SUCCESS;
- }
- mb_error_t kb_mb_schdule_clear(kb_movie_service_t *service)
- {
- unsigned char index;
- for(index=0;index<7;index++)
- {
- mb_free(service->evs[index].events);
- service->evs[index].evtCount=0;
- }
-
- return MB_SUCCESS;
- }
- mb_error_t kb_mb_service_list_clear(void)
- {
- unsigned short index;
- _kb_mb_service_id=0;
- _kb_mb_event_id=0;
- //clear
- for(index=0;index<_kb_mb_serviceList[all_tv_list].count;index++)
- {
- kb_mb_schdule_clear(&(_kb_mb_serviceList[all_tv_list].services[index]));
- mb_memset(&(_kb_mb_serviceList[all_tv_list].services[index]),0,sizeof(kb_movie_service_t));
- }
- mb_free(_kb_mb_serviceList[all_tv_list].services);
- mb_memset(&(_kb_mb_serviceList[all_tv_list]),0,sizeof(kb_movie_serviceList_t));
- for(index=0;index<_kb_mb_serviceList[radio_list].count;index++)
- {
- kb_mb_schdule_clear(&(_kb_mb_serviceList[radio_list].services[index]));
- mb_memset(&(_kb_mb_serviceList[radio_list].services[index]),0,sizeof(kb_movie_service_t));
- }
- mb_free(_kb_mb_serviceList[radio_list].services);
- mb_memset(&(_kb_mb_serviceList[radio_list]),0,sizeof(kb_movie_serviceList_t));
- return MB_SUCCESS;
- }
- mb_error_t kb_mb_service_list_reset(void)
- {
- //clear
- kb_mb_service_list_clear();
-
- //add
- kb_mb_service_list_init();
- //search
- //kb_machblue_search_schedule();
- return MB_SUCCESS;
- }
- mb_error_t kb_mb_service_list_resetEx(void)
- {
- //clear
- kb_mb_service_list_clear();
-
- //add
- kb_mb_service_list_init();
- kb_mb_chledit_list_reset();
- return MB_SUCCESS;
- }
- mb_error_t kb_mb_event_schedule_reset(void)
- {
- unsigned short index;
- //clear
- for(index=0;index<_kb_mb_serviceList[all_tv_list].count;index++)
- {
- kb_mb_schdule_clear(&(_kb_mb_serviceList[all_tv_list].services[index]));
- }
- for(index=0;index<_kb_mb_serviceList[radio_list].count;index++)
- {
- kb_mb_schdule_clear(&(_kb_mb_serviceList[radio_list].services[index]));
- }
-
- //search
- //kb_machblue_search_schedule();
- return MB_SUCCESS;
- }
- static mb_error_t kb_machblue_service_list_all_tv_init(void)
- {
- unsigned short videoCnt=0,index;
- UINT16 service_ID;
- unsigned char *service_name;
-
-
- _kb_mb_serviceList[all_tv_list].info.id=0;
- mb_memcpy(_kb_mb_serviceList[all_tv_list].info.name,"All Service",11);
- mb_memcpy(_kb_mb_serviceList[all_tv_list].info.logo_url," ",1);
- mb_memcpy(_kb_mb_serviceList[all_tv_list].info.extra_info," ",1);
- _kb_mb_serviceList[all_tv_list].services=NULL;
- _kb_mb_serviceList[all_tv_list].count=0;
- //_kb_mb_serviceList[all_tv_list].svl_manager=NULL;
- videoCnt=KB_DBGetPrgTotal(DTVPRG);
- if(videoCnt==0)
- return MB_SUCCESS;
-
- //malloc service memory
- _kb_mb_serviceList[all_tv_list].services=mb_malloc(sizeof(kb_movie_service_t)*videoCnt);
- if(_kb_mb_serviceList[all_tv_list].services==NULL)
- {
- mb_printf("n[Machblue]:Service list 1 init no memory.");
- return MB_FAILURE;
- }
- mb_memset(_kb_mb_serviceList[all_tv_list].services,0,sizeof(kb_movie_service_t)*videoCnt);
- //insert video service
- for(index=0;index<videoCnt;index++)
- {
- //service info
- service_ID = KB_DBGetSvcIDByNO(DTVPRG, index);
- service_name = KB_DBGetPrgName(DTVPRG,index+1);
- _kb_mb_serviceList[all_tv_list].services[index].info.id=(int)_kb_mb_service_id++;
- _kb_mb_serviceList[all_tv_list].services[index].info.display_id=service_ID;//gPrgAllInfo.gDTVInfo.PgmList[index].SvcID;
- mb_memcpy(_kb_mb_serviceList[all_tv_list].services[index].info.name,service_name,MB_TV_SERVICE_NAME_LENGTH);
- _kb_mb_serviceList[all_tv_list].services[index].info.name[15]=' ';
- mb_memcpy(_kb_mb_serviceList[all_tv_list].services[index].info.logo_url,"0000 ",5);
- //mb_memcpy(_kb_mb_serviceList[all_tv_list].services[index].info.name[15],"