main_app_external.c 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578
  1. /*****************************************************************************
  2. ** File: main_app_external.c
  3. **
  4. ** Description:
  5. **
  6. ** Copyright(c) 2008 Sunmedia Technologies - All Rights Reserved
  7. **
  8. ** Author : qin.he
  9. **
  10. ** $Id: $
  11. *****************************************************************************/
  12. /*header file*/
  13. #include <sys/ioctl.h>
  14. #include "umf_debug.h"
  15. #include "main_app.h"
  16. #include "app_event.h"
  17. #include "sysapp_table.h"
  18. #include "sysapp_if.h"
  19. #include "app_msg_filter.h"
  20. #include "app_msg_filter_tbl.h"
  21. #include "sysapp_timer.h"
  22. #include "gobj_datastruct.h"
  23. #include "al_fw.h"
  24. #include "kmf_ioctl.h"
  25. #include "ap_extern.h"
  26. #include "util_ioctl.h"
  27. #include "drv_blt_interface.h"
  28. #include "osd_lib.h"
  29. #ifdef CONFIG_ATV_SUPPORT
  30. #include "atv_guiobj_table.h"
  31. #endif
  32. #include "app_menumgr.h"
  33. #include "app_audio.h"
  34. #include "app_video.h"
  35. #include "app_global.h"
  36. #include "app_gui.h"
  37. #include "app_power_control.h"
  38. #include "app_systime.h"
  39. #include "app_data_setting.h"
  40. #include "main_guiobj_table.h"
  41. #include "app_guiobj_source.h"
  42. #include "app_guiobj_adjust.h"
  43. #include "app_guiobj_mainmenupop.h"
  44. //#include "app_guiobj_mainmenu.h"
  45. //#include "app_guiobj_fm_factory.h"
  46. #include "app_guiobj_sleeptimer.h"
  47. #include "pin_config.h"
  48. #ifdef CONFIG_SUPPORT_MEDIA_AUTO_PLAY
  49. #include <dirent.h> // DIR need
  50. #include "MM_media_auto_play.h"
  51. #endif
  52. #ifdef SUPPORT_CEC_TV
  53. #include "umf_cec.h"
  54. #endif
  55. #include "app_usb_upgrade.h"
  56. #ifdef SUPPORT_WAKEUP_TIMER_IN_STANDBY
  57. //#include "app_guiobj_channel.h"
  58. #endif
  59. #include "app_factory.h"
  60. #include "atv_app.h"
  61. #ifdef CONFIG_MEDIA_ENABLE
  62. #include "MM_popmsg_gui.h"
  63. #endif
  64. /*----------------Net------------------*/
  65. #ifdef CONFIG_NET_SUPPORT
  66. #include "net_daemon.h"
  67. #include "net/net_app/net_config.h"
  68. #include "app_net_instance.h"
  69. #ifdef SUPPORT_NET_TESTING
  70. #include "net/net_app/net_test.h"
  71. #endif
  72. #ifdef CONFIG_NET_ET_SUPPORT
  73. #include "cbk_event.h"
  74. #include "net_daemon.h"
  75. #include "net/et/libet.h"
  76. #endif
  77. #ifdef SAMBA_SUPPORT
  78. #include "app_network.h"
  79. #endif
  80. #ifdef CONFIG_NET_N32_SUPPORT
  81. #include "net/dlmgr/dlmgr_if.h"
  82. #include "net/net_app/net_config.h"
  83. #endif
  84. #ifdef NET_WIFI_SUPPORT
  85. #include "dvb_gui_object_wifi_list.h"
  86. #endif
  87. /*+++++++++++++++++NET++++++++++++++++++++*/
  88. #include "platform_venc.h"
  89. #include "net/net_app/net_config.h"
  90. #include "net_daemon.h"
  91. #ifdef SUPPORT_NET_TESTING
  92. #include "net/net_app/net_test.h"
  93. #endif
  94. #include "network_app.h"
  95. #endif
  96. #include "app_clone_data.h"
  97. #include "main_app_external.h"
  98. #ifdef SUPPORT_FACTORY_AUTO_TEST
  99. //#include "Debug_msg.h"
  100. #endif
  101. #ifdef SUPPORT_SHOP_DEMO_MODE
  102. #include "app_guiobj_picture.h"
  103. #endif
  104. #ifdef SUPPORT_LED_FLASH
  105. #include "app_led_control.h"
  106. #endif
  107. #include "mid_partition_list.h"
  108. #include "app_guiobj_hdmilink.h"
  109. #include "customize.h"
  110. #if defined(CONFIG_AUTO_USB_STORE_IRSEQ) && defined(CONFIG_QSD_AUTOIR)
  111. #include "umf_automation.h"
  112. #endif
  113. #ifdef CONFIG_BLUETOOTH_SUPPORT
  114. #include "al_bluetooth.h"
  115. #endif
  116. #if defined(CONFIG_BT_RDA5856)||defined(CONFIG_BT_POL6556)
  117. #include "app_bt.h"
  118. #endif
  119. #define MAIN_APP_DEBUG
  120. #ifdef MAIN_APP_DEBUG
  121. #undef mainapp_printf
  122. #define mainapp_printf(fmt, arg...) UMFDBG(0,"[MAINAPP]:"fmt, ##arg)
  123. #else
  124. #define mainapp_printf(fmt, arg...) ((void) 0)
  125. #endif
  126. #define NUM_RESEND_MESSAGE_TYPE (DMN_EVENT_DEVICE_DETECT_MAX-DMN_EVENT_DEVICE_DETECT_MIN-1)
  127. #define NUM_RESEND_MESSAGE_OF_TYPE (10)
  128. #ifdef CONFIG_SUPPORT_MEDIA_AUTO_PLAY
  129. #define MAX_COM_BUF_SIZE 2048
  130. #define INTERNAL_COM_DISK_NAME_LEN (15)
  131. #ifdef CONFIG_SUPPORT_PARTITIONNUM_MAX
  132. #define MAX_COM_PARTITION_NUM (20)
  133. #else
  134. #define MAX_COM_PARTITION_NUM (8)
  135. #endif
  136. #define MM_COMMON_AUTO_PLAY "AutoPlay"
  137. static char PlayComFilePath[MAX_COM_BUF_SIZE];
  138. static UINT8 gb_NeedAutoPlay = FALSE;
  139. #endif
  140. #ifdef CONFIG_NET_SUPPORT
  141. extern Common_SysSet_NetETConfigStorage_t stNetConfigStorage;
  142. #endif
  143. #ifdef SUPPORT_WAKEUP_TIMER_IN_STANDBY
  144. extern Boolean g_fRecorderNeedEntryStandby;
  145. #endif
  146. #ifdef AC_ON_AUTO_GET_TIME
  147. extern Boolean g_fBackgroundGetTime;
  148. #endif
  149. #if defined(CONFIG_BT_RDA5856)
  150. extern Boolean g_SystemPowerOnReadyNeedReconnectBT;
  151. extern UINT8 g_BT_HasHeart;
  152. #endif
  153. #ifdef CONFIG_NET_SUPPORT
  154. extern int gMsgHandle;
  155. #ifdef CONFIG_NET_ET_SUPPORT
  156. static void _MAINAPP_EtMountHandle(MainAppUIEventHandlerInfo_t *pstEventInfo, UINT32 dDevNum);
  157. static void _MAINAPP_EtUnmountHandle(MainAppUIEventHandlerInfo_t *pstEventInfo, UINT32 dDevNum);
  158. #endif
  159. #ifdef CONFIG_NET_N32_SUPPORT
  160. static void _MAINAPP_N32MountHandle(MainAppUIEventHandlerInfo_t *pstEventInfo, UINT32 dDevNum);
  161. static void _MAINAPP_N32UnmountHandle(MainAppUIEventHandlerInfo_t *pstEventInfo, UINT32 dDevNum);
  162. #endif
  163. #ifdef CONFIG_NET_ET_SUPPORT
  164. MainAppUIEventHandlerInfo_t stUIEventHandlerInfo =
  165. {
  166. STATUS_NULL,
  167. UI_EVENT_NULL,
  168. TOTAL_SYS_APP_SIZE
  169. };
  170. #endif
  171. #endif
  172. GUI_Object_Definition_t* MAIN_APP_GUI_Obj_List[MAINAPP_GUIOBJ_MAX] =
  173. {
  174. };
  175. /* global variables */
  176. static Boolean g_bPowerOffFlag = FALSE;
  177. static UINT32 gdResentMessage[NUM_RESEND_MESSAGE_TYPE][NUM_RESEND_MESSAGE_OF_TYPE] = {{0}};
  178. static UINT32 gdResentParam[NUM_RESEND_MESSAGE_TYPE][NUM_RESEND_MESSAGE_OF_TYPE] = {{0}};
  179. extern Boolean gUSBUpgradeBinIsSupperBin;
  180. static Boolean g_CheckUpgrade = FALSE;//for mantis 0164559 @20120204
  181. #ifdef SUPPORT_FACTORY_AUTO_TEST
  182. typedef struct{
  183. UINT32 dResendMessage;
  184. UINT32 dResendMessageParm;
  185. }sFACResentMessage;
  186. static sFACResentMessage gFACTESTResentMessage = {0,0};
  187. static Boolean AcPowerOnNoRomBinFlag = FALSE;
  188. #endif
  189. #ifdef SUPPORT_USB_UPGRADE_LONG_PRESS_KEYPAD_POWER
  190. extern UINT8 IsKeypadPowerOnPressRepeat;
  191. UINT32 USB_ATTACHED = FALSE;
  192. #endif
  193. static void _MAINAPP_ResendEventInTransition(void)
  194. {
  195. UINT32 dActiveSysApp = 0;
  196. UINT8 u8Count1 = 0;
  197. UINT8 u8Count2 = 0;
  198. switch (MAINAPP_GetActiveSystemAppIndex(&dActiveSysApp))
  199. {
  200. case MAIN_APP_IN_TRANSITION:
  201. mainapp_printf(" In Transition State, wait and retry.\n");
  202. break;
  203. case MAIN_APP_SUCCESS:
  204. for (u8Count1 = 0; u8Count1 < NUM_RESEND_MESSAGE_TYPE; u8Count1++)
  205. {
  206. for (u8Count2 = 0; u8Count2 < NUM_RESEND_MESSAGE_OF_TYPE; u8Count2++)
  207. {
  208. if (gdResentMessage[u8Count1][u8Count2] > 0)
  209. {
  210. MSG_FILTER_DispatchMessage(gdResentMessage[u8Count1][u8Count2], gdResentParam[u8Count1][u8Count2]);
  211. }
  212. }
  213. }
  214. break;
  215. default:
  216. mainapp_printf("[%s] In Invalid State\n",__FUNCTION__);
  217. for (u8Count1 = 0; u8Count1 < NUM_RESEND_MESSAGE_TYPE; u8Count1++)
  218. {
  219. for (u8Count2 = 0; u8Count2 < NUM_RESEND_MESSAGE_OF_TYPE; u8Count2++)
  220. {
  221. gdResentMessage[u8Count1][u8Count2] = 0;
  222. gdResentParam[u8Count1][u8Count2] = 0;
  223. }
  224. }
  225. break;
  226. }
  227. }
  228. static void _MAINAPP_SetEventInTransition(UINT32 dMessage, UINT32 dParam)
  229. {
  230. UINT8 u8Count = 0;
  231. if (((dMessage-DMN_EVENT_DEVICE_DETECT_MIN) > 0)
  232. && ((dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1) < NUM_RESEND_MESSAGE_TYPE))
  233. {
  234. for (u8Count = 0; u8Count < NUM_RESEND_MESSAGE_OF_TYPE; u8Count++)
  235. {
  236. //zhongbaoxing added @20120313. no need to record the exist messages
  237. if((gdResentMessage[dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1][u8Count] == dMessage)
  238. &&(gdResentParam[dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1][u8Count] == dParam))
  239. {
  240. break;
  241. }
  242. if (gdResentMessage[dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1][u8Count] == 0)
  243. {
  244. gdResentMessage[dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1][u8Count] = dMessage;
  245. gdResentParam[dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1][u8Count] = dParam;
  246. break;
  247. }
  248. }
  249. }
  250. }
  251. static void _MAINAPP_ClearEventInTransition(UINT32 dMessage, UINT32 dParam)
  252. {
  253. UINT8 u8Count = 0;
  254. if (((dMessage-DMN_EVENT_DEVICE_DETECT_MIN) > 0)
  255. && ((dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1) < NUM_RESEND_MESSAGE_TYPE))
  256. {
  257. for (u8Count = 0; u8Count < NUM_RESEND_MESSAGE_OF_TYPE; u8Count++)
  258. {
  259. if ((gdResentMessage[dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1][u8Count] == dMessage)
  260. &&(gdResentParam[dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1][u8Count] == dParam))
  261. {
  262. gdResentMessage[dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1][u8Count] = 0;
  263. gdResentParam[dMessage-DMN_EVENT_DEVICE_DETECT_MIN-1][u8Count] = 0;
  264. break;
  265. }
  266. }
  267. }
  268. }
  269. /*****************************************************************************
  270. ** FUNCTION : _MAINAPP_GUIFeedbackEventHandler
  271. **
  272. ** DESCRIPTION :
  273. ** main app feedback event handler
  274. **
  275. ** PARAMETERS :
  276. ** dMessage: feadback message
  277. ** dParam: feadback message's paramter
  278. **
  279. ** RETURN VALUES:
  280. ** None
  281. *****************************************************************************/
  282. void _MAINAPP_GUIFeedbackEventHandler(UINT32 dMessage, UINT32 dParam)
  283. {
  284. switch(dMessage)
  285. {
  286. default:
  287. mainapp_printf(" Unknown GUI feedback message received.\n");
  288. break;
  289. }
  290. return;
  291. }
  292. /*****************************************************************************
  293. ** FUNCTION : _MAINAPP_UIEventHandler
  294. **
  295. ** DESCRIPTION :
  296. ** main app UI event handler
  297. **
  298. ** PARAMETERS :
  299. ** dMessage: UI message
  300. ** dParam: UI message's paramter
  301. **
  302. ** RETURN VALUES:
  303. ** None
  304. *****************************************************************************/
  305. int _MAINAPP_UIEventHandler(UINT32 dMessage, UINT32 dParam)
  306. {
  307. UINT32 dIndex = 0;
  308. APP_Source_Type_t eSourceType;
  309. eSourceType = APP_SOURCE_MAX;
  310. if (MAIN_APP_SUCCESS == MAINAPP_GetActiveSystemAppIndex(&dIndex))
  311. {
  312. if((dMessage == UI_EVENT_POWER)||(dMessage == UI_EVENT_KEYPAD_POWER))
  313. {
  314. if (SYSAPP_GOBJ_GUIObjectExist(dIndex, APP_GUIOBJ_SLEEP_INFO))//close sleeptimer menu
  315. {
  316. APP_GUIOBJ_SleepTimer_Reset();
  317. SYSAPP_GOBJ_DestroyGUIObject(dIndex, APP_GUIOBJ_SLEEP_INFO);
  318. return MAIN_APP_SUCCESS;
  319. }
  320. #ifdef SUPPORT_POWERAGAIN_CONFIRM_POWEROFF
  321. if ((!SYSAPP_GOBJ_GUIObjectExist(dIndex, APP_GUIOBJ_MAINMENUPOP)
  322. || APP_GUIOBJ_MainPopMsg_GetPopType() != MAINPOPMSG_SHOW_CONFIRM_POWER)
  323. && (dParam == AL_POWER_STATE_CONFIRM))//no auto power off or reset power
  324. {
  325. SYSAPP_IF_SendGlobalEventWithIndex(dIndex, APP_GLOBAL_EVENT_CONFIRM_POWER|PASS_TO_SYSAPP, 0);
  326. return MAIN_APP_SUCCESS;
  327. }
  328. #endif
  329. }
  330. APP_GUIOBJ_Source_GetCurrSource(&eSourceType);
  331. }
  332. if (MAIN_APP_SUCCESS == MAINAPP_GetActiveSystemAppIndex(&dIndex))
  333. {
  334. #ifdef CONFIG_SUPPORT_OTA_UPGRADE
  335. if (SYS_APP_DVB == dIndex)
  336. {
  337. if (SYSAPP_GOBJ_GUIObjectExist(dIndex, DVB_GUIOBJ_OTA_UPGRADE_PROGRESS) && (AL_POWER_STATE_MAX != dParam))
  338. {
  339. return MAIN_APP_SUCCESS;
  340. }
  341. }
  342. #endif
  343. #ifdef CONFIG_SUPPORT_USB_UPGRADE
  344. if (SYSAPP_GOBJ_GUIObjectExist(dIndex, APP_GUIOBJ_SOFTWARE_UPGRADE))
  345. {
  346. return MAIN_APP_SUCCESS;
  347. }
  348. #endif
  349. }
  350. switch (dMessage)
  351. {
  352. case UI_EVENT_POWER:
  353. #if defined(CONFIG_BT_RDA5856)||defined(CONFIG_BT_POL6556)
  354. APP_BT_DisConnect_CurrentBT();
  355. #endif
  356. #ifdef SUPPORT_WAKEUP_TIMER_IN_STANDBY
  357. if (APP_WAKEUP_GetBootFlag() == TRUE)
  358. {
  359. #ifdef AC_ON_AUTO_GET_TIME
  360. if (g_fBackgroundGetTime == TRUE)
  361. {
  362. g_fBackgroundGetTime = FALSE;
  363. }
  364. #endif
  365. g_fRecorderNeedEntryStandby = FALSE;
  366. /*< light backlight */
  367. APP_WAKEUP_RealPowerUp();
  368. return MAIN_APP_SUCCESS;
  369. }
  370. else
  371. #endif
  372. {
  373. #ifdef CHECK_USB_FOR_SLEEP_AND_STANDBY
  374. /*
  375. * if the POWER event is from handset, check usb status for schedruler rec
  376. */
  377. if (APP_IsUIMessageType())
  378. {
  379. USB_PvrSt_t USB_ST = USB_MSG_SUCCESS;
  380. UINT32 dActiveSysApp = 0;
  381. USB_ST = APP_CheckUSBStatus();
  382. if (MAINAPP_GetActiveSystemAppIndex(&dActiveSysApp) == MAIN_APP_SUCCESS)
  383. {
  384. UINT32 u32PopMsgName = POPMSG_PROMPT_NO_PROG;
  385. #ifdef CONFIG_MEDIA_ENABLE
  386. UINT32 u32MMPopName = FILE_POP_PLAYBACK_NONE;
  387. if (SYS_APP_FILE_PLAYER == dActiveSysApp)
  388. {
  389. u32MMPopName = MM_PopMsg_GetCurrentPopup();
  390. }
  391. else
  392. #endif
  393. if ((SYS_APP_ATV== dActiveSysApp)
  394. || (SYS_APP_DVB== dActiveSysApp))
  395. {
  396. APP_GUIOBJ_PopMsg_GetMsgDialogType(&u32PopMsgName);
  397. }
  398. if ((u32PopMsgName != POPMSG_CONFIRM_INSERT_USB)
  399. && (u32PopMsgName != POPMSG_CONFIRM_INVALID_USB)
  400. #ifdef CONFIG_MEDIA_ENABLE
  401. && (u32MMPopName != FILE_POP_PVR_INSERT_USB_CONFIRM)
  402. && (u32MMPopName != FILE_POP_PVR_INVALID_USB_CONFIRM)
  403. #endif
  404. )
  405. {
  406. switch(USB_ST)
  407. {
  408. case USB_MSG_SUCCESS:
  409. break;
  410. case USB_MSG_FAIL_NO_STORAGE:
  411. SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, APP_GLOBAL_EVENT_PVR_INSERT_USB_CONFIRM|PASS_TO_SYSAPP, 0);
  412. return MAIN_APP_SUCCESS;
  413. default:
  414. SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, APP_GLOBAL_EVENT_PVR_INVALID_USB_CONFIRM|PASS_TO_SYSAPP, 0);
  415. return MAIN_APP_SUCCESS;
  416. }
  417. }
  418. }
  419. }
  420. #endif
  421. AL_Setting_Read(APP_Data_UserSetting_Handle(), SYS_SET_ID_FACTUSER, 0,
  422. sizeof(APP_SETTING_FactoryUser_t), &(g_stFactoryUserData));
  423. if (g_stFactoryUserData.n_FactSet_BurningMode == 1)
  424. {
  425. return MAIN_APP_SUCCESS;
  426. }
  427. mainapp_printf(" UI_EVENT_POWER received.\n");
  428. #ifdef CONFIG_AUTO_USB_STORE_IRSEQ
  429. extern int AUTO_IF_Stop(void);
  430. AUTO_IF_Stop();
  431. #endif
  432. #ifdef SUPPORT_WAKEUP_TIMER_IN_STANDBY
  433. #ifdef CONFIG_SUPPORT_USB_UPGRADE
  434. extern bool g_bUpgradeForceStandby;
  435. #endif
  436. if((APP_WAKEUP_CheckTimer() == FALSE)
  437. #ifdef CONFIG_SUPPORT_USB_UPGRADE
  438. || (g_bUpgradeForceStandby == TRUE)
  439. #endif
  440. )
  441. #endif
  442. {
  443. //zhongbaoxing added to mute the video for mantis 0166639 @20120224
  444. #ifdef CONFIG_SUPPORT_SUBTITLE
  445. if (MAIN_APP_SUCCESS == MAINAPP_GetActiveSystemAppIndex(&dIndex))
  446. {
  447. if (dIndex == SYS_APP_DVB)
  448. {
  449. DVBApp_DataApplicationSwitch(OSD2CTRLMDL_DISABLE|OSD2CTRLMDL_SUB);
  450. }
  451. }
  452. #endif
  453. #ifdef CONFIG_SUPPORT_TTX
  454. if (MAIN_APP_SUCCESS == MAINAPP_GetActiveSystemAppIndex(&dIndex))
  455. {
  456. #ifdef CONFIG_ATV_SUPPORT
  457. if(SYS_APP_ATV == dIndex)
  458. {
  459. if (SYSAPP_GOBJ_GUIObjectExist(dIndex, ATV_GUIOBJ_TTX))
  460. {
  461. SYSAPP_GOBJ_DestroyGUIObject(dIndex, ATV_GUIOBJ_TTX);
  462. }
  463. }
  464. #endif
  465. }
  466. #endif
  467. #ifdef CONFIG_CC_SUPPORT
  468. if (MAIN_APP_SUCCESS == MAINAPP_GetActiveSystemAppIndex(&dIndex))
  469. {
  470. if(dIndex == SYS_APP_ATV)
  471. {
  472. if(SYSAPP_GOBJ_GUIObjectExist(SYS_APP_ATV, ATV_GUIOBJ_CC))
  473. {
  474. SYSAPP_GOBJ_DestroyGUIObject(SYS_APP_ATV, ATV_GUIOBJ_CC);
  475. }
  476. }
  477. }
  478. #endif
  479. #ifdef SUPPORT_CEC_TV
  480. AL_Setting_Read(APP_Data_UserSetting_Handle(), SYS_SET_ID_FEATURE, 0,
  481. sizeof(APP_SETTING_Feature_t), &(g_stFeatureData));
  482. if (( APP_SWITCH_ON == g_stFeatureData.Enable_HDMILink)
  483. &&(APP_SWITCH_ON == g_stFeatureData.HDMI_AutoStandby))
  484. {
  485. if (CECTV_GetCECEnable()==CECTV_ENABLE)
  486. {
  487. CECTV_SendCmd(CECTV_SINGLE_ACT_CMD_STANDBY, 0);
  488. /*mainapp_printf("[%s]:Waiting for CECTV_SINGLE_ACT_CMD_STANDBY Send Complete !!!!!\n\n", __FUNCTION__);
  489. UINT8 i=0;
  490. while(CECTV_GetCECTaskStatus()!=CEC_TASK_Standby)//Waiting for CEC Message Send complete
  491. {
  492. i++;
  493. GL_TaskSleep(10);
  494. if (i > 50)
  495. {
  496. break;
  497. }
  498. }*/
  499. }
  500. }
  501. #endif
  502. #ifdef CONFIG_SUPPORT_USB_MCAST
  503. if (MAIN_APP_SUCCESS == MAINAPP_GetActiveSystemAppIndex(&dIndex))
  504. {
  505. #ifdef CONFIG_SUPPORT_NETAPP
  506. if(dIndex == SYS_APP_NETWORK)
  507. {
  508. if(SYSAPP_GOBJ_GUIObjectExist(SYS_APP_NETWORK, NET_GUIOBJ_USB_MCAST_PAGE))
  509. {
  510. SYSAPP_GOBJ_DestroyGUIObject(SYS_APP_NETWORK, NET_GUIOBJ_USB_MCAST_PAGE);
  511. }
  512. }
  513. #endif
  514. }
  515. #endif
  516. #ifdef CONFIG_BLUETOOTH_SUPPORT
  517. Al_Bluetooth_Disable();
  518. GL_TaskSleep(50);
  519. Al_Bluetooth_Destory();
  520. #endif
  521. Cmd_gpio_WriteOnLevel(GPIO_AUDIO_CTL);
  522. Cmd_gpio_WriteOffLevel(GPIO_12V_EN);
  523. AL_Power_SetPowerState(dParam);
  524. /* g_stUserInfoData.PowerStatus = APP_SWITCH_OFF; // power off
  525. AL_Setting_Write(APP_Data_UserSetting_Handle(), SYS_SET_ID_USERINFO,
  526. ITEM_OFFSET(APP_SETTING_UserInfo_t, PowerStatus),
  527. sizeof(g_stUserInfoData.PowerStatus), &(g_stUserInfoData.PowerStatus));
  528. AL_Setting_Store(APP_Data_UserSetting_Handle(), SYS_SET_ID_USERINFO,
  529. ITEM_OFFSET(APP_SETTING_UserInfo_t, PowerStatus), sizeof(g_stUserInfoData.PowerStatus));*/
  530. #ifdef AC_ON_AUTO_GET_TIME
  531. if (g_fBackgroundGetTime == TRUE)
  532. {
  533. /* keep the latest source if get time over */
  534. g_fBackgroundGetTime = FALSE;
  535. APP_Source_Type_t SourceIndex;
  536. SourceIndex = APP_GUIOBJ_Source_GetStandbySource();
  537. g_stUserInfoData.SourceIndex = SourceIndex;
  538. AL_Setting_Write(APP_Data_UserSetting_Handle(), SYS_SET_ID_USERINFO,
  539. ITEM_OFFSET(APP_SETTING_UserInfo_t, SourceIndex),
  540. sizeof(g_stUserInfoData.SourceIndex),&(g_stUserInfoData.SourceIndex));
  541. AL_Setting_Store(APP_Data_UserSetting_Handle(), SYS_SET_ID_USERINFO,
  542. ITEM_OFFSET(APP_SETTING_UserInfo_t, SourceIndex),
  543. sizeof(g_stUserInfoData.SourceIndex));
  544. }
  545. #endif
  546. #ifdef CONFIG_SUPPORT_MIRACAST
  547. WriteP2pConfigToFlash();
  548. #endif
  549. MAINAPP_FinalizeFlow(dParam);
  550. }
  551. }
  552. break;
  553. case UI_EVENT_MUTE:
  554. if (MAINAPP_GetActiveSystemAppIndex(&dIndex) == MAIN_APP_SUCCESS)
  555. {
  556. SYSAPP_IF_SendGlobalEventWithIndex(dIndex,(dMessage | PASS_TO_SYSAPP), dParam);
  557. }
  558. break;
  559. case UI_EVENT_SOURCE:
  560. mainapp_printf("[%s]: UI_EVENT_SOURCE!!!!!\n\n", __FUNCTION__);
  561. break;
  562. #ifdef SUPPORT_USB_UPGRADE_LONG_PRESS_KEYPAD_POWER
  563. case UI_EVENT_KEYPAD_POWER_UPGRADE:
  564. if (MAINAPP_GetActiveSystemAppIndex(&dIndex) == MAIN_APP_SUCCESS)
  565. {
  566. dMessage = APP_GLOBAL_EVENT_USB_UPGRADE | PASS_TO_SYSAPP;
  567. SYSAPP_IF_SendGlobalEventWithIndex(dIndex, dMessage, 0); // 1:EraseAll,0:not EraseAll
  568. g_CheckUpgrade = TRUE;
  569. }
  570. break;
  571. #endif
  572. case APP_GLOBAL_EVENT_OSD_CAPTURE:
  573. {
  574. mainapp_printf("\n\n%s APP_GLOBAL_EVENT_OSD_CAPTURE\n", __FUNCTION__);
  575. //extern int app_capture_osd_handler(void);
  576. //app_capture_osd_handler();
  577. //mainapp_printf("capture OK! \n");
  578. char szMountName[20];
  579. char szTempName[20] = {0};
  580. char fileNameStringtemp[50] = {0};
  581. char fileNameString[200] = {0};
  582. struct stat stStat;
  583. memset(fileNameStringtemp, 0, 50);
  584. memset(fileNameString, 0, 200);
  585. memset(szMountName, 0, sizeof(szMountName));
  586. MID_PartitionList_GetMountName(0, szMountName);
  587. if(strcmp(szMountName, szTempName))
  588. {
  589. sprintf(fileNameStringtemp,"%s/%s", szMountName,"SPOSD");
  590. if (stat(fileNameStringtemp, &stStat) < 0)
  591. {
  592. if (mkdir(fileNameStringtemp, O_WRONLY | O_CREAT) < 0)
  593. {
  594. mainapp_printf("%s mkdir failed\n", __FUNCTION__);
  595. break;
  596. }
  597. }
  598. static int fn = 0;
  599. fn++;
  600. sprintf(fileNameString,"%s/%s%d_%.3d%.2d.bmp", fileNameStringtemp,"OSD_",fn,rand()%1000,rand()%100);
  601. mainapp_printf("\nfileNameString:%s\n",fileNameString);
  602. OSD_ChangeIntoBitmap(fileNameString);
  603. mainapp_printf("\n\n%s capture ok!\n", __FUNCTION__);
  604. }
  605. break;
  606. }
  607. case FW_DB_LOAD_DEFAULT:
  608. #ifdef CONFIG_DVB_SYSTEM_DVBS_SUPPORT
  609. if (AL_DBTYPE_DVB_S == APP_DVB_Playback_GetCurrentNetType())
  610. {
  611. /* wait for DVB-S becomes acticve */
  612. while(AL_FW_CheckActiveDBModule(AL_DBTYPE_DVB_S) != al_true);
  613. DVBApp_LoadCustomerDB(AL_DBTYPE_DVB_S);
  614. AL_DB_Sync(AL_DBTYPE_DVB_S, al_true);
  615. }
  616. #endif
  617. break;
  618. default:
  619. mainapp_printf(" Un-handled UI Eventid: 0x%x.\n", dMessage);
  620. break;
  621. }
  622. return MAIN_APP_SUCCESS;
  623. }
  624. #ifdef CONFIG_SUPPORT_MEDIA_AUTO_PLAY
  625. /******************************************************************************/
  626. /**
  627. * @brief Check Folder Path Exist
  628. * @param char* const Folder_Path : Folder Path
  629. * @return TRUE : Folder is exist\n
  630. * FALSE : Folder is not exist
  631. *
  632. ******************************************************************************/
  633. static BOOL FileSystem_Lib_Com_IsFolderExist(char* const Folder_Path)
  634. {
  635. if (Folder_Path == NULL)
  636. {
  637. mainapp_printf("Folder_Path = NULL\n");
  638. return FALSE;
  639. }
  640. DIR* dir;
  641. dir = opendir(Folder_Path);
  642. if (dir == NULL)
  643. {
  644. mainapp_printf("Folder Path = %s is not exist!\n", Folder_Path);
  645. return FALSE;
  646. }
  647. if (closedir(dir) != 0)
  648. {
  649. mainapp_printf("call closedir fail\n");
  650. return FALSE;
  651. }
  652. dir = NULL;
  653. return TRUE;
  654. }
  655. static UINT16 FileSystem_Lib_Com_GetTotalSupportedPartitionNumber(void)
  656. {
  657. int MountedCount = MID_PartitionList_GetMountedCount();
  658. if (MountedCount > MAX_COM_PARTITION_NUM)
  659. {
  660. mainapp_printf("Partition Num = %d is more than %d\n", MountedCount, MAX_COM_PARTITION_NUM);
  661. MountedCount = MAX_COM_PARTITION_NUM;
  662. }
  663. return MountedCount;
  664. }
  665. static BOOLEAN MM_AutoPlay_Com_SetFlag(void)
  666. {
  667. UINT16 TotalPartition = FileSystem_Lib_Com_GetTotalSupportedPartitionNumber();
  668. UINT16 i = 0;
  669. char Name[INTERNAL_COM_DISK_NAME_LEN + 1];
  670. for (i = 0; i < TotalPartition; i++)
  671. {
  672. MID_PartitionList_GetMountName(i, Name);
  673. memset(PlayComFilePath, 0, MAX_COM_BUF_SIZE);
  674. snprintf(PlayComFilePath, MAX_COM_BUF_SIZE, "%s/%s", Name, MM_COMMON_AUTO_PLAY);
  675. mainapp_printf("[%s:%d] FilePath = %s \n", __FUNCTION__, __LINE__, PlayComFilePath);
  676. if (FileSystem_Lib_Com_IsFolderExist(PlayComFilePath))
  677. {
  678. mainapp_printf("[%s:%d]i = [%d] folder exist \n", __FUNCTION__, __LINE__, i);
  679. return TRUE;
  680. }
  681. }
  682. //mainapp_printf("[%s:%d]: bAutoPlay = %d \n", __FUNCTION__, __LINE__, bAutoPlay);
  683. return FALSE;
  684. }
  685. #endif
  686. /*****************************************************************************
  687. ** FUNCTION : _MAINAPP_DaemonEventHandler
  688. **
  689. ** DESCRIPTION :
  690. ** main app daemon event handler
  691. **
  692. ** PARAMETERS :
  693. ** dMessage: daemon message
  694. ** dParam: daemon message's paramter
  695. **
  696. ** RETURN VALUES:
  697. ** None
  698. *****************************************************************************/
  699. void _MAINAPP_DaemonEventHandler(UINT32 dMessage, UINT32 dParam)
  700. {
  701. #ifdef CONFIG_NET_SUPPORT
  702. #ifdef NET_APP_SUPPORT
  703. UINT8 i;
  704. UINT8 bFlag = 0;
  705. char *pcMountName = NULL;
  706. int iPtnHandle = 0;
  707. #endif
  708. #endif
  709. UINT32 dActiveSysApp = 0;
  710. int sdPtIdx = -1;
  711. INT32 iRet = AL_FAILURE;
  712. #if defined(CONFIG_SUPPORT_USB_AUTO_UPGRADE)
  713. app_data_keyupgrade_status_e updateCI = APP_DATA_KEYUPGRADE_NOT_UPGRADE;
  714. app_data_keyupgrade_status_e updateHDCP = APP_DATA_KEYUPGRADE_NOT_UPGRADE;
  715. #ifdef CONFIG_SUPPORT_STORE_HDCP2X_TO_FLASH
  716. app_data_keyupgrade_status_e updateHDCP2X = APP_DATA_KEYUPGRADE_NOT_UPGRADE;
  717. #endif
  718. UINT32 dKeyparam = 0;
  719. UINT32 dKeyUpgradeEvent = 0;
  720. #endif
  721. #if defined(CONFIG_NET_ET_SUPPORT) || defined (CONFIG_NET_N32_SUPPORT)
  722. MainAppUIEventHandlerInfo_t *pstEventInfo = &stUIEventHandlerInfo;
  723. #endif
  724. switch (dMessage)
  725. {
  726. case DMN_EVENT_BD_VIDEO_DISC_INSERTED:
  727. case DMN_EVENT_DVD_VIDEO_DISC_INSERTED:
  728. case DMN_EVENT_VCD_DISC_INSERTED:
  729. case DMN_EVENT_TEMPTEST_START_USB_DVD:
  730. break;
  731. case DMN_EVENT_USB_HDD_ATTACHED:
  732. case DMN_EVENT_USB_LOADER_ATTACHED:
  733. case DMN_EVENT_CARD_DEV_ATTACHED:
  734. case DMN_EVENT_IDE_HDD_ATTACHED:
  735. case DMN_EVENT_IDE_LOADER_ATTACHED:
  736. case DMN_EVENT_NAND_ATTACHED:
  737. {
  738. #if defined(CONFIG_AUTO_USB_STORE_IRSEQ) && defined(CONFIG_QSD_AUTOIR)
  739. AUTO_IF_Start(SEQUENTIAL_TEST, 0)
  740. #endif
  741. #ifdef SUPPORT_USB_UPGRADE_LONG_PRESS_KEYPAD_POWER
  742. if(dMessage == DMN_EVENT_USB_HDD_ATTACHED)
  743. {
  744. USB_ATTACHED = TRUE;
  745. }
  746. #endif
  747. #ifdef CONFIG_STORE_MSG_TO_USB
  748. {
  749. UINT8 isEnablePrintToUSB = 1;
  750. ioctl(kmfdev, KMF_IOC_PRINTOFILEENABLE, &isEnablePrintToUSB);
  751. }
  752. #endif
  753. iRet = APP_Data_USB_Upgrade_ChecFileAndBuildTime();
  754. //mainapp_printf("[L%d] DEV_ATTACHED(%d) received.\n", __LINE__,dMessage);
  755. switch (MAINAPP_GetActiveSystemAppIndex(&dActiveSysApp))
  756. {
  757. case MAIN_APP_IN_TRANSITION:
  758. //mainapp_printf("[L%d] In Transition State, wait and retry.\n",__LINE__);
  759. _MAINAPP_SetEventInTransition(dMessage, dParam);
  760. return;
  761. case MAIN_APP_SUCCESS:
  762. //mainapp_printf("[L%d] MAIN_APP_SUCCESS!!!\n",__LINE__);
  763. break;
  764. default:
  765. mainapp_printf("[%s %d] In Invalid State\n",__FUNCTION__,__LINE__);
  766. return;
  767. }
  768. _MAINAPP_ClearEventInTransition(dMessage, dParam);
  769. #if defined(CONFIG_SUPPORT_USB_AUTO_UPGRADE)
  770. #ifdef CONFIG_SUPPORT_STORE_HDCP2X_TO_FLASH
  771. updateHDCP = APP_Data_HDCPKey_Upgrade_AutoStart(iRet);
  772. updateHDCP2X = APP_Data_HDCP2XKey_Upgrade_AutoStart(iRet);
  773. updateHDCP = (updateHDCP || updateHDCP2X);
  774. #else
  775. updateHDCP = APP_Data_HDCPKey_Upgrade_AutoStart(iRet);
  776. #endif
  777. dKeyparam = (updateHDCP<<4) | updateCI;
  778. dKeyUpgradeEvent = APP_GLOBAL_EVENT_CIHDCPKEY_RESULT | PASS_TO_SYSAPP;
  779. SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, dKeyUpgradeEvent, dKeyparam);
  780. #endif
  781. #ifdef CONFIG_NET_SUPPORT
  782. MID_PartitionList_Mount(sdPtIdx, MntModule_Network);
  783. #ifdef CONFIG_NET_ET_SUPPORT
  784. _MAINAPP_EtMountHandle(pstEventInfo, dParam);
  785. #endif
  786. #ifdef CONFIG_NET_N32_SUPPORT
  787. _MAINAPP_N32MountHandle(pstEventInfo, dParam);
  788. #endif
  789. #endif
  790. #ifdef CONFIG_NET_SUPPORT
  791. #ifdef NET_APP_SUPPORT
  792. pcMountName = (char *)GL_MemAlloc(_SPAL_PARTITION_NAME_MAX_LENGTH);
  793. memset(pcMountName, 0, _SPAL_PARTITION_NAME_MAX_LENGTH2);
  794. iPtnHandle = MID_PartitionList_FindItem(dParam);
  795. if (iPtnHandle == -1)
  796. {
  797. mainapp_printf("get ptn handle\n");
  798. }
  799. if (MID_PartitionList_GetMountName(iPtnHandle, pcMountName) == NULL)
  800. {
  801. mainapp_printf("Get Mount Name\n");
  802. }
  803. if (strcmp(pcMountName, stNetConfigStorage.stParName) == 0)
  804. {
  805. Net_Cfg_SetDlPath(stNetConfigStorage.stParName);
  806. }
  807. if (NULL != pcMountName)
  808. {
  809. GL_MemFree(pcMountName);
  810. }
  811. if (stNetConfigStorage.u8IsSetNetConfigStorage == 0)
  812. {
  813. stNetConfigStorage.u8IsSetNetConfigStorage = 1;
  814. stNetConfigStorage.u8NetConfigStorage = 0;
  815. MID_PartitionList_GetMountName((int)stNetConfigStorage.u8NetConfigStorage, stNetConfigStorage.stParName);
  816. Net_Cfg_SetDlPath(stNetConfigStorage.stParName);
  817. }
  818. #endif
  819. #endif
  820. SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, dMessage, (UINT32)sdPtIdx);
  821. #if (defined(SUPPORT_FACTORY_AUTO_TEST)||defined(SUPPORT_FACTORY_AUTO_TEST_MODE2))
  822. if (APP_Factory_GetAutoTestOnOff() == TRUE)
  823. {
  824. Cmd_SetPanelBacklightPower(1);
  825. }
  826. #endif
  827. #ifdef SUPPORT_FACTORY_AUTO_TEST
  828. if ((APP_Factory_GetAutoTestOnOff() == TRUE)&&(iRet == AL_FAILURE))
  829. {
  830. extern void Enable_Debug_Message(UINT32 DBGStatus);
  831. Enable_Debug_Message(1<<MODULEID_UMF);
  832. //mainapp_printf("Test Start\n");
  833. Enable_Debug_Message(0);
  834. if(AcPowerOnNoRomBinFlag== FALSE)
  835. AcPowerOnNoRomBinFlag= TRUE;
  836. }
  837. #endif
  838. if(g_CheckUpgrade)
  839. {
  840. break;
  841. }
  842. if((iRet == AL_SUCCESS)
  843. #ifdef SUPPORT_WAKEUP_TIMER_IN_STANDBY
  844. && (APP_WAKEUP_GetBootFlag() == FALSE)
  845. #endif
  846. )
  847. {
  848. mainapp_printf("[L%d] APP_Data_USB_Upgrade_ChecFileAndBuildTime() Success!!!\n",__LINE__);
  849. #ifdef SUPPORT_FACTORY_AUTO_TEST
  850. extern int APP_Factory_GetAutoTestOnOff(void);
  851. extern int APP_Factory_GetUpgradeandAutoTestFlag(void);
  852. extern void APP_Factory_SetUpgradeandAutoTestFlag(Boolean Flag);
  853. if(AcPowerOnNoRomBinFlag == TRUE)
  854. {
  855. mainapp_printf("In AutoTest Factory mode\n");
  856. }
  857. else if((APP_Factory_GetAutoTestOnOff() == TRUE)&&(APP_Factory_GetUpgradeandAutoTestFlag() == FALSE))
  858. {
  859. dMessage = APP_GLOBAL_EVENT_USB_UPGRADE | PASS_TO_SYSAPP;
  860. gFACTESTResentMessage.dResendMessage = dMessage;
  861. gFACTESTResentMessage.dResendMessageParm = 0;
  862. //SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, dMessage, 0); // 1:EraseAll,0:not EraseAll
  863. //APP_Factory_SetAutoTestOnOff(FALSE);
  864. //APP_Factory_SetUpgradeandAutoTestFlag(TRUE);
  865. //g_CheckUpgrade = TRUE;
  866. }
  867. else if((APP_Factory_GetAutoTestOnOff() == TRUE)&&(APP_Factory_GetUpgradeandAutoTestFlag() == TRUE))
  868. {
  869. mainapp_printf("In AutoTest Factory mode\n");
  870. }
  871. else
  872. {
  873. #ifndef CONFIG_SUPPORT_USB_AUTO_UPGRADE
  874. if(FALSE == gUSBUpgradeBinIsSupperBin)
  875. {
  876. break;
  877. }
  878. #endif
  879. dMessage = APP_GLOBAL_EVENT_USB_UPGRADE | PASS_TO_SYSAPP;
  880. SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, dMessage, 0);
  881. g_CheckUpgrade = TRUE;
  882. }
  883. #else
  884. #ifndef CONFIG_SUPPORT_USB_AUTO_UPGRADE
  885. if(FALSE == gUSBUpgradeBinIsSupperBin)
  886. {
  887. break;
  888. }
  889. #endif
  890. dMessage = APP_GLOBAL_EVENT_USB_UPGRADE | PASS_TO_SYSAPP;
  891. SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, dMessage, 0);
  892. g_CheckUpgrade = TRUE;
  893. #endif
  894. }
  895. else
  896. if(dMessage == DMN_EVENT_USB_HDD_ATTACHED)
  897. {
  898. }
  899. #ifdef CONFIG_SUPPORT_MEDIA_AUTO_PLAY
  900. //BOOLEAN MM_AutoPlay_SetFlag(void);
  901. if(MM_AutoPlay_Com_SetFlag())
  902. {
  903. if (APP_GUIOBJ_Source_GetSourceTransState() == TRUE)
  904. {
  905. gb_NeedAutoPlay = TRUE;
  906. }
  907. else
  908. {
  909. APP_GUIOBJ_Source_SetAppSource(APP_SOURCE_MEDIA);
  910. }
  911. }
  912. #endif
  913. }
  914. break;
  915. case DMN_EVENT_USB_HDD_DETACHED:
  916. case DMN_EVENT_USB_LOADER_DETACHED:
  917. case DMN_EVENT_CARD_DEV_DETACHED:
  918. case DMN_EVENT_IDE_HDD_DETACHED:
  919. case DMN_EVENT_IDE_LOADER_DETACHED:
  920. case DMN_EVENT_NAND_DETACHED:
  921. mainapp_printf(" DEV_DETACHED(%d) received.\n", dMessage);
  922. switch (MAINAPP_GetActiveSystemAppIndex(&dActiveSysApp))
  923. {
  924. case MAIN_APP_IN_TRANSITION:
  925. //mainapp_printf("[L%d] In Transition State, wait and retry.\n",__LINE__);
  926. _MAINAPP_SetEventInTransition(dMessage, dParam);
  927. return;
  928. case MAIN_APP_SUCCESS:
  929. //mainapp_printf("[L%d] MAIN_APP_SUCCESS!!!\n",__LINE__);
  930. break;
  931. default:
  932. mainapp_printf("[%s %d] In Invalid State\n",__FUNCTION__,__LINE__);
  933. return;
  934. }
  935. _MAINAPP_ClearEventInTransition(dMessage, dParam);
  936. if(dMessage == DMN_EVENT_USB_HDD_DETACHED)
  937. {
  938. g_CheckUpgrade = FALSE;
  939. #ifdef SUPPORT_USB_UPGRADE_LONG_PRESS_KEYPAD_POWER
  940. USB_ATTACHED = FALSE;
  941. #endif
  942. }
  943. #ifdef CONFIG_CONFIRM_AUTO_UPGRADE
  944. UINT32 u32PopMsgName;
  945. APP_GUIOBJ_PopMsg_GetMsgDialogType(&u32PopMsgName);
  946. if(u32PopMsgName == POPMSG_CONFIRM_START_AUTO_UPGRADE)
  947. {
  948. AutoUpgrade = FALSE;
  949. if(SYS_APP_ATV == dActiveSysApp)
  950. {
  951. ATVApp_ClosePopup(POPMSG_CONFIRM_START_AUTO_UPGRADE, UI_EVENT_NULL);
  952. }
  953. }
  954. #endif
  955. #ifdef CONFIG_NET_ET_SUPPORT
  956. _MAINAPP_EtUnmountHandle(pstEventInfo, dParam);
  957. #endif
  958. #ifdef CONFIG_NET_N32_SUPPORT
  959. _MAINAPP_N32UnmountHandle(pstEventInfo, dParam);
  960. #endif
  961. #ifdef CONFIG_NET_SUPPORT
  962. #ifdef NET_APP_SUPPORT
  963. #if defined(CONFIG_DVB_SYSTEM_DVBC_SUPPORT)
  964. Dvb_GUIOBJ_Networking_PartitionInfoUpdate();
  965. #endif
  966. pcMountName = (char *)GL_MemAlloc(_SPAL_PARTITION_NAME_MAX_LENGTH);
  967. memset(pcMountName, 0, _SPAL_PARTITION_NAME_MAX_LENGTH2);
  968. for (i = 0; i < MID_PartitionList_GetMountedCount(); i++)
  969. {
  970. MID_PartitionList_GetMountName(i, pcMountName);
  971. if (strcmp(pcMountName, stNetConfigStorage.stParName) == 0)
  972. {
  973. bFlag++;
  974. }
  975. }
  976. if (NULL != pcMountName)
  977. {
  978. GL_MemFree(pcMountName);
  979. }
  980. if (bFlag == 0)
  981. {
  982. if (MID_PartitionList_GetMountedCount() == 0)
  983. {
  984. memset(stNetConfigStorage.stParName, 0, sizeof(char)*_SPAL_PARTITION_NAME_MAX_LENGTH);
  985. stNetConfigStorage.u8IsSetNetConfigStorage = 0;
  986. stNetConfigStorage.u8NetConfigStorage = 0;
  987. }
  988. else
  989. {
  990. stNetConfigStorage.u8IsSetNetConfigStorage = 1;
  991. stNetConfigStorage.u8NetConfigStorage = 0;
  992. MID_PartitionList_GetMountName((int)stNetConfigStorage.u8NetConfigStorage, stNetConfigStorage.stParName);
  993. }
  994. }
  995. Net_Cfg_SetDlPath(stNetConfigStorage.stParName);
  996. #endif
  997. #endif
  998. SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, dMessage, (UINT32)sdPtIdx);
  999. break;
  1000. case DMN_EVENT_SCREEN_SAVER_ON:
  1001. mainapp_printf(" DMN_EVENT_SCREEN_SAVER_ON received.\n");
  1002. break;
  1003. case DMN_EVENT_SCREEN_SAVER_OFF:
  1004. mainapp_printf(" DMN_EVENT_SCREEN_SAVER_OFF received.\n");
  1005. break;
  1006. #ifdef CONFIG_NET_SUPPORT
  1007. case DMN_EVENT_NET_LINKER_DETACHED:
  1008. mainapp_printf("DMN_EVENT_NET_LINKER_DETACHED received.\n");
  1009. #if defined( SAMBA_SUPPORT ) && defined( SUPPORT_ETHERNET )
  1010. DVB_Network_UnMountSmbFs();
  1011. #endif
  1012. pstEventInfo->stNetDriveCtrlInfo.eState = NET_DRIVE_STATE_SHUT_DOWN;
  1013. if (MAINAPP_GetActiveSystemAppIndex(&dActiveSysApp) == MAIN_APP_SUCCESS)
  1014. {
  1015. SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, dMessage, dParam);
  1016. }
  1017. break;
  1018. case DMN_EVENT_NET_LINKER_ATTACHED:
  1019. mainapp_printf("DMN_EVENT_NET_LINKER_ATTACHED received.\n");
  1020. #if defined( SAMBA_SUPPORT ) && defined( SUPPORT_ETHERNET )
  1021. DVB_Network_MountSmbFs();
  1022. #endif
  1023. pstEventInfo->stNetDriveCtrlInfo.eState = NET_DRIVE_STATE_BOOTUP;
  1024. if (MAINAPP_GetActiveSystemAppIndex(&dActiveSysApp) == MAIN_APP_SUCCESS)
  1025. {
  1026. SYSAPP_IF_SendGlobalEventWithIndex(dActiveSysApp, dMessage, dParam);
  1027. }
  1028. break;
  1029. #endif
  1030. case DMN_EVENT_MAINAPP_STARTS:
  1031. mainapp_printf(" DMN_EVENT_MAINAPP_STARTS received.\n");
  1032. #ifdef CONFIG_NET_SUPPORT
  1033. MAINAPP_NetAPInit();
  1034. #endif
  1035. break;
  1036. default:
  1037. mainapp_printf(" Un-handled Daemon Eventid: 0x%x.\n", dMessage);
  1038. break;
  1039. }
  1040. return;
  1041. }
  1042. /*****************************************************************************
  1043. ** FUNCTION : MAINAPP_OnTimerUpdate
  1044. **
  1045. ** DESCRIPTION :
  1046. ** main app 100ms message handler
  1047. **
  1048. ** PARAMETERS :
  1049. ** None
  1050. **
  1051. ** RETURN VALUES:
  1052. ** None
  1053. *****************************************************************************/
  1054. int MAINAPP_OnTimerUpdate(void)
  1055. {
  1056. UINT32 dIndex = 0;
  1057. /*mark for S2tek */
  1058. #ifdef SUPPORT_FACTORY_AUTO_TEST
  1059. if((APP_Factory_GetAutoTestOnOff() == TRUE) && (APP_Factory_GetUpgradeandAutoTestFlag() == FALSE))
  1060. {
  1061. static UINT8 CheckCount = 0;
  1062. //100ms * 50
  1063. CheckCount++;
  1064. CheckCount %= 255;
  1065. if(CheckCount >= 50 && gFACTESTResentMessage.dResendMessage != 0)
  1066. {
  1067. APP_Factory_SetAutoTestOnOff(FALSE);
  1068. APP_Factory_SetUpgradeandAutoTestFlag(TRUE);
  1069. MSG_FILTER_DispatchMessage(gFACTESTResentMessage.dResendMessage, gFACTESTResentMessage.dResendMessageParm);
  1070. g_CheckUpgrade = TRUE;
  1071. gFACTESTResentMessage.dResendMessage = 0;
  1072. gFACTESTResentMessage.dResendMessageParm= 0;
  1073. }
  1074. }
  1075. #endif
  1076. _MAINAPP_ResendEventInTransition();
  1077. AL_Time_Timeout();
  1078. if (APP_SleepTimer_GetDetectFlag())
  1079. {
  1080. if(!(APP_MenuMgr_Exist_Factory_Menu()))
  1081. {
  1082. if (APP_GUIOBJ_SleepTimer_Timeout())
  1083. {
  1084. if(MAIN_APP_SUCCESS != MAINAPP_GetActiveSystemAppIndex(&dIndex))
  1085. {
  1086. printf("GetActiveSystemApp faile\n");
  1087. }
  1088. if(SYSAPP_GOBJ_GUIObjectExist(dIndex, APP_GUIOBJ_SLEEP_INFO))
  1089. {
  1090. APP_GUIOBJ_SleepTimer_SetSleepPopConflict(TRUE);
  1091. }
  1092. SYSAPP_IF_SendGlobalEventWithIndex(dIndex,
  1093. (APP_GLOBAL_EVENT_SLEEP_TIMER_INFO | PASS_TO_SYSAPP), APP_POWERDOWN_SLEEP);
  1094. APP_SleepTimer_SetDetectFlag(FALSE);
  1095. }
  1096. }
  1097. }
  1098. if (APP_AutoPowerOff_Timeout() || APP_2Hours_PowerOff_Timeout())
  1099. {
  1100. if(MAIN_APP_SUCCESS != MAINAPP_GetActiveSystemAppIndex(&dIndex))
  1101. {
  1102. printf("GetActiveSystemApp faile\n");
  1103. }
  1104. if (SYSAPP_GOBJ_GUIObjectExist(dIndex, APP_GUIOBJ_SLEEP_INFO) && (APP_GUIOBJ_SleepTimer_GetStandbyPopConflict() == FALSE))
  1105. {
  1106. APP_GUIOBJ_SleepTimer_SetStandbyPopConflict(TRUE);
  1107. }
  1108. SYSAPP_IF_SendGlobalEventWithIndex(dIndex,
  1109. (APP_GLOBAL_EVENT_SLEEP_TIMER_INFO | PASS_TO_SYSAPP), APP_POWERDOWN_AUTOPOWEROFF);
  1110. #if 0
  1111. while(!SYSAPP_GOBJ_GUIObjectExist(SYS_APP_DVB, APP_GUIOBJ_SLEEP_INFO))
  1112. {
  1113. MAINAPP_SendGlobalEvent(UI_EVENT_POWER, AL_POWER_STATE_OFF);
  1114. }
  1115. #endif
  1116. }
  1117. #ifdef SUPPORT_SHOP_DEMO_MODE
  1118. if (APP_ShopDemo_Timeout())
  1119. {
  1120. APP_GUIOBJ_Picture_SetPictureMode(TV_IDS_String_Picture_dynamic);
  1121. APP_GUIOBJ_Picture_SetColourTemp(TV_IDS_String_Standard);
  1122. APP_Video_OSD_PQSet(APP_VIDEO_OSD_ITEM_BACKLIGHT, 100);
  1123. }
  1124. #endif
  1125. #if defined(CONFIG_SUPPORT_SET_CLOCK_ONOFFTIME)|| defined (TEAC_ONOFF_TIMER_SUPPORT)
  1126. APP_OffTimer_Check();
  1127. #ifdef TEAC_ONOFF_TIMER_SUPPORT
  1128. APP_OnTimer_Check_WhenPanelOff();
  1129. #endif
  1130. #endif
  1131. #if defined(CONFIG_BT_RDA5856)
  1132. if(APP_BT_GetHeartTimer() >= 50)
  1133. {
  1134. if(APP_BT_GetHeartTimer()!= 0xff)
  1135. {
  1136. APP_BT_SetHeartTimer(0xff);
  1137. MSG_FILTER_DispatchMessage(DMN_EVENT_BLUETOOTH_WAITCONNECT,0);
  1138. }
  1139. }
  1140. else
  1141. {
  1142. APP_BT_SetHeartTimer(APP_BT_GetHeartTimer()+1);
  1143. }
  1144. if(g_SystemPowerOnReadyNeedReconnectBT == TRUE)
  1145. {
  1146. APP_Source_Type_t getCurrSourType = APP_SOURCE_MAX;
  1147. APP_GUIOBJ_Source_GetCurrSource(&getCurrSourType);
  1148. if(getCurrSourType != APP_SOURCE_BLUETOOTH)
  1149. {
  1150. AL_Setting_Read(APP_Data_UserSetting_Handle(), SYS_SET_ID_SETUP,0,
  1151. sizeof(APP_SETTING_Setup_t), &(g_stSetupData));
  1152. UINT8 NULLADDR[6] = "";
  1153. if(APP_BT_GetBTIsReady() == TRUE)
  1154. {
  1155. g_SystemPowerOnReadyNeedReconnectBT = FALSE;
  1156. if((g_stSetupData.BTMode != BT_MODE_SEND)
  1157. ||(memcmp((const void *)g_stSetupData.BTAddrs,(const void *)NULLADDR,sizeof(t_bdaddr)) == 0))
  1158. {
  1159. ;//do nothing
  1160. }
  1161. else
  1162. {
  1163. APP_BT_Auto_ReconnectBTDevice();
  1164. }
  1165. }
  1166. }
  1167. else
  1168. {
  1169. g_SystemPowerOnReadyNeedReconnectBT = FALSE;
  1170. }
  1171. }
  1172. #endif
  1173. #ifdef CONFIG_SUPPORT_MEDIA_AUTO_PLAY
  1174. if (gb_NeedAutoPlay && APP_GUIOBJ_Source_GetSourceTransState() == FALSE && MM_AutoPlay_Com_SetFlag())
  1175. {
  1176. APP_GUIOBJ_Source_SetAppSource(APP_SOURCE_MEDIA);
  1177. gb_NeedAutoPlay = FALSE;
  1178. }
  1179. #endif
  1180. #ifdef CONFIG_SKIP_AC_POWERKEY
  1181. UINT8 key0State = GPIO_LEVEL_LOW;
  1182. static UINT8 checkHighTimes = 0;
  1183. Cmd_gpio_Read(GPIO_KEY0_PIN,&key0State);
  1184. if(GPIO_LEVEL_HIGH == key0State)
  1185. {
  1186. checkHighTimes++;
  1187. if(checkHighTimes >= 10)
  1188. {
  1189. MAINAPP_SendGlobalEvent(UI_EVENT_POWER, AL_POWER_STATE_OFF);
  1190. }
  1191. }
  1192. #endif
  1193. return SP_SUCCESS;
  1194. }
  1195. /*****************************************************************************
  1196. ** FUNCTION : MAINAPP_OnEvent
  1197. **
  1198. ** DESCRIPTION :
  1199. ** main app external event handler
  1200. **
  1201. ** PARAMETERS :
  1202. ** dMessage : message
  1203. ** dParam : the parameter for dMessage
  1204. **
  1205. ** RETURN VALUES:
  1206. ** None
  1207. *****************************************************************************/
  1208. int MAINAPP_OnEvent(UINT32 dMessage, UINT32 dParam)
  1209. {
  1210. if((dMessage < UI_EVENT_NULL)
  1211. || ((dMessage > APP_GLOBAL_EVENT_MIN) && (dMessage < APP_GLOBAL_EVENT_MAX)))
  1212. {
  1213. //mainapp_printf("==================_MAINAPP_UIEventHandler()=================\n");
  1214. _MAINAPP_UIEventHandler(dMessage, dParam);
  1215. }
  1216. else if ((dMessage > DMN_EVENT_MIN && dMessage < DMN_EVENT_MAX)
  1217. || (dMessage > DMN_EVENT_DEVICE_DETECT_MIN && dMessage < DMN_EVENT_DEVICE_DETECT_MAX))
  1218. {
  1219. //mainapp_printf("==================_MAINAPP_DaemonEventHandler()=================\n");
  1220. _MAINAPP_DaemonEventHandler(dMessage, dParam);
  1221. }
  1222. else if (dMessage > GUI_RESPOND_MIN && dMessage < GUI_RESPOND_MAX)
  1223. {
  1224. //mainapp_printf("==================_MAINAPP_GUIFeedbackEventHandler()=================\n");
  1225. _MAINAPP_GUIFeedbackEventHandler(dMessage, dParam);
  1226. }
  1227. return SP_SUCCESS;
  1228. }
  1229. /*****************************************************************************
  1230. ** FUNCTION : MAINAPP_GetPowerOffState
  1231. **
  1232. ** DESCRIPTION :
  1233. ** Get power off state
  1234. **
  1235. ** PARAMETERS :
  1236. ** None
  1237. **
  1238. ** RETURN VALUES:
  1239. ** g_bPowerOffFlag: power off state
  1240. *****************************************************************************/
  1241. Boolean MAINAPP_GetPowerOffState(void)
  1242. {
  1243. return g_bPowerOffFlag;
  1244. }
  1245. /*****************************************************************************
  1246. ** FUNCTION : MAINAPP_SetPowerOffState
  1247. **
  1248. ** DESCRIPTION :
  1249. ** Set power off state
  1250. **
  1251. ** PARAMETERS :
  1252. ** PowerOffFlag - power off state
  1253. **
  1254. ** RETURN VALUES:
  1255. ** None
  1256. *****************************************************************************/
  1257. void MAINAPP_SetPowerOffState(Boolean PowerOffFlag)
  1258. {
  1259. g_bPowerOffFlag = PowerOffFlag;
  1260. }
  1261. #ifdef CONFIG_NET_ET_SUPPORT
  1262. static void MAINAPP_NetAPInit(void)
  1263. {
  1264. NetDaemonCfg_t stNetDaemon;
  1265. stNetDaemon.pfEventCallBack = NetDaemon_callback;
  1266. #ifdef NET_WIFI_SUPPORT
  1267. Net_WifiFlashiInit();
  1268. #endif
  1269. if (NET_IF_Initialize(&stNetDaemon) != NET_DAEMON_IF_SUCCESSFUL)
  1270. {
  1271. mainapp_printf("ERROR: init net daemon\n");
  1272. }
  1273. if (APP_NET_Initialize() != APP_NET_IF_SUCCESSFUL)
  1274. {
  1275. mainapp_printf("ERROR: app init net daemon\n");
  1276. }
  1277. #ifdef SUPPORT_NET_TESTING
  1278. if (NetTest_Init(1) != 0)
  1279. {
  1280. mainapp_printf("ERROR: Init Net Testing Thread\n");
  1281. }
  1282. #endif
  1283. }
  1284. MainAppUIEventHandlerInfo_t *MAINAPP_GetNetHandlerInfo(void)
  1285. {
  1286. return &stUIEventHandlerInfo;
  1287. }
  1288. static void _MAINAPP_EtMountHandle(MainAppUIEventHandlerInfo_t *pstEventInfo, UINT32 dDevNum)
  1289. {
  1290. int iPtnHandle = 0;
  1291. char *pszMountPonit = NULL;
  1292. if (!pstEventInfo)
  1293. {
  1294. mainapp_printf("%s\n", __FUNCTION__);
  1295. return;
  1296. }
  1297. pszMountPonit = GL_MemAlloc(ET_PATH_NAME_MAX_LENTH);
  1298. if (!pszMountPonit)
  1299. {
  1300. mainapp_printf("alloc et new path name\n");
  1301. return;
  1302. }
  1303. memset(pszMountPonit, 0, ET_PATH_NAME_MAX_LENTH);
  1304. do
  1305. {
  1306. iPtnHandle = MID_PartitionList_FindItem(dDevNum);
  1307. if (iPtnHandle == -1)
  1308. {
  1309. mainapp_printf("invalidate ptn handle\n");
  1310. break;
  1311. }
  1312. if (MID_PartitionList_GetMountName(iPtnHandle, pszMountPonit) == NULL)
  1313. {
  1314. mainapp_printf("get ptn mount point error!\n");
  1315. break;
  1316. }
  1317. pstEventInfo->stSysDriveCtrlInfo.iSysCurPtnHnd = iPtnHandle;
  1318. }
  1319. while (0);
  1320. GL_MemFree(pszMountPonit);
  1321. }
  1322. static void _MAINAPP_EtUnmountHandle(MainAppUIEventHandlerInfo_t *pstEventInfo, UINT32 dDevNum)
  1323. {
  1324. int iPtnHandle = 0;
  1325. char *pszMountPonit = NULL;
  1326. if (!pstEventInfo)
  1327. {
  1328. mainapp_printf("%s\n", __FUNCTION__);
  1329. return;
  1330. }
  1331. pszMountPonit = GL_MemAlloc(ET_PATH_NAME_MAX_LENTH);
  1332. if (!pszMountPonit)
  1333. {
  1334. mainapp_printf("alloc et new path name\n");
  1335. return;
  1336. }
  1337. memset(pszMountPonit, 0, ET_PATH_NAME_MAX_LENTH);
  1338. do
  1339. {
  1340. iPtnHandle = MID_PartitionList_FindItem(dDevNum);
  1341. if (iPtnHandle == -1)
  1342. {
  1343. mainapp_printf("invalidate ptn handle\n");
  1344. break;
  1345. }
  1346. if (MID_PartitionList_GetMountName(iPtnHandle, pszMountPonit) == NULL)
  1347. {
  1348. mainapp_printf("get ptn mount point error!\n");
  1349. break;
  1350. }
  1351. #if 0
  1352. sdReturnValue = NET_IF_InstOps(NET_DAEMON_INST_ET, NET_DAEMON_INST_OPS_UNMOUNT_CHECK, (UINT32)pszMountPonit);
  1353. if (sdReturnValue < NET_DAEMON_IF_SUCCESSFUL)
  1354. {
  1355. mainapp_printf("boot up check et download\n");
  1356. break;
  1357. }
  1358. #endif
  1359. pstEventInfo->stSysDriveCtrlInfo.iSysCurPtnHnd = iPtnHandle;
  1360. }
  1361. while (0);
  1362. GL_MemFree(pszMountPonit);
  1363. }
  1364. #endif
  1365. #ifdef CONFIG_NET_N32_SUPPORT
  1366. static void _MAINAPP_N32MountHandle(MainAppUIEventHandlerInfo_t *pstEventInfo, UINT32 dDevNum)
  1367. {
  1368. INT32 sdReturnValue = MAIN_APP_SUCCESS;
  1369. int iPtnHandle = 0;
  1370. char *pszMountPonit = NULL;
  1371. if (!pstEventInfo)
  1372. {
  1373. mainapp_printf("%s\n", __FUNCTION__);
  1374. return;
  1375. }
  1376. pszMountPonit = GL_MemAlloc(DLMGR_IF_FILEPATH_MAX_LEN);
  1377. if (!pszMountPonit)
  1378. {
  1379. mainapp_printf("alloc et new path name\n");
  1380. return;
  1381. }
  1382. memset(pszMountPonit, 0, DLMGR_IF_FILEPATH_MAX_LEN);
  1383. do
  1384. {
  1385. iPtnHandle = MID_PartitionList_FindItem(dDevNum);
  1386. if (iPtnHandle == -1)
  1387. {
  1388. mainapp_printf("get ptn handle\n");
  1389. break;
  1390. }
  1391. if (MID_PartitionList_GetMountName(iPtnHandle, pszMountPonit) == NULL)
  1392. {
  1393. mainapp_printf("get ptn mount point error!\n");
  1394. break;
  1395. }
  1396. //add by ztli 2010/08/04 for mantis bug 96324 start {
  1397. if (iPtnHandle == 0)
  1398. {
  1399. Net_Cfg_SetDlPath(pszMountPonit);
  1400. }
  1401. //add by ztli end }
  1402. //sdReturnValue = NET_IF_InstOps(NET_DAEMON_INST_N32,NET_DAEMON_N32_INST_OPS_MOUNT_CHECK,(UINT32)pszMountPonit);
  1403. //if(sdReturnValue < NET_DAEMON_IF_SUCCESSFUL)
  1404. sdReturnValue = APP_NET_InstCtrl(APP_NET_INST_N32, APP_NET_INST_OPS_MOUNT, (UINT32)pszMountPonit);
  1405. if (sdReturnValue < APP_NET_IF_SUCCESSFUL)
  1406. {
  1407. mainapp_printf("boot up check et download\n");
  1408. break;
  1409. }
  1410. }
  1411. while (0);
  1412. GL_MemFree(pszMountPonit);
  1413. }
  1414. static void _MAINAPP_N32UnmountHandle(MainAppUIEventHandlerInfo_t *pstEventInfo, UINT32 dDevNum)
  1415. {
  1416. INT32 sdReturnValue = MAIN_APP_SUCCESS;
  1417. int iPtnHandle = 0;
  1418. char *pszMountPonit = NULL;
  1419. if (!pstEventInfo)
  1420. {
  1421. mainapp_printf("%s\n", __FUNCTION__);
  1422. return;
  1423. }
  1424. pszMountPonit = GL_MemAlloc(DLMGR_IF_FILEPATH_MAX_LEN);
  1425. if (!pszMountPonit)
  1426. {
  1427. mainapp_printf("alloc et new path name\n");
  1428. return;
  1429. }
  1430. memset(pszMountPonit, 0, DLMGR_IF_FILEPATH_MAX_LEN);
  1431. do
  1432. {
  1433. iPtnHandle = MID_PartitionList_FindItem(dDevNum);
  1434. if (iPtnHandle == -1)
  1435. {
  1436. mainapp_printf("invalidate ptn handle\n");
  1437. break;
  1438. }
  1439. if (MID_PartitionList_GetMountName(iPtnHandle, pszMountPonit) == NULL)
  1440. {
  1441. mainapp_printf("get ptn mount point error!\n");
  1442. break;
  1443. }
  1444. //sdReturnValue = NET_IF_InstOps(NET_DAEMON_INST_N32,NET_DAEMON_N32_INST_OPS_UNMOUNT_CHECK,(UINT32)pszMountPonit);
  1445. //if(sdReturnValue < NET_DAEMON_IF_SUCCESSFUL)
  1446. sdReturnValue = APP_NET_InstCtrl(APP_NET_INST_N32, APP_NET_INST_OPS_UNMOUNT, (UINT32)pszMountPonit);
  1447. if (sdReturnValue < APP_NET_IF_SUCCESSFUL)
  1448. {
  1449. mainapp_printf("boot up check et download\n");
  1450. break;
  1451. }
  1452. }
  1453. while (0);
  1454. GL_MemFree(pszMountPonit);
  1455. }
  1456. #endif