kb_machblue_client_lc.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:81k
- //*****************************************************************************
- //File Name: kb_machblue_lconnection.c
- //
- //Description: some function about local connection
- //
- //Author: wisco
- //
- //Date: 2007.03.08
- //
- //Version: v1.0
- //******************************************************************************
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include "db.h"
- #include "tcpip.h"
- #include "avplay.h"
- #include "gendef.h"
- #include "search.h"
- #include "nvod.h"
- #include "pub_st.h"
- #include "appltype.h"
- #include "Demand.h"
- #include "kb_dc.h"
- #include "tcmu30311.h"
- #include "machblue_client.h"
- #include "machblue_defines.h"
- #include "kb_machblue_client.h"
- #include "kb_machblue_client_lc.h"
- #include "machblue_porting_core.h"
- #include "machblue_tv_customer.h"
- #include "kb_machblue_client_vote.h"
- #include "kb_machblue_client_data.h"
- #include "Ca_user.h"
- #include "StbMoviesInfo.h"
- #include "XmlStbInfo.h"
- //static kb_lc_attributes_t s_kb_attr;
- static int kb_mb_mail_type;
- #define LC_COMMAND_BUF_SIZE 1024*5
- static unsigned long lcCommandBufIndex=0;
- static unsigned char lcCommandBuf[LC_COMMAND_BUF_SIZE];
- static unsigned char *pLcCommand=lcCommandBuf;
- void kb_machblue_lc_menu(kb_lc_attributes_t *pAttribs);
- void kb_machblue_lc_2_mail(UINT32 word);
- void kb_machblue_lc_F_mail(kb_lc_attributes_t *pAttribs);
- void kb_machblue_lc_channel_edit(UINT32 word);
- void KB_MB_lc_Factory_Reset(UINT32 word);
- void kb_machblue_lc_2_mail_list(UINT32 word);
- void kb_machblue_lc_2_mail_read(UINT32 word);
- void kb_machblue_lc_2_mail_delete(UINT32 word);
- extern int get_dtv_num(void);
- extern int get_radio_num(void);
- extern int mb_strcmp(mb_char_t *s0, mb_char_t *s1);
- extern INT32 STB_StateSwitch(INT32 nApplet);
- extern int KB_TimeGetCurTime(time_t *plTime);
- extern time_t Time_2_Local_Tiem(time_t timeStamp);
- extern WORD TFCASTB_GetEmailHeads(OUT STFCAEmailHead* pEmailHead,INOUT BYTE* pbyCount,INOUT BYTE* pbyFromIndex);
- extern int ConvertTimeStampToDate(U32 timeStamp, U32 *year, U32 *month, U32 *day);
- extern WORD TFCASTB_GetEmailContent(ULONG dwEmailID,OUT STFCAEmailContent* pEmailContent);
- extern void kb_machblue_lc_F_NVOD(kb_lc_attributes_t *pAttribs);
- extern void kb_machblue_lc_2_NVOD(UINT32 word);
- /*********************************************************************
- * menu operation used by local connection following.
- *********************************************************************/
- unsigned char *KB_MB_lc_getCommandBuf(unsigned short size)
- {
- unsigned char *p=NULL;
- unsigned short bufSize=size+1;
-
- if((lcCommandBufIndex+bufSize)>LC_COMMAND_BUF_SIZE)
- {
- p=pLcCommand=lcCommandBuf;
- lcCommandBufIndex=bufSize;
- pLcCommand+=bufSize;
- }
- else
- {
- p=pLcCommand;
- lcCommandBufIndex+=bufSize;
- pLcCommand+=bufSize;
- }
-
- return p;
- }
- /*
- * 函数名称 : KB_MB_lc_2_movie_Post_Task
- *
- * 函数简介 : 发送消息
- *
- * 输入参数 : none
- *
- * 输出参数 : none
- *
- * 返 回 值 : none
- */
- void KB_MB_lc_2_movie_Post_Task(void)
- {
- KB_OSPMsgNode movie_msg;
-
- movie_msg.Word1= KB_MOVIE_LC_TO_MOVIE;
- movie_msg.Word2= 1;
- kb_machblue_task_post(&movie_msg);
-
- }
- /*
- * 函数名称 : KB_MB_lc_2_movie_word_Post_Task
- *
- * 函数简介 : 发送消息
- *
- * 输入参数 : none
- *
- * 输出参数 : none
- *
- * 返 回 值 : none
- */
- void KB_MB_lc_2_movie_word_Post_Task(UINT32 word)
- {
- KB_OSPMsgNode movie_msg;
-
- movie_msg.Word1= KB_MOVIE_LC_TO_MOVIE;
- movie_msg.Word2 = word;
- kb_machblue_task_post(&movie_msg);
-
- }
- /**
- * local connection manager
- * @return None.
- */
- void kb_machblue_localConnection(kb_lc_attributes_t *attribs)
- {
- int movie_type;
- if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_ADVER))
- movie_type = movie_adver;
- else if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_GAME))
- movie_type = movie_game;
- else if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_VOTE))
- movie_type = movie_vote;
- else if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_MENU))
- movie_type = movie_menu;
- else if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_DBC))
- movie_type = movie_dbc;
- switch(movie_type)
- {
- case movie_adver:
- kb_machblue_lc_ad(attribs);
- break;
- case movie_game:
- break;
- case movie_vote:
- kb_vote_infoFMovie(attribs);
- break;
- case movie_dbc:
- case movie_menu:
- kb_machblue_lc_menu(attribs);
- break;
- default:
- break;
- }
- }
- /*
- * 函数名称 : KB_Machblue_LC_To_Movie
- *
- * 函数简介 : 向影片发送信息
- *
- * 输入参数 : word < 消息中的属性>
- *
- * 输出参数 : none
- *
- * 返 回 值 : none
- */
- void KB_Machblue_LC_To_Movie(long word)
- {
- kb_movie_struct_t *pCurMovie=kb_machblue_getCurrentMovie();
-
- switch(pCurMovie->info.name)
- {
- case kb_movie_menu_search:
- case kb_movie_menu_searchAll:
- kb_searchResult2Movie(word);
- break;
- case kb_movie_menu_volume:
- kb_volumeTrack();
- break;
- case kb_movie_menu_volumeMute:
- kb_volumeMuteFlag();
- break;
- case kb_movie_menu_pf:
- kb_pfGot(word);
- break;
- case kb_movie_menu_sys_info:
- kb_sysInfo();
- break;
- case kb_movie_menu_mail:
- kb_machblue_lc_2_mail(word);
- break;
- case kb_movie_menu_nvod:
- kb_machblue_lc_2_NVOD(word);
- break;
- case kb_movie_menu_channle_no:
- kb_mb_ch_no_2_movie(word);
- break;
- case kb_movie_dbc_gov:
- kb_dbc_govContent(word);
- break;
- case kb_movie_dbc_weather:
- kb_weatherCitySwitch(word);
- break;
- case kb_movie_ca_inform:
- kb_machblue_lc_2_ca_inform();
- break;
- case kb_movie_swfUpdatePrompt:
- KB_Swf_UpdateInfoLC(word);
- break;
- default:
- break;
- }
- }
- #if 1// menu switch
- /**
- * menu operation of lc.
- * @return None.
- */
- void kb_machblue_lc_menu(kb_lc_attributes_t *pAttribs)
- {
- if(pAttribs==NULL)
- {
- mb_printf("n[Machblue]:Client menu operatioin attributes NULL.");
- return;
- }
- if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_SEARCH))
- {
- //KB_UpdateCheckClear();
- kb_getInfoFSearchMenu(pAttribs);
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_MENU_SWITCH))
- {
- kb_machblue_switchMenuMovie(pAttribs);
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_SYS_RESET))
- {
- KB_DBReset();
- KB_MB_lc_2_movie_Post_Task();
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_MAIL_MESSAGE))
- {
- kb_machblue_lc_F_mail(pAttribs);
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_NVOD))
- {
- kb_machblue_lc_F_NVOD(pAttribs);
- }
- //add by shriek
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_MENU_OTA_HINT))
- {
- kb_machblue_lc_F_otahint(pAttribs);
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_CH_NO))
- {
- kb_mb_ch_no_F_movie(pAttribs);
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_WEATHER))
- {
- int city_index;
- city_index = atoi((char *)pAttribs->parameters[lc_data2].value);
- KB_MB_lc_2_movie_word_Post_Task(city_index);
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_GOV))
- {
- if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_GOV_CONTENT))
- {
- int govContentIndex;
- govContentIndex = atoi((char *)pAttribs->parameters[lc_data2].value);
- KB_MB_lc_2_movie_word_Post_Task(govContentIndex);
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_GOV_CATALOG))
- {
- kb_dbc_govCatalog();
- }
- }
- //shriek end
- }
- #endif
- #if 1//search menu
- /**
- * send channel management to flash movie
-
- * word < message type >
-
- * @return none
- */
- void kb_machblue_lc_channel_edit(UINT32 word)
- {
- char result_string[2];
- mb_handle_t req_handle;
- mb_param_t cha_man_2_movie[9];
- kb_movie_struct_t current_movie_info;
- int channel_edit_type;
- cha_man_2_movie[0].name = KB_LC_PARA_INDEX_0;
- cha_man_2_movie[0].value= MOVIE_NAME_MENU_SEARCH;
- cha_man_2_movie[1].name = KB_LC_PARA_INDEX_1;
- cha_man_2_movie[1].value= MOVIE_TYPE_MOVIE_MENU;
- cha_man_2_movie[2].name = KB_LC_PARA_INDEX_2;
- cha_man_2_movie[2].value= MOVIE_MENU_SEARCH_CONNECTION;
- cha_man_2_movie[3].name = KB_LC_PARA_INDEX_3;
- cha_man_2_movie[3].value= MOVIE_MENU_SEARCH_FUNCTION;
- cha_man_2_movie[4].name = KB_LC_PARA_INDEX_4;
- cha_man_2_movie[4].value= EVENT_TYPE_SEARCH;
- cha_man_2_movie[5].name = KB_LC_PARA_INDEX_5;
- cha_man_2_movie[5].value= EVENT_SEARCH_TYPE_CHA_EDIT;
-
- if(word == 0)
- channel_edit_type = fav_edit;
- else if(word == 1)
- channel_edit_type = move_edit;
- else if(word == 2)
- channel_edit_type = delete_edit;
- else if(word == 3)
- channel_edit_type = lock_edit;
- cha_man_2_movie[6].name = KB_LC_PARA_INDEX_6;
- mb_memset(result_string, 0x00, 2);
- sprintf(result_string,"%ld",word);
- cha_man_2_movie[6].value = result_string;//进行何种编辑0 喜爱 1 移动 2 删除3 锁盯
-
- cha_man_2_movie[7].name = KB_LC_PARA_INDEX_7;
- cha_man_2_movie[7].value= KB_LC_PARA_INIT_1;//该操作是否成功
- cha_man_2_movie[8].name = NULL;
- cha_man_2_movie[8].value = NULL;
-
-
- if(mb_movie_lc_request_send( current_movie_info.movie, cha_man_2_movie[2].value,cha_man_2_movie[3].value, cha_man_2_movie, &req_handle))
- mb_printf("nthe return value of mb_movie_lc_request_send is successn");
- else
- mb_printf("nthe return value of mb_movie_lc_request_send is failedn");
- }
- /**
- * send signal value to flash movie
-
- * word frequency
-
- * @return none
- */
- void kb_machblue_lc_progress(UINT32 word)
- {
- int ret;
- char start_str1[3];
- mb_param_t progress_2_movie[8];
- kb_movie_struct_t current_movie_info;
- mb_handle_t handle;
-
- progress_2_movie[0].name = KB_LC_PARA_INDEX_0;
- progress_2_movie[0].value= MOVIE_NAME_MENU_SEARCH;
- progress_2_movie[1].name = KB_LC_PARA_INDEX_1;
- progress_2_movie[1].value= MOVIE_TYPE_MOVIE_MENU;
- progress_2_movie[2].name = KB_LC_PARA_INDEX_2;
- progress_2_movie[2].value= MOVIE_MENU_SEARCH_CONNECTION;
- progress_2_movie[3].name = KB_LC_PARA_INDEX_3;
- progress_2_movie[3].value= MOVIE_MENU_SEARCH_FUNCTION;
- progress_2_movie[4].name = KB_LC_PARA_INDEX_4;
- progress_2_movie[4].value= EVENT_TYPE_SEARCH;
- progress_2_movie[5].name = KB_LC_PARA_INDEX_5;
- progress_2_movie[5].value= EVENT_SEARCH_TYPE_PROGRESS;
- progress_2_movie[6].name = KB_LC_PARA_INDEX_6;
- mb_memset(start_str1, 0x00, 3);
- sprintf(start_str1,"%ld",word);
- progress_2_movie[6].value = start_str1;//progress
-
- progress_2_movie[7].name = NULL;
- progress_2_movie[7].value = NULL;
-
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_SEARCH_CONNECTION,MOVIE_MENU_SEARCH_FUNCTION,progress_2_movie,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client send signal strength or quality error");
- }
- }
- //#define test
- void KB_OTA_Set(int sys_info, kb_lc_attributes_t *pAttribs)
- {
- KB_DBOtaPara ota_para;
-
- #if 0
- mb_printf("n[KB_OTA_Set]:lc_movie_name=%s",(mb_char_t*)pAttribs->parameters[lc_movie_name].value);
- mb_printf("n[KB_OTA_Set]:lc_movie_type=%s",(mb_char_t*)pAttribs->parameters[lc_movie_type].value);
- mb_printf("n[KB_OTA_Set]:lc_movie_lcName=%s",(mb_char_t*)pAttribs->parameters[lc_movie_lcName].value);
- mb_printf("n[KB_OTA_Set]:lc_movie_funName=%s",(mb_char_t*)pAttribs->parameters[lc_movie_funName].value);
- mb_printf("n[KB_OTA_Set]:lc_event_type=%s",(mb_char_t*)pAttribs->parameters[lc_event_type].value);
- mb_printf("n[KB_OTA_Set]:lc_data1=%s",(mb_char_t*)pAttribs->parameters[lc_data1].value);
- mb_printf("n[KB_OTA_Set]:lc_data2=%s",(mb_char_t*)pAttribs->parameters[lc_data2].value);
- mb_printf("n[KB_OTA_Set]:lc_data3=%s",(mb_char_t*)pAttribs->parameters[lc_data3].value);
- mb_printf("n[KB_OTA_Set]:lc_data4=%s",(mb_char_t*)pAttribs->parameters[lc_data4].value);
- mb_printf("n[KB_OTA_Set]:lc_data5=%s",(mb_char_t*)pAttribs->parameters[lc_data5].value);
- #endif
- ota_para.freq = (UINT32)atoi((mb_char_t*)pAttribs->parameters[lc_data2].value)*1000;
- ota_para.Symb = (UINT32)atoi((mb_char_t*)pAttribs->parameters[lc_data3].value);
- ota_para.Qam = (UINT8)atoi((mb_char_t*)pAttribs->parameters[lc_data4].value);
- ota_para.PID= (UINT16)atoi((mb_char_t*)pAttribs->parameters[lc_data5].value);
- mb_printf("n[KB_OTA_Set]:%ld %ld %ld %ld",ota_para.freq, ota_para.Symb, ota_para.Qam, ota_para.PID);
- KB_DBSaveOtaPara(&ota_para);
- KB_Restart();
-
- }
- #endif
- #if 1 //系统信息界面,合3为1
- void KB_MB_lc_Factory_Reset(UINT32 word)
- {
- //char str1[3];
- mb_handle_t req_handle;
- mb_param_t reset_2_movie[8];
- kb_movie_struct_t current_movie_info;
- //int i;
- mb_error_t ret;
- reset_2_movie[0].name = KB_LC_PARA_INDEX_0;
- reset_2_movie[0].value = MOVIE_NAME_SYS_INFO;
- reset_2_movie[1].name = KB_LC_PARA_INDEX_1;
- reset_2_movie[1].value = MOVIE_TYPE_MOVIE_MENU;
- reset_2_movie[2].name = KB_LC_PARA_INDEX_2;
- reset_2_movie[2].value = MOVIE_MENU_SYS_INFO_CONNECTION;
- reset_2_movie[3].name = KB_LC_PARA_INDEX_3;
- reset_2_movie[3].value = MOVIE_MENU_SYS_INFO_FUNCTION;
- reset_2_movie[4].name = KB_LC_PARA_INDEX_4;
- reset_2_movie[4].value = EVENT_TYPE_SYS_INFO;
- reset_2_movie[5].name = KB_LC_PARA_INDEX_5;
- reset_2_movie[5].value = EVENT_SYS_INFO_TYPE_FACTORY_RESET;
- reset_2_movie[6].name = KB_LC_PARA_INDEX_6;
- if (word == 1)
- reset_2_movie[6].value= KB_LC_PARA_INIT_1;//初始化是否成功0失败1成功
- else
- reset_2_movie[6].value= KB_LC_PARA_INIT_0;
- reset_2_movie[7].name = NULL;
- reset_2_movie[7].value = NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret = mb_movie_lc_request_send( current_movie_info.movie,(mb_char_t*)MOVIE_MENU_SYS_INFO_CONNECTION, (mb_char_t*)MOVIE_MENU_SYS_INFO_FUNCTION, reset_2_movie, &req_handle);
- if (ret == MB_FAILURE)
- mb_printf("[Macblue] 向机顶盒发送初始化是否成功信息失败!");
- }
- #endif
- #if 1//Mail Message
- void KB_MB_lc_Set_Mail_Type(int mail_Type)
- {
- kb_mb_mail_type = mail_Type;
- }
- int KB_MB_lc_Get_Mail_Type(void)
- {
- return kb_mb_mail_type;
- }
- /**
- * Receive mail information to server,and send vote result to movie
- * @return none
- */
- void kb_machblue_lc_F_mail(kb_lc_attributes_t *pAttribs)
- {
- int message_Type;
- UINT32 word;
- //为了提高邮件的操作速度,用下述函数通知CAM进入邮件管理。
- //退出时调用TFCASTB_LeaveMailManager。zjm. 04/12/15
- //TFCASTB_EnterMailManager();
- //kb_email_test
- //TFCASTB_LeaveMailManager();//exit
-
- if(mb_strcmp((mb_char_t*)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_MAIL_TYPE_LIST)==0)
- message_Type = mail_list;
- else if(mb_strcmp((mb_char_t*)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_MAIL_TYPE_READ)==0)
- message_Type = mail_read;
- else if(mb_strcmp((mb_char_t*)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_MAIL_TYPE_DELETE)==0)
- message_Type = mail_delete;
- KB_MB_lc_Set_Mail_Type(message_Type);
- word = atoi((mb_char_t*)pAttribs->parameters[lc_data2].value);
- KB_MB_lc_2_movie_word_Post_Task(word);
- }
- /**
- * send mail information to server,and send vote result to movie
- * @return none
- */
- void kb_machblue_lc_2_mail(UINT32 word)
- {
- int message_Type;
-
-
- message_Type = KB_MB_lc_Get_Mail_Type();
- switch(message_Type)
- {
- case mail_list:
- kb_machblue_lc_2_mail_list(word);
- break;
- case mail_read:
- kb_machblue_lc_2_mail_read(word);
- break;
- case mail_delete:
- kb_machblue_lc_2_mail_delete(word);
- break;
- default:
- kb_machblue_lc_2_mail_list(word);
- break;
- }
- }
- void kb_machblue_lc_2_mail_list(UINT32 word)
- {
- int i,ret,mail_count = 0;
- char start_str1[5],start_str2[5],start_str3[5],start_str4[5],start_str5[5],start_str6[20];
- mb_param_t message_list[100];
- kb_movie_struct_t current_movie_info;
- mb_handle_t handle;
- time_t loc_time;
- int nYear,nMonth,nDay;
- STFCAEmailHead ArrEmailHead[10];
- BYTE byCount = 10;
- BYTE byFromIndex = 0;
-
- message_list[0].name=KB_LC_PARA_INDEX_0;
- message_list[0].value=MOVIE_NAME_MENU_MAIL;
- message_list[1].name=KB_LC_PARA_INDEX_1;
- message_list[1].value=MOVIE_TYPE_MOVIE_MENU;
- message_list[2].name=KB_LC_PARA_INDEX_2;
- message_list[2].value=MOVIE_MENU_MAIL_CONNECTION;
- message_list[3].name=KB_LC_PARA_INDEX_3;
- message_list[3].value=MOVIE_MENU_MAIL_FUNCTION;
- message_list[4].name=KB_LC_PARA_INDEX_4;
- message_list[4].value=EVENT_TYPE_MAIL_MESSAGE;
- message_list[5].name=KB_LC_PARA_INDEX_5;
- message_list[5].value=EVENT_MAIL_TYPE_LIST;
- message_list[6].name=KB_LC_PARA_INDEX_6;
- message_list[6].value=KB_LC_PARA_INIT_0;
- if(TFCASTB_GetEmailHeads(ArrEmailHead, &byCount, &byFromIndex) == TFCAS_OK)
- {
- for(i = 0; i<byCount; i++)
- {
- //STFCAEmailContent EmailContent;
- //printf("邮件ID = 0x%8xrn", ArrEmailHead[i].m_dwActionID);
- ArrEmailHead[i].m_szEmailHead[TFCA_MAXLEN_EMAIL_TITLE] = 0; //防止溢出+++
- //printf("邮件标题 = %srn", ArrEmailHead[i].m_szEmailHead);
- mb_memset(start_str1, 0x00,5);
- sprintf(start_str1,"%d",7+0+(i*4));
- message_list[7+0+(i*4)].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)message_list[7+0+(i*4)].name, (void*)start_str1, 5);
- message_list[7+0+(i*4)].value=(mb_char_t*)KB_MB_lc_getCommandBuf(32);
- mb_memcpy((void*)message_list[7+0+(i*4)].value, (void*)ArrEmailHead[i].m_szEmailHead, 32);
-
-
- mb_memset(start_str2, 0x00, 5);
- sprintf(start_str2,"%d",7+1+(i*4));
- message_list[7+1+(i*4)].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)message_list[7+1+(i*4)].name, (void*)start_str2, 5);
- loc_time = Time_2_Local_Tiem(ArrEmailHead[i].m_tCreateTime);
- //节目播放日期
- ConvertTimeStampToDate((U32)loc_time, (U32 *)&nYear, (U32 *)&nMonth, (U32 *)&nDay);
- mb_memset(start_str6, 0x00, 20);
- sprintf(start_str6,"%04d-%02d-%02d",nYear,nMonth, nDay);
- message_list[7+1+(i*4)].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
- mb_memcpy((void*)message_list[7+1+(i*4)].value, (void*)start_str6, 20);
-
- mb_memset(start_str3, 0x00, 5);
- sprintf(start_str3,"%d",7+2+(i*4));
- message_list[7+2+(i*4)].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)message_list[7+2+(i*4)].name, (void*)start_str3, 5);
- if (ArrEmailHead[i].m_wImportance == 0)
- message_list[7+(i*4)+2].value=KB_LC_PARA_INIT_0;
- else
- message_list[7+(i*4)+2].value=KB_LC_PARA_INIT_1;
-
- mb_memset(start_str4, 0x00, 5);
- sprintf(start_str4,"%d",7+3+(i*4));
- message_list[7+3+(i*4)].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)message_list[7+3+(i*4)].name, (void*)start_str4, 5);
- if(ArrEmailHead[i].m_bNewEmail == 0)
- message_list[7+(i*4)+3].value=KB_LC_PARA_INIT_0;
- else
- message_list[7+(i*4)+3].value=KB_LC_PARA_INIT_1;
- }
-
- mb_memset(start_str5, 0x00, 5);
- sprintf(start_str5,"%d",byCount*4+8);
- message_list[6].value=start_str5;
- mail_count = byCount;
- }
- mb_memset(start_str1, 0x00, 5);
- sprintf(start_str1,"%d",7+0+(mail_count*4));
- message_list[7+0+(mail_count*4)].name = NULL;
- message_list[7+0+(mail_count*4)].value = NULL;
-
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_MAIL_CONNECTION,MOVIE_MENU_MAIL_FUNCTION,message_list,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client send mail list error");
- }
- }
- //word mail index
- void kb_machblue_lc_2_mail_read(UINT32 word)
- {
- int ret;
- char start_str1[5];//,start_str2[32],start_str3[162];
- mb_param_t message_read[11];
- kb_movie_struct_t current_movie_info;
- mb_handle_t handle;
- //int i;
- //STFCAEmailHead mail_head;
- STFCAEmailContent EmailContent;
- STFCAEmailHead ArrEmailHead[10];
- BYTE byCount = 10;
- BYTE byFromIndex = 0;
-
- message_read[0].name=KB_LC_PARA_INDEX_0;
- message_read[0].value=MOVIE_NAME_MENU_MAIL;
- message_read[1].name=KB_LC_PARA_INDEX_1;
- message_read[1].value=MOVIE_TYPE_MOVIE_MENU;
- message_read[2].name=KB_LC_PARA_INDEX_2;
- message_read[2].value=MOVIE_MENU_MAIL_CONNECTION;
- message_read[3].name=KB_LC_PARA_INDEX_3;
- message_read[3].value=MOVIE_MENU_MAIL_FUNCTION;
- message_read[4].name=KB_LC_PARA_INDEX_4;
- message_read[4].value=EVENT_TYPE_MAIL_MESSAGE;
- message_read[5].name=KB_LC_PARA_INDEX_5;
- message_read[5].value=EVENT_MAIL_TYPE_READ;
- message_read[6].name=KB_LC_PARA_INDEX_6;
- mb_memset(start_str1, 0x00, 5);
- sprintf(start_str1,"%ld",word);
- //mb_printf("[machblue]kb_machblue_lc_2_mail_read:word = %d, str1 = %sn",word,start_str1);
- message_read[6].value = start_str1;
- message_read[7].name=KB_LC_PARA_INDEX_7;
- message_read[7].value=KB_LC_PARA_INIT_1;//read mail success or fail
- message_read[8].name=KB_LC_PARA_INDEX_8;
- message_read[8].value = " ";
- message_read[9].name=KB_LC_PARA_INDEX_9;
- message_read[9].value = " ";
- //mb_printf("nkb_machblue_lc_2_mail_read");
- if(TFCASTB_GetEmailHeads(ArrEmailHead, &byCount, &byFromIndex) == TFCAS_OK)
- {
- ArrEmailHead[word].m_szEmailHead[TFCA_MAXLEN_EMAIL_TITLE] = 0; //防止溢出+++
- //printf("邮件标题 = %srn", ArrEmailHead[word].m_szEmailHead);
- message_read[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(32);
- mb_memcpy((void*)message_read[8].value, (void*)ArrEmailHead[word].m_szEmailHead, 32);
- //message_read[8].value=mail_head.m_szEmailHead;
- if(TFCASTB_GetEmailContent(ArrEmailHead[word].m_dwActionID, &EmailContent)==TFCAS_OK)
- {
- message_read[7].value=KB_LC_PARA_INIT_1;
- EmailContent.m_szEmail[TFCA_MAXLEN_EMAIL_CONTENT] = 0;//防止溢出+++
- message_read[9].value=(mb_char_t*)KB_MB_lc_getCommandBuf(162);
- mb_memcpy((void*)message_read[9].value, (void*)EmailContent.m_szEmail, 162);
- //printf("邮件内容 = %srn", EmailContent.m_szEmail);
- }
- else
- {
- message_read[7].value = KB_LC_PARA_INIT_0;
- message_read[9].value = " ";
- }
- }
- message_read[10].name=NULL;
- message_read[10].value=NULL;
-
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_MAIL_CONNECTION,MOVIE_MENU_MAIL_FUNCTION,message_read,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:kb_machblue_lc_2_mail_read error");
- }
- mb_printf("n[Machblue]:kb_machblue_lc_2_mail_read over.");
- }
- //word mail index
- void kb_machblue_lc_2_mail_delete(UINT32 word)
- {
- int ret;
- char start_str1[30];
- mb_param_t message_delete[9];
- kb_movie_struct_t current_movie_info;
- mb_handle_t handle;
-
- message_delete[0].name=KB_LC_PARA_INDEX_0;
- message_delete[0].value=MOVIE_NAME_MENU_MAIL;
- message_delete[1].name=KB_LC_PARA_INDEX_1;
- message_delete[1].value=MOVIE_TYPE_MOVIE_MENU;
- message_delete[2].name=KB_LC_PARA_INDEX_2;
- message_delete[2].value=MOVIE_MENU_MAIL_CONNECTION;
- message_delete[3].name=KB_LC_PARA_INDEX_3;
- message_delete[3].value=MOVIE_MENU_MAIL_FUNCTION;
- message_delete[4].name=KB_LC_PARA_INDEX_4;
- message_delete[4].value=EVENT_TYPE_MAIL_MESSAGE;
- message_delete[5].name=KB_LC_PARA_INDEX_5;
- message_delete[5].value=EVENT_MAIL_TYPE_READ;
- message_delete[6].name=KB_LC_PARA_INDEX_6;
- mb_memset(start_str1, 0x00, 2);
- sprintf(start_str1,"%ld",word);
- message_delete[6].value = start_str1;
-
- message_delete[7].name=KB_LC_PARA_INDEX_7;
- message_delete[7].value=KB_LC_PARA_INIT_1;//delete mail success or fail
-
- message_delete[8].name=NULL;
- message_delete[8].value=NULL;
-
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_MAIL_CONNECTION,MOVIE_MENU_MAIL_FUNCTION,message_delete,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client delete mail list error");
- }
- }
- #endif
- #if 1
- void kb_machblue_lc_2_prompt(char* promt)
- {
- mb_error_t ret;
- kb_movie_struct_t current_movie_info;
- mb_param_t prompt_2_movie[7];
- mb_handle_t req_handle;
-
- prompt_2_movie[0].name = KB_LC_PARA_INDEX_0;
- prompt_2_movie[0].value = MOVIE_NAME_MENU_PROMPT;
- prompt_2_movie[1].name = KB_LC_PARA_INDEX_1;
- prompt_2_movie[1].value = MOVIE_TYPE_MOVIE_MENU;
- prompt_2_movie[2].name = KB_LC_PARA_INDEX_2;
- prompt_2_movie[2].value = MOVIE_MENU_PROMPT_CONNECTION;
- prompt_2_movie[3].name = KB_LC_PARA_INDEX_3;
- prompt_2_movie[3].value = MOVIE_MENU_PROMPT_FUNCTION;
- prompt_2_movie[4].name = KB_LC_PARA_INDEX_4;
- prompt_2_movie[4].value = EVENT_TYPE_MENU_PROMPT;
- prompt_2_movie[5].name = KB_LC_PARA_INDEX_5;
- prompt_2_movie[5].value=promt;
- prompt_2_movie[6].name = NULL;
- prompt_2_movie[6].value=NULL;
-
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_PROMPT_CONNECTION,MOVIE_MENU_PROMPT_FUNCTION,prompt_2_movie,&req_handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client epg init error");
- }
- else
- {
- mb_printf("n[Machblue]:Client epg init success");
- }
-
- }
- #endif
- #if 1//NVOD
- void kb_machblue_lc_F_NVOD(kb_lc_attributes_t *pAttribs)
- {
- int nPrgRow,nSchRow;
- BOOL ret;
- //int i;
- /*
- for (i=0;i<10;i++)
- {
- mb_printf("n[machblue]receive[%d] = %sn",i,(char *)pAttribs->parameters[i].value);
- }
- */
- //mb_printf("n[machblue]kb_machblue_lc_F_NVOD:nPrgRow = %s,nSchRow = %sn",(char *)pAttribs->parameters[lc_data3].value,(char *)pAttribs->parameters[lc_event_type+4].value);
- nPrgRow = atoi((char *)pAttribs->parameters[lc_data3].value);
- nSchRow = atoi((char *)pAttribs->parameters[lc_data4].value);
- //BOOL KB_NVOD_PlayForGrap(int nPrgCurRow, int nSchCurRow)
- //mb_printf("n[machblue]kb_machblue_lc_F_NVOD:nPrgRow = %d,nSchRow = %dn",nPrgRow,nSchRow);
- ret = KB_NVOD_PlayForGrap(nPrgRow, nSchRow);
- if (ret!=TRUE)
- KB_MB_lc_2_movie_word_Post_Task(0);
- }
- void kb_machblue_lc_2_NVOD(UINT32 word)
- {
- char start_str1[30];
- time_t plTime;
- mb_error_t ret;
- mb_param_t nvod[15];
- mb_handle_t handle;
- kb_movie_struct_t current_movie_info;
- //int i;
- //mb_printf("n[machblue]enter kb_machblue_lc_2_NVODn");
- nvod[0].name=KB_LC_PARA_INDEX_0;
- nvod[0].value=MOVIE_NAME_MENU_NVOD;
- nvod[1].name=KB_LC_PARA_INDEX_1;
- nvod[1].value=MOVIE_TYPE_MOVIE_MENU;
- nvod[2].name=KB_LC_PARA_INDEX_2;
- nvod[2].value=MOVIE_NVOD_CONNECTION;
- nvod[3].name=KB_LC_PARA_INDEX_3;
- nvod[3].value=MOVIE_NVOD_FUN_SELECTCH;
- nvod[4].name=KB_LC_PARA_INDEX_4;
- nvod[4].value=EVENT_TYPE_NVOD;
- nvod[5].name=KB_LC_PARA_INDEX_5;
- nvod[5].value=EVENT_TYPE_2_NVOD;
- nvod[6].name=KB_LC_PARA_INDEX_6;
- nvod[6].value=EVENT_TYPE_2_NVOD_S_F;
-
- nvod[7].name=KB_LC_PARA_INDEX_7;
- if (word != 1)
- nvod[7].value=KB_LC_PARA_INIT_0;//0失败1成功
- else
- nvod[7].value=KB_LC_PARA_INIT_1;
-
- KB_TimeGetCurTime(&plTime);
- mb_memset(start_str1, 0x00, 30);
- sprintf(start_str1,"%ld",plTime);
- nvod[8].name=KB_LC_PARA_INDEX_8;
- nvod[8].value = start_str1;
- nvod[9].name=KB_LC_PARA_INDEX_9;
- nvod[9].value=NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_NVOD_CONNECTION,MOVIE_NVOD_FUN_SELECTCH,nvod,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client init nvod fail!");
- }
-
- }
- #endif
- #if 1
- void kb_mb_ch_no_2_movie(UINT32 word)
- {
- mb_param_t channel_no[50];
- mb_handle_t handle;
- char str[5];
- kb_movie_struct_t current_movie_info;
- mb_error_t ret;
- int pro_type,pro_no;
- UINT16 pro_total;
-
- KB_DTVGetPrg(&pro_type,&pro_no);
-
- channel_no[0].name=KB_LC_PARA_INDEX_0;
- channel_no[0].value=MOVIE_NAME_MENU_CHANNEL_NO;
- channel_no[1].name=KB_LC_PARA_INDEX_1;
- channel_no[1].value=MOVIE_TYPE_MOVIE_MENU;
- channel_no[2].name=KB_LC_PARA_INDEX_2;
- channel_no[2].value=MOVIE_CH_NO_CONNECTION;
- channel_no[3].name=KB_LC_PARA_INDEX_3;
- channel_no[3].value=MOVIE_CH_NO_FUNCTION;
- channel_no[4].name=KB_LC_PARA_INDEX_4;
- channel_no[4].value=EVENT_TYPE_CH_NO;
- channel_no[5].name=KB_LC_PARA_INDEX_5;
- sprintf(str,"%ld",word);
- channel_no[5].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)channel_no[5].value, (void*)str, 5);
-
- channel_no[6].name=KB_LC_PARA_INDEX_6;
- pro_total = KB_DBGetPrgTotal(pro_type);
- sprintf(str,"%d",pro_total);
- channel_no[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)channel_no[6].value, (void*)str, 5);
-
- channel_no[7].name=NULL;
- channel_no[7].value=NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_CH_NO_CONNECTION,MOVIE_CH_NO_FUNCTION,channel_no,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:C code send information to movie error");
- }
- }
- void kb_mb_ch_no_F_movie(kb_lc_attributes_t *pAttribs)
- {
- int chan_no;
- int pro_type,pro_no;
- KB_DTVGetPrg(&pro_type,&pro_no);
- chan_no = atoi((char *)pAttribs->parameters[lc_data1].value);
- KB_DTVPlayPrg(pro_type, chan_no);
- //close movie
- kb_machblue_movie_close(TRUE);
- }
- #endif
- #if 1//ca inform
- void kb_machblue_lc_2_ca_inform(void)
- {
- mb_error_t ret;
- kb_movie_struct_t current_movie_info;
- mb_param_t ca_inform_2_movie[8];
- mb_handle_t req_handle;
- int ca_inform_flag;
- char* message;
- char str[5];
- message = Get_CA_Inform_flag(&ca_inform_flag);
- if (message == NULL)
- message = " ";
-
- ca_inform_2_movie[0].name = KB_LC_PARA_INDEX_0;
- ca_inform_2_movie[0].value = MOVIE_NAME_CA_INFORM;
- ca_inform_2_movie[1].name = KB_LC_PARA_INDEX_1;
- ca_inform_2_movie[1].value = MOVIE_TYPE_MOVIE_MENU;
- ca_inform_2_movie[2].name = KB_LC_PARA_INDEX_2;
- ca_inform_2_movie[2].value = MOVIE_CA_INFORM_CONNECTION;
- ca_inform_2_movie[3].name = KB_LC_PARA_INDEX_3;
- ca_inform_2_movie[3].value = MOVIE_CA_CON_INFORM_FUNCTION;
- ca_inform_2_movie[4].name = KB_LC_PARA_INDEX_4;
- ca_inform_2_movie[4].value = MOVIE_CA_CON_INFORM_FUNCTION;
- ca_inform_2_movie[5].name = KB_LC_PARA_INDEX_5;
- ca_inform_2_movie[5].value=message; //content
- ca_inform_2_movie[6].name = KB_LC_PARA_INDEX_6;
- mb_memset(str, 0x00, 5);
- sprintf(str,"%d",ca_inform_flag);
- ca_inform_2_movie[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)ca_inform_2_movie[6].value, (void*)str, 5);// 0 up 1 down 2 close up 3 close down
- ca_inform_2_movie[7].name = NULL;
- ca_inform_2_movie[7].value = NULL;
-
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_CA_INFORM_CONNECTION,MOVIE_CA_CON_INFORM_FUNCTION,ca_inform_2_movie,&req_handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client epg init error");
- }
- else
- {
- mb_printf("n[Machblue]:Client epg init success");
- }
-
- }
- #endif
- //add by shriek
- //extern void OTA_lc_Service (KB_OSPMsgNode *pMsg);
- void kb_machblue_lc_F_otahint(kb_lc_attributes_t *pAttribs)
- {
- //int ota_info;
- KB_OSPMsgNode MsgCaClient;
- mb_printf("n[kb_machblue_lc_F_otahint]:lc_movie_name=%s",(mb_char_t*)pAttribs->parameters[lc_movie_name].value);
- mb_printf("n[kb_machblue_lc_F_otahint]:lc_movie_type=%s",(mb_char_t*)pAttribs->parameters[lc_movie_type].value);
- mb_printf("n[kb_machblue_lc_F_otahint]:lc_movie_lcName=%s",(mb_char_t*)pAttribs->parameters[lc_movie_lcName].value);
- mb_printf("n[kb_machblue_lc_F_otahint]:lc_movie_funName=%s",(mb_char_t*)pAttribs->parameters[lc_movie_funName].value);
- mb_printf("n[kb_machblue_lc_F_otahint]:lc_event_type=%s",(mb_char_t*)pAttribs->parameters[lc_event_type].value);
- mb_printf("n[kb_machblue_lc_F_otahint]:lc_data1=%s",(mb_char_t*)pAttribs->parameters[lc_data1].value);
- mb_printf("n[kb_machblue_lc_F_otahint]:lc_data2=%s",(mb_char_t*)pAttribs->parameters[lc_data2].value);
-
- //空中升级
- if(mb_strcmp((mb_char_t*)pAttribs->parameters[lc_event_type+1].value,(mb_char_t*)MOVIE_TYPE_MOVIE_OTA_QUERY)==0)
- {
- printf("n kb_machblue_lc_F_otahint: to send return key to ota modules");
- //kb_machblue_movie_close(TRUE);
- MsgCaClient.Word1 = atoi((mb_char_t*)pAttribs->parameters[lc_data2].value);
- //OTA_lc_Service (&MsgCaClient);
- }
-
- }
- void KB_MB_lc_OTA_hint_2_movie(char *hint)
- {
- mb_error_t ret;
- kb_movie_struct_t current_movie_info;
- mb_param_t prompt_2_movie[7];
- mb_handle_t req_handle;
- //int i;
- printf("n KB_MB_lc_OTA_hint_2_movie: %s", hint);
-
- prompt_2_movie[0].name = KB_LC_PARA_INDEX_0;
- prompt_2_movie[0].value = MOVIE_NAME_MENU_OTA_HINT;
- prompt_2_movie[1].name = KB_LC_PARA_INDEX_1;
- prompt_2_movie[1].value = MOVIE_TYPE_MOVIE_MENU;
- prompt_2_movie[2].name = KB_LC_PARA_INDEX_2;
- prompt_2_movie[2].value = MOVIE_MENU_OTA_HINT_CONNECTION;
- prompt_2_movie[3].name = KB_LC_PARA_INDEX_3;
- prompt_2_movie[3].value = MOVIE_MENU_OTA_HINT_FUNCTION;
- prompt_2_movie[4].name = KB_LC_PARA_INDEX_4;
- prompt_2_movie[4].value = EVENT_TYPE_MENU_PROMPT;
- prompt_2_movie[5].name = KB_LC_PARA_INDEX_5;
- prompt_2_movie[5].value= hint;
- prompt_2_movie[6].name = NULL;
- prompt_2_movie[6].value=NULL;
- //for(i=0;i<7;i++) printf("n name[%d]=%s value[%d]=%s", i,prompt_2_movie[i].name, i, prompt_2_movie[i].value);
-
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_OTA_HINT_CONNECTION,MOVIE_MENU_OTA_HINT_FUNCTION,prompt_2_movie,&req_handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client ota init error");
- }
- else
- {
- mb_printf("n[Machblue]:Client ota init success");
- }
-
-
- }
- #if 1
- //频道编辑接口
- void kb_machblue_lc_Dtvpgm_test(unsigned char dtv_type)
- {
- int i;
-
- for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
- {
- printf("n kb_machblue_lc_Dtvpgm_test: %s", _kb_mb_serviceList[dtv_type].services[i].info.name);
- }
- }
- typedef struct
- {
- UINT16 mb_tsid;
- UINT16 mb_svcid;
- mb_char_t logo_url[5];
- mb_char_t name[MB_TV_SERVICE_NAME_LENGTH];
- } mb_tv_chledit_info_s;
- typedef struct
- {
- mb_tv_chledit_info_s *services;
- unsigned long count;
- }kb_chledit_infoList_s;
- kb_chledit_infoList_s _kb_chledit_List[list_last];
- mb_error_t kb_mb_chledit_list_clear(void)
- {
- unsigned short index;
- //clear tvlist
- for(index=0;index<_kb_chledit_List[all_tv_list].count;index++)
- {
- mb_memset(&(_kb_chledit_List[all_tv_list].services[index]),0,sizeof(mb_tv_chledit_info_s));
- }
-
- mb_free(_kb_chledit_List[all_tv_list].services);
- mb_memset(&(_kb_chledit_List[all_tv_list]),0,sizeof(kb_chledit_infoList_s));
- //clear radio list
- for(index=0;index<_kb_chledit_List[radio_list].count;index++)
- {
- mb_memset(&(_kb_chledit_List[radio_list].services[index]),0,sizeof(mb_tv_chledit_info_s));
- }
- mb_free(_kb_chledit_List[radio_list].services);
- mb_memset(&(_kb_chledit_List[radio_list]),0,sizeof(kb_chledit_infoList_s));
- return MB_SUCCESS;
- }
- static mb_error_t kb_mb_chledit_list_all_tv_init(void)
- {
- unsigned short videoCnt=0,index;
- UINT16 service_ID;
- unsigned char *service_name;
- _kb_chledit_List[all_tv_list].services=NULL;
- _kb_chledit_List[all_tv_list].count=0;
- videoCnt=KB_DBGetPrgTotal(DTVPRG);
- if(videoCnt==0)
- return MB_SUCCESS;
- //malloc service memory
- _kb_chledit_List[all_tv_list].services=mb_malloc(sizeof(mb_tv_chledit_info_s)*videoCnt);
- if(_kb_chledit_List[all_tv_list].services==NULL)
- {
- mb_printf("n[Machblue]:Service list 1 init no memory.");
- return MB_FAILURE;
- }
- mb_memset(_kb_chledit_List[all_tv_list].services,0,sizeof(mb_tv_chledit_info_s)*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_chledit_List[all_tv_list].services[index].mb_svcid = service_ID;
- _kb_chledit_List[all_tv_list].services[index].mb_tsid = KB_DBGetPrgTsID(DTVPRG,index+1);
- mb_memcpy(_kb_chledit_List[all_tv_list].services[index].name, service_name,MB_TV_SERVICE_NAME_LENGTH);
- mb_memcpy(_kb_chledit_List[all_tv_list].services[index].logo_url, "0000 ",5);
- //service count
- _kb_chledit_List[all_tv_list].count+=1;
- }
- return MB_SUCCESS;
- }
- static mb_error_t kb_mb_chledit_list_all_radio_init(void)
- {
- unsigned short audioCnt=0,index;
- UINT16 service_ID;
- unsigned char *service_name;
- _kb_chledit_List[radio_list].services=NULL;
- _kb_chledit_List[radio_list].count=0;
- audioCnt=KB_DBGetPrgTotal(RADIOPRG);
- if(audioCnt==0)
- return MB_SUCCESS;
- //malloc service memory
- _kb_chledit_List[radio_list].services=mb_malloc(sizeof(mb_tv_chledit_info_s)*audioCnt);
- if(_kb_chledit_List[radio_list].services==NULL)
- {
- mb_printf("n[Machblue]:Service list 1 init no memory.");
- return MB_FAILURE;
- }
- mb_memset(_kb_chledit_List[radio_list].services,0,sizeof(mb_tv_chledit_info_s)*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_chledit_List[radio_list].services[index].mb_svcid = service_ID;
- _kb_chledit_List[radio_list].services[index].mb_tsid = KB_DBGetPrgTsID(RADIOPRG,index+1);
- mb_memcpy(_kb_chledit_List[radio_list].services[index].name, service_name,MB_TV_SERVICE_NAME_LENGTH);
- mb_memcpy(_kb_chledit_List[radio_list].services[index].logo_url, "0000 ",5);
- //service count
- _kb_chledit_List[radio_list].count+=1;
- }
- return MB_SUCCESS;
- }
- /**
- * This function init the channel edit service list information.
- * @return MB_SUCCESS on success, MB_FAILURE on failure.
- */
- mb_error_t kb_mb_chledit_list_init(void)
- {
- kb_mb_chledit_list_all_tv_init();
- kb_mb_chledit_list_all_radio_init();
- return MB_SUCCESS;
- }
- mb_error_t kb_mb_chledit_list_reset(void)
- {
- //clear
- kb_mb_chledit_list_clear();
-
- //add
- kb_mb_chledit_list_init();
- return MB_SUCCESS;
- }
- mb_error_t kb_mb_chledit_list_test(void)
- {
- int i;
- for(i=0;i<_kb_chledit_List[all_tv_list].count;i++)
- {
- printf("n [chledit_list_test]-name = %s mb_svcid = %x mb_tsid=%x",_kb_chledit_List[all_tv_list].services[i].name, _kb_chledit_List[all_tv_list].services[i].mb_svcid, _kb_chledit_List[all_tv_list].services[i].mb_tsid);
- }
-
- return MB_SUCCESS;
- }
- /**
- * kb_machblue_lc_Channel_Fake_Operate
-
- * attribs < parameter to search service >
-
- * @return none
- */
- void kb_machblue_lc_Channel_Fake_Operate(unsigned char dtv_type, kb_lc_attributes_t *attribs)
- {
- int index;
- unsigned char operate;
- index = atoi((mb_char_t*)attribs->parameters[lc_data3].value);
- operate = atoi((mb_char_t*)attribs->parameters[lc_data4].value);
- mb_printf("n kb_machblue_lc_Channel_Fake_Operate: index=%d operate=%d nn", index, operate);
- if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_Fav)==0)
- {
- _kb_mb_serviceList[dtv_type].services[index].serInfo.edit_info.favor= operate;
- }
- else if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_MOVE)==0)
- {
- _kb_mb_serviceList[dtv_type].services[index].serInfo.edit_info.move= operate;
- }
- else if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_DEL)==0)
- {
- _kb_mb_serviceList[dtv_type].services[index].serInfo.edit_info.del= operate;
- }
- else if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_LOCK)==0)
- {
- _kb_mb_serviceList[dtv_type].services[index].serInfo.edit_info.lock= operate;
- }
-
- }
- /**
- * kb_machblue_lc_Channel_edit_proc
-
- * attribs < parameter to search service >
-
- * @return none
- */
- void kb_machblue_lc_Channel_edit_proc(kb_lc_attributes_t *attribs)
- {
- //UINT edit_type;
- mb_printf("n Channel_edit_proc: %s %s %s %s",(mb_char_t*)attribs->parameters[lc_data1].value, (mb_char_t*)attribs->parameters[lc_data2].value, (mb_char_t*)attribs->parameters[lc_data3].value, (mb_char_t*)attribs->parameters[lc_data4].value);
-
- if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data1].value, EVENT_SEARCH_TYPE_CHA_EDIT)==0)
- {
- if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_SAVE)==0)
- {
- kb_machblue_lc_Channel_Save_Allproc(all_tv_list, atoi((mb_char_t*)attribs->parameters[lc_data3].value));
- }
- else if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_NONE)==0)
- {
- mb_printf("n no edit to be save");
- }
- else
- {
- mb_printf("n edit operate is:%s", (mb_char_t*)attribs->parameters[lc_data2].value);
- kb_machblue_lc_Channel_Fake_Operate(all_tv_list, attribs);
- }
- }
-
- }
- /**
- * kb_machblue_lc_Channel_Save_Allproc
-
- * attribs < parameter to search service >
-
- * @return none
- */
- void kb_machblue_lc_Channel_Save_Allproc(unsigned char dtv_type, unsigned int flag)
- {
- int i;
- UINT16 mb_tsid;
- UINT16 mb_svcid;
- //mb_printf("nn------test1 start-----");
- //kb_machblue_lc_editinfo_test(all_tv_list); //test only
- //kb_DB_Dtvpgm_test();
- //kb_machblue_lc_Dtvpgm_test(all_tv_list);
- //mb_printf("n------test1 end-----nn");
-
-
- //确定修改
- if(flag==1)
- {
- mb_printf("n kb_machblue_lc_Channel_Save_Allproc: user select to save edit");
- for(i=0; i<_kb_mb_serviceList[dtv_type].count; i++)
- {
- mb_tsid = _kb_mb_serviceList[dtv_type].services[i].serInfo.tsID;
- mb_svcid = _kb_mb_serviceList[dtv_type].services[i].info.display_id;
-
- //delete operation
- if(_kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del==1)
- {
- kb_machblue_lc_editinfo_update(dtv_type, i, MB_DELETE, 1);
- mb_printf("n progm[%d] : %s be deleted!--mb_tsid=%x mb_svcid=%x", i, _kb_mb_serviceList[0].services[i].info.name, mb_tsid, mb_svcid);
- KB_DBDelPrgInfoByTsidSrvid(dtv_type, mb_tsid, mb_svcid);
- continue;
- }
-
- //favor operation
- if(_kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor==1)
- {
- kb_machblue_lc_editinfo_update(dtv_type, i, MB_FAVOR, 1);
- KB_DBAddFavPrg(dtv_type, mb_tsid, mb_svcid);
- //mb_printf("n progm[%d] : %s be favored!--mb_tsid=%x mb_svcid=%x", i, _kb_mb_serviceList[0].services[i].info.name, mb_tsid, mb_svcid);
- }
- else
- {
- kb_machblue_lc_editinfo_update(dtv_type, i, MB_FAVOR, 0);
- KB_DBDelFavPrg(dtv_type, mb_tsid, mb_svcid );
- }
-
- //lock operation
- if(_kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock==1)
- {
- mb_printf("n progm[%d] : %s be locked!--mb_tsid=%x mb_svcid=%x", i, _kb_mb_serviceList[0].services[i].info.name, mb_tsid, mb_svcid);
- kb_machblue_lc_editinfo_update(dtv_type, i, MB_LOCK, 1);
- KB_DBLockSrv(dtv_type, i);
- }
- else
- {
- kb_machblue_lc_editinfo_update(dtv_type, i, MB_LOCK, 0);
- KB_DBUnlockSrv(dtv_type, i);
- }
-
-
- }
- mb_printf("nn------test2 start-----");
- //kb_DB_Dtvpgm_test();
- //保存节目
- KB_DBSaveToFlash();
-
- //重新构造macblue 节目列表
- kb_mb_service_list_reset();
- kb_mb_editinfo_reinit();
-
- //kb_machblue_lc_Dtvpgm_test(all_tv_list);
- //kb_machblue_lc_editinfo_test(all_tv_list); //test only
- //KB_DBFavTest();
- mb_printf("n------test2 end----nn-");
- }
- //放弃修改
- else//(flag == 0)
- {
- mb_printf("n kb_machblue_lc_Channel_Save_Allproc: user select to giveup edit");
- }
- }
- //shriek end
- void kb_machblue_lc_editinfo_update(unsigned char dtv_type, unsigned int index, unsigned char flag, unsigned char value)
- {
- char c;
-
- if(flag>4||flag<0)
- return;
- if(value==1)
- {
- c = '1';
- _kb_chledit_List[dtv_type].services[index].logo_url[flag] = c;
- }
- else
- {
- c = '0';
- _kb_chledit_List[dtv_type].services[index].logo_url[flag] =c ;
- }
- _kb_chledit_List[dtv_type].services[index].logo_url[4] = ' ';
-
- }
- mb_error_t kb_mb_editinfo_init(void)
- {
- kb_mb_chledit_list_init();
- kb_mb_editinfo_load();
- return MB_SUCCESS;
- }
- mb_error_t kb_mb_editinfo_load(void)
- {
- int i,j, dtv_type;
- UINT16 mb_tsid;
- UINT16 mb_svcid;
- KB_DBFavDtvInfo FavDtvInfo;
- KB_DBFavRadInfo RadInfo;
- char c0,c1;
- bool dtv_found=false;
- bool radio_found=false;
- c0='0';
- c1='1';
-
- //logo_url load
- for(dtv_type=all_tv_list; dtv_type<=radio_list; dtv_type++)
- {
- for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
- {
- mb_tsid = _kb_mb_serviceList[dtv_type].services[i].serInfo.tsID;
- mb_svcid = _kb_mb_serviceList[dtv_type].services[i].info.display_id;
- if(dtv_type== all_tv_list)
- {
- //favor dtv load
- KB_DBGetFavPrgInfoInE2p(all_tv_list, (KB_DBFavDtvInfo*)&FavDtvInfo);
- if(FavDtvInfo.nTotal==0)
- break;
- for (j= 0; j< FavDtvInfo.nTotal; j++)
- {
- if(FavDtvInfo.FavList[j].SrvId==mb_svcid&&FavDtvInfo.FavList[j].TsId==mb_tsid)
- {
- _kb_mb_serviceList[dtv_type].services[i].info.logo_url[0]=c1;
- dtv_found = true;
- }
- }
- if(!dtv_found)
- {
- printf("n no dtv favor found");
- }
- //lock dtv load
- if(KB_DBIsSrvLocked(all_tv_list, i))
- {
- _kb_mb_serviceList[all_tv_list].services[i].info.logo_url[3]=c1;
- }
-
- }
- else if(dtv_type==radio_list)
- {
- //favor radio load
- KB_DBGetFavPrgInfoInE2p(radio_list, &RadInfo);
- if(RadInfo.nTotal==0)
- break;
- for (j= 0; j< RadInfo.nTotal; j++)
- {
- if(RadInfo.FavList[j].SrvId==mb_svcid&&RadInfo.FavList[j].TsId==mb_tsid)
- {
- _kb_mb_serviceList[dtv_type].services[i].info.logo_url[0]=c1;
- radio_found = true;
- }
- }
- if(!radio_found)
- {
- printf("n no radio favor found");
- }
- //lock dtv load
- if(KB_DBIsSrvLocked(radio_list, i))
- {
- _kb_mb_serviceList[radio_list].services[i].info.logo_url[3]=c1;
- }
-
- }
- }
- }
-
- //fake operate info load
- for(dtv_type=all_tv_list; dtv_type<=radio_list; dtv_type++)
- {
- for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
- {
- if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[0]=='1')
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor=1;
- else
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor=0;
- if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[1]=='1')
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.move=1;
- else
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.move=0;
- if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[2]=='1')
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del=1;
- else
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del=0;
- if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[3]=='1')
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock=1;
- else
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock=0;
-
- }
-
- }
- return MB_SUCCESS;
-
- }
- mb_error_t kb_mb_editinfo_reload(void)
- {
- int i,j, dtv_type;
- UINT16 mb_tsid;
- UINT16 mb_svcid;
- //logo_url reload
- for(dtv_type=all_tv_list; dtv_type<=radio_list; dtv_type++)
- {
- for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
- {
- mb_tsid = _kb_mb_serviceList[dtv_type].services[i].serInfo.tsID;
- mb_svcid = _kb_mb_serviceList[dtv_type].services[i].info.display_id;
-
- for(j=0;j<_kb_chledit_List[dtv_type].count;j++)
- {
- if(mb_tsid==_kb_chledit_List[dtv_type].services[j].mb_tsid&&mb_svcid==_kb_chledit_List[dtv_type].services[j].mb_svcid)
- {
- mb_memcpy(_kb_mb_serviceList[dtv_type].services[i].info.logo_url, _kb_chledit_List[dtv_type].services[j].logo_url, 5);
- break;
- }
- }
- if(j==_kb_chledit_List[dtv_type].count)
- return MB_FAILURE;
- }
- }
-
- //fake operate info reload
- for(dtv_type=all_tv_list; dtv_type<=radio_list; dtv_type++)
- {
- for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
- {
- if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[0]=='1')
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor=1;
- else
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor=0;
- if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[1]=='1')
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.move=1;
- else
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.move=0;
- if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[2]=='1')
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del=1;
- else
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del=0;
- if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[3]=='1')
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock=1;
- else
- _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock=0;
-
- }
-
- }
- return MB_SUCCESS;
-
- }
- void kb_mb_editinfo_reinit(void)
- {
- if(kb_mb_editinfo_reload()==MB_SUCCESS)
- {
- kb_mb_chledit_list_reset();
- }
- else
- {
- mb_printf("n kb_mb_editinfo_reload falure");
- }
- }
- void kb_machblue_lc_editinfo_test(unsigned char dtv_type)
- {
- int i;
- for(i=0; i<_kb_chledit_List[dtv_type].count; i++)
- {
- printf("nn chledit_logo_url: favor=%c lock=%c", _kb_chledit_List[dtv_type].services[i].logo_url[0], _kb_chledit_List[dtv_type].services[i].logo_url[3]);
- }
- printf("n---------------next url-------------------n");
- printf("n serviceList_logo_url: logo_url=%s", _kb_mb_serviceList[dtv_type].services[i].info.logo_url);
- for(i=0; i<_kb_mb_serviceList[dtv_type].count; i++)
- {
- printf("nn serviceList_logo_url: favor=%c lock=%c", _kb_mb_serviceList[dtv_type].services[i].info.logo_url[0], _kb_mb_serviceList[dtv_type].services[i].info.logo_url[3]);
- }
- }
- //shriek end
- #endif
- //shriek end
- void kb_machblue_lc_menu_noRadioList(KB_DBPRGType type)
- {
- mb_error_t ret;
- mb_param_t para[6];
- mb_handle_t handle;
- kb_movie_struct_t current_movie_info;
-
- para[0].name=KB_LC_PARA_INDEX_0;
- para[0].value=MOVIE_NAME_MENU_MAIN;
- para[1].name=KB_LC_PARA_INDEX_1;
- para[1].value=MOVIE_TYPE_MOVIE_MENU;
- para[2].name=KB_LC_PARA_INDEX_2;
- para[2].value="_mainConnect_connection";
- para[3].name=KB_LC_PARA_INDEX_3;
- para[3].value="receive_func";
- para[4].name=KB_LC_PARA_INDEX_4;
- switch(type)
- {
- case DTVPRG:
- para[4].value="0";
- break;
- case RADIOPRG:
- para[4].value="1";
- break;
- }
- para[5].name=NULL;
- para[5].value=NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,"_mainConnect_connection","receive_func",para,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client epg init error");
- }
- else
- mb_printf("nkb_machblue_lc_menu_noRadioList");
- }
- /***
- 新代码
- ***/
- /***
- 搜索页面
- ***/
- //从搜索页面接收到消息,并根据消息来确定需要做那些操作
- void kb_getInfoFSearchMenu(kb_lc_attributes_t *pAttribs)
- {
- if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_SEARCH_1))
- {
- unsigned char searchType;
- int frequency1,frequency2;
- T_SEARCH_PARA *searchApp;
- KB_DMDTunerParameters gSearchFre;
-
- searchType = atoi((char *)pAttribs->parameters[lc_data2].value);
- frequency1 = atoi((char *)pAttribs->parameters[lc_data3].value);
- KB_EPG_ResetSchInfoByTsid(0xFFFF);
- KB_DTVStopAV();
- KD_ResetCurPrgInfo();
- mb_printf("nenter the functionkb_getInfoFSearchMenun");
- if(searchType==1)
- {
- //自动搜索
- gSearchFre.frequency=frequency1*1000;
- gSearchFre.details.qam.symbolRatekSs=6875;
- gSearchFre.details.qam.modulation=3;
- KB_SEARCHSetPara(KB_SEARCH_IN_NET, gSearchFre.frequency, gSearchFre.details.qam.symbolRatekSs, gSearchFre.details.qam.modulation);
- }
- else if(searchType==2)
- {
- //手动搜索
- searchApp=KB_SrchGetSrchApp();
- searchApp->srchMode=(UINT8)KB_SEARCH_IN_TS;//手动
- searchApp->tsParams.frequency= (UINT32)frequency1*1000;
- }
- else if(searchType==3)
- {
- //全频点搜索
- frequency2 = atoi((char *)pAttribs->parameters[lc_data4].value);
- KB_SEARCHSetPara(KB_SEARCH_IN_WHOLE_NET, gSearchFre.frequency, gSearchFre.details.qam.symbolRatekSs, gSearchFre.details.qam.modulation);
- KB_DBClearAllProg();
- }
- STB_StateSwitch(State_SRCH);
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_SEARCH_2))
- {
- }
- }
- //发送关于搜索结果页面上的信息给影片
- extern KB_DBPrgAllInfo gPrgAllInfo;
- void kb_searchResult2Movie(UINT32 word)
- {
- char resultString[5];
- int tvNum,radioNum,frequency;
- UINT8 nvodNum;
- mb_error_t ret;
- mb_handle_t reqHandle;
- mb_param_t searchResult2Movie[15];
- kb_movie_struct_t currentMovieInfo;
- searchResult2Movie[0].name = KB_LC_PARA_INDEX_0;
- searchResult2Movie[0].value = MOVIE_NAME_MENU_SEARCH;
- searchResult2Movie[1].name = KB_LC_PARA_INDEX_1;
- searchResult2Movie[1].value = MOVIE_TYPE_MOVIE_MENU;
- searchResult2Movie[2].name = KB_LC_PARA_INDEX_2;
- searchResult2Movie[2].value = KB_DTV_LC_NAME;
- searchResult2Movie[3].name = KB_LC_PARA_INDEX_3;
- searchResult2Movie[3].value = KB_DTV_LC_FUNCTION;
- searchResult2Movie[4].name = KB_LC_PARA_INDEX_4;
- searchResult2Movie[4].value = EVENT_TYPE_SEARCH;
- searchResult2Movie[5].name = KB_LC_PARA_INDEX_5;
- searchResult2Movie[5].value = EVENT_SUB_TYPE_SEARCH_1;
- //搜索是否成功0 失败1 成功
- searchResult2Movie[6].name = KB_LC_PARA_INDEX_6;
- searchResult2Movie[6].value = "1";
- //搜索是否完成0 没有完成1 完成
- searchResult2Movie[7].name = KB_LC_PARA_INDEX_7;
- searchResult2Movie[7].value = "0";
- mb_printf("n[kb_searchResult2Movie] the word is %ld",word);
- switch(word)
- {
- case KB_SEARCH_HINT0:
- case KB_SEARCH_HINT1:
- case KB_SEARCH_HINT2:
- case KB_SEARCH_HINT3:
- case KB_SEARCH_HINT4:
- case KB_SEARCH_HINT5:
- case KB_SEARCH_DISABLED:
- //搜索失败
- searchResult2Movie[6].value = "0";
- searchResult2Movie[8].name = NULL;
- searchResult2Movie[8].value = NULL;
- KB_SEARCHDestroy();
- break;
- //case KB_SEARCH_HINT6:
- // break;
- case KB_SEARCH_HINT7:
- //所有频点搜索完毕
- break;
- case KB_SEARCH_HINT8:
- case KB_SEARCH_HINT9:
- case KB_SEARCH_HINT10:
- //搜索完成,并保存完毕
- searchResult2Movie[7].value = "1";
- searchResult2Movie[8].name = NULL;
- searchResult2Movie[8].value = NULL;
- KB_SEARCHDestroy();
- kb_mb_service_list_resetEx();
- break;
- case KB_SEARCH_HINT6:
- default:
- {
- //正在搜索
- frequency = word/10;
- tvNum = get_dtv_num();
- radioNum = get_radio_num();
- nvodNum = KB_DBGetNvodNum();
-
- searchResult2Movie[8].name = KB_LC_PARA_INDEX_8;
- mb_memset(resultString, 0x00, 5);
- sprintf( resultString, "%d", frequency) ;
- searchResult2Movie[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)searchResult2Movie[8].value, (void*)resultString, 5);
- if(frequency>100)
- {
- searchResult2Movie[9].name = NULL;
- searchResult2Movie[9].value = NULL;
- break;
- }
- searchResult2Movie[9].name = KB_LC_PARA_INDEX_9;
- mb_memset(resultString, 0x00, 5);
- sprintf( resultString, "%d", tvNum) ;
- searchResult2Movie[9].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)searchResult2Movie[9].value, (void*)resultString, 5);
- searchResult2Movie[10].name = KB_LC_PARA_INDEX_10;
- mb_memset(resultString, 0x00, 5);
- sprintf( resultString, "%d", radioNum) ;
- searchResult2Movie[10].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)searchResult2Movie[10].value, (void*)resultString, 5);
- searchResult2Movie[11].name = KB_LC_PARA_INDEX_11;
- mb_memset(resultString, 0x00, 5);
- sprintf( resultString, "%d", nvodNum) ;
- searchResult2Movie[11].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)searchResult2Movie[11].value, (void*)resultString, 5);
- searchResult2Movie[12].name = NULL;
- searchResult2Movie[12].value = NULL;
-
- }
- break;
- }
- kb_machblue_getCurMovieInfo(¤tMovieInfo);
- ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)searchResult2Movie[2].value,(mb_char_t*)searchResult2Movie[3].value, searchResult2Movie, &reqHandle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[kb_searchResult2Movie]向影片发送信息失败n");
- }
- }
- void kb_pfGot(UINT32 word)
- {
- mb_error_t ret;
- mb_handle_t handle;
- mb_param_t para[8] = {0};
- kb_movie_struct_t current_movie_info;
- para[0].name=KB_LC_PARA_INDEX_0;
- para[0].value=MOVIE_NAME_MENU_PF;
- para[1].name=KB_LC_PARA_INDEX_1;
- para[1].value=MOVIE_TYPE_MOVIE_MENU;
- para[2].name=KB_LC_PARA_INDEX_2;
- para[2].value=KB_DTV_LC_NAME;
- para[3].name=KB_LC_PARA_INDEX_3;
- para[3].value=KB_DTV_LC_FUNCTION;
- para[4].name=KB_LC_PARA_INDEX_4;
- para[4].value=EVENT_TYPE_PF;
- para[5].name=KB_LC_PARA_INDEX_5;
- mb_printf("nthe word is %d",word);
- if(word==1)
- para[5].value = "1";
- else
- para[5].value = "0";
- para[6].name=NULL;
- para[6].value=NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,para,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client epg send current service id to menu_pf error.");
- }
- }
- void kb_sysInfo(void)
- {
- mb_error_t ret;
- mb_handle_t handle;
- mb_param_t para[10] = {0};
- kb_movie_struct_t current_movie_info;
- KB_DBSTBInfo stbinfo;
-
- para[0].name=KB_LC_PARA_INDEX_0;
- para[0].value=MOVIE_NAME_SYS_INFO;
- para[1].name=KB_LC_PARA_INDEX_1;
- para[1].value=MOVIE_TYPE_MOVIE_MENU;
- para[2].name=KB_LC_PARA_INDEX_2;
- para[2].value=KB_DTV_LC_NAME;
- para[3].name=KB_LC_PARA_INDEX_3;
- para[3].value=KB_DTV_LC_FUNCTION;
- para[4].name=KB_LC_PARA_INDEX_4;
- para[4].value=EVENT_SYS_INFO;
- KB_DBGetSTBInfo(&stbinfo);
- para[5].name=KB_LC_PARA_INDEX_5;
- para[5].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
- mb_memcpy((void*)para[5].value, (void*)stbinfo.STB_Model, 20);
- para[6].name=KB_LC_PARA_INDEX_6;
- para[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
- mb_memcpy((void*)para[6].value, (void*)stbinfo.HW_Info, 20);
- para[7].name=KB_LC_PARA_INDEX_7;
- para[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
- mb_memcpy((void*)para[7].value, (void*)stbinfo.SW_Info, 20);
- para[8].name=KB_LC_PARA_INDEX_8;
- para[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
- mb_memcpy((void*)para[8].value, (void*)stbinfo.Manufacturer, 20);
- para[9].name=NULL;
- para[9].value=NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,para,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:send information to sys info page error");
- }
- }
- void kb_volumeMuteFlag(void)
- {
- mb_error_t ret;
- mb_handle_t handle;
- mb_param_t para[8] = {0};
- kb_movie_struct_t current_movie_info;
- para[0].name=KB_LC_PARA_INDEX_0;
- para[0].value=MOVIE_NAME_SOUND_MUTE;
- para[1].name=KB_LC_PARA_INDEX_1;
- para[1].value=MOVIE_TYPE_MOVIE_MENU;
- para[2].name=KB_LC_PARA_INDEX_2;
- para[2].value=KB_DTV_LC_NAME;
- para[3].name=KB_LC_PARA_INDEX_3;
- para[3].value=KB_DTV_LC_FUNCTION;
- para[4].name=KB_LC_PARA_INDEX_4;
- para[4].value=EVENT_TYPE_MENU_SOUND;
- para[5].name=KB_LC_PARA_INDEX_5;
- para[5].value = EVENT_SOUND_SUBTYPE_2;
- para[6].name=KB_LC_PARA_INDEX_6;
- if(KB_DTVGetMuteFlag())
- {
- para[6].value = "1";
- }
- else
- {
- para[6].value = "0";
- }
- para[7].name=NULL;
- para[7].value=NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,para,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client epg send current service id to menu_pf error.");
- }
- }
- void kb_volumeTrack(void)
- {
- char str[5];
- mb_error_t ret;
- mb_handle_t handle;
- mb_param_t para[10] = {0};
- kb_movie_struct_t current_movie_info;
- para[0].name=KB_LC_PARA_INDEX_0;
- para[0].value=MOVIE_NAME_SOUND;
- para[1].name=KB_LC_PARA_INDEX_1;
- para[1].value=MOVIE_TYPE_MOVIE_MENU;
- para[2].name=KB_LC_PARA_INDEX_2;
- para[2].value=KB_DTV_LC_NAME;
- para[3].name=KB_LC_PARA_INDEX_3;
- para[3].value=KB_DTV_LC_FUNCTION;
- para[4].name=KB_LC_PARA_INDEX_4;
- para[4].value=EVENT_TYPE_MENU_SOUND;
- para[5].name=KB_LC_PARA_INDEX_5;
- para[5].value = EVENT_SOUND_SUBTYPE_1;
- para[6].name=KB_LC_PARA_INDEX_6;
- sprintf( str, "%d", KB_DTVGetVolume()) ;
- para[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)para[6].value, (void*)str, 5);
- para[7].name = KB_LC_PARA_INDEX_7;
- switch(KB_DTVGetTrack())
- {
- case LEFT_TRACK:
- para[7].value = KB_LC_PARA_INIT_0;
- break;
- case RIGHT_TRACK:
- para[7].value = KB_LC_PARA_INIT_1;
- break;
- case STEREO_TRACK:
- para[7].value = KB_LC_PARA_INIT_2;
- break;
- default:
- para[7].value = KB_LC_PARA_INIT_0;
- break;
- }
-
- para[8].name=NULL;
- para[8].value=NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,para,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:Client epg send current service id to menu_pf error.");
- }
- }
- /***
- 投票影片本地通讯
- ***/
- static kb_vote_serviceType_e s_vote_serviceType = 7;
- void KB_Vote_SetServiceType(kb_vote_serviceType_e serviceType)
- {
- s_vote_serviceType = serviceType;
- }
- static kb_vote_serviceType_e KB_Vote_GetServiceType(void)
- {
- return s_vote_serviceType;
- }
- //将从影片收到的信息进行分类
- void kb_vote_infoFMovie(kb_lc_attributes_t *attribs)
- {
- if(0 == mb_strcmp((char *)attribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_VOTE_1))
- {
- kb_vote_infoContent2Movie();
- }
- else if(0 == mb_strcmp((char *)attribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_VOTE_2))
- {
- kb_vote_info2Server(attribs);
- }
- else if(0 == mb_strcmp((char *)attribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_VOTE_3))
- {
- kb_vote_queryInfo2Movie(attribs);
- }
- }
- //获取从服务器获取到的投票内容并发送到影片
- //在投票模板影片启动的时候调用
- void kb_vote_infoContent2Movie(void)
- {
- unsigned char i = 0,voteSuccessFlag = 0,voteItemCount = 0;
- char strIndex[5]= {0};
- char *voteName,voteItemName[100][20];
- mb_param_t vote2Movie[30]= {0};
- mb_error_t ret;
- mb_handle_t reqHandle;
- kb_vote_node_t *voteService=NULL;
- kb_vote_serviceType_e voteServiceType;
- kb_movie_struct_t currentMovieInfo;
-
- vote2Movie[0].name = KB_LC_PARA_INDEX_0;
- vote2Movie[0].value = MOVIE_NAME_MENU_VOTE;
- vote2Movie[1].name = KB_LC_PARA_INDEX_1;
- vote2Movie[1].value = MOVIE_TYPE_MOVIE_VOTE;
- vote2Movie[2].name = KB_LC_PARA_INDEX_2;
- vote2Movie[2].value = KB_DTV_LC_NAME;
- vote2Movie[3].name = KB_LC_PARA_INDEX_3;
- vote2Movie[3].value = KB_DTV_LC_FUNCTION;
- vote2Movie[4].name = KB_LC_PARA_INDEX_4;
- vote2Movie[4].value = EVENT_TYPE_VOTE;
- vote2Movie[5].name = KB_LC_PARA_INDEX_5;
- vote2Movie[5].value = EVENT_SUB_TYPE_VOTE_1;
- //获取投票选项成功或失败0 失败1 成功
- vote2Movie[6].name = KB_LC_PARA_INDEX_6;
- voteServiceType = KB_Vote_GetServiceType();
- if(g_kb_vote_service[voteServiceType]!=NULL)
- {
- voteSuccessFlag = 1;
- voteService = g_kb_vote_service[voteServiceType];
- voteItemCount = voteService->voteService.itemCount;
- voteName = (mb_char_t*)KB_MB_lc_getCommandBuf(20);
- mb_memcpy((void*)voteName, (void*)voteService->voteService.name, 20);
- i = 0;
- while(voteService!=NULL)
- {
- mb_memcpy((void*)voteItemName[i], (void*)voteService->voteService.item, 20);
- voteService = voteService->pNext;
- i++;
- }
- }
- if(voteSuccessFlag==1)
- {
- vote2Movie[6].value = "1";
- vote2Movie[7].name = KB_LC_PARA_INDEX_7;
- vote2Movie[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
- mb_memcpy((void*)vote2Movie[7].value, (void*)voteName, 20);
-
- vote2Movie[8].name = KB_LC_PARA_INDEX_8;
- sprintf(strIndex,"%d",voteItemCount);
- vote2Movie[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)vote2Movie[8].value, (void*)strIndex, 5);
- for(i = 0; i <voteItemCount;i++)
- {
- mb_memset(strIndex, 0x00,5);
- sprintf(strIndex,"%d",9+i);
- vote2Movie[9+i].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)vote2Movie[9+i].name, (void*)strIndex, 5);
-
- vote2Movie[9+i].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
- mb_memcpy((void*)vote2Movie[9+i].value, (void*)voteItemName[i], 20);
- }
- vote2Movie[9+i].name= NULL;
- vote2Movie[9+i].value= NULL;
- }
- else
- {
- vote2Movie[6].value = "0";
- vote2Movie[7].name = NULL;
- vote2Movie[7].value = NULL;
- }
- kb_machblue_getCurMovieInfo(¤tMovieInfo);
- ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)vote2Movie[2].value,(mb_char_t*)vote2Movie[3].value, vote2Movie, &reqHandle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[kb_vote_info2Server]向影片发送信息失败n");
- }
- }
- //接收到从影片发下来的投票信息,发向服务器
- //并返回给影片成功或者失败
- void kb_vote_info2Server(kb_lc_attributes_t *attribs)
- {
- BOOL voteResult = FALSE;
- kb_vote_t kb_vote;
- mb_param_t vote2Movie[10];
- mb_error_t ret;
- mb_handle_t reqHandle;
- kb_movie_struct_t currentMovieInfo;
-
- vote2Movie[0].name = KB_LC_PARA_INDEX_0;
- vote2Movie[0].value = MOVIE_NAME_MENU_VOTE;
- vote2Movie[1].name = KB_LC_PARA_INDEX_1;
- vote2Movie[1].value = MOVIE_TYPE_MOVIE_VOTE;
- vote2Movie[2].name = KB_LC_PARA_INDEX_2;
- vote2Movie[2].value = KB_DTV_LC_NAME;
- vote2Movie[3].name = KB_LC_PARA_INDEX_3;
- vote2Movie[3].value = KB_DTV_LC_FUNCTION_1;
- vote2Movie[4].name = KB_LC_PARA_INDEX_4;
- vote2Movie[4].value = EVENT_TYPE_VOTE;
- vote2Movie[5].name = KB_LC_PARA_INDEX_5;
- vote2Movie[5].value = EVENT_SUB_TYPE_VOTE_2;
- //投票成功或失败0 失败1 成功
- vote2Movie[6].name = KB_LC_PARA_INDEX_6;
-
- mb_memcpy(kb_vote.name, (char *)attribs->parameters[lc_data3].value, 60);
- //mb_memcpy(kb_vote.name, (char *)"超级女生投票", 60);
- kb_vote.index = atoi((char *)attribs->parameters[lc_data2].value);
- kb_vote.count = atoi((char *)attribs->parameters[lc_data4].value);
- kb_vote.ip = (long)getip();
- voteResult = kb_vote_info_send(&kb_vote);
- if(voteResult)
- {
- vote2Movie[6].value = "1";
- }
- else
- {
- vote2Movie[6].value = "0";
- }
- vote2Movie[7].name = NULL;
- vote2Movie[7].value = NULL;
-
- kb_machblue_getCurMovieInfo(¤tMovieInfo);
- ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)vote2Movie[2].value,(mb_char_t*)vote2Movie[3].value, vote2Movie, &reqHandle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[kb_vote_info2Server]向影片发送信息失败n");
- }
- }
- //接收到从影片发下来的投票查询信息,向服务器发查询请求
- //并返回给影片的查询结果
- void kb_vote_queryInfo2Movie(kb_lc_attributes_t *attribs)
- {
- unsigned char i = 0;
- char strIndex[5],strResult[10],voteName[60];
- BOOL queryResult = FALSE;
- mb_param_t vote2Movie[30];
- mb_error_t ret;
- mb_handle_t reqHandle;
- kb_movie_struct_t currentMovieInfo;
- kb_vote_info_t voteResultInfo;
-
- vote2Movie[0].name = KB_LC_PARA_INDEX_0;
- vote2Movie[0].value = MOVIE_NAME_MENU_VOTE;
- vote2Movie[1].name = KB_LC_PARA_INDEX_1;
- vote2Movie[1].value = MOVIE_TYPE_MOVIE_VOTE;
- vote2Movie[2].name = KB_LC_PARA_INDEX_2;
- vote2Movie[2].value = KB_DTV_LC_NAME;
- vote2Movie[3].name = KB_LC_PARA_INDEX_3;
- vote2Movie[3].value = KB_DTV_LC_FUNCTION_2;
- vote2Movie[4].name = KB_LC_PARA_INDEX_4;
- vote2Movie[4].value = EVENT_TYPE_VOTE;
- vote2Movie[5].name = KB_LC_PARA_INDEX_5;
- vote2Movie[5].value = EVENT_SUB_TYPE_VOTE_3;
- //查询成功或失败0 失败1 成功
- vote2Movie[6].name = KB_LC_PARA_INDEX_6;
- mb_memcpy(voteName, (char *)attribs->parameters[lc_data3].value, 60);
- queryResult = kb_vote_result_get((unsigned char *)voteName,&voteResultInfo);
- if(queryResult)
- {
- vote2Movie[6].value = "1";
- vote2Movie[7].name = KB_LC_PARA_INDEX_7;
- mb_memset(strIndex, 0x00,5);
- sprintf(strIndex,"%d",voteResultInfo.resCount);
- vote2Movie[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)vote2Movie[7].value, (void*)strIndex, 5);
- for(i = 0;i<voteResultInfo.resCount;i++)
- {
- mb_memset(strIndex, 0x00,5);
- sprintf(strIndex,"%d",8+i*2+0);
- vote2Movie[8+i*2+0].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)vote2Movie[8+i*2+0].name, (void*)strIndex, 5);
-
- mb_memset(strIndex, 0x00,5);
- sprintf(strIndex,"%d",voteResultInfo.result[i].index);
- vote2Movie[8+i*2+0].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)vote2Movie[8+i*2+0].value, (void*)strIndex, 5);
- mb_memset(strIndex, 0x00,5);
- sprintf(strIndex,"%d",8+i*2+1);
- vote2Movie[8+i*2+1].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)vote2Movie[8+i*2+1].name, (void*)strIndex, 5);
- mb_memset(strResult, 0x00,10);
- sprintf(strResult,"%ld",voteResultInfo.result[i].result);
- vote2Movie[8+i*2+1].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
- mb_memcpy((void*)vote2Movie[8+i*2+1].value, (void*)strResult, 10);
- }
- vote2Movie[8+i*2+0].name = NULL;
- vote2Movie[8+i*2+0].value = NULL;
- }
- else
- {
- vote2Movie[6].value = "0";
- vote2Movie[7].name = NULL;
- vote2Movie[7].value = NULL;
- }
- kb_machblue_getCurMovieInfo(¤tMovieInfo);
- ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)vote2Movie[2].value,(mb_char_t*)vote2Movie[3].value, vote2Movie, &reqHandle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[kb_vote_queryInfo2Server]向影片发送信息失败n");
- }
- }
- /***
- 天气预报菜单
- ***/
- void kb_weatherInit(void)
- {
- int i,city_num=0;
- char start_str[5] = {0},city_name[100][15]= {0};//city_name[30];
- mb_error_t ret;
- mb_handle_t handle;
- mb_param_t initWeather[120] = {0};
- kb_movie_struct_t current_movie_info;
- KB_WeatherInfoNode *pWeatherInfo=NULL;
- kb_dayWeather_t day_weather[2] = {0};
- initWeather[0].name=KB_LC_PARA_INDEX_0;
- initWeather[0].value=MOVIE_NAME_DBC_WEATHER;
- initWeather[1].name=KB_LC_PARA_INDEX_1;
- initWeather[1].value=MOVIE_TYPE_MOVIE_DBC;
- initWeather[2].name=KB_LC_PARA_INDEX_2;
- initWeather[2].value=KB_DTV_LC_NAME;
- initWeather[3].name=KB_LC_PARA_INDEX_3;
- initWeather[3].value=KB_DTV_LC_FUNCTION;
- initWeather[4].name=KB_LC_PARA_INDEX_4;
- initWeather[4].value=EVENT_TYPE_WEATHER;
- initWeather[5].name=KB_LC_PARA_INDEX_5;
- initWeather[5].value=EVENT_TYPE_WEATHER_INIT;
-
- pWeatherInfo = KB_GetXmlWeatherInfoHead();
- while (pWeatherInfo != NULL)
- {
- mb_memcpy((char*)city_name[city_num], (char*)pWeatherInfo->st_WeatherInfo.city, 15);
- if(city_num == 0)
- {
- day_weather[0] = pWeatherInfo->st_WeatherInfo.today;
- day_weather[1] = pWeatherInfo->st_WeatherInfo.tomorrow;
- }
- city_num++;
- pWeatherInfo = pWeatherInfo->m_pNext;
- }
- //total number of the city
- initWeather[6].name=KB_LC_PARA_INDEX_6;//the total number of the city
- mb_memset(start_str, 0x00, 5);
- sprintf(start_str,"%d",city_num);
- initWeather[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)initWeather[6].value, (void*)start_str, 5);
-
- //first day of first city
- initWeather[7].name=KB_LC_PARA_INDEX_7;//first date of the first city
- initWeather[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
- mb_memcpy((void*)initWeather[7].value, (void*)day_weather[0].date, 15);
-
-
- initWeather[8].name=KB_LC_PARA_INDEX_8;//weather of the first city in the first day
- mb_memset(start_str, 0x00, 5);
- sprintf(start_str,"%d",day_weather[0].weather);
- initWeather[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)initWeather[8].value, (void*)start_str, 5);
-
-
- initWeather[9].name=KB_LC_PARA_INDEX_9;//first temperature of the first city
- initWeather[9].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
- mb_memcpy((void*)initWeather[9].value, (void*)day_weather[0].temperature, 10);
-
- initWeather[10].name=KB_LC_PARA_INDEX_10;//first weather description of the first city
- initWeather[10].value=(mb_char_t*)KB_MB_lc_getCommandBuf(25);
- mb_memcpy((void*)initWeather[10].value, (void*)day_weather[0].weatherDes, 25);
-
- //second day of the first city
- initWeather[11].name=KB_LC_PARA_INDEX_11;//second date of the first city
- initWeather[11].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
- mb_memcpy((void*)initWeather[11].value, (void*)day_weather[1].date, 15);
-
- initWeather[12].name=KB_LC_PARA_INDEX_12;//weather of the first city in the second day
- mb_memset(start_str, 0x00, 5);
- sprintf(start_str,"%d",day_weather[1].weather);
- initWeather[12].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)initWeather[12].value, (void*)start_str, 5);
-
- initWeather[13].name=KB_LC_PARA_INDEX_13;//second temperature of the first city
- initWeather[13].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
- mb_memcpy((void*)initWeather[13].value, (void*)day_weather[1].temperature, 10);
- initWeather[14].name=KB_LC_PARA_INDEX_14;//second weather description of the first city
- initWeather[14].value=(mb_char_t*)KB_MB_lc_getCommandBuf(25);
- mb_memcpy((void*)initWeather[14].value, (void*)day_weather[1].weatherDes, 25);
- //city names
- for(i=0;i<city_num;i++)
- {
- mb_memset(start_str, 0x00, 5);
- sprintf(start_str,"%d",15+i);
- initWeather[15+i].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)initWeather[15+i].name, (void*)start_str, 5);
-
- initWeather[15+i].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
- mb_memcpy((void*)initWeather[15+i].value, (void*)city_name[i], 15);
- }
- initWeather[15+city_num].name=NULL;
- initWeather[15+city_num].value=NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,initWeather,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:C code send information to DBC weather error");
- }
- }
- void kb_weatherCitySwitch(UINT32 cityIndex)
- {
- int city_num=0;
- char start_str[5] ={0};
- mb_error_t ret;
- mb_handle_t handle;
- mb_param_t weatherCity[15] = {0};
- kb_movie_struct_t current_movie_info;
- KB_WeatherInfoNode *pWeatherInfo=NULL;
- kb_dayWeather_t day_weather[2] = {0};
- pWeatherInfo = KB_GetXmlWeatherInfoHead();
- while (pWeatherInfo != NULL)
- {
- if(city_num == cityIndex)
- {
- day_weather[0] = pWeatherInfo->st_WeatherInfo.today;
- day_weather[1] = pWeatherInfo->st_WeatherInfo.tomorrow;
- break;
- }
- city_num++;
- pWeatherInfo = pWeatherInfo->m_pNext;
- }
- weatherCity[0].name=KB_LC_PARA_INDEX_0;
- weatherCity[0].value=MOVIE_NAME_DBC_WEATHER;
- weatherCity[1].name=KB_LC_PARA_INDEX_1;
- weatherCity[1].value=MOVIE_TYPE_MOVIE_DBC;
- weatherCity[2].name=KB_LC_PARA_INDEX_2;
- weatherCity[2].value=KB_DTV_LC_NAME;
- weatherCity[3].name=KB_LC_PARA_INDEX_3;
- weatherCity[3].value=KB_DTV_LC_FUNCTION;
- weatherCity[4].name=KB_LC_PARA_INDEX_4;
- weatherCity[4].value=EVENT_TYPE_WEATHER;
- weatherCity[5].name=KB_LC_PARA_INDEX_5;
- weatherCity[5].value=EVENT_TYPE_WEATHER_CITY;
- if (cityIndex>=0)
- {
- //first day of the city
- weatherCity[6].name=KB_LC_PARA_INDEX_6;//first date of the first city
- weatherCity[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
- mb_memcpy((void*)weatherCity[6].value, (void*)day_weather[0].date, 15);
-
- weatherCity[7].name=KB_LC_PARA_INDEX_7;//weather of the first city in the first day
- mb_memset(start_str, 0x00, 5);
- sprintf(start_str,"%d",day_weather[0].weather);
- weatherCity[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)weatherCity[7].value, (void*)start_str, 5);
-
- weatherCity[8].name=KB_LC_PARA_INDEX_8;//first temperature of the first city
- weatherCity[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
- mb_memcpy((void*)weatherCity[8].value, (void*)day_weather[0].temperature, 10);
-
- weatherCity[9].name=KB_LC_PARA_INDEX_9;//first description of the first city
- weatherCity[9].value=(mb_char_t*)KB_MB_lc_getCommandBuf(25);
- mb_memcpy((void*)weatherCity[9].value, (void*)day_weather[0].weatherDes, 25);
- //second day of the city
- weatherCity[10].name=KB_LC_PARA_INDEX_10;//second date of the first city
- weatherCity[10].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
- mb_memcpy((void*)weatherCity[10].value, (void*)day_weather[1].date, 15);
-
- weatherCity[11].name=KB_LC_PARA_INDEX_11;//weather of the first city in the second day
- mb_memset(start_str, 0x00, 5);
- sprintf(start_str,"%d",day_weather[1].weather);
- weatherCity[11].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)weatherCity[11].value, (void*)start_str, 5);
-
- weatherCity[12].name=KB_LC_PARA_INDEX_12;//second temperature of the first city
- weatherCity[12].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
- mb_memcpy((void*)weatherCity[12].value, (void*)day_weather[1].temperature, 10);
-
- weatherCity[13].name=KB_LC_PARA_INDEX_13;//second description of the first city
- weatherCity[13].value=(mb_char_t*)KB_MB_lc_getCommandBuf(25);
- mb_memcpy((void*)weatherCity[13].value, (void*)day_weather[1].weatherDes, 25);
- weatherCity[14].name = NULL;
- weatherCity[14].value = NULL;
- }
- else
- {
- weatherCity[6].name = NULL;
- weatherCity[6].value = NULL;
- }
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,weatherCity,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:C code send information to DBC weather error");
- }
- }
- /***
- 政府公告
- ***/
- //政府公告目录
- void kb_dbc_govCatalog(void)
- {
- int i;
- int catalogCount = 0;//total number of the gov ad
- char title[100][100],str[5];
- mb_error_t ret;
- mb_handle_t handle;
- mb_param_t govCatalog[100];
- kb_movie_struct_t current_movie_info;
- KB_BulletinInfoNode *pBulletinInfo;
- pBulletinInfo = KB_GetXmlBulletinInfoHead();
- while (pBulletinInfo != NULL)
- {
- mb_memcpy((char*)title[catalogCount], (char*)pBulletinInfo->st_BulletinInfo.title, 100);
- catalogCount++;
- pBulletinInfo = pBulletinInfo->m_pNext;
- }
- govCatalog[0].name=KB_LC_PARA_INDEX_0;
- govCatalog[0].value=MOVIE_NAME_DBC_GOV_BULLETIN;
- govCatalog[1].name=KB_LC_PARA_INDEX_1;
- govCatalog[1].value=MOVIE_TYPE_MOVIE_DBC;
- govCatalog[2].name=KB_LC_PARA_INDEX_2;
- govCatalog[2].value=KB_DTV_LC_NAME;
- govCatalog[3].name=KB_LC_PARA_INDEX_3;
- govCatalog[3].value=KB_DTV_LC_FUNCTION;
- govCatalog[4].name=KB_LC_PARA_INDEX_4;
- govCatalog[4].value=EVENT_TYPE_GOV;
- govCatalog[5].name=KB_LC_PARA_INDEX_5;
- govCatalog[5].value=EVENT_SUB_TYPE_GOV_CATALOG;
- govCatalog[6].name=KB_LC_PARA_INDEX_6;
- mb_memset(str, 0x00, 5);
- sprintf(str,"%d",catalogCount);
- govCatalog[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)govCatalog[6].value, (void*)str, 5);
- for(i=0;i<catalogCount;i++)
- {
- mb_memset(str, 0x00, 5);
- sprintf(str,"%d",7+i);
- govCatalog[7+i].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
- mb_memcpy((void*)govCatalog[7+i].name, (void*)str, 5);
-
- govCatalog[7+i].value=(mb_char_t*)KB_MB_lc_getCommandBuf(100);
- mb_memcpy((void*)govCatalog[7+i].value, (void*)title[i], 100);
- }
- govCatalog[7+catalogCount].name=NULL;
- govCatalog[7+catalogCount].value=NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,govCatalog,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:C code send information to DBC gov main error");
- }
- }
- //政府公告内容
- void kb_dbc_govContent(UINT32 contentIndex)
- {
- mb_error_t ret;
- mb_handle_t handle;
- int govContentIndex = 0;
- mb_param_t govContent[10];
- kb_movie_struct_t current_movie_info;
- KB_BulletinInfoNode *pBulletinInfo;
- govContent[0].name=KB_LC_PARA_INDEX_0;
- govContent[0].value=MOVIE_NAME_DBC_GOV_BULLETIN;
- govContent[1].name=KB_LC_PARA_INDEX_1;
- govContent[1].value=MOVIE_TYPE_MOVIE_DBC;
- govContent[2].name=KB_LC_PARA_INDEX_2;
- govContent[2].value=KB_DTV_LC_NAME;
- govContent[3].name=KB_LC_PARA_INDEX_3;
- govContent[3].value=KB_DTV_LC_FUNCTION_1;
- govContent[4].name=KB_LC_PARA_INDEX_4;
- govContent[4].value=EVENT_TYPE_GOV;
- govContent[5].name=KB_LC_PARA_INDEX_5;
- govContent[5].value=EVENT_SUB_TYPE_GOV_CONTENT;
-
- govContent[6].name=KB_LC_PARA_INDEX_6;//title
- govContent[7].name=KB_LC_PARA_INDEX_7;//content
- mb_printf("n[machblue]the index of the government ad is %dn",contentIndex);
- pBulletinInfo = KB_GetXmlBulletinInfoHead();
- while (pBulletinInfo != NULL)
- {
- if(govContentIndex == contentIndex)
- {
- break;
- }
- govContentIndex++;
- pBulletinInfo = pBulletinInfo->m_pNext;
- }
- if (contentIndex>=0)
- {
- govContent[6].value = (mb_char_t*)pBulletinInfo->st_BulletinInfo.title;
- govContent[7].value= (mb_char_t*)pBulletinInfo->st_BulletinInfo.content;
- }
- govContent[8].name=NULL;
- govContent[8].value= NULL;
- kb_machblue_getCurMovieInfo(¤t_movie_info);
- ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION_1,govContent,&handle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[Machblue]:C code send information to DBC gov content error");
- }
- }
- void KB_Swf_UpdateInfoLC(UINT32 word)
- {
- mb_param_t updateInfo[10];
- mb_error_t ret;
- mb_handle_t reqHandle;
- kb_movie_struct_t currentMovieInfo;
-
- updateInfo[0].name = KB_LC_PARA_INDEX_0;
- updateInfo[0].value = MOVIE_NAME_MENU_PROMPT;
- updateInfo[1].name = KB_LC_PARA_INDEX_1;
- updateInfo[1].value = MOVIE_TYPE_MOVIE_MENU;
- updateInfo[2].name = KB_LC_PARA_INDEX_2;
- updateInfo[2].value = KB_DTV_LC_NAME;
- updateInfo[3].name = KB_LC_PARA_INDEX_3;
- updateInfo[3].value = KB_DTV_LC_FUNCTION;
- updateInfo[4].name = KB_LC_PARA_INDEX_4;
- updateInfo[4].value = EVENT_TYPE_MENU_PROMPT;
- //投票成功或失败0 失败1 成功
- updateInfo[5].name = KB_LC_PARA_INDEX_5;
-
- if(word)
- {
- updateInfo[5].value = "1";
- }
- else
- {
- updateInfo[5].value = "0";
- }
- updateInfo[6].name = NULL;
- updateInfo[6].value = NULL;
-
- kb_machblue_getCurMovieInfo(¤tMovieInfo);
- ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)updateInfo[2].value,(mb_char_t*)updateInfo[3].value, updateInfo, &reqHandle);
- if(ret!=MB_SUCCESS)
- {
- mb_printf("n[kb_vote_info2Server]向影片更新情况影片发送消息失败n");
- }
- }
- void kb_machblue_lc_ad(kb_lc_attributes_t *pAttribs)
- {
- if(pAttribs==NULL)
- {
- mb_printf("n[Machblue]:Client menu operatioin attributes NULL.");
- return;
- }
- if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)MOVIE_NAME_AD1))
- {
- //播放互相广告1
- kb_machblue_alterAdvPlay(1);
- }
- else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)MOVIE_NAME_AD2))
- {
- //播放互相广告2
- kb_machblue_alterAdvPlay(2);
- }
- }