kb_machblue_client_lc.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:81k
源码类别:

DVD

开发平台:

C/C++

  1. //*****************************************************************************
  2. //File Name: kb_machblue_lconnection.c
  3. //
  4. //Description:       some function about local connection
  5. //
  6. //Author: wisco
  7. //
  8. //Date:  2007.03.08
  9. //
  10. //Version:  v1.0
  11. //******************************************************************************
  12. #include <stdlib.h> 
  13. #include <stdio.h> 
  14. #include <string.h> 
  15. #include "db.h"
  16. #include "tcpip.h"
  17. #include "avplay.h"
  18. #include "gendef.h"
  19. #include "search.h"
  20. #include "nvod.h"
  21. #include "pub_st.h"
  22. #include "appltype.h"
  23. #include "Demand.h"
  24. #include "kb_dc.h"
  25. #include "tcmu30311.h"
  26. #include "machblue_client.h"
  27. #include "machblue_defines.h"
  28. #include "kb_machblue_client.h"
  29. #include "kb_machblue_client_lc.h"
  30. #include "machblue_porting_core.h"
  31. #include "machblue_tv_customer.h"
  32. #include "kb_machblue_client_vote.h"
  33. #include "kb_machblue_client_data.h"
  34. #include "Ca_user.h"
  35. #include "StbMoviesInfo.h"
  36. #include "XmlStbInfo.h"
  37. //static kb_lc_attributes_t s_kb_attr;
  38. static int kb_mb_mail_type;
  39. #define LC_COMMAND_BUF_SIZE 1024*5
  40. static unsigned long lcCommandBufIndex=0;
  41. static unsigned char lcCommandBuf[LC_COMMAND_BUF_SIZE];
  42. static unsigned char *pLcCommand=lcCommandBuf;
  43. void kb_machblue_lc_menu(kb_lc_attributes_t *pAttribs);
  44. void kb_machblue_lc_2_mail(UINT32 word);
  45. void kb_machblue_lc_F_mail(kb_lc_attributes_t *pAttribs);
  46. void kb_machblue_lc_channel_edit(UINT32 word);
  47. void KB_MB_lc_Factory_Reset(UINT32 word);
  48. void kb_machblue_lc_2_mail_list(UINT32 word);
  49. void kb_machblue_lc_2_mail_read(UINT32 word);
  50. void kb_machblue_lc_2_mail_delete(UINT32 word);
  51. extern int get_dtv_num(void);
  52. extern int get_radio_num(void);
  53. extern int mb_strcmp(mb_char_t *s0, mb_char_t *s1);
  54. extern INT32 STB_StateSwitch(INT32 nApplet);
  55. extern int KB_TimeGetCurTime(time_t  *plTime);
  56. extern time_t Time_2_Local_Tiem(time_t timeStamp);
  57. extern WORD TFCASTB_GetEmailHeads(OUT STFCAEmailHead* pEmailHead,INOUT BYTE* pbyCount,INOUT BYTE* pbyFromIndex);
  58. extern int ConvertTimeStampToDate(U32 timeStamp, U32 *year,  U32 *month, U32 *day);
  59. extern WORD TFCASTB_GetEmailContent(ULONG dwEmailID,OUT STFCAEmailContent* pEmailContent);
  60. extern void kb_machblue_lc_F_NVOD(kb_lc_attributes_t *pAttribs);
  61. extern void kb_machblue_lc_2_NVOD(UINT32 word);
  62. /*********************************************************************
  63. * menu operation used by local connection following.
  64. *********************************************************************/
  65. unsigned char *KB_MB_lc_getCommandBuf(unsigned short size)
  66. {
  67. unsigned char *p=NULL;
  68. unsigned short bufSize=size+1;
  69. if((lcCommandBufIndex+bufSize)>LC_COMMAND_BUF_SIZE)
  70. {
  71. p=pLcCommand=lcCommandBuf;
  72. lcCommandBufIndex=bufSize;
  73. pLcCommand+=bufSize;
  74. }
  75. else
  76. {
  77. p=pLcCommand;
  78. lcCommandBufIndex+=bufSize;
  79. pLcCommand+=bufSize;
  80. }
  81. return p;
  82. }
  83. /*
  84.   * 函数名称 : KB_MB_lc_2_movie_Post_Task
  85.   *
  86.   * 函数简介 : 发送消息
  87.   *
  88.   * 输入参数 : none
  89.   *
  90.   * 输出参数 : none
  91.   *
  92.   * 返   回  值 : none
  93.   */
  94. void KB_MB_lc_2_movie_Post_Task(void)
  95. {
  96. KB_OSPMsgNode movie_msg;
  97. movie_msg.Word1= KB_MOVIE_LC_TO_MOVIE;
  98. movie_msg.Word2= 1;
  99. kb_machblue_task_post(&movie_msg);
  100. }
  101. /*
  102.   * 函数名称 : KB_MB_lc_2_movie_word_Post_Task
  103.   *
  104.   * 函数简介 : 发送消息
  105.   *
  106.   * 输入参数 : none
  107.   *
  108.   * 输出参数 : none
  109.   *
  110.   * 返   回  值 : none
  111.   */
  112. void KB_MB_lc_2_movie_word_Post_Task(UINT32 word)
  113. {
  114. KB_OSPMsgNode movie_msg;
  115. movie_msg.Word1= KB_MOVIE_LC_TO_MOVIE;
  116. movie_msg.Word2 = word;
  117. kb_machblue_task_post(&movie_msg);
  118. }
  119. /**
  120.  * local connection manager
  121.  * @return None.
  122.  */
  123. void kb_machblue_localConnection(kb_lc_attributes_t *attribs)
  124. {
  125. int movie_type;
  126. if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_ADVER))
  127. movie_type = movie_adver;
  128. else if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_GAME))
  129. movie_type = movie_game;
  130. else if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_VOTE))
  131. movie_type = movie_vote;
  132. else if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_MENU))
  133. movie_type = movie_menu;
  134. else if(0 == mb_strcmp((char *)attribs->parameters[lc_movie_type].value,(mb_char_t*)MOVIE_TYPE_MOVIE_DBC))
  135. movie_type = movie_dbc;
  136. switch(movie_type)
  137. {
  138. case movie_adver:
  139. kb_machblue_lc_ad(attribs);
  140. break;
  141. case movie_game:
  142. break;
  143. case movie_vote:
  144. kb_vote_infoFMovie(attribs);
  145. break;
  146. case movie_dbc:
  147. case movie_menu:
  148. kb_machblue_lc_menu(attribs);
  149. break;
  150. default:
  151. break;
  152. }
  153. }
  154. /*
  155.   * 函数名称 : KB_Machblue_LC_To_Movie
  156.   *
  157.   * 函数简介 : 向影片发送信息
  158.   *
  159.   * 输入参数 : word  < 消息中的属性>
  160.   *
  161.   * 输出参数 : none
  162.   *
  163.   * 返   回  值 : none
  164.   */
  165. void KB_Machblue_LC_To_Movie(long word)
  166. {
  167. kb_movie_struct_t *pCurMovie=kb_machblue_getCurrentMovie();
  168. switch(pCurMovie->info.name)
  169. {
  170. case kb_movie_menu_search:
  171. case kb_movie_menu_searchAll:
  172. kb_searchResult2Movie(word);
  173. break;
  174. case kb_movie_menu_volume:
  175. kb_volumeTrack();
  176. break;
  177. case kb_movie_menu_volumeMute:
  178. kb_volumeMuteFlag();
  179. break;
  180. case kb_movie_menu_pf:
  181. kb_pfGot(word);
  182. break;
  183. case kb_movie_menu_sys_info:
  184. kb_sysInfo();
  185. break;
  186. case kb_movie_menu_mail:
  187. kb_machblue_lc_2_mail(word);
  188. break;
  189. case kb_movie_menu_nvod:
  190. kb_machblue_lc_2_NVOD(word);
  191. break;
  192. case kb_movie_menu_channle_no:
  193. kb_mb_ch_no_2_movie(word);
  194. break;
  195. case kb_movie_dbc_gov:
  196. kb_dbc_govContent(word);
  197. break;
  198. case kb_movie_dbc_weather:
  199. kb_weatherCitySwitch(word);
  200. break;
  201. case kb_movie_ca_inform:
  202. kb_machblue_lc_2_ca_inform();
  203. break;
  204. case kb_movie_swfUpdatePrompt:
  205. KB_Swf_UpdateInfoLC(word);
  206. break;
  207. default:
  208. break;
  209. }
  210. }
  211. #if 1// menu switch
  212. /**
  213.  * menu operation of lc.
  214.  * @return None.
  215.  */
  216. void kb_machblue_lc_menu(kb_lc_attributes_t *pAttribs)
  217. {
  218. if(pAttribs==NULL)
  219. {
  220.       mb_printf("n[Machblue]:Client menu operatioin attributes NULL.");
  221. return;
  222. }
  223. if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_SEARCH))
  224. {
  225. //KB_UpdateCheckClear();
  226. kb_getInfoFSearchMenu(pAttribs);
  227. }
  228. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_MENU_SWITCH))
  229. {
  230. kb_machblue_switchMenuMovie(pAttribs);
  231. }
  232. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_SYS_RESET))
  233. {
  234. KB_DBReset();
  235. KB_MB_lc_2_movie_Post_Task();
  236. }
  237. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_MAIL_MESSAGE))
  238. {
  239. kb_machblue_lc_F_mail(pAttribs);
  240. }
  241. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_NVOD))
  242. {
  243. kb_machblue_lc_F_NVOD(pAttribs);
  244. }
  245. //add by shriek
  246. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_MENU_OTA_HINT))
  247. {
  248. kb_machblue_lc_F_otahint(pAttribs);
  249. }
  250. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_CH_NO))
  251. {
  252. kb_mb_ch_no_F_movie(pAttribs);
  253. }
  254. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_WEATHER))
  255. {
  256. int city_index;
  257. city_index = atoi((char *)pAttribs->parameters[lc_data2].value);
  258. KB_MB_lc_2_movie_word_Post_Task(city_index);
  259. }
  260. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_event_type].value,(mb_char_t*)EVENT_TYPE_GOV))
  261. {
  262. if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_GOV_CONTENT))
  263. {
  264. int govContentIndex;
  265. govContentIndex = atoi((char *)pAttribs->parameters[lc_data2].value);
  266. KB_MB_lc_2_movie_word_Post_Task(govContentIndex);
  267. }
  268. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_GOV_CATALOG))
  269. {
  270. kb_dbc_govCatalog();
  271. }
  272. }
  273. //shriek end
  274. }
  275. #endif
  276. #if 1//search menu
  277. /**
  278.  * send channel management to flash movie
  279.  
  280.  * word < message type >
  281.  
  282.  * @return none
  283.  */
  284. void kb_machblue_lc_channel_edit(UINT32 word)
  285. {
  286. char result_string[2]; 
  287. mb_handle_t  req_handle;
  288. mb_param_t cha_man_2_movie[9];
  289. kb_movie_struct_t current_movie_info;
  290. int channel_edit_type;
  291. cha_man_2_movie[0].name = KB_LC_PARA_INDEX_0;
  292. cha_man_2_movie[0].value= MOVIE_NAME_MENU_SEARCH;
  293. cha_man_2_movie[1].name = KB_LC_PARA_INDEX_1;
  294. cha_man_2_movie[1].value= MOVIE_TYPE_MOVIE_MENU;
  295. cha_man_2_movie[2].name = KB_LC_PARA_INDEX_2;
  296. cha_man_2_movie[2].value= MOVIE_MENU_SEARCH_CONNECTION;
  297. cha_man_2_movie[3].name = KB_LC_PARA_INDEX_3;
  298. cha_man_2_movie[3].value= MOVIE_MENU_SEARCH_FUNCTION;
  299. cha_man_2_movie[4].name = KB_LC_PARA_INDEX_4;
  300. cha_man_2_movie[4].value= EVENT_TYPE_SEARCH;
  301. cha_man_2_movie[5].name = KB_LC_PARA_INDEX_5;
  302. cha_man_2_movie[5].value= EVENT_SEARCH_TYPE_CHA_EDIT;
  303. if(word == 0)
  304. channel_edit_type = fav_edit;
  305. else if(word == 1)
  306. channel_edit_type = move_edit;
  307. else if(word == 2)
  308. channel_edit_type = delete_edit;
  309. else if(word == 3)
  310. channel_edit_type = lock_edit;
  311. cha_man_2_movie[6].name = KB_LC_PARA_INDEX_6;
  312. mb_memset(result_string, 0x00, 2);
  313. sprintf(result_string,"%ld",word);
  314. cha_man_2_movie[6].value = result_string;//进行何种编辑0 喜爱 1 移动 2 删除3 锁盯
  315. cha_man_2_movie[7].name = KB_LC_PARA_INDEX_7;
  316. cha_man_2_movie[7].value= KB_LC_PARA_INIT_1;//该操作是否成功
  317. cha_man_2_movie[8].name = NULL;
  318. cha_man_2_movie[8].value = NULL;
  319. 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))
  320. mb_printf("nthe return value of mb_movie_lc_request_send is successn");
  321. else
  322. mb_printf("nthe return value of mb_movie_lc_request_send is failedn");
  323. }
  324. /**
  325.  * send signal value to flash movie
  326.  
  327.  * word frequency
  328.  
  329.  * @return none
  330.  */
  331. void kb_machblue_lc_progress(UINT32 word)
  332. {
  333. int ret;
  334. char start_str1[3];
  335. mb_param_t progress_2_movie[8];
  336. kb_movie_struct_t current_movie_info;
  337. mb_handle_t  handle;
  338. progress_2_movie[0].name = KB_LC_PARA_INDEX_0;
  339. progress_2_movie[0].value= MOVIE_NAME_MENU_SEARCH;
  340. progress_2_movie[1].name = KB_LC_PARA_INDEX_1;
  341. progress_2_movie[1].value= MOVIE_TYPE_MOVIE_MENU;
  342. progress_2_movie[2].name = KB_LC_PARA_INDEX_2;
  343. progress_2_movie[2].value= MOVIE_MENU_SEARCH_CONNECTION;
  344. progress_2_movie[3].name = KB_LC_PARA_INDEX_3;
  345. progress_2_movie[3].value= MOVIE_MENU_SEARCH_FUNCTION;
  346. progress_2_movie[4].name = KB_LC_PARA_INDEX_4;
  347. progress_2_movie[4].value= EVENT_TYPE_SEARCH;
  348. progress_2_movie[5].name = KB_LC_PARA_INDEX_5;
  349. progress_2_movie[5].value= EVENT_SEARCH_TYPE_PROGRESS;
  350. progress_2_movie[6].name = KB_LC_PARA_INDEX_6;
  351. mb_memset(start_str1, 0x00, 3);
  352. sprintf(start_str1,"%ld",word);
  353. progress_2_movie[6].value = start_str1;//progress
  354. progress_2_movie[7].name = NULL;
  355. progress_2_movie[7].value = NULL;
  356. kb_machblue_getCurMovieInfo(&current_movie_info);
  357. ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_SEARCH_CONNECTION,MOVIE_MENU_SEARCH_FUNCTION,progress_2_movie,&handle);
  358. if(ret!=MB_SUCCESS)
  359. {
  360.       mb_printf("n[Machblue]:Client send signal strength or quality error");
  361. }
  362. }
  363. //#define test 
  364. void KB_OTA_Set(int sys_info, kb_lc_attributes_t *pAttribs)
  365. {
  366. KB_DBOtaPara ota_para;
  367. #if 0
  368. mb_printf("n[KB_OTA_Set]:lc_movie_name=%s",(mb_char_t*)pAttribs->parameters[lc_movie_name].value);
  369. mb_printf("n[KB_OTA_Set]:lc_movie_type=%s",(mb_char_t*)pAttribs->parameters[lc_movie_type].value);
  370. mb_printf("n[KB_OTA_Set]:lc_movie_lcName=%s",(mb_char_t*)pAttribs->parameters[lc_movie_lcName].value);
  371. mb_printf("n[KB_OTA_Set]:lc_movie_funName=%s",(mb_char_t*)pAttribs->parameters[lc_movie_funName].value);
  372. mb_printf("n[KB_OTA_Set]:lc_event_type=%s",(mb_char_t*)pAttribs->parameters[lc_event_type].value);
  373. mb_printf("n[KB_OTA_Set]:lc_data1=%s",(mb_char_t*)pAttribs->parameters[lc_data1].value);
  374. mb_printf("n[KB_OTA_Set]:lc_data2=%s",(mb_char_t*)pAttribs->parameters[lc_data2].value);
  375. mb_printf("n[KB_OTA_Set]:lc_data3=%s",(mb_char_t*)pAttribs->parameters[lc_data3].value);
  376. mb_printf("n[KB_OTA_Set]:lc_data4=%s",(mb_char_t*)pAttribs->parameters[lc_data4].value);
  377. mb_printf("n[KB_OTA_Set]:lc_data5=%s",(mb_char_t*)pAttribs->parameters[lc_data5].value);
  378. #endif
  379. ota_para.freq = (UINT32)atoi((mb_char_t*)pAttribs->parameters[lc_data2].value)*1000;
  380. ota_para.Symb =  (UINT32)atoi((mb_char_t*)pAttribs->parameters[lc_data3].value);
  381. ota_para.Qam = (UINT8)atoi((mb_char_t*)pAttribs->parameters[lc_data4].value);
  382. ota_para.PID= (UINT16)atoi((mb_char_t*)pAttribs->parameters[lc_data5].value);
  383.        mb_printf("n[KB_OTA_Set]:%ld %ld %ld %ld",ota_para.freq, ota_para.Symb, ota_para.Qam, ota_para.PID);
  384. KB_DBSaveOtaPara(&ota_para);
  385. KB_Restart();
  386. }
  387. #endif
  388. #if 1 //系统信息界面,合3为1
  389. void KB_MB_lc_Factory_Reset(UINT32 word)
  390. {
  391. //char str1[3];
  392. mb_handle_t  req_handle;
  393. mb_param_t  reset_2_movie[8];
  394. kb_movie_struct_t current_movie_info;
  395. //int i;
  396. mb_error_t ret;
  397. reset_2_movie[0].name = KB_LC_PARA_INDEX_0;
  398. reset_2_movie[0].value = MOVIE_NAME_SYS_INFO;
  399. reset_2_movie[1].name = KB_LC_PARA_INDEX_1;
  400. reset_2_movie[1].value = MOVIE_TYPE_MOVIE_MENU;
  401. reset_2_movie[2].name = KB_LC_PARA_INDEX_2;
  402. reset_2_movie[2].value = MOVIE_MENU_SYS_INFO_CONNECTION;
  403. reset_2_movie[3].name = KB_LC_PARA_INDEX_3;
  404. reset_2_movie[3].value = MOVIE_MENU_SYS_INFO_FUNCTION;
  405. reset_2_movie[4].name = KB_LC_PARA_INDEX_4;
  406. reset_2_movie[4].value = EVENT_TYPE_SYS_INFO;
  407. reset_2_movie[5].name = KB_LC_PARA_INDEX_5;
  408. reset_2_movie[5].value = EVENT_SYS_INFO_TYPE_FACTORY_RESET;
  409. reset_2_movie[6].name = KB_LC_PARA_INDEX_6;
  410. if (word == 1)
  411. reset_2_movie[6].value= KB_LC_PARA_INIT_1;//初始化是否成功0失败1成功
  412. else
  413. reset_2_movie[6].value= KB_LC_PARA_INIT_0;
  414. reset_2_movie[7].name = NULL;
  415. reset_2_movie[7].value = NULL;
  416. kb_machblue_getCurMovieInfo(&current_movie_info);
  417. 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);
  418. if (ret == MB_FAILURE)
  419. mb_printf("[Macblue] 向机顶盒发送初始化是否成功信息失败!");
  420. }
  421. #endif
  422. #if 1//Mail Message
  423. void KB_MB_lc_Set_Mail_Type(int mail_Type)
  424. {
  425. kb_mb_mail_type = mail_Type;
  426. }
  427. int KB_MB_lc_Get_Mail_Type(void)
  428. {
  429. return kb_mb_mail_type;
  430. }
  431. /**
  432.  * Receive mail information to server,and send vote result to movie
  433.  * @return none
  434.  */
  435. void kb_machblue_lc_F_mail(kb_lc_attributes_t *pAttribs)
  436. {
  437. int message_Type;
  438. UINT32 word;
  439. //为了提高邮件的操作速度,用下述函数通知CAM进入邮件管理。
  440. //退出时调用TFCASTB_LeaveMailManager。zjm. 04/12/15
  441. //TFCASTB_EnterMailManager();
  442. //kb_email_test
  443. //TFCASTB_LeaveMailManager();//exit
  444. if(mb_strcmp((mb_char_t*)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_MAIL_TYPE_LIST)==0)
  445. message_Type = mail_list;
  446. else if(mb_strcmp((mb_char_t*)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_MAIL_TYPE_READ)==0)
  447. message_Type = mail_read;
  448. else if(mb_strcmp((mb_char_t*)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_MAIL_TYPE_DELETE)==0)
  449. message_Type = mail_delete;
  450. KB_MB_lc_Set_Mail_Type(message_Type);
  451. word  = atoi((mb_char_t*)pAttribs->parameters[lc_data2].value);
  452. KB_MB_lc_2_movie_word_Post_Task(word);
  453. }
  454. /**
  455.  * send mail information to server,and send vote result to movie
  456.  * @return none
  457.  */
  458. void kb_machblue_lc_2_mail(UINT32 word)
  459. {
  460. int message_Type;
  461. message_Type = KB_MB_lc_Get_Mail_Type();
  462. switch(message_Type)
  463. {
  464. case mail_list:
  465. kb_machblue_lc_2_mail_list(word);
  466. break;
  467. case mail_read:
  468. kb_machblue_lc_2_mail_read(word);
  469. break;
  470. case mail_delete:
  471. kb_machblue_lc_2_mail_delete(word);
  472. break;
  473. default:
  474. kb_machblue_lc_2_mail_list(word);
  475. break;
  476. }
  477. }
  478. void kb_machblue_lc_2_mail_list(UINT32 word)
  479. {
  480. int i,ret,mail_count = 0;
  481. char start_str1[5],start_str2[5],start_str3[5],start_str4[5],start_str5[5],start_str6[20];
  482. mb_param_t message_list[100];
  483. kb_movie_struct_t current_movie_info;
  484. mb_handle_t handle;
  485. time_t loc_time;
  486. int nYear,nMonth,nDay;
  487. STFCAEmailHead  ArrEmailHead[10];
  488. BYTE byCount = 10;
  489. BYTE byFromIndex = 0;
  490. message_list[0].name=KB_LC_PARA_INDEX_0;
  491. message_list[0].value=MOVIE_NAME_MENU_MAIL;
  492. message_list[1].name=KB_LC_PARA_INDEX_1;
  493. message_list[1].value=MOVIE_TYPE_MOVIE_MENU;
  494. message_list[2].name=KB_LC_PARA_INDEX_2;
  495. message_list[2].value=MOVIE_MENU_MAIL_CONNECTION;
  496. message_list[3].name=KB_LC_PARA_INDEX_3;
  497. message_list[3].value=MOVIE_MENU_MAIL_FUNCTION;
  498. message_list[4].name=KB_LC_PARA_INDEX_4;
  499. message_list[4].value=EVENT_TYPE_MAIL_MESSAGE;
  500. message_list[5].name=KB_LC_PARA_INDEX_5;
  501. message_list[5].value=EVENT_MAIL_TYPE_LIST;
  502. message_list[6].name=KB_LC_PARA_INDEX_6;
  503. message_list[6].value=KB_LC_PARA_INIT_0;
  504. if(TFCASTB_GetEmailHeads(ArrEmailHead, &byCount, &byFromIndex) == TFCAS_OK)
  505. {
  506. for(i = 0; i<byCount; i++)
  507. {
  508. //STFCAEmailContent EmailContent;
  509. //printf("邮件ID = 0x%8xrn", ArrEmailHead[i].m_dwActionID);
  510. ArrEmailHead[i].m_szEmailHead[TFCA_MAXLEN_EMAIL_TITLE] = 0; //防止溢出+++
  511. //printf("邮件标题 = %srn", ArrEmailHead[i].m_szEmailHead);
  512. mb_memset(start_str1, 0x00,5);
  513. sprintf(start_str1,"%d",7+0+(i*4));
  514. message_list[7+0+(i*4)].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  515. mb_memcpy((void*)message_list[7+0+(i*4)].name, (void*)start_str1, 5);
  516. message_list[7+0+(i*4)].value=(mb_char_t*)KB_MB_lc_getCommandBuf(32);
  517. mb_memcpy((void*)message_list[7+0+(i*4)].value, (void*)ArrEmailHead[i].m_szEmailHead, 32);
  518. mb_memset(start_str2, 0x00, 5);
  519. sprintf(start_str2,"%d",7+1+(i*4));
  520. message_list[7+1+(i*4)].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  521. mb_memcpy((void*)message_list[7+1+(i*4)].name, (void*)start_str2, 5);
  522. loc_time = Time_2_Local_Tiem(ArrEmailHead[i].m_tCreateTime);
  523. //节目播放日期
  524. ConvertTimeStampToDate((U32)loc_time, (U32 *)&nYear, (U32 *)&nMonth, (U32 *)&nDay);
  525. mb_memset(start_str6, 0x00, 20);
  526. sprintf(start_str6,"%04d-%02d-%02d",nYear,nMonth, nDay);
  527. message_list[7+1+(i*4)].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
  528. mb_memcpy((void*)message_list[7+1+(i*4)].value, (void*)start_str6, 20);
  529. mb_memset(start_str3, 0x00, 5);
  530. sprintf(start_str3,"%d",7+2+(i*4));
  531. message_list[7+2+(i*4)].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  532. mb_memcpy((void*)message_list[7+2+(i*4)].name, (void*)start_str3, 5);
  533. if (ArrEmailHead[i].m_wImportance == 0)
  534. message_list[7+(i*4)+2].value=KB_LC_PARA_INIT_0;
  535. else
  536. message_list[7+(i*4)+2].value=KB_LC_PARA_INIT_1;
  537. mb_memset(start_str4, 0x00, 5);
  538. sprintf(start_str4,"%d",7+3+(i*4));
  539. message_list[7+3+(i*4)].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  540. mb_memcpy((void*)message_list[7+3+(i*4)].name, (void*)start_str4, 5);
  541. if(ArrEmailHead[i].m_bNewEmail == 0)
  542. message_list[7+(i*4)+3].value=KB_LC_PARA_INIT_0;
  543. else
  544. message_list[7+(i*4)+3].value=KB_LC_PARA_INIT_1;
  545. }
  546. mb_memset(start_str5, 0x00, 5);
  547. sprintf(start_str5,"%d",byCount*4+8);
  548. message_list[6].value=start_str5;
  549. mail_count = byCount;
  550. }
  551. mb_memset(start_str1, 0x00, 5);
  552. sprintf(start_str1,"%d",7+0+(mail_count*4));
  553. message_list[7+0+(mail_count*4)].name = NULL;
  554. message_list[7+0+(mail_count*4)].value = NULL;
  555. kb_machblue_getCurMovieInfo(&current_movie_info);
  556. ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_MAIL_CONNECTION,MOVIE_MENU_MAIL_FUNCTION,message_list,&handle);
  557. if(ret!=MB_SUCCESS)
  558. {
  559.       mb_printf("n[Machblue]:Client send mail list error");
  560. }
  561. }
  562. //word mail index
  563. void kb_machblue_lc_2_mail_read(UINT32 word)
  564. {
  565. int ret;
  566. char start_str1[5];//,start_str2[32],start_str3[162];
  567. mb_param_t message_read[11];
  568. kb_movie_struct_t current_movie_info;
  569. mb_handle_t handle;
  570. //int i;
  571. //STFCAEmailHead  mail_head;
  572. STFCAEmailContent EmailContent;
  573. STFCAEmailHead  ArrEmailHead[10];
  574. BYTE byCount = 10;
  575. BYTE byFromIndex = 0;
  576. message_read[0].name=KB_LC_PARA_INDEX_0;
  577. message_read[0].value=MOVIE_NAME_MENU_MAIL;
  578. message_read[1].name=KB_LC_PARA_INDEX_1;
  579. message_read[1].value=MOVIE_TYPE_MOVIE_MENU;
  580. message_read[2].name=KB_LC_PARA_INDEX_2;
  581. message_read[2].value=MOVIE_MENU_MAIL_CONNECTION;
  582. message_read[3].name=KB_LC_PARA_INDEX_3;
  583. message_read[3].value=MOVIE_MENU_MAIL_FUNCTION;
  584. message_read[4].name=KB_LC_PARA_INDEX_4;
  585. message_read[4].value=EVENT_TYPE_MAIL_MESSAGE;
  586. message_read[5].name=KB_LC_PARA_INDEX_5;
  587. message_read[5].value=EVENT_MAIL_TYPE_READ;
  588. message_read[6].name=KB_LC_PARA_INDEX_6;
  589. mb_memset(start_str1, 0x00, 5);
  590. sprintf(start_str1,"%ld",word);
  591. //mb_printf("[machblue]kb_machblue_lc_2_mail_read:word = %d, str1 = %sn",word,start_str1);
  592. message_read[6].value = start_str1;
  593. message_read[7].name=KB_LC_PARA_INDEX_7;
  594. message_read[7].value=KB_LC_PARA_INIT_1;//read mail success or fail
  595. message_read[8].name=KB_LC_PARA_INDEX_8;
  596. message_read[8].value = " ";
  597. message_read[9].name=KB_LC_PARA_INDEX_9;
  598. message_read[9].value = " ";
  599. //mb_printf("nkb_machblue_lc_2_mail_read");
  600. if(TFCASTB_GetEmailHeads(ArrEmailHead, &byCount, &byFromIndex) == TFCAS_OK)
  601. {
  602. ArrEmailHead[word].m_szEmailHead[TFCA_MAXLEN_EMAIL_TITLE] = 0; //防止溢出+++
  603. //printf("邮件标题 = %srn", ArrEmailHead[word].m_szEmailHead);
  604. message_read[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(32);
  605. mb_memcpy((void*)message_read[8].value, (void*)ArrEmailHead[word].m_szEmailHead, 32);
  606. //message_read[8].value=mail_head.m_szEmailHead;
  607. if(TFCASTB_GetEmailContent(ArrEmailHead[word].m_dwActionID, &EmailContent)==TFCAS_OK)
  608. {
  609. message_read[7].value=KB_LC_PARA_INIT_1;
  610. EmailContent.m_szEmail[TFCA_MAXLEN_EMAIL_CONTENT] = 0;//防止溢出+++
  611. message_read[9].value=(mb_char_t*)KB_MB_lc_getCommandBuf(162);
  612. mb_memcpy((void*)message_read[9].value, (void*)EmailContent.m_szEmail, 162);
  613. //printf("邮件内容 = %srn", EmailContent.m_szEmail);
  614. }
  615. else
  616. {
  617. message_read[7].value = KB_LC_PARA_INIT_0;
  618. message_read[9].value = " ";
  619. }
  620. }
  621. message_read[10].name=NULL;
  622. message_read[10].value=NULL;
  623. kb_machblue_getCurMovieInfo(&current_movie_info);
  624. ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_MAIL_CONNECTION,MOVIE_MENU_MAIL_FUNCTION,message_read,&handle);
  625. if(ret!=MB_SUCCESS)
  626. {
  627.       mb_printf("n[Machblue]:kb_machblue_lc_2_mail_read error");
  628. }
  629. mb_printf("n[Machblue]:kb_machblue_lc_2_mail_read over.");
  630. }
  631. //word mail index
  632. void kb_machblue_lc_2_mail_delete(UINT32 word)
  633. {
  634. int ret;
  635. char start_str1[30];
  636. mb_param_t message_delete[9];
  637. kb_movie_struct_t current_movie_info;
  638. mb_handle_t handle;
  639. message_delete[0].name=KB_LC_PARA_INDEX_0;
  640. message_delete[0].value=MOVIE_NAME_MENU_MAIL;
  641. message_delete[1].name=KB_LC_PARA_INDEX_1;
  642. message_delete[1].value=MOVIE_TYPE_MOVIE_MENU;
  643. message_delete[2].name=KB_LC_PARA_INDEX_2;
  644. message_delete[2].value=MOVIE_MENU_MAIL_CONNECTION;
  645. message_delete[3].name=KB_LC_PARA_INDEX_3;
  646. message_delete[3].value=MOVIE_MENU_MAIL_FUNCTION;
  647. message_delete[4].name=KB_LC_PARA_INDEX_4;
  648. message_delete[4].value=EVENT_TYPE_MAIL_MESSAGE;
  649. message_delete[5].name=KB_LC_PARA_INDEX_5;
  650. message_delete[5].value=EVENT_MAIL_TYPE_READ;
  651. message_delete[6].name=KB_LC_PARA_INDEX_6;
  652. mb_memset(start_str1, 0x00, 2);
  653. sprintf(start_str1,"%ld",word);
  654. message_delete[6].value = start_str1;
  655. message_delete[7].name=KB_LC_PARA_INDEX_7;
  656. message_delete[7].value=KB_LC_PARA_INIT_1;//delete mail success or fail
  657. message_delete[8].name=NULL;
  658. message_delete[8].value=NULL;
  659. kb_machblue_getCurMovieInfo(&current_movie_info);
  660. ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_MAIL_CONNECTION,MOVIE_MENU_MAIL_FUNCTION,message_delete,&handle);
  661. if(ret!=MB_SUCCESS)
  662. {
  663.       mb_printf("n[Machblue]:Client delete mail list error");
  664. }
  665. }
  666. #endif
  667. #if 1
  668. void kb_machblue_lc_2_prompt(char* promt)
  669. {
  670. mb_error_t ret;
  671. kb_movie_struct_t current_movie_info;
  672. mb_param_t prompt_2_movie[7];
  673. mb_handle_t  req_handle;
  674. prompt_2_movie[0].name = KB_LC_PARA_INDEX_0;
  675. prompt_2_movie[0].value = MOVIE_NAME_MENU_PROMPT;
  676. prompt_2_movie[1].name = KB_LC_PARA_INDEX_1;
  677. prompt_2_movie[1].value = MOVIE_TYPE_MOVIE_MENU;
  678. prompt_2_movie[2].name = KB_LC_PARA_INDEX_2;
  679. prompt_2_movie[2].value = MOVIE_MENU_PROMPT_CONNECTION;
  680. prompt_2_movie[3].name = KB_LC_PARA_INDEX_3;
  681. prompt_2_movie[3].value = MOVIE_MENU_PROMPT_FUNCTION;
  682. prompt_2_movie[4].name = KB_LC_PARA_INDEX_4;
  683. prompt_2_movie[4].value = EVENT_TYPE_MENU_PROMPT;
  684. prompt_2_movie[5].name = KB_LC_PARA_INDEX_5;
  685. prompt_2_movie[5].value=promt;
  686. prompt_2_movie[6].name = NULL;
  687. prompt_2_movie[6].value=NULL;
  688. kb_machblue_getCurMovieInfo(&current_movie_info);
  689. ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_MENU_PROMPT_CONNECTION,MOVIE_MENU_PROMPT_FUNCTION,prompt_2_movie,&req_handle);
  690. if(ret!=MB_SUCCESS)
  691. {
  692.       mb_printf("n[Machblue]:Client epg init error");
  693. }
  694. else
  695. {
  696.       mb_printf("n[Machblue]:Client epg init success");
  697. }
  698. }
  699. #endif
  700. #if 1//NVOD
  701. void kb_machblue_lc_F_NVOD(kb_lc_attributes_t *pAttribs)
  702. {
  703. int nPrgRow,nSchRow;
  704. BOOL ret;
  705. //int i;
  706. /*
  707. for (i=0;i<10;i++)
  708. {
  709. mb_printf("n[machblue]receive[%d] = %sn",i,(char *)pAttribs->parameters[i].value);
  710. }
  711. */
  712. //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);
  713. nPrgRow = atoi((char *)pAttribs->parameters[lc_data3].value);
  714. nSchRow = atoi((char *)pAttribs->parameters[lc_data4].value);
  715. //BOOL KB_NVOD_PlayForGrap(int nPrgCurRow, int nSchCurRow)
  716. //mb_printf("n[machblue]kb_machblue_lc_F_NVOD:nPrgRow = %d,nSchRow = %dn",nPrgRow,nSchRow);
  717. ret = KB_NVOD_PlayForGrap(nPrgRow, nSchRow);
  718. if (ret!=TRUE)
  719. KB_MB_lc_2_movie_word_Post_Task(0);
  720. }
  721. void kb_machblue_lc_2_NVOD(UINT32 word)
  722. {
  723. char start_str1[30];
  724. time_t plTime;
  725. mb_error_t ret;
  726. mb_param_t nvod[15];
  727. mb_handle_t handle;
  728. kb_movie_struct_t current_movie_info;
  729. //int i;
  730. //mb_printf("n[machblue]enter kb_machblue_lc_2_NVODn");
  731. nvod[0].name=KB_LC_PARA_INDEX_0;
  732. nvod[0].value=MOVIE_NAME_MENU_NVOD;
  733. nvod[1].name=KB_LC_PARA_INDEX_1;
  734. nvod[1].value=MOVIE_TYPE_MOVIE_MENU;
  735. nvod[2].name=KB_LC_PARA_INDEX_2;
  736. nvod[2].value=MOVIE_NVOD_CONNECTION;
  737. nvod[3].name=KB_LC_PARA_INDEX_3;
  738. nvod[3].value=MOVIE_NVOD_FUN_SELECTCH;
  739. nvod[4].name=KB_LC_PARA_INDEX_4;
  740. nvod[4].value=EVENT_TYPE_NVOD;
  741. nvod[5].name=KB_LC_PARA_INDEX_5;
  742. nvod[5].value=EVENT_TYPE_2_NVOD;
  743. nvod[6].name=KB_LC_PARA_INDEX_6;
  744. nvod[6].value=EVENT_TYPE_2_NVOD_S_F;
  745. nvod[7].name=KB_LC_PARA_INDEX_7;
  746. if (word != 1)
  747. nvod[7].value=KB_LC_PARA_INIT_0;//0失败1成功
  748. else
  749. nvod[7].value=KB_LC_PARA_INIT_1;
  750. KB_TimeGetCurTime(&plTime);
  751. mb_memset(start_str1, 0x00, 30);
  752. sprintf(start_str1,"%ld",plTime);
  753. nvod[8].name=KB_LC_PARA_INDEX_8;
  754. nvod[8].value = start_str1;
  755. nvod[9].name=KB_LC_PARA_INDEX_9;
  756. nvod[9].value=NULL;
  757. kb_machblue_getCurMovieInfo(&current_movie_info);
  758. ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_NVOD_CONNECTION,MOVIE_NVOD_FUN_SELECTCH,nvod,&handle);
  759. if(ret!=MB_SUCCESS)
  760. {
  761.       mb_printf("n[Machblue]:Client init nvod fail!");
  762. }
  763. }
  764. #endif
  765. #if 1
  766. void kb_mb_ch_no_2_movie(UINT32 word)
  767. {
  768. mb_param_t channel_no[50];
  769. mb_handle_t handle;
  770. char str[5];
  771. kb_movie_struct_t current_movie_info;
  772. mb_error_t ret;
  773. int pro_type,pro_no;
  774. UINT16 pro_total;
  775. KB_DTVGetPrg(&pro_type,&pro_no);
  776. channel_no[0].name=KB_LC_PARA_INDEX_0;
  777. channel_no[0].value=MOVIE_NAME_MENU_CHANNEL_NO;
  778. channel_no[1].name=KB_LC_PARA_INDEX_1;
  779. channel_no[1].value=MOVIE_TYPE_MOVIE_MENU;
  780. channel_no[2].name=KB_LC_PARA_INDEX_2;
  781. channel_no[2].value=MOVIE_CH_NO_CONNECTION;
  782. channel_no[3].name=KB_LC_PARA_INDEX_3;
  783. channel_no[3].value=MOVIE_CH_NO_FUNCTION;
  784. channel_no[4].name=KB_LC_PARA_INDEX_4;
  785. channel_no[4].value=EVENT_TYPE_CH_NO;
  786. channel_no[5].name=KB_LC_PARA_INDEX_5;
  787. sprintf(str,"%ld",word);
  788. channel_no[5].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  789. mb_memcpy((void*)channel_no[5].value, (void*)str, 5);
  790. channel_no[6].name=KB_LC_PARA_INDEX_6;
  791. pro_total = KB_DBGetPrgTotal(pro_type);
  792. sprintf(str,"%d",pro_total);
  793. channel_no[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  794. mb_memcpy((void*)channel_no[6].value, (void*)str, 5);
  795. channel_no[7].name=NULL;
  796. channel_no[7].value=NULL;
  797. kb_machblue_getCurMovieInfo(&current_movie_info);
  798. ret=mb_movie_lc_request_send(current_movie_info.movie,MOVIE_CH_NO_CONNECTION,MOVIE_CH_NO_FUNCTION,channel_no,&handle);
  799. if(ret!=MB_SUCCESS)
  800. {
  801.       mb_printf("n[Machblue]:C code send information to movie error");
  802. }
  803. }
  804. void kb_mb_ch_no_F_movie(kb_lc_attributes_t *pAttribs)
  805. {
  806. int chan_no;
  807. int pro_type,pro_no;
  808. KB_DTVGetPrg(&pro_type,&pro_no);
  809. chan_no = atoi((char *)pAttribs->parameters[lc_data1].value);
  810. KB_DTVPlayPrg(pro_type, chan_no);
  811. //close movie
  812. kb_machblue_movie_close(TRUE);
  813. }
  814. #endif
  815. #if 1//ca inform
  816. void kb_machblue_lc_2_ca_inform(void)
  817. {
  818. mb_error_t ret;
  819. kb_movie_struct_t current_movie_info;
  820. mb_param_t ca_inform_2_movie[8];
  821. mb_handle_t  req_handle;
  822. int ca_inform_flag;
  823. char* message;
  824. char str[5];
  825. message = Get_CA_Inform_flag(&ca_inform_flag);
  826. if (message == NULL)
  827. message = " ";
  828. ca_inform_2_movie[0].name = KB_LC_PARA_INDEX_0;
  829. ca_inform_2_movie[0].value = MOVIE_NAME_CA_INFORM;
  830. ca_inform_2_movie[1].name = KB_LC_PARA_INDEX_1;
  831. ca_inform_2_movie[1].value = MOVIE_TYPE_MOVIE_MENU;
  832. ca_inform_2_movie[2].name = KB_LC_PARA_INDEX_2;
  833. ca_inform_2_movie[2].value = MOVIE_CA_INFORM_CONNECTION;
  834. ca_inform_2_movie[3].name = KB_LC_PARA_INDEX_3;
  835. ca_inform_2_movie[3].value = MOVIE_CA_CON_INFORM_FUNCTION;
  836. ca_inform_2_movie[4].name = KB_LC_PARA_INDEX_4;
  837. ca_inform_2_movie[4].value = MOVIE_CA_CON_INFORM_FUNCTION;
  838. ca_inform_2_movie[5].name = KB_LC_PARA_INDEX_5;
  839. ca_inform_2_movie[5].value=message; //content
  840. ca_inform_2_movie[6].name = KB_LC_PARA_INDEX_6;
  841. mb_memset(str, 0x00, 5);
  842. sprintf(str,"%d",ca_inform_flag);
  843. ca_inform_2_movie[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  844. mb_memcpy((void*)ca_inform_2_movie[6].value, (void*)str, 5);// 0 up 1 down 2 close up 3 close down
  845. ca_inform_2_movie[7].name = NULL;
  846. ca_inform_2_movie[7].value = NULL;
  847. kb_machblue_getCurMovieInfo(&current_movie_info);
  848. 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);
  849. if(ret!=MB_SUCCESS)
  850. {
  851.       mb_printf("n[Machblue]:Client epg init error");
  852. }
  853. else
  854. {
  855.       mb_printf("n[Machblue]:Client epg init success");
  856. }
  857. }
  858. #endif
  859. //add by shriek 
  860. //extern void OTA_lc_Service (KB_OSPMsgNode *pMsg);
  861. void kb_machblue_lc_F_otahint(kb_lc_attributes_t *pAttribs)  
  862. {
  863. //int ota_info;
  864. KB_OSPMsgNode   MsgCaClient;  
  865.  mb_printf("n[kb_machblue_lc_F_otahint]:lc_movie_name=%s",(mb_char_t*)pAttribs->parameters[lc_movie_name].value);
  866.  mb_printf("n[kb_machblue_lc_F_otahint]:lc_movie_type=%s",(mb_char_t*)pAttribs->parameters[lc_movie_type].value);
  867.  mb_printf("n[kb_machblue_lc_F_otahint]:lc_movie_lcName=%s",(mb_char_t*)pAttribs->parameters[lc_movie_lcName].value);
  868.  mb_printf("n[kb_machblue_lc_F_otahint]:lc_movie_funName=%s",(mb_char_t*)pAttribs->parameters[lc_movie_funName].value);
  869.  mb_printf("n[kb_machblue_lc_F_otahint]:lc_event_type=%s",(mb_char_t*)pAttribs->parameters[lc_event_type].value);     
  870.  mb_printf("n[kb_machblue_lc_F_otahint]:lc_data1=%s",(mb_char_t*)pAttribs->parameters[lc_data1].value);
  871.  mb_printf("n[kb_machblue_lc_F_otahint]:lc_data2=%s",(mb_char_t*)pAttribs->parameters[lc_data2].value);
  872.  
  873. //空中升级
  874.        if(mb_strcmp((mb_char_t*)pAttribs->parameters[lc_event_type+1].value,(mb_char_t*)MOVIE_TYPE_MOVIE_OTA_QUERY)==0)
  875. {
  876. printf("n kb_machblue_lc_F_otahint: to send return key to ota modules");
  877. //kb_machblue_movie_close(TRUE);
  878.        MsgCaClient.Word1 = atoi((mb_char_t*)pAttribs->parameters[lc_data2].value);
  879.        //OTA_lc_Service (&MsgCaClient);
  880. }
  881. }
  882. void KB_MB_lc_OTA_hint_2_movie(char *hint)
  883. {
  884. mb_error_t ret;
  885. kb_movie_struct_t current_movie_info;
  886. mb_param_t prompt_2_movie[7];
  887. mb_handle_t  req_handle;
  888. //int i;
  889.        printf("n KB_MB_lc_OTA_hint_2_movie: %s", hint);
  890. prompt_2_movie[0].name = KB_LC_PARA_INDEX_0;
  891. prompt_2_movie[0].value = MOVIE_NAME_MENU_OTA_HINT;
  892. prompt_2_movie[1].name = KB_LC_PARA_INDEX_1;
  893. prompt_2_movie[1].value = MOVIE_TYPE_MOVIE_MENU;
  894. prompt_2_movie[2].name = KB_LC_PARA_INDEX_2;
  895. prompt_2_movie[2].value = MOVIE_MENU_OTA_HINT_CONNECTION;
  896. prompt_2_movie[3].name = KB_LC_PARA_INDEX_3;
  897. prompt_2_movie[3].value = MOVIE_MENU_OTA_HINT_FUNCTION;
  898. prompt_2_movie[4].name = KB_LC_PARA_INDEX_4;
  899. prompt_2_movie[4].value = EVENT_TYPE_MENU_PROMPT;
  900. prompt_2_movie[5].name = KB_LC_PARA_INDEX_5;
  901. prompt_2_movie[5].value= hint;
  902. prompt_2_movie[6].name = NULL;
  903. prompt_2_movie[6].value=NULL;  
  904.        //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);
  905.    
  906. kb_machblue_getCurMovieInfo(&current_movie_info);
  907. 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);
  908. if(ret!=MB_SUCCESS)
  909. {
  910.       mb_printf("n[Machblue]:Client ota init error");
  911. }
  912. else
  913. {
  914.       mb_printf("n[Machblue]:Client ota init success");
  915. }
  916. }
  917. #if 1
  918. //频道编辑接口
  919. void kb_machblue_lc_Dtvpgm_test(unsigned char dtv_type)
  920. {
  921. int i;
  922. for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
  923. {
  924.      printf("n kb_machblue_lc_Dtvpgm_test:  %s",   _kb_mb_serviceList[dtv_type].services[i].info.name);
  925. }
  926. typedef struct 
  927. {
  928. UINT16  mb_tsid;
  929. UINT16  mb_svcid;         
  930. mb_char_t   logo_url[5];           
  931. mb_char_t   name[MB_TV_SERVICE_NAME_LENGTH];      
  932. } mb_tv_chledit_info_s;
  933. typedef struct 
  934. {
  935.        mb_tv_chledit_info_s   *services;
  936. unsigned long  count;
  937. }kb_chledit_infoList_s;
  938. kb_chledit_infoList_s _kb_chledit_List[list_last];
  939. mb_error_t kb_mb_chledit_list_clear(void)
  940. {
  941. unsigned short index;
  942. //clear tvlist
  943. for(index=0;index<_kb_chledit_List[all_tv_list].count;index++)
  944. {
  945. mb_memset(&(_kb_chledit_List[all_tv_list].services[index]),0,sizeof(mb_tv_chledit_info_s));
  946. }
  947. mb_free(_kb_chledit_List[all_tv_list].services);
  948. mb_memset(&(_kb_chledit_List[all_tv_list]),0,sizeof(kb_chledit_infoList_s));
  949.        //clear radio list
  950. for(index=0;index<_kb_chledit_List[radio_list].count;index++)
  951. {
  952. mb_memset(&(_kb_chledit_List[radio_list].services[index]),0,sizeof(mb_tv_chledit_info_s));
  953. }
  954. mb_free(_kb_chledit_List[radio_list].services);
  955. mb_memset(&(_kb_chledit_List[radio_list]),0,sizeof(kb_chledit_infoList_s));
  956. return MB_SUCCESS;
  957. }
  958. static mb_error_t kb_mb_chledit_list_all_tv_init(void)
  959. {
  960. unsigned short videoCnt=0,index;
  961. UINT16 service_ID;
  962. unsigned char *service_name;
  963. _kb_chledit_List[all_tv_list].services=NULL;
  964. _kb_chledit_List[all_tv_list].count=0;
  965. videoCnt=KB_DBGetPrgTotal(DTVPRG);
  966. if(videoCnt==0)
  967. return MB_SUCCESS;
  968. //malloc service memory
  969. _kb_chledit_List[all_tv_list].services=mb_malloc(sizeof(mb_tv_chledit_info_s)*videoCnt);
  970. if(_kb_chledit_List[all_tv_list].services==NULL)
  971. {
  972. mb_printf("n[Machblue]:Service list 1 init no memory.");
  973.        return MB_FAILURE;
  974. }
  975. mb_memset(_kb_chledit_List[all_tv_list].services,0,sizeof(mb_tv_chledit_info_s)*videoCnt);
  976. //insert video service
  977. for(index=0;index<videoCnt;index++)
  978. {
  979. //service info
  980. service_ID = KB_DBGetSvcIDByNO(DTVPRG, index);
  981. service_name = KB_DBGetPrgName(DTVPRG,index+1);
  982. _kb_chledit_List[all_tv_list].services[index].mb_svcid = service_ID;
  983. _kb_chledit_List[all_tv_list].services[index].mb_tsid = KB_DBGetPrgTsID(DTVPRG,index+1);
  984. mb_memcpy(_kb_chledit_List[all_tv_list].services[index].name, service_name,MB_TV_SERVICE_NAME_LENGTH);
  985. mb_memcpy(_kb_chledit_List[all_tv_list].services[index].logo_url, "0000 ",5);
  986. //service count
  987. _kb_chledit_List[all_tv_list].count+=1;
  988.      }
  989. return MB_SUCCESS;
  990. }
  991. static mb_error_t kb_mb_chledit_list_all_radio_init(void)
  992. {
  993. unsigned short audioCnt=0,index;
  994. UINT16 service_ID;
  995. unsigned char *service_name;
  996. _kb_chledit_List[radio_list].services=NULL;
  997. _kb_chledit_List[radio_list].count=0;
  998. audioCnt=KB_DBGetPrgTotal(RADIOPRG);
  999. if(audioCnt==0)
  1000. return MB_SUCCESS;
  1001. //malloc service memory
  1002. _kb_chledit_List[radio_list].services=mb_malloc(sizeof(mb_tv_chledit_info_s)*audioCnt);
  1003. if(_kb_chledit_List[radio_list].services==NULL)
  1004. {
  1005. mb_printf("n[Machblue]:Service list 1 init no memory.");
  1006.        return MB_FAILURE;
  1007. }
  1008. mb_memset(_kb_chledit_List[radio_list].services,0,sizeof(mb_tv_chledit_info_s)*audioCnt);
  1009. //insert video service
  1010. for(index=0;index<audioCnt;index++)
  1011. {
  1012. //service info
  1013. service_ID = KB_DBGetSvcIDByNO(RADIOPRG, index);
  1014. service_name = KB_DBGetPrgName(RADIOPRG,index+1);
  1015. _kb_chledit_List[radio_list].services[index].mb_svcid = service_ID;
  1016. _kb_chledit_List[radio_list].services[index].mb_tsid = KB_DBGetPrgTsID(RADIOPRG,index+1);
  1017. mb_memcpy(_kb_chledit_List[radio_list].services[index].name, service_name,MB_TV_SERVICE_NAME_LENGTH);
  1018. mb_memcpy(_kb_chledit_List[radio_list].services[index].logo_url, "0000 ",5);
  1019. //service count
  1020. _kb_chledit_List[radio_list].count+=1;
  1021.      }
  1022. return MB_SUCCESS;
  1023. }
  1024. /**
  1025.  * This function init the channel edit service list information. 
  1026.  * @return MB_SUCCESS on success, MB_FAILURE on failure.
  1027.  */
  1028. mb_error_t kb_mb_chledit_list_init(void)
  1029. {
  1030. kb_mb_chledit_list_all_tv_init();
  1031. kb_mb_chledit_list_all_radio_init();
  1032. return MB_SUCCESS;
  1033. }
  1034. mb_error_t kb_mb_chledit_list_reset(void)
  1035. {
  1036. //clear
  1037. kb_mb_chledit_list_clear();
  1038. //add
  1039. kb_mb_chledit_list_init();
  1040. return MB_SUCCESS;
  1041. }
  1042. mb_error_t kb_mb_chledit_list_test(void)
  1043. {
  1044. int i;
  1045. for(i=0;i<_kb_chledit_List[all_tv_list].count;i++)
  1046. {
  1047. 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);
  1048. }
  1049. return MB_SUCCESS;
  1050. }
  1051. /**
  1052.  * kb_machblue_lc_Channel_Fake_Operate
  1053.  
  1054.  * attribs < parameter to search service >
  1055.  
  1056.  * @return none
  1057.  */
  1058. void kb_machblue_lc_Channel_Fake_Operate(unsigned char dtv_type, kb_lc_attributes_t *attribs)
  1059. {
  1060. int index;
  1061. unsigned char operate;
  1062. index = atoi((mb_char_t*)attribs->parameters[lc_data3].value);
  1063. operate = atoi((mb_char_t*)attribs->parameters[lc_data4].value);
  1064. mb_printf("n kb_machblue_lc_Channel_Fake_Operate:  index=%d   operate=%d nn", index, operate);
  1065. if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_Fav)==0)
  1066. {
  1067. _kb_mb_serviceList[dtv_type].services[index].serInfo.edit_info.favor= operate;
  1068. }
  1069. else if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_MOVE)==0)
  1070. {
  1071. _kb_mb_serviceList[dtv_type].services[index].serInfo.edit_info.move= operate;
  1072. }
  1073. else if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_DEL)==0)
  1074. {
  1075. _kb_mb_serviceList[dtv_type].services[index].serInfo.edit_info.del= operate;
  1076. }
  1077. else if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_LOCK)==0)
  1078. {
  1079. _kb_mb_serviceList[dtv_type].services[index].serInfo.edit_info.lock= operate;
  1080. }
  1081. }
  1082. /**
  1083.  * kb_machblue_lc_Channel_edit_proc
  1084.  
  1085.  * attribs < parameter to search service >
  1086.  
  1087.  * @return none
  1088.  */
  1089. void kb_machblue_lc_Channel_edit_proc(kb_lc_attributes_t *attribs)
  1090. {
  1091. //UINT edit_type;
  1092. 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);
  1093. if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data1].value, EVENT_SEARCH_TYPE_CHA_EDIT)==0)
  1094. {
  1095. if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_SAVE)==0)
  1096. {
  1097. kb_machblue_lc_Channel_Save_Allproc(all_tv_list, atoi((mb_char_t*)attribs->parameters[lc_data3].value));
  1098. }
  1099. else if(mb_strcmp((mb_char_t*)attribs->parameters[lc_data2].value, EVENT_SEARCH_TYPE_CHA_EDIT_NONE)==0)
  1100. {
  1101. mb_printf("n no edit to be save");
  1102. }
  1103. else
  1104. {
  1105. mb_printf("n edit operate is:%s", (mb_char_t*)attribs->parameters[lc_data2].value);
  1106. kb_machblue_lc_Channel_Fake_Operate(all_tv_list, attribs);
  1107. }
  1108. }
  1109. }
  1110. /**
  1111.  * kb_machblue_lc_Channel_Save_Allproc
  1112.  
  1113.  * attribs < parameter to search service >
  1114.  
  1115.  * @return none
  1116.  */
  1117. void kb_machblue_lc_Channel_Save_Allproc(unsigned char dtv_type, unsigned int flag)
  1118. {
  1119. int i;
  1120. UINT16 mb_tsid;
  1121. UINT16 mb_svcid;
  1122. //mb_printf("nn------test1 start-----");
  1123. //kb_machblue_lc_editinfo_test(all_tv_list);   //test only
  1124. //kb_DB_Dtvpgm_test();
  1125. //kb_machblue_lc_Dtvpgm_test(all_tv_list);
  1126. //mb_printf("n------test1 end-----nn");
  1127. //确定修改
  1128. if(flag==1)  
  1129. {
  1130. mb_printf("n kb_machblue_lc_Channel_Save_Allproc:  user select to save edit");
  1131. for(i=0; i<_kb_mb_serviceList[dtv_type].count; i++)
  1132. {
  1133. mb_tsid = _kb_mb_serviceList[dtv_type].services[i].serInfo.tsID;
  1134. mb_svcid =  _kb_mb_serviceList[dtv_type].services[i].info.display_id;
  1135. //delete operation
  1136. if(_kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del==1)
  1137. {
  1138. kb_machblue_lc_editinfo_update(dtv_type, i, MB_DELETE, 1);
  1139. 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);
  1140. KB_DBDelPrgInfoByTsidSrvid(dtv_type, mb_tsid, mb_svcid);
  1141. continue;
  1142. }  
  1143. //favor operation
  1144. if(_kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor==1)
  1145. {
  1146. kb_machblue_lc_editinfo_update(dtv_type, i, MB_FAVOR, 1);
  1147. KB_DBAddFavPrg(dtv_type, mb_tsid, mb_svcid);
  1148. //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);
  1149. }
  1150. else
  1151. {
  1152. kb_machblue_lc_editinfo_update(dtv_type, i, MB_FAVOR, 0);
  1153. KB_DBDelFavPrg(dtv_type, mb_tsid, mb_svcid );
  1154. }
  1155. //lock operation
  1156. if(_kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock==1)
  1157. {
  1158. 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);
  1159. kb_machblue_lc_editinfo_update(dtv_type, i, MB_LOCK, 1);
  1160. KB_DBLockSrv(dtv_type, i);
  1161. }
  1162. else
  1163. {
  1164. kb_machblue_lc_editinfo_update(dtv_type, i, MB_LOCK, 0);
  1165. KB_DBUnlockSrv(dtv_type, i);
  1166. }
  1167. }
  1168. mb_printf("nn------test2 start-----");
  1169. //kb_DB_Dtvpgm_test();
  1170. //保存节目
  1171. KB_DBSaveToFlash();
  1172. //重新构造macblue 节目列表
  1173. kb_mb_service_list_reset();
  1174. kb_mb_editinfo_reinit();
  1175. //kb_machblue_lc_Dtvpgm_test(all_tv_list);
  1176. //kb_machblue_lc_editinfo_test(all_tv_list);   //test only
  1177. //KB_DBFavTest();
  1178. mb_printf("n------test2 end----nn-");
  1179. }
  1180. //放弃修改
  1181. else//(flag == 0)
  1182. {
  1183. mb_printf("n kb_machblue_lc_Channel_Save_Allproc:  user select to giveup edit");
  1184. }
  1185. }
  1186. //shriek end
  1187. void kb_machblue_lc_editinfo_update(unsigned char dtv_type, unsigned int index, unsigned char  flag, unsigned char  value)
  1188. {
  1189. char c;
  1190. if(flag>4||flag<0)
  1191. return;
  1192. if(value==1)
  1193. {
  1194. c = '1';
  1195. _kb_chledit_List[dtv_type].services[index].logo_url[flag] = c;
  1196. }
  1197. else 
  1198. {
  1199. c =  '0';
  1200. _kb_chledit_List[dtv_type].services[index].logo_url[flag] =c ;
  1201. }
  1202. _kb_chledit_List[dtv_type].services[index].logo_url[4] = '';
  1203.  
  1204. }
  1205. mb_error_t kb_mb_editinfo_init(void)
  1206. {
  1207. kb_mb_chledit_list_init();
  1208. kb_mb_editinfo_load();
  1209. return MB_SUCCESS;
  1210. }
  1211. mb_error_t kb_mb_editinfo_load(void)
  1212. {
  1213. int i,j, dtv_type;
  1214. UINT16 mb_tsid;
  1215. UINT16 mb_svcid;
  1216. KB_DBFavDtvInfo FavDtvInfo;
  1217. KB_DBFavRadInfo RadInfo;
  1218. char c0,c1;
  1219. bool dtv_found=false;
  1220. bool radio_found=false;
  1221. c0='0';
  1222. c1='1';
  1223. //logo_url load
  1224. for(dtv_type=all_tv_list; dtv_type<=radio_list; dtv_type++)
  1225. {
  1226. for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
  1227. {
  1228. mb_tsid = _kb_mb_serviceList[dtv_type].services[i].serInfo.tsID;
  1229. mb_svcid =  _kb_mb_serviceList[dtv_type].services[i].info.display_id;
  1230. if(dtv_type== all_tv_list)
  1231. {
  1232. //favor dtv load
  1233. KB_DBGetFavPrgInfoInE2p(all_tv_list, (KB_DBFavDtvInfo*)&FavDtvInfo);
  1234. if(FavDtvInfo.nTotal==0)
  1235. break;
  1236. for (j= 0; j< FavDtvInfo.nTotal; j++)
  1237.          {
  1238.          if(FavDtvInfo.FavList[j].SrvId==mb_svcid&&FavDtvInfo.FavList[j].TsId==mb_tsid)
  1239.          {
  1240. _kb_mb_serviceList[dtv_type].services[i].info.logo_url[0]=c1;
  1241. dtv_found = true;
  1242.          }
  1243. }
  1244. if(!dtv_found)
  1245. {
  1246. printf("n no dtv favor found");
  1247. }
  1248. //lock dtv load
  1249. if(KB_DBIsSrvLocked(all_tv_list, i))
  1250. {
  1251. _kb_mb_serviceList[all_tv_list].services[i].info.logo_url[3]=c1;
  1252. }
  1253. }
  1254. else if(dtv_type==radio_list)
  1255. {
  1256. //favor radio load
  1257. KB_DBGetFavPrgInfoInE2p(radio_list, &RadInfo);
  1258. if(RadInfo.nTotal==0)
  1259. break;
  1260. for (j= 0; j< RadInfo.nTotal; j++)
  1261.          {
  1262.          if(RadInfo.FavList[j].SrvId==mb_svcid&&RadInfo.FavList[j].TsId==mb_tsid)
  1263.          {
  1264. _kb_mb_serviceList[dtv_type].services[i].info.logo_url[0]=c1;
  1265. radio_found = true;
  1266.          }
  1267. }
  1268. if(!radio_found)
  1269. {
  1270. printf("n no radio favor found");
  1271. }
  1272. //lock dtv load
  1273. if(KB_DBIsSrvLocked(radio_list, i))
  1274. {
  1275. _kb_mb_serviceList[radio_list].services[i].info.logo_url[3]=c1;
  1276. }
  1277. }
  1278. }
  1279. }
  1280. //fake operate info load
  1281. for(dtv_type=all_tv_list; dtv_type<=radio_list; dtv_type++)
  1282. {
  1283. for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
  1284. {
  1285. if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[0]=='1')
  1286. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor=1;
  1287. else
  1288. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor=0;
  1289. if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[1]=='1')
  1290. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.move=1;
  1291. else
  1292. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.move=0;
  1293. if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[2]=='1')
  1294. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del=1;
  1295. else
  1296. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del=0;
  1297. if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[3]=='1')
  1298. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock=1;
  1299. else
  1300. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock=0;
  1301. }
  1302. }
  1303. return MB_SUCCESS;
  1304. }
  1305. mb_error_t kb_mb_editinfo_reload(void)
  1306. {
  1307. int i,j, dtv_type;
  1308. UINT16 mb_tsid;
  1309. UINT16 mb_svcid;
  1310. //logo_url reload
  1311. for(dtv_type=all_tv_list; dtv_type<=radio_list; dtv_type++)
  1312. {
  1313. for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
  1314. {
  1315. mb_tsid = _kb_mb_serviceList[dtv_type].services[i].serInfo.tsID;
  1316. mb_svcid =  _kb_mb_serviceList[dtv_type].services[i].info.display_id;
  1317. for(j=0;j<_kb_chledit_List[dtv_type].count;j++)
  1318. {
  1319. if(mb_tsid==_kb_chledit_List[dtv_type].services[j].mb_tsid&&mb_svcid==_kb_chledit_List[dtv_type].services[j].mb_svcid)
  1320. {
  1321. mb_memcpy(_kb_mb_serviceList[dtv_type].services[i].info.logo_url, _kb_chledit_List[dtv_type].services[j].logo_url, 5);
  1322. break;
  1323. }
  1324. }
  1325. if(j==_kb_chledit_List[dtv_type].count)
  1326. return MB_FAILURE;
  1327. }
  1328. }
  1329. //fake operate info reload
  1330. for(dtv_type=all_tv_list; dtv_type<=radio_list; dtv_type++)
  1331. {
  1332. for(i=0;i<_kb_mb_serviceList[dtv_type].count;i++)
  1333. {
  1334. if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[0]=='1')
  1335. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor=1;
  1336. else
  1337. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.favor=0;
  1338. if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[1]=='1')
  1339. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.move=1;
  1340. else
  1341. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.move=0;
  1342. if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[2]=='1')
  1343. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del=1;
  1344. else
  1345. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.del=0;
  1346. if(_kb_mb_serviceList[dtv_type].services[i].info.logo_url[3]=='1')
  1347. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock=1;
  1348. else
  1349. _kb_mb_serviceList[dtv_type].services[i].serInfo.edit_info.lock=0;
  1350. }
  1351. }
  1352. return MB_SUCCESS;
  1353. }
  1354. void kb_mb_editinfo_reinit(void)
  1355. {
  1356. if(kb_mb_editinfo_reload()==MB_SUCCESS)
  1357. {
  1358. kb_mb_chledit_list_reset();
  1359. }
  1360. else
  1361. {
  1362. mb_printf("n kb_mb_editinfo_reload falure");
  1363. }
  1364. }
  1365. void kb_machblue_lc_editinfo_test(unsigned char dtv_type)
  1366. {
  1367. int i;
  1368. for(i=0; i<_kb_chledit_List[dtv_type].count; i++)
  1369. {
  1370. 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]);
  1371. }
  1372. printf("n---------------next url-------------------n");
  1373. printf("n serviceList_logo_url: logo_url=%s",  _kb_mb_serviceList[dtv_type].services[i].info.logo_url);
  1374. for(i=0; i<_kb_mb_serviceList[dtv_type].count; i++)
  1375. {
  1376. 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]);
  1377. }
  1378. }
  1379. //shriek end
  1380. #endif
  1381. //shriek end
  1382. void kb_machblue_lc_menu_noRadioList(KB_DBPRGType type)
  1383. {
  1384. mb_error_t ret;
  1385. mb_param_t para[6];
  1386. mb_handle_t handle;
  1387. kb_movie_struct_t current_movie_info;
  1388. para[0].name=KB_LC_PARA_INDEX_0;
  1389. para[0].value=MOVIE_NAME_MENU_MAIN;
  1390. para[1].name=KB_LC_PARA_INDEX_1;
  1391. para[1].value=MOVIE_TYPE_MOVIE_MENU;
  1392. para[2].name=KB_LC_PARA_INDEX_2;
  1393. para[2].value="_mainConnect_connection";
  1394. para[3].name=KB_LC_PARA_INDEX_3;
  1395. para[3].value="receive_func";
  1396. para[4].name=KB_LC_PARA_INDEX_4;
  1397. switch(type)
  1398. {
  1399. case DTVPRG:
  1400. para[4].value="0";
  1401. break;
  1402. case RADIOPRG:
  1403. para[4].value="1";
  1404. break;
  1405. }
  1406. para[5].name=NULL;
  1407. para[5].value=NULL;
  1408. kb_machblue_getCurMovieInfo(&current_movie_info);
  1409. ret=mb_movie_lc_request_send(current_movie_info.movie,"_mainConnect_connection","receive_func",para,&handle);
  1410. if(ret!=MB_SUCCESS)
  1411. {
  1412.       mb_printf("n[Machblue]:Client epg init error");
  1413. }
  1414. else
  1415. mb_printf("nkb_machblue_lc_menu_noRadioList");
  1416. }
  1417. /***
  1418. 新代码
  1419. ***/
  1420. /***
  1421. 搜索页面
  1422. ***/
  1423. //从搜索页面接收到消息,并根据消息来确定需要做那些操作
  1424. void kb_getInfoFSearchMenu(kb_lc_attributes_t *pAttribs)
  1425. {
  1426. if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_SEARCH_1))
  1427. {
  1428. unsigned char searchType;
  1429. int frequency1,frequency2;
  1430. T_SEARCH_PARA *searchApp;
  1431. KB_DMDTunerParameters gSearchFre;
  1432. searchType = atoi((char *)pAttribs->parameters[lc_data2].value);
  1433. frequency1 = atoi((char *)pAttribs->parameters[lc_data3].value);
  1434. KB_EPG_ResetSchInfoByTsid(0xFFFF);
  1435. KB_DTVStopAV();
  1436. KD_ResetCurPrgInfo();
  1437. mb_printf("nenter the functionkb_getInfoFSearchMenun");
  1438. if(searchType==1)
  1439. {
  1440. //自动搜索
  1441. gSearchFre.frequency=frequency1*1000;
  1442. gSearchFre.details.qam.symbolRatekSs=6875;
  1443. gSearchFre.details.qam.modulation=3;
  1444. KB_SEARCHSetPara(KB_SEARCH_IN_NET, gSearchFre.frequency, gSearchFre.details.qam.symbolRatekSs, gSearchFre.details.qam.modulation);
  1445. else if(searchType==2)
  1446. {
  1447. //手动搜索
  1448. searchApp=KB_SrchGetSrchApp();
  1449. searchApp->srchMode=(UINT8)KB_SEARCH_IN_TS;//手动
  1450. searchApp->tsParams.frequency= (UINT32)frequency1*1000;
  1451. }
  1452. else if(searchType==3)
  1453. {
  1454. //全频点搜索
  1455. frequency2 = atoi((char *)pAttribs->parameters[lc_data4].value);
  1456. KB_SEARCHSetPara(KB_SEARCH_IN_WHOLE_NET, gSearchFre.frequency, gSearchFre.details.qam.symbolRatekSs, gSearchFre.details.qam.modulation);
  1457. KB_DBClearAllProg();
  1458. }
  1459. STB_StateSwitch(State_SRCH);
  1460. }
  1461. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_SEARCH_2))
  1462. {
  1463. }
  1464. }
  1465. //发送关于搜索结果页面上的信息给影片
  1466. extern KB_DBPrgAllInfo gPrgAllInfo;
  1467. void kb_searchResult2Movie(UINT32 word)
  1468. char resultString[5];
  1469. int tvNum,radioNum,frequency;
  1470. UINT8 nvodNum;
  1471. mb_error_t ret;
  1472. mb_handle_t reqHandle;
  1473. mb_param_t searchResult2Movie[15];
  1474. kb_movie_struct_t currentMovieInfo;
  1475. searchResult2Movie[0].name = KB_LC_PARA_INDEX_0;
  1476. searchResult2Movie[0].value = MOVIE_NAME_MENU_SEARCH;
  1477. searchResult2Movie[1].name = KB_LC_PARA_INDEX_1;
  1478. searchResult2Movie[1].value = MOVIE_TYPE_MOVIE_MENU;
  1479. searchResult2Movie[2].name = KB_LC_PARA_INDEX_2;
  1480. searchResult2Movie[2].value = KB_DTV_LC_NAME;
  1481. searchResult2Movie[3].name = KB_LC_PARA_INDEX_3;
  1482. searchResult2Movie[3].value = KB_DTV_LC_FUNCTION;
  1483. searchResult2Movie[4].name = KB_LC_PARA_INDEX_4;
  1484. searchResult2Movie[4].value = EVENT_TYPE_SEARCH;
  1485. searchResult2Movie[5].name = KB_LC_PARA_INDEX_5;
  1486. searchResult2Movie[5].value = EVENT_SUB_TYPE_SEARCH_1;
  1487. //搜索是否成功0 失败1 成功
  1488. searchResult2Movie[6].name = KB_LC_PARA_INDEX_6;
  1489. searchResult2Movie[6].value = "1";
  1490. //搜索是否完成0 没有完成1 完成
  1491. searchResult2Movie[7].name = KB_LC_PARA_INDEX_7;
  1492. searchResult2Movie[7].value = "0";
  1493. mb_printf("n[kb_searchResult2Movie] the word is %ld",word);
  1494. switch(word)
  1495. {
  1496. case KB_SEARCH_HINT0:
  1497. case KB_SEARCH_HINT1:
  1498. case KB_SEARCH_HINT2:
  1499. case KB_SEARCH_HINT3:
  1500. case KB_SEARCH_HINT4:
  1501. case KB_SEARCH_HINT5:
  1502. case KB_SEARCH_DISABLED:
  1503. //搜索失败
  1504. searchResult2Movie[6].value = "0";
  1505. searchResult2Movie[8].name = NULL;
  1506. searchResult2Movie[8].value = NULL;
  1507. KB_SEARCHDestroy();
  1508. break;
  1509. //case KB_SEARCH_HINT6:
  1510. // break;
  1511. case KB_SEARCH_HINT7:
  1512. //所有频点搜索完毕
  1513. break;
  1514. case KB_SEARCH_HINT8:
  1515. case KB_SEARCH_HINT9:
  1516. case KB_SEARCH_HINT10:
  1517. //搜索完成,并保存完毕
  1518. searchResult2Movie[7].value = "1";
  1519. searchResult2Movie[8].name = NULL;
  1520. searchResult2Movie[8].value = NULL;
  1521. KB_SEARCHDestroy();
  1522. kb_mb_service_list_resetEx();
  1523. break;
  1524. case KB_SEARCH_HINT6:
  1525. default:
  1526. {
  1527. //正在搜索
  1528. frequency = word/10;
  1529. tvNum = get_dtv_num();
  1530. radioNum = get_radio_num();
  1531. nvodNum = KB_DBGetNvodNum();
  1532.  
  1533. searchResult2Movie[8].name = KB_LC_PARA_INDEX_8;
  1534. mb_memset(resultString, 0x00, 5);
  1535. sprintf( resultString, "%d", frequency) ;
  1536. searchResult2Movie[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1537. mb_memcpy((void*)searchResult2Movie[8].value, (void*)resultString, 5);
  1538. if(frequency>100)
  1539. {
  1540. searchResult2Movie[9].name = NULL;
  1541. searchResult2Movie[9].value = NULL;
  1542. break;
  1543. }  
  1544. searchResult2Movie[9].name = KB_LC_PARA_INDEX_9;
  1545. mb_memset(resultString, 0x00, 5);
  1546. sprintf( resultString, "%d", tvNum) ;
  1547. searchResult2Movie[9].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1548. mb_memcpy((void*)searchResult2Movie[9].value, (void*)resultString, 5);
  1549. searchResult2Movie[10].name = KB_LC_PARA_INDEX_10;
  1550. mb_memset(resultString, 0x00, 5);
  1551. sprintf( resultString, "%d", radioNum) ;
  1552. searchResult2Movie[10].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1553. mb_memcpy((void*)searchResult2Movie[10].value, (void*)resultString, 5);
  1554. searchResult2Movie[11].name = KB_LC_PARA_INDEX_11;
  1555. mb_memset(resultString, 0x00, 5);
  1556. sprintf( resultString, "%d", nvodNum) ;
  1557. searchResult2Movie[11].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1558. mb_memcpy((void*)searchResult2Movie[11].value, (void*)resultString, 5);
  1559. searchResult2Movie[12].name = NULL;
  1560. searchResult2Movie[12].value = NULL;
  1561. }
  1562. break;
  1563. }
  1564. kb_machblue_getCurMovieInfo(&currentMovieInfo);
  1565. ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)searchResult2Movie[2].value,(mb_char_t*)searchResult2Movie[3].value, searchResult2Movie, &reqHandle);
  1566. if(ret!=MB_SUCCESS)
  1567. {
  1568. mb_printf("n[kb_searchResult2Movie]向影片发送信息失败n");
  1569. }
  1570. }
  1571. void kb_pfGot(UINT32 word)
  1572. {
  1573. mb_error_t ret;
  1574. mb_handle_t handle;
  1575. mb_param_t para[8] = {0};
  1576. kb_movie_struct_t current_movie_info;
  1577. para[0].name=KB_LC_PARA_INDEX_0;
  1578. para[0].value=MOVIE_NAME_MENU_PF;
  1579. para[1].name=KB_LC_PARA_INDEX_1;
  1580. para[1].value=MOVIE_TYPE_MOVIE_MENU;
  1581. para[2].name=KB_LC_PARA_INDEX_2;
  1582. para[2].value=KB_DTV_LC_NAME;
  1583. para[3].name=KB_LC_PARA_INDEX_3;
  1584. para[3].value=KB_DTV_LC_FUNCTION;
  1585. para[4].name=KB_LC_PARA_INDEX_4;
  1586. para[4].value=EVENT_TYPE_PF;
  1587. para[5].name=KB_LC_PARA_INDEX_5;
  1588. mb_printf("nthe word is %d",word);
  1589. if(word==1)
  1590. para[5].value = "1";
  1591. else
  1592. para[5].value = "0";
  1593. para[6].name=NULL;
  1594. para[6].value=NULL;
  1595. kb_machblue_getCurMovieInfo(&current_movie_info);
  1596. ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,para,&handle);
  1597. if(ret!=MB_SUCCESS)
  1598. {
  1599.       mb_printf("n[Machblue]:Client epg send current service id to menu_pf error.");
  1600. }
  1601. }
  1602. void kb_sysInfo(void)
  1603. {
  1604. mb_error_t ret;
  1605. mb_handle_t handle;
  1606. mb_param_t para[10] = {0};
  1607. kb_movie_struct_t current_movie_info;
  1608. KB_DBSTBInfo stbinfo;
  1609. para[0].name=KB_LC_PARA_INDEX_0;
  1610. para[0].value=MOVIE_NAME_SYS_INFO;
  1611. para[1].name=KB_LC_PARA_INDEX_1;
  1612. para[1].value=MOVIE_TYPE_MOVIE_MENU;
  1613. para[2].name=KB_LC_PARA_INDEX_2;
  1614. para[2].value=KB_DTV_LC_NAME;
  1615. para[3].name=KB_LC_PARA_INDEX_3;
  1616. para[3].value=KB_DTV_LC_FUNCTION;
  1617. para[4].name=KB_LC_PARA_INDEX_4;
  1618. para[4].value=EVENT_SYS_INFO;
  1619. KB_DBGetSTBInfo(&stbinfo);
  1620. para[5].name=KB_LC_PARA_INDEX_5;
  1621. para[5].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
  1622. mb_memcpy((void*)para[5].value, (void*)stbinfo.STB_Model, 20);
  1623. para[6].name=KB_LC_PARA_INDEX_6;
  1624. para[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
  1625. mb_memcpy((void*)para[6].value, (void*)stbinfo.HW_Info, 20);
  1626. para[7].name=KB_LC_PARA_INDEX_7;
  1627. para[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
  1628. mb_memcpy((void*)para[7].value, (void*)stbinfo.SW_Info, 20);
  1629. para[8].name=KB_LC_PARA_INDEX_8;
  1630. para[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
  1631. mb_memcpy((void*)para[8].value, (void*)stbinfo.Manufacturer, 20);
  1632. para[9].name=NULL;
  1633. para[9].value=NULL;
  1634. kb_machblue_getCurMovieInfo(&current_movie_info);
  1635. ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,para,&handle);
  1636. if(ret!=MB_SUCCESS)
  1637. {
  1638.       mb_printf("n[Machblue]:send information to sys info page error");
  1639. }
  1640. }
  1641. void kb_volumeMuteFlag(void)
  1642. {
  1643. mb_error_t ret;
  1644. mb_handle_t handle;
  1645. mb_param_t para[8] = {0};
  1646. kb_movie_struct_t current_movie_info;
  1647. para[0].name=KB_LC_PARA_INDEX_0;
  1648. para[0].value=MOVIE_NAME_SOUND_MUTE;
  1649. para[1].name=KB_LC_PARA_INDEX_1;
  1650. para[1].value=MOVIE_TYPE_MOVIE_MENU;
  1651. para[2].name=KB_LC_PARA_INDEX_2;
  1652. para[2].value=KB_DTV_LC_NAME;
  1653. para[3].name=KB_LC_PARA_INDEX_3;
  1654. para[3].value=KB_DTV_LC_FUNCTION;
  1655. para[4].name=KB_LC_PARA_INDEX_4;
  1656. para[4].value=EVENT_TYPE_MENU_SOUND;
  1657. para[5].name=KB_LC_PARA_INDEX_5;
  1658. para[5].value = EVENT_SOUND_SUBTYPE_2;
  1659. para[6].name=KB_LC_PARA_INDEX_6;
  1660. if(KB_DTVGetMuteFlag())
  1661. {
  1662. para[6].value = "1";
  1663. }
  1664. else
  1665. {
  1666. para[6].value = "0";
  1667. }
  1668. para[7].name=NULL;
  1669. para[7].value=NULL;
  1670. kb_machblue_getCurMovieInfo(&current_movie_info);
  1671. ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,para,&handle);
  1672. if(ret!=MB_SUCCESS)
  1673. {
  1674.       mb_printf("n[Machblue]:Client epg send current service id to menu_pf error.");
  1675. }
  1676. }
  1677. void kb_volumeTrack(void)
  1678. {
  1679. char str[5];
  1680. mb_error_t ret;
  1681. mb_handle_t handle;
  1682. mb_param_t para[10] = {0};
  1683. kb_movie_struct_t current_movie_info;
  1684. para[0].name=KB_LC_PARA_INDEX_0;
  1685. para[0].value=MOVIE_NAME_SOUND;
  1686. para[1].name=KB_LC_PARA_INDEX_1;
  1687. para[1].value=MOVIE_TYPE_MOVIE_MENU;
  1688. para[2].name=KB_LC_PARA_INDEX_2;
  1689. para[2].value=KB_DTV_LC_NAME;
  1690. para[3].name=KB_LC_PARA_INDEX_3;
  1691. para[3].value=KB_DTV_LC_FUNCTION;
  1692. para[4].name=KB_LC_PARA_INDEX_4;
  1693. para[4].value=EVENT_TYPE_MENU_SOUND;
  1694. para[5].name=KB_LC_PARA_INDEX_5;
  1695. para[5].value = EVENT_SOUND_SUBTYPE_1;
  1696. para[6].name=KB_LC_PARA_INDEX_6;
  1697. sprintf( str, "%d", KB_DTVGetVolume()) ;
  1698. para[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1699. mb_memcpy((void*)para[6].value, (void*)str, 5);
  1700. para[7].name = KB_LC_PARA_INDEX_7;
  1701. switch(KB_DTVGetTrack())
  1702. {
  1703. case LEFT_TRACK:
  1704. para[7].value = KB_LC_PARA_INIT_0;
  1705. break;
  1706. case RIGHT_TRACK:
  1707. para[7].value = KB_LC_PARA_INIT_1;
  1708. break;
  1709. case STEREO_TRACK:
  1710. para[7].value = KB_LC_PARA_INIT_2;
  1711. break;
  1712. default:
  1713. para[7].value = KB_LC_PARA_INIT_0;
  1714. break;
  1715. }
  1716. para[8].name=NULL;
  1717. para[8].value=NULL;
  1718. kb_machblue_getCurMovieInfo(&current_movie_info);
  1719. ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,para,&handle);
  1720. if(ret!=MB_SUCCESS)
  1721. {
  1722.       mb_printf("n[Machblue]:Client epg send current service id to menu_pf error.");
  1723. }
  1724. }
  1725. /***
  1726. 投票影片本地通讯
  1727. ***/
  1728. static kb_vote_serviceType_e s_vote_serviceType = 7;
  1729. void KB_Vote_SetServiceType(kb_vote_serviceType_e serviceType)
  1730. {
  1731. s_vote_serviceType = serviceType;
  1732. }
  1733. static kb_vote_serviceType_e KB_Vote_GetServiceType(void)
  1734. {
  1735. return s_vote_serviceType;
  1736. }
  1737. //将从影片收到的信息进行分类
  1738. void kb_vote_infoFMovie(kb_lc_attributes_t *attribs)
  1739. {
  1740. if(0 == mb_strcmp((char *)attribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_VOTE_1))
  1741. {
  1742. kb_vote_infoContent2Movie();
  1743. }
  1744. else if(0 == mb_strcmp((char *)attribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_VOTE_2))
  1745. {
  1746. kb_vote_info2Server(attribs);
  1747. }
  1748. else if(0 == mb_strcmp((char *)attribs->parameters[lc_data1].value,(mb_char_t*)EVENT_SUB_TYPE_VOTE_3))
  1749. {
  1750. kb_vote_queryInfo2Movie(attribs);
  1751. }
  1752. }
  1753. //获取从服务器获取到的投票内容并发送到影片
  1754. //在投票模板影片启动的时候调用
  1755. void kb_vote_infoContent2Movie(void)
  1756. {
  1757. unsigned char i = 0,voteSuccessFlag = 0,voteItemCount = 0;
  1758. char strIndex[5]= {0};
  1759. char *voteName,voteItemName[100][20];
  1760. mb_param_t vote2Movie[30]= {0};
  1761. mb_error_t ret;
  1762. mb_handle_t reqHandle;
  1763. kb_vote_node_t *voteService=NULL;
  1764. kb_vote_serviceType_e voteServiceType;
  1765. kb_movie_struct_t currentMovieInfo;
  1766. vote2Movie[0].name = KB_LC_PARA_INDEX_0;
  1767. vote2Movie[0].value = MOVIE_NAME_MENU_VOTE;
  1768. vote2Movie[1].name = KB_LC_PARA_INDEX_1;
  1769. vote2Movie[1].value = MOVIE_TYPE_MOVIE_VOTE;
  1770. vote2Movie[2].name = KB_LC_PARA_INDEX_2;
  1771. vote2Movie[2].value = KB_DTV_LC_NAME;
  1772. vote2Movie[3].name = KB_LC_PARA_INDEX_3;
  1773. vote2Movie[3].value = KB_DTV_LC_FUNCTION;
  1774. vote2Movie[4].name = KB_LC_PARA_INDEX_4;
  1775. vote2Movie[4].value = EVENT_TYPE_VOTE;
  1776. vote2Movie[5].name = KB_LC_PARA_INDEX_5;
  1777. vote2Movie[5].value = EVENT_SUB_TYPE_VOTE_1;
  1778. //获取投票选项成功或失败0 失败1 成功
  1779. vote2Movie[6].name = KB_LC_PARA_INDEX_6;
  1780. voteServiceType = KB_Vote_GetServiceType();
  1781. if(g_kb_vote_service[voteServiceType]!=NULL)
  1782. {
  1783. voteSuccessFlag = 1;
  1784. voteService = g_kb_vote_service[voteServiceType];
  1785. voteItemCount = voteService->voteService.itemCount;
  1786. voteName = (mb_char_t*)KB_MB_lc_getCommandBuf(20);
  1787. mb_memcpy((void*)voteName, (void*)voteService->voteService.name, 20);
  1788. i = 0;
  1789. while(voteService!=NULL)
  1790. {
  1791. mb_memcpy((void*)voteItemName[i], (void*)voteService->voteService.item, 20);
  1792. voteService = voteService->pNext;
  1793. i++;
  1794. }
  1795. }
  1796. if(voteSuccessFlag==1)
  1797. {
  1798. vote2Movie[6].value = "1";
  1799. vote2Movie[7].name = KB_LC_PARA_INDEX_7;
  1800. vote2Movie[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
  1801. mb_memcpy((void*)vote2Movie[7].value, (void*)voteName, 20);
  1802. vote2Movie[8].name = KB_LC_PARA_INDEX_8;
  1803. sprintf(strIndex,"%d",voteItemCount);
  1804. vote2Movie[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1805. mb_memcpy((void*)vote2Movie[8].value, (void*)strIndex, 5);
  1806. for(i = 0; i <voteItemCount;i++)
  1807. {
  1808. mb_memset(strIndex, 0x00,5);
  1809. sprintf(strIndex,"%d",9+i);
  1810. vote2Movie[9+i].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1811. mb_memcpy((void*)vote2Movie[9+i].name, (void*)strIndex, 5);
  1812. vote2Movie[9+i].value=(mb_char_t*)KB_MB_lc_getCommandBuf(20);
  1813. mb_memcpy((void*)vote2Movie[9+i].value, (void*)voteItemName[i], 20);
  1814. }
  1815. vote2Movie[9+i].name= NULL;
  1816. vote2Movie[9+i].value= NULL;
  1817. }
  1818. else
  1819. {
  1820. vote2Movie[6].value = "0";
  1821. vote2Movie[7].name = NULL;
  1822. vote2Movie[7].value = NULL;
  1823. }
  1824. kb_machblue_getCurMovieInfo(&currentMovieInfo);
  1825. ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)vote2Movie[2].value,(mb_char_t*)vote2Movie[3].value, vote2Movie, &reqHandle);
  1826. if(ret!=MB_SUCCESS)
  1827. {
  1828. mb_printf("n[kb_vote_info2Server]向影片发送信息失败n");
  1829. }
  1830. }
  1831. //接收到从影片发下来的投票信息,发向服务器
  1832. //并返回给影片成功或者失败
  1833. void kb_vote_info2Server(kb_lc_attributes_t *attribs)
  1834. {
  1835. BOOL voteResult = FALSE;
  1836. kb_vote_t  kb_vote;
  1837. mb_param_t vote2Movie[10];
  1838. mb_error_t ret;
  1839. mb_handle_t reqHandle;
  1840. kb_movie_struct_t currentMovieInfo;
  1841. vote2Movie[0].name = KB_LC_PARA_INDEX_0;
  1842. vote2Movie[0].value = MOVIE_NAME_MENU_VOTE;
  1843. vote2Movie[1].name = KB_LC_PARA_INDEX_1;
  1844. vote2Movie[1].value = MOVIE_TYPE_MOVIE_VOTE;
  1845. vote2Movie[2].name = KB_LC_PARA_INDEX_2;
  1846. vote2Movie[2].value = KB_DTV_LC_NAME;
  1847. vote2Movie[3].name = KB_LC_PARA_INDEX_3;
  1848. vote2Movie[3].value = KB_DTV_LC_FUNCTION_1;
  1849. vote2Movie[4].name = KB_LC_PARA_INDEX_4;
  1850. vote2Movie[4].value = EVENT_TYPE_VOTE;
  1851. vote2Movie[5].name = KB_LC_PARA_INDEX_5;
  1852. vote2Movie[5].value = EVENT_SUB_TYPE_VOTE_2;
  1853. //投票成功或失败0 失败1 成功
  1854. vote2Movie[6].name = KB_LC_PARA_INDEX_6;
  1855. mb_memcpy(kb_vote.name, (char *)attribs->parameters[lc_data3].value, 60); 
  1856. //mb_memcpy(kb_vote.name, (char *)"超级女生投票", 60); 
  1857. kb_vote.index = atoi((char *)attribs->parameters[lc_data2].value);
  1858. kb_vote.count = atoi((char *)attribs->parameters[lc_data4].value);
  1859. kb_vote.ip = (long)getip();
  1860. voteResult = kb_vote_info_send(&kb_vote);
  1861. if(voteResult)
  1862. {
  1863. vote2Movie[6].value = "1";
  1864. }
  1865. else
  1866. {
  1867. vote2Movie[6].value = "0";
  1868. }
  1869. vote2Movie[7].name = NULL;
  1870. vote2Movie[7].value = NULL;
  1871. kb_machblue_getCurMovieInfo(&currentMovieInfo);
  1872. ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)vote2Movie[2].value,(mb_char_t*)vote2Movie[3].value, vote2Movie, &reqHandle);
  1873. if(ret!=MB_SUCCESS)
  1874. {
  1875. mb_printf("n[kb_vote_info2Server]向影片发送信息失败n");
  1876. }
  1877. }
  1878. //接收到从影片发下来的投票查询信息,向服务器发查询请求
  1879. //并返回给影片的查询结果
  1880. void kb_vote_queryInfo2Movie(kb_lc_attributes_t *attribs)
  1881. {
  1882. unsigned char i = 0;
  1883. char strIndex[5],strResult[10],voteName[60];
  1884. BOOL queryResult = FALSE;
  1885. mb_param_t vote2Movie[30];
  1886. mb_error_t ret;
  1887. mb_handle_t reqHandle;
  1888. kb_movie_struct_t currentMovieInfo;
  1889. kb_vote_info_t voteResultInfo;
  1890. vote2Movie[0].name = KB_LC_PARA_INDEX_0;
  1891. vote2Movie[0].value = MOVIE_NAME_MENU_VOTE;
  1892. vote2Movie[1].name = KB_LC_PARA_INDEX_1;
  1893. vote2Movie[1].value = MOVIE_TYPE_MOVIE_VOTE;
  1894. vote2Movie[2].name = KB_LC_PARA_INDEX_2;
  1895. vote2Movie[2].value = KB_DTV_LC_NAME;
  1896. vote2Movie[3].name = KB_LC_PARA_INDEX_3;
  1897. vote2Movie[3].value = KB_DTV_LC_FUNCTION_2;
  1898. vote2Movie[4].name = KB_LC_PARA_INDEX_4;
  1899. vote2Movie[4].value = EVENT_TYPE_VOTE;
  1900. vote2Movie[5].name = KB_LC_PARA_INDEX_5;
  1901. vote2Movie[5].value = EVENT_SUB_TYPE_VOTE_3;
  1902. //查询成功或失败0 失败1 成功
  1903. vote2Movie[6].name = KB_LC_PARA_INDEX_6;
  1904. mb_memcpy(voteName, (char *)attribs->parameters[lc_data3].value, 60); 
  1905. queryResult = kb_vote_result_get((unsigned char *)voteName,&voteResultInfo);
  1906. if(queryResult)
  1907. {
  1908. vote2Movie[6].value = "1";
  1909. vote2Movie[7].name = KB_LC_PARA_INDEX_7;
  1910. mb_memset(strIndex, 0x00,5);
  1911. sprintf(strIndex,"%d",voteResultInfo.resCount);
  1912. vote2Movie[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1913. mb_memcpy((void*)vote2Movie[7].value, (void*)strIndex, 5);
  1914. for(i = 0;i<voteResultInfo.resCount;i++)
  1915. {
  1916. mb_memset(strIndex, 0x00,5);
  1917. sprintf(strIndex,"%d",8+i*2+0);
  1918. vote2Movie[8+i*2+0].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1919. mb_memcpy((void*)vote2Movie[8+i*2+0].name, (void*)strIndex, 5);
  1920. mb_memset(strIndex, 0x00,5);
  1921. sprintf(strIndex,"%d",voteResultInfo.result[i].index);
  1922. vote2Movie[8+i*2+0].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1923. mb_memcpy((void*)vote2Movie[8+i*2+0].value, (void*)strIndex, 5);
  1924. mb_memset(strIndex, 0x00,5);
  1925. sprintf(strIndex,"%d",8+i*2+1);
  1926. vote2Movie[8+i*2+1].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1927. mb_memcpy((void*)vote2Movie[8+i*2+1].name, (void*)strIndex, 5);
  1928. mb_memset(strResult, 0x00,10);
  1929. sprintf(strResult,"%ld",voteResultInfo.result[i].result);
  1930. vote2Movie[8+i*2+1].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
  1931. mb_memcpy((void*)vote2Movie[8+i*2+1].value, (void*)strResult, 10);
  1932. }
  1933. vote2Movie[8+i*2+0].name = NULL;
  1934. vote2Movie[8+i*2+0].value = NULL;
  1935. }
  1936. else
  1937. {
  1938. vote2Movie[6].value = "0";
  1939. vote2Movie[7].name = NULL;
  1940. vote2Movie[7].value = NULL;
  1941. }
  1942. kb_machblue_getCurMovieInfo(&currentMovieInfo);
  1943. ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)vote2Movie[2].value,(mb_char_t*)vote2Movie[3].value, vote2Movie, &reqHandle);
  1944. if(ret!=MB_SUCCESS)
  1945. {
  1946. mb_printf("n[kb_vote_queryInfo2Server]向影片发送信息失败n");
  1947. }
  1948. }
  1949. /***
  1950. 天气预报菜单
  1951. ***/
  1952. void kb_weatherInit(void)
  1953. {
  1954. int i,city_num=0;
  1955. char start_str[5] = {0},city_name[100][15]= {0};//city_name[30];
  1956. mb_error_t ret;
  1957. mb_handle_t handle;
  1958. mb_param_t initWeather[120] = {0};
  1959. kb_movie_struct_t current_movie_info;
  1960. KB_WeatherInfoNode *pWeatherInfo=NULL;
  1961. kb_dayWeather_t day_weather[2] = {0};
  1962. initWeather[0].name=KB_LC_PARA_INDEX_0;
  1963. initWeather[0].value=MOVIE_NAME_DBC_WEATHER;
  1964. initWeather[1].name=KB_LC_PARA_INDEX_1;
  1965. initWeather[1].value=MOVIE_TYPE_MOVIE_DBC;
  1966. initWeather[2].name=KB_LC_PARA_INDEX_2;
  1967. initWeather[2].value=KB_DTV_LC_NAME;
  1968. initWeather[3].name=KB_LC_PARA_INDEX_3;
  1969. initWeather[3].value=KB_DTV_LC_FUNCTION;
  1970. initWeather[4].name=KB_LC_PARA_INDEX_4;
  1971. initWeather[4].value=EVENT_TYPE_WEATHER;
  1972. initWeather[5].name=KB_LC_PARA_INDEX_5;
  1973. initWeather[5].value=EVENT_TYPE_WEATHER_INIT;
  1974. pWeatherInfo = KB_GetXmlWeatherInfoHead();
  1975. while (pWeatherInfo != NULL)
  1976. {        
  1977. mb_memcpy((char*)city_name[city_num], (char*)pWeatherInfo->st_WeatherInfo.city, 15);
  1978. if(city_num == 0)
  1979. {
  1980. day_weather[0] = pWeatherInfo->st_WeatherInfo.today;
  1981. day_weather[1] = pWeatherInfo->st_WeatherInfo.tomorrow;
  1982. }
  1983. city_num++;
  1984. pWeatherInfo = pWeatherInfo->m_pNext;
  1985. }
  1986. //total number of the city
  1987. initWeather[6].name=KB_LC_PARA_INDEX_6;//the total number of the city
  1988. mb_memset(start_str, 0x00, 5);
  1989. sprintf(start_str,"%d",city_num);
  1990. initWeather[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  1991. mb_memcpy((void*)initWeather[6].value, (void*)start_str, 5);
  1992. //first day of first city
  1993. initWeather[7].name=KB_LC_PARA_INDEX_7;//first date of  the first city
  1994. initWeather[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
  1995. mb_memcpy((void*)initWeather[7].value, (void*)day_weather[0].date, 15);
  1996. initWeather[8].name=KB_LC_PARA_INDEX_8;//weather of  the first city in the first day
  1997. mb_memset(start_str, 0x00, 5);
  1998. sprintf(start_str,"%d",day_weather[0].weather);
  1999. initWeather[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  2000. mb_memcpy((void*)initWeather[8].value, (void*)start_str, 5);
  2001. initWeather[9].name=KB_LC_PARA_INDEX_9;//first temperature of  the first city
  2002. initWeather[9].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
  2003. mb_memcpy((void*)initWeather[9].value, (void*)day_weather[0].temperature, 10);
  2004. initWeather[10].name=KB_LC_PARA_INDEX_10;//first weather description of  the first city
  2005. initWeather[10].value=(mb_char_t*)KB_MB_lc_getCommandBuf(25);
  2006. mb_memcpy((void*)initWeather[10].value, (void*)day_weather[0].weatherDes, 25);
  2007. //second day of the first city
  2008. initWeather[11].name=KB_LC_PARA_INDEX_11;//second date of  the first city
  2009. initWeather[11].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
  2010. mb_memcpy((void*)initWeather[11].value, (void*)day_weather[1].date, 15);
  2011. initWeather[12].name=KB_LC_PARA_INDEX_12;//weather of  the first city in the second day
  2012. mb_memset(start_str, 0x00, 5);
  2013. sprintf(start_str,"%d",day_weather[1].weather);
  2014. initWeather[12].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  2015. mb_memcpy((void*)initWeather[12].value, (void*)start_str, 5);
  2016. initWeather[13].name=KB_LC_PARA_INDEX_13;//second temperature of  the first city
  2017. initWeather[13].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
  2018. mb_memcpy((void*)initWeather[13].value, (void*)day_weather[1].temperature, 10);
  2019. initWeather[14].name=KB_LC_PARA_INDEX_14;//second weather description of  the first city
  2020. initWeather[14].value=(mb_char_t*)KB_MB_lc_getCommandBuf(25);
  2021. mb_memcpy((void*)initWeather[14].value, (void*)day_weather[1].weatherDes, 25);
  2022. //city names
  2023. for(i=0;i<city_num;i++)
  2024. {
  2025. mb_memset(start_str, 0x00, 5);
  2026. sprintf(start_str,"%d",15+i);
  2027. initWeather[15+i].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  2028. mb_memcpy((void*)initWeather[15+i].name, (void*)start_str, 5);
  2029. initWeather[15+i].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
  2030. mb_memcpy((void*)initWeather[15+i].value, (void*)city_name[i], 15);
  2031. }
  2032. initWeather[15+city_num].name=NULL;
  2033. initWeather[15+city_num].value=NULL;
  2034. kb_machblue_getCurMovieInfo(&current_movie_info);
  2035. ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,initWeather,&handle);
  2036. if(ret!=MB_SUCCESS)
  2037. {
  2038.       mb_printf("n[Machblue]:C code send information to DBC weather error");
  2039. }
  2040. }
  2041. void kb_weatherCitySwitch(UINT32 cityIndex)
  2042. {
  2043. int city_num=0;
  2044. char start_str[5] ={0};
  2045. mb_error_t ret;
  2046. mb_handle_t handle;
  2047. mb_param_t weatherCity[15] = {0};
  2048. kb_movie_struct_t current_movie_info;
  2049. KB_WeatherInfoNode *pWeatherInfo=NULL;
  2050. kb_dayWeather_t day_weather[2] = {0};
  2051. pWeatherInfo = KB_GetXmlWeatherInfoHead();
  2052. while (pWeatherInfo != NULL)
  2053. {        
  2054. if(city_num == cityIndex)
  2055. {
  2056. day_weather[0] = pWeatherInfo->st_WeatherInfo.today;
  2057. day_weather[1] = pWeatherInfo->st_WeatherInfo.tomorrow;
  2058. break;
  2059. }
  2060. city_num++;
  2061. pWeatherInfo = pWeatherInfo->m_pNext;
  2062. }
  2063. weatherCity[0].name=KB_LC_PARA_INDEX_0;
  2064. weatherCity[0].value=MOVIE_NAME_DBC_WEATHER;
  2065. weatherCity[1].name=KB_LC_PARA_INDEX_1;
  2066. weatherCity[1].value=MOVIE_TYPE_MOVIE_DBC;
  2067. weatherCity[2].name=KB_LC_PARA_INDEX_2;
  2068. weatherCity[2].value=KB_DTV_LC_NAME;
  2069. weatherCity[3].name=KB_LC_PARA_INDEX_3;
  2070. weatherCity[3].value=KB_DTV_LC_FUNCTION;
  2071. weatherCity[4].name=KB_LC_PARA_INDEX_4;
  2072. weatherCity[4].value=EVENT_TYPE_WEATHER;
  2073. weatherCity[5].name=KB_LC_PARA_INDEX_5;
  2074. weatherCity[5].value=EVENT_TYPE_WEATHER_CITY;
  2075. if (cityIndex>=0)
  2076. {
  2077. //first day of the city
  2078. weatherCity[6].name=KB_LC_PARA_INDEX_6;//first date of  the first city
  2079. weatherCity[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
  2080. mb_memcpy((void*)weatherCity[6].value, (void*)day_weather[0].date, 15);
  2081. weatherCity[7].name=KB_LC_PARA_INDEX_7;//weather of  the first city in the first day
  2082. mb_memset(start_str, 0x00, 5);
  2083. sprintf(start_str,"%d",day_weather[0].weather);
  2084. weatherCity[7].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  2085. mb_memcpy((void*)weatherCity[7].value, (void*)start_str, 5);
  2086. weatherCity[8].name=KB_LC_PARA_INDEX_8;//first temperature of  the first city
  2087. weatherCity[8].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
  2088. mb_memcpy((void*)weatherCity[8].value, (void*)day_weather[0].temperature, 10);
  2089. weatherCity[9].name=KB_LC_PARA_INDEX_9;//first description of  the first city
  2090. weatherCity[9].value=(mb_char_t*)KB_MB_lc_getCommandBuf(25);
  2091. mb_memcpy((void*)weatherCity[9].value, (void*)day_weather[0].weatherDes, 25);
  2092. //second day of the  city
  2093. weatherCity[10].name=KB_LC_PARA_INDEX_10;//second date of  the first city
  2094. weatherCity[10].value=(mb_char_t*)KB_MB_lc_getCommandBuf(15);
  2095. mb_memcpy((void*)weatherCity[10].value, (void*)day_weather[1].date, 15);
  2096. weatherCity[11].name=KB_LC_PARA_INDEX_11;//weather of  the first city in the second day
  2097. mb_memset(start_str, 0x00, 5);
  2098. sprintf(start_str,"%d",day_weather[1].weather);
  2099. weatherCity[11].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  2100. mb_memcpy((void*)weatherCity[11].value, (void*)start_str, 5);
  2101. weatherCity[12].name=KB_LC_PARA_INDEX_12;//second temperature of  the first city
  2102. weatherCity[12].value=(mb_char_t*)KB_MB_lc_getCommandBuf(10);
  2103. mb_memcpy((void*)weatherCity[12].value, (void*)day_weather[1].temperature, 10);
  2104. weatherCity[13].name=KB_LC_PARA_INDEX_13;//second description of  the first city
  2105. weatherCity[13].value=(mb_char_t*)KB_MB_lc_getCommandBuf(25);
  2106. mb_memcpy((void*)weatherCity[13].value, (void*)day_weather[1].weatherDes, 25);
  2107. weatherCity[14].name = NULL;
  2108. weatherCity[14].value = NULL;
  2109. }
  2110. else
  2111. {
  2112. weatherCity[6].name = NULL;
  2113. weatherCity[6].value = NULL;
  2114. }
  2115. kb_machblue_getCurMovieInfo(&current_movie_info);
  2116. ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,weatherCity,&handle);
  2117. if(ret!=MB_SUCCESS)
  2118. {
  2119.       mb_printf("n[Machblue]:C code send information to DBC weather error");
  2120. }
  2121. }
  2122. /***
  2123. 政府公告
  2124. ***/
  2125. //政府公告目录
  2126. void kb_dbc_govCatalog(void)
  2127. {
  2128. int i;
  2129. int catalogCount = 0;//total number of the gov ad
  2130. char title[100][100],str[5];
  2131. mb_error_t ret;
  2132. mb_handle_t handle;
  2133. mb_param_t govCatalog[100];
  2134. kb_movie_struct_t current_movie_info;
  2135. KB_BulletinInfoNode *pBulletinInfo;
  2136. pBulletinInfo = KB_GetXmlBulletinInfoHead();
  2137. while (pBulletinInfo != NULL)
  2138. {        
  2139. mb_memcpy((char*)title[catalogCount], (char*)pBulletinInfo->st_BulletinInfo.title, 100);
  2140. catalogCount++;
  2141. pBulletinInfo = pBulletinInfo->m_pNext;
  2142. }
  2143. govCatalog[0].name=KB_LC_PARA_INDEX_0;
  2144. govCatalog[0].value=MOVIE_NAME_DBC_GOV_BULLETIN;
  2145. govCatalog[1].name=KB_LC_PARA_INDEX_1;
  2146. govCatalog[1].value=MOVIE_TYPE_MOVIE_DBC;
  2147. govCatalog[2].name=KB_LC_PARA_INDEX_2;
  2148. govCatalog[2].value=KB_DTV_LC_NAME;
  2149. govCatalog[3].name=KB_LC_PARA_INDEX_3;
  2150. govCatalog[3].value=KB_DTV_LC_FUNCTION;
  2151. govCatalog[4].name=KB_LC_PARA_INDEX_4;
  2152. govCatalog[4].value=EVENT_TYPE_GOV;
  2153. govCatalog[5].name=KB_LC_PARA_INDEX_5;
  2154. govCatalog[5].value=EVENT_SUB_TYPE_GOV_CATALOG;
  2155. govCatalog[6].name=KB_LC_PARA_INDEX_6;
  2156. mb_memset(str, 0x00, 5);
  2157. sprintf(str,"%d",catalogCount);
  2158. govCatalog[6].value=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  2159. mb_memcpy((void*)govCatalog[6].value, (void*)str, 5);
  2160. for(i=0;i<catalogCount;i++)
  2161. {
  2162. mb_memset(str, 0x00, 5);
  2163. sprintf(str,"%d",7+i);
  2164. govCatalog[7+i].name=(mb_char_t*)KB_MB_lc_getCommandBuf(5);
  2165. mb_memcpy((void*)govCatalog[7+i].name, (void*)str, 5);
  2166. govCatalog[7+i].value=(mb_char_t*)KB_MB_lc_getCommandBuf(100);
  2167. mb_memcpy((void*)govCatalog[7+i].value, (void*)title[i], 100);
  2168. }
  2169. govCatalog[7+catalogCount].name=NULL;
  2170. govCatalog[7+catalogCount].value=NULL;
  2171. kb_machblue_getCurMovieInfo(&current_movie_info);
  2172. ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION,govCatalog,&handle);
  2173. if(ret!=MB_SUCCESS)
  2174. {
  2175.       mb_printf("n[Machblue]:C code send information to DBC gov main error");
  2176. }
  2177. }
  2178. //政府公告内容
  2179. void kb_dbc_govContent(UINT32 contentIndex)
  2180. {
  2181. mb_error_t ret;
  2182. mb_handle_t handle;
  2183. int govContentIndex = 0;
  2184. mb_param_t govContent[10];
  2185. kb_movie_struct_t current_movie_info;
  2186. KB_BulletinInfoNode *pBulletinInfo;
  2187. govContent[0].name=KB_LC_PARA_INDEX_0;
  2188. govContent[0].value=MOVIE_NAME_DBC_GOV_BULLETIN;
  2189. govContent[1].name=KB_LC_PARA_INDEX_1;
  2190. govContent[1].value=MOVIE_TYPE_MOVIE_DBC;
  2191. govContent[2].name=KB_LC_PARA_INDEX_2;
  2192. govContent[2].value=KB_DTV_LC_NAME;
  2193. govContent[3].name=KB_LC_PARA_INDEX_3;
  2194. govContent[3].value=KB_DTV_LC_FUNCTION_1;
  2195. govContent[4].name=KB_LC_PARA_INDEX_4;
  2196. govContent[4].value=EVENT_TYPE_GOV;
  2197. govContent[5].name=KB_LC_PARA_INDEX_5;
  2198. govContent[5].value=EVENT_SUB_TYPE_GOV_CONTENT;
  2199. govContent[6].name=KB_LC_PARA_INDEX_6;//title
  2200. govContent[7].name=KB_LC_PARA_INDEX_7;//content
  2201. mb_printf("n[machblue]the index of the government ad is %dn",contentIndex);
  2202. pBulletinInfo = KB_GetXmlBulletinInfoHead();
  2203. while (pBulletinInfo != NULL)
  2204. {        
  2205. if(govContentIndex == contentIndex)
  2206. {
  2207. break;
  2208. }
  2209. govContentIndex++;
  2210. pBulletinInfo = pBulletinInfo->m_pNext;
  2211. }
  2212. if (contentIndex>=0)
  2213. {
  2214. govContent[6].value = (mb_char_t*)pBulletinInfo->st_BulletinInfo.title;
  2215. govContent[7].value= (mb_char_t*)pBulletinInfo->st_BulletinInfo.content;
  2216. }
  2217. govContent[8].name=NULL;
  2218. govContent[8].value= NULL;
  2219. kb_machblue_getCurMovieInfo(&current_movie_info);
  2220. ret=mb_movie_lc_request_send(current_movie_info.movie,KB_DTV_LC_NAME,KB_DTV_LC_FUNCTION_1,govContent,&handle);
  2221. if(ret!=MB_SUCCESS)
  2222. {
  2223.       mb_printf("n[Machblue]:C code send information to DBC gov content error");
  2224. }
  2225. }
  2226. void KB_Swf_UpdateInfoLC(UINT32 word)
  2227. {
  2228. mb_param_t updateInfo[10];
  2229. mb_error_t ret;
  2230. mb_handle_t reqHandle;
  2231. kb_movie_struct_t currentMovieInfo;
  2232. updateInfo[0].name = KB_LC_PARA_INDEX_0;
  2233. updateInfo[0].value = MOVIE_NAME_MENU_PROMPT;
  2234. updateInfo[1].name = KB_LC_PARA_INDEX_1;
  2235. updateInfo[1].value = MOVIE_TYPE_MOVIE_MENU;
  2236. updateInfo[2].name = KB_LC_PARA_INDEX_2;
  2237. updateInfo[2].value = KB_DTV_LC_NAME;
  2238. updateInfo[3].name = KB_LC_PARA_INDEX_3;
  2239. updateInfo[3].value = KB_DTV_LC_FUNCTION;
  2240. updateInfo[4].name = KB_LC_PARA_INDEX_4;
  2241. updateInfo[4].value = EVENT_TYPE_MENU_PROMPT;
  2242. //投票成功或失败0 失败1 成功
  2243. updateInfo[5].name = KB_LC_PARA_INDEX_5;
  2244. if(word)
  2245. {
  2246. updateInfo[5].value = "1";
  2247. }
  2248. else
  2249. {
  2250. updateInfo[5].value = "0";
  2251. }
  2252. updateInfo[6].name = NULL;
  2253. updateInfo[6].value = NULL;
  2254. kb_machblue_getCurMovieInfo(&currentMovieInfo);
  2255. ret = mb_movie_lc_request_send(currentMovieInfo.movie, (mb_char_t*)updateInfo[2].value,(mb_char_t*)updateInfo[3].value, updateInfo, &reqHandle);
  2256. if(ret!=MB_SUCCESS)
  2257. {
  2258. mb_printf("n[kb_vote_info2Server]向影片更新情况影片发送消息失败n");
  2259. }
  2260. }
  2261. void kb_machblue_lc_ad(kb_lc_attributes_t *pAttribs)
  2262. {
  2263. if(pAttribs==NULL)
  2264. {
  2265.       mb_printf("n[Machblue]:Client menu operatioin attributes NULL.");
  2266. return;
  2267. }
  2268. if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)MOVIE_NAME_AD1))
  2269. {
  2270. //播放互相广告1
  2271. kb_machblue_alterAdvPlay(1);
  2272. }
  2273. else if(0 == mb_strcmp((char *)pAttribs->parameters[lc_data1].value,(mb_char_t*)MOVIE_NAME_AD2))
  2274. {
  2275. //播放互相广告2
  2276. kb_machblue_alterAdvPlay(2);
  2277. }
  2278. }