Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
kb_machblue_client_data.c
Package: ST_5105DTV.rar [view]
Upload User: fy98168
Upload Date: 2015-06-26
Package Size: 13771k
Code Size: 24k
Category:
DVD
Development Platform:
C/C++
- /*---------------------------------------------------------------------------
- * 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],"",1);
- //mb_printf("nProgram [%d] name is [%s]",index+1,_kb_mb_serviceList[all_tv_list].services[index].info.name);
- _kb_mb_serviceList[all_tv_list].services[index].info.type=MB_TV_DIGITAL_SERVICE;
- _kb_mb_serviceList[all_tv_list].services[index].info.source_info.id=0;
- _kb_mb_serviceList[all_tv_list].services[index].info.source_info.type=MB_TV_CABLE_SOURCE;
- //service state
- _kb_mb_serviceList[all_tv_list].services[index].state=MB_TV_SERVICE_DISCONNECTED;
- //authorization
- _kb_mb_serviceList[all_tv_list].services[index].auth=MB_TV_AF_AUTHORIZED;
- //
- _kb_mb_serviceList[all_tv_list].services[index].serInfo.tsID=KB_DBGetPrgTsID(DTVPRG,index+1);
- //event
- mb_memset(&(_kb_mb_serviceList[all_tv_list].services[index].evs),0,sizeof(kb_movie_eventSchedule_t));
- mb_memset(&(_kb_mb_serviceList[all_tv_list].services[index].current_event),0,sizeof(kb_movie_event_t));
- mb_memset(&(_kb_mb_serviceList[all_tv_list].services[index].following_event),0,sizeof(kb_movie_event_t));
- //pointer
- _kb_mb_serviceList[all_tv_list].services[index].svl=&_kb_mb_serviceList[all_tv_list];
- _kb_mb_serviceList[all_tv_list].services[index].svc=&_kb_mb_serviceContext;
- _kb_mb_serviceList[all_tv_list].services[index].streams=&_kb_mb_serviceStream;
- _kb_mb_serviceList[all_tv_list].services[index].current_event.service=&_kb_mb_serviceList[all_tv_list].services[index];
- _kb_mb_serviceList[all_tv_list].services[index].current_event.evs=&_kb_mb_serviceList[all_tv_list].services[index].evs[0];
- _kb_mb_serviceList[all_tv_list].services[index].following_event.service=&_kb_mb_serviceList[all_tv_list].services[index];
- _kb_mb_serviceList[all_tv_list].services[index].following_event.evs=&_kb_mb_serviceList[all_tv_list].services[index].evs[0];
- //service count
- _kb_mb_serviceList[all_tv_list].count+=1;
- }
- return MB_SUCCESS;
- }
- static mb_error_t kb_machblue_service_list_radio_init(void)
- {
- unsigned short audioCnt=0,index;
- UINT16 service_ID;
- unsigned char *service_name;
- _kb_mb_serviceList[radio_list].info.id=1;
- mb_memcpy(_kb_mb_serviceList[radio_list].info.name,"Radio Service",13);
- mb_memcpy(_kb_mb_serviceList[radio_list].info.logo_url," ",1);
- mb_memcpy(_kb_mb_serviceList[radio_list].info.extra_info," ",1);
- _kb_mb_serviceList[radio_list].services=NULL;
- _kb_mb_serviceList[radio_list].count=0;
- //_kb_mb_serviceList[all_tv_list].svl_manager=NULL;
- audioCnt=KB_DBGetPrgTotal(RADIOPRG);
- if(audioCnt==0)
- return MB_SUCCESS;
- //malloc service memory
- _kb_mb_serviceList[radio_list].services=mb_malloc(sizeof(kb_movie_service_t)*audioCnt);
- if(_kb_mb_serviceList[radio_list].services==NULL)
- {
- mb_printf("n[Machblue]:Service list 2 init no memory.");
- return MB_FAILURE;
- }
- mb_memset(_kb_mb_serviceList[radio_list].services,0,sizeof(kb_movie_service_t)*audioCnt);
- //insert video service
- for(index=0;index<audioCnt;index++)
- {
- //service info
- service_ID = KB_DBGetSvcIDByNO(RADIOPRG, index);
- service_name = KB_DBGetPrgName(RADIOPRG,index+1);
- _kb_mb_serviceList[radio_list].services[index].info.id=(int)_kb_mb_radio_service_id++;
- _kb_mb_serviceList[radio_list].services[index].info.display_id=service_ID;//gPrgAllInfo.gDTVInfo.PgmList[index].SvcID;
- mb_memcpy(_kb_mb_serviceList[radio_list].services[index].info.name,service_name,MB_TV_SERVICE_NAME_LENGTH);
- mb_memcpy(_kb_mb_serviceList[radio_list].services[index].info.logo_url,"0000 ",5);
- _kb_mb_serviceList[radio_list].services[index].info.type=MB_TV_DIGITAL_SERVICE;
- _kb_mb_serviceList[radio_list].services[index].info.source_info.id=0;
- _kb_mb_serviceList[radio_list].services[index].info.source_info.type=MB_TV_CABLE_SOURCE;
- //service state
- _kb_mb_serviceList[radio_list].services[index].state=MB_TV_SERVICE_DISCONNECTED;
- //authorization
- _kb_mb_serviceList[radio_list].services[index].auth=MB_TV_AF_AUTHORIZED;
- //
- _kb_mb_serviceList[radio_list].services[index].serInfo.tsID=KB_DBGetPrgTsID(RADIOPRG,index+1);
- //event
- mb_memset(&(_kb_mb_serviceList[radio_list].services[index].evs),0,sizeof(kb_movie_eventSchedule_t));
- mb_memset(&(_kb_mb_serviceList[radio_list].services[index].current_event),0,sizeof(kb_movie_event_t));
- mb_memset(&(_kb_mb_serviceList[radio_list].services[index].following_event),0,sizeof(kb_movie_event_t));
- //pointer
- _kb_mb_serviceList[radio_list].services[index].svl=&_kb_mb_serviceList[radio_list];
- _kb_mb_serviceList[radio_list].services[index].svc=&_kb_mb_serviceContext;
- _kb_mb_serviceList[radio_list].services[index].streams=&_kb_mb_serviceStream;
- _kb_mb_serviceList[radio_list].services[index].current_event.service=&_kb_mb_serviceList[radio_list].services[index];
- _kb_mb_serviceList[radio_list].services[index].current_event.evs=&_kb_mb_serviceList[radio_list].services[index].evs[0];
- _kb_mb_serviceList[radio_list].services[index].following_event.service=&_kb_mb_serviceList[radio_list].services[index];
- _kb_mb_serviceList[radio_list].services[index].following_event.evs=&_kb_mb_serviceList[radio_list].services[index].evs[0];
- //service count
- _kb_mb_serviceList[radio_list].count+=1;
- }
- return MB_SUCCESS;
- }
- mb_error_t kb_machblue_nvod_flag(time_t start_time,time_t duration )
- {
- time_t plTime, end_time;
- //KB_TimeGetCurTime(&plTime);
- plTime = KB_TimeGetCurGMTTime();
- end_time = start_time + duration;
- //mb_printf("nptime = %ld,start = %ld, end = %ld",plTime, start_time, end_time);
- if ((plTime>=start_time)&&(plTime<end_time))
- {
- /*
- {
- char out[30];
- ConvertTimeStampToHHMMSS(plTime, out);
- mb_printf("n[machblue]hhmmss is %sn",out);
- ConvertTimeStampToDateString(plTime, out);
- mb_printf("n[machblue]yymmdd is %sn",out);
- }
- */
- return MB_SUCCESS;
- }
- return MB_FAILURE;
- }
- mb_error_t kb_machblue_service_list_NVOD_init(UINT8 count,KB_NVOD_Info*pNVOD[])
- {
- unsigned short NVODCnt=0,index;
- char *service_name;
- int i,j,k=0;
- kb_movie_service_t *service;
- _kb_mb_serviceList[NVOD_list].info.id=2;
- mb_memcpy(_kb_mb_serviceList[NVOD_list].info.name,"NVOD Service",12);
- mb_memcpy(_kb_mb_serviceList[NVOD_list].info.logo_url," ",2);
- mb_memcpy(_kb_mb_serviceList[NVOD_list].info.extra_info," ",2);
- _kb_mb_serviceList[NVOD_list].services=NULL;
- _kb_mb_serviceList[NVOD_list].count=0;
- for(index = 0;index<count;index++)
- {
- NVODCnt = NVODCnt+pNVOD[index]->RefEventNum;
- }
- if(NVODCnt==0)
- return MB_SUCCESS;
- _kb_mb_serviceList[NVOD_list].services=mb_malloc(sizeof(kb_movie_service_t)*NVODCnt);
- if(_kb_mb_serviceList[NVOD_list].services==NULL)
- {
- mb_printf("n[Machblue]:Service list 2 init no memory.");
- return MB_FAILURE;
- }
- //malloc service memory
- mb_memset(_kb_mb_serviceList[NVOD_list].services,0,sizeof(kb_movie_service_t)*NVODCnt);
- _kb_mb_NVOD_service_id = 0;
- for(index = 0;index<count;index++)
- {
- for(i = 0;i < pNVOD[index]->RefEventNum;i++,k++)
- {
- //service info
- //service_ID = i;
- service_name = pNVOD[index]->RefEventData[i].PrgName;
- _kb_mb_serviceList[NVOD_list].services[k].info.id=(int)_kb_mb_NVOD_service_id++;
- _kb_mb_serviceList[NVOD_list].services[k].info.display_id=k;//gPrgAllInfo.gDTVInfo.PgmList[index].SvcID;
- mb_memcpy(_kb_mb_serviceList[NVOD_list].services[k].info.name,service_name,MB_TV_SERVICE_NAME_LENGTH);
- _kb_mb_serviceList[NVOD_list].services[k].info.name[15]='';
- //mb_printf("nzhengyang_NVOD's name is %s,ID is %dn",pNVOD[index]->RefEventData[i].PrgName,k);
- //mb_printf("nwisco_NVOD's name is %sn",_kb_mb_serviceList[NVOD_list].services[i].info.name);
- _kb_mb_serviceList[NVOD_list].services[k].info.type=MB_TV_DIGITAL_SERVICE;
- _kb_mb_serviceList[NVOD_list].services[k].info.source_info.id=0;
- _kb_mb_serviceList[NVOD_list].services[k].info.source_info.type=MB_TV_CABLE_SOURCE;
- //service state
- _kb_mb_serviceList[NVOD_list].services[k].state=MB_TV_SERVICE_DISCONNECTED;
- //authorization
- _kb_mb_serviceList[NVOD_list].services[k].auth=MB_TV_AF_AUTHORIZED;
- //event
- mb_memset(&(_kb_mb_serviceList[NVOD_list].services[k].evs),0,sizeof(kb_movie_eventSchedule_t));
- mb_memset(&(_kb_mb_serviceList[NVOD_list].services[k].current_event),0,sizeof(kb_movie_event_t));
- mb_memset(&(_kb_mb_serviceList[NVOD_list].services[k].following_event),0,sizeof(kb_movie_event_t));
- //pointer
- _kb_mb_serviceList[NVOD_list].services[k].svl=&_kb_mb_serviceList[NVOD_list];
- _kb_mb_serviceList[NVOD_list].services[k].svc=&_kb_mb_serviceContext;
- _kb_mb_serviceList[NVOD_list].services[k].streams=&_kb_mb_serviceStream;
- //service count
- _kb_mb_serviceList[NVOD_list].count+=1;
- service = &_kb_mb_serviceList[NVOD_list].services[k];
- //_kb_mb_event_id = 0;
- if (pNVOD[index]->RefEventData[i].TimeNum == 0)
- {
- continue;
- }
- service->evs[0].evtCount=pNVOD[index]->RefEventData[i].TimeNum;
- if (service->evs[0].evtCount > 30)
- service->evs[0].evtCount = 30;
- service->evs[0].events=mb_malloc((mb_size_t)(sizeof(kb_movie_event_t)*service->evs[0].evtCount));
- for(j = 0;j <service->evs[0].evtCount; j++)
- {
- service->evs[0].events[j].attributes.event_info.id=j;//_kb_mb_event_id++;
- service->evs[0].events[j].attributes.event_info.duration=pNVOD[index]->RefEventData[i].durTime;
- mb_memcpy(service->evs[0].events[j].attributes.event_info.name, "",1);
- mb_memcpy(service->evs[0].events[j].attributes.event_info.short_desc,
- pNVOD[index]->RefEventData[i].PrgTxt,
- MB_TV_EVENT_DESCRIPTION_LENGTH);
- service->evs[0].events[j].attributes.event_info.short_desc[MB_TV_EVENT_DESCRIPTION_LENGTH]='';
- service->evs[0].events[j].attributes.start_time=pNVOD[index]->RefEventData[i].TimeNode[j].startTime;//+8*3600;
- service->evs[0].events[j].attributes.cost=0;
- service->evs[0].events[j].attributes.expiration_date=0;
- service->evs[0].events[j].auth=MB_TV_AF_AUTHORIZED;
- service->evs[0].events[j].day=0;
- service->evs[0].events[j].service=service;
- service->evs[0].events[j].evs=&service->evs[0];
- if(kb_machblue_nvod_flag((time_t)pNVOD[index]->RefEventData[i].TimeNode[j].startTime,(time_t)pNVOD[index]->RefEventData[i].durTime))
- {
- //mb_printf("n在播节目%d == %s",j,service->info.name);
- //{
- // char out[30];
- // ConvertTimeStampToHHMMSS((time_t)service->evs[0].events[j].attributes.start_time, out);
- // mb_printf("n[machblue]hhmmss is %sn",out);
- // ConvertTimeStampToDateString((time_t)service->evs[0].events[j].attributes.start_time, out);
- // mb_printf("n[machblue]yymmdd is %sn",out);
- //}
- mb_memcpy((void*)service->evs[0].events[j].attributes.event_info.genre,"Y",2);
- }
- else
- mb_memcpy((void*)service->evs[0].events[j].attributes.event_info.genre,"N",2);
- }
- }
- }
- /*
- for(i=0;i<_kb_mb_serviceList[NVOD_list].services[1].evs[0].evtCount;i++)
- {
- mb_printf("n[machblue]service[%d]=id = %d,[%d]=name = %sn",i,_kb_mb_serviceList[NVOD_list].services[1].info.id,i,_kb_mb_serviceList[NVOD_list].services[1].info.name);
- mb_printf("n[machblue]event[%d]=id = %d,[%d]=name = %ldn",i,_kb_mb_serviceList[NVOD_list].services[1].evs[0].events[i].attributes.event_info.id,i,_kb_mb_serviceList[NVOD_list].services[1].evs[0].events[i].attributes.start_time);
- }
- */
- return MB_SUCCESS;
- }
- /**
- * This function delete the service list information.
- * @return MB_SUCCESS on success, MB_FAILURE on failure.
- */
- mb_error_t kb_mb_service_list_delete(void)
- {
- return MB_SUCCESS;
- }
- /**
- * This function get the service list pointer.
- * @return pointer of service list.
- */
- kb_movie_serviceList_t *kb_mb_service_list_get(void)
- {
- return _kb_mb_serviceList;
- }
- /**
- * This function create event schedule of service.
- * service < service which event belong to >
- * @return MB_SUCCESS on success, MB_FAILURE on failure.
- */
- mb_error_t kb_mb_event_schedule_create(kb_movie_service_t *service)
- {
- KB_EPGDayInfo *pDayInfo;
- unsigned long i,j,evtCount=0,count=0;
- time_t plTime;
- //U32 hour, min, seconds;
- //U32 y, m, d;
- int index;
- if(service==NULL)
- {
- mb_printf("n[Machblue]:TV notification send NULL.");
- return MB_FAILURE;
- }
- KB_TimeGetCurTime(&plTime);
- for(i=0;i<7;i++)
- {
- pDayInfo=(KB_EPGDayInfo *)KD_EPGGetSCH(KB_EPG_GetTsNumFromTsId(service->serInfo.tsID),service->info.display_id,i);
- evtCount=pDayInfo->nEventCount;
- count+=evtCount;
- if(evtCount==0)
- continue;
- service->evs[i].events=mb_malloc((mb_size_t)(sizeof(kb_movie_event_t)*evtCount));
- service->evs[i].service=service;
- service->evs[i].evtCount=evtCount;
- //add event information
- for(j=0;j<pDayInfo->nEventCount;j++)
- {
- service->evs[i].events[j].attributes.event_info.id=(int)_kb_mb_event_id++;
- service->evs[i].events[j].attributes.event_info.duration=pDayInfo->ptEvent[j].duration;
- mb_memcpy(service->evs[i].events[j].attributes.event_info.name,
- pDayInfo->ptEvent[j].chinese.event_name,
- sizeof(pDayInfo->ptEvent[j].chinese.event_name));
- mb_memcpy(service->evs[i].events[j].attributes.event_info.short_desc,
- pDayInfo->ptEvent[j].chinese.text,
- MB_TV_EVENT_DESCRIPTION_LENGTH);
- service->evs[i].events[j].attributes.start_time=pDayInfo->ptEvent[j].start_time;
- service->evs[i].events[j].attributes.cost=0;
- service->evs[i].events[j].attributes.expiration_date=0;
- service->evs[i].events[j].auth=MB_TV_AF_AUTHORIZED;
- service->evs[i].events[j].day=(unsigned char)i;
- service->evs[i].events[j].service=service;
- service->evs[i].events[j].evs=&service->evs[i];
- if(service->svl->info.id==0)
- {
- for(index = 0; index<_kb_mb_serviceList[all_tv_list].count;index++)
- {
- if(_kb_mb_serviceList[all_tv_list].services[index].info.display_id==service->info.display_id)//gPrgAllInfo.gDTVInfo.PgmList[index].SvcID;
- break;
- }
- if(KB_CheckDmdEnt(index,(int)j,(int)i,(int)DT_EPG))
- {
- mb_memcpy((void*)service->evs[i].events[j].attributes.event_info.genre,"Y",2);
- }
- else
- mb_memcpy((void*)service->evs[i].events[j].attributes.event_info.genre,"N",2);
- }
- }
- }
- //mb_printf("nkb_mb_event_schedule_create service [%s] event count[%d]",service->info.name,count);
- return MB_SUCCESS;
- }
- /**
- * This function init the service context information.
- * @return MB_SUCCESS on success, MB_FAILURE on failure.
- */
- mb_error_t kb_mb_service_context_init(void)
- {
- mb_memset(&_kb_mb_serviceContext,0,sizeof(_kb_mb_serviceContext));
- _kb_mb_serviceContext.info.id=1;
- //_kb_mb_serviceContext.info.
- _kb_mb_serviceContext.service=&_kb_mb_serviceList[all_tv_list].services[0];
- return MB_SUCCESS;
- }
- void kb_mb_service_context_evaluation(int serviceIndex,int service_type)
- {
- int ser_list_type;
- if(service_type == DTVPRG)
- ser_list_type =all_tv_list;
- if (service_type == RADIOPRG)
- ser_list_type = radio_list;
- if(serviceIndex>0)
- _kb_mb_serviceContext.service=&_kb_mb_serviceList[ser_list_type].services[serviceIndex-1];
- }
- /**
- * This function get the service context pointer.
- * @return pointer of service context.
- */
- kb_movie_serviceContext_t *kb_mb_service_context_get(void)
- {
- return &_kb_mb_serviceContext;
- }
- /**
- * This function set notification and client data.
- * @return none.
- */
- void kb_mb_notification_set(mb_tv_notify_f *notify_fct,void *clientdata)
- {
- _kb_mb_tvNotifyFun=notify_fct;
- _kb_mb_tvClientData=clientdata;
- }
- /**
- * This function send notification to machblue player.
- * @return MB_SUCCESS on success, MB_FAILURE on failure.
- */
- mb_error_t kb_mb_notification_send(mb_tv_notif_reason_t reason,mb_args_t *args)
- {
- if(_kb_mb_tvNotifyFun==NULL)
- {
- mb_printf("n[Machblue]:TV notification send NULL.");
- return MB_FAILURE;
- }
- // invokes native callback
- return _kb_mb_tvNotifyFun(reason,args,_kb_mb_tvClientData);
- }