uiEntry.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /*
  2. UI具体界面在此文件中实现
  3. */
  4. #include "includes.h"
  5. /********************************UI状态机记录操作功能*************************/
  6. UI_STACKDEF uiStack;
  7. UI_STACKDEF *getStackStruct(void){return &uiStack;}
  8. static void uiStackInit(void){
  9. memset((unsigned char *)&uiStack, 0, sizeof(uiStack));
  10. uiStack.ok_back=0;
  11. uiStack.top=-1;
  12. uiStack.FastUiChange=0;
  13. }
  14. short uiPushStack(unsigned char data){
  15. if(uiStack.top==4) return 1;
  16. uiStack.top ++;
  17. uiStack.sta[uiStack.top]=data;
  18. return 0;
  19. }
  20. short uiPullStack(void){
  21. unsigned char tmp;
  22. if(uiStack.top<0) return -1;
  23. else{
  24. tmp=uiStack.sta[uiStack.top];
  25. uiStack.top--;
  26. return tmp;
  27. }
  28. }
  29. /********************************UI状态切换功能*********************************/
  30. UI_STATUSDEF sutUIstatus;
  31. void uISetNextStatus(unsigned char status){
  32. sutUIstatus.LastStatus=sutUIstatus.NextStatus;
  33. sutUIstatus.NextStatus=status;
  34. }
  35. void uiDataInit(void){
  36. memset((unsigned char *)&sutUIstatus, 0, sizeof(UI_STATUSDEF));
  37. uISetNextStatus(UIS_STANDBY);
  38. }
  39. void uiLoop(unsigned int exeInterval){
  40. char StatusUpdate=0;
  41. if(sutUIstatus.Status!=sutUIstatus.NextStatus){
  42. sutUIstatus.LastStatus=sutUIstatus.Status;
  43. sutUIstatus.Status=sutUIstatus.NextStatus;
  44. sutUIstatus.ItemRefresh=1;
  45. StatusUpdate=1;
  46. }
  47. if(sutApp.forceUiFlash!=0){
  48. StatusUpdate=1;
  49. sutApp.forceUiFlash=0;
  50. }
  51. switch(sutUIstatus.Status){
  52. /***********0级:待机界面显示入口*************/
  53. case UIS_STANDBY:
  54. uiStackInit();
  55. PalaceIndexReset();
  56. uiShowMainInterface(StatusUpdate,exeInterval);
  57. break;
  58. /***********1级:主菜单界面显示入口*************/
  59. case UIS_MENU_MAIN:
  60. uiShowMenuMain(StatusUpdate);
  61. break;
  62. /***********1.1级:群组选择界面显示入口*************/
  63. case UIS_MENU_GROUP_SEL:
  64. uiShowGUSel(StatusUpdate,exeInterval,0);
  65. break;
  66. /***********1.2级:成员选择界面显示入口*************/
  67. case UIS_MENU_USER_SEL:
  68. uiShowGUSel(StatusUpdate,exeInterval,1);
  69. break;
  70. case UIS_MENU_FRIEND_SEL:
  71. uiShowGUSel(StatusUpdate,exeInterval,2);
  72. break;
  73. /***********1.3级:文本信息界面显示入口*************/
  74. case UIS_MENU_MAIL_SEL:
  75. //uiShowMailBox(StatusUpdate);
  76. break;
  77. /***********1.4级:系统设置界面显示入口*************/
  78. case UIS_MENU_SYS_SEL:
  79. uiShowMenuSysSetup(StatusUpdate);
  80. break;
  81. /***********1.5级:定位设置界面显示入口*************/
  82. case UIS_MENU_XINBIAO_MAIN:
  83. //uiShowMenuLocationSel(StatusUpdate);
  84. uiShowXINBIAOMenuSysSetup(StatusUpdate);
  85. break;
  86. /***********1.6级:终端信息界面显示入口*************/
  87. case UIS_MENU_INFO_SEL:
  88. uiShowInformation(StatusUpdate);
  89. break;
  90. /****************1.3.1文本消息菜单-消息读界面显示入口*/
  91. case UIS_MENU_MAIL_READ:
  92. // MessageReadShow(StatusUpdate);
  93. break;
  94. /****************1.3.2文本消息菜单-消息选项界面显示入口*/
  95. case UIS_MENU_MAIL_OPTION:
  96. // MessageOptionShow(StatusUpdate);
  97. break;
  98. /****************1.3.2.1文本消息菜单-消息删除界面显示入口*/
  99. case UIS_MENU_MAIL_DEL:
  100. //MessageDeletShow(StatusUpdate);
  101. break;
  102. /****************1.3.2.2文本消息菜单-消息格式化界面显示入口*/
  103. case UIS_MENU_MAIL_FORMAT:
  104. //MessageFormatShow(StatusUpdate);
  105. break;
  106. /***********1.4.1级:系统设置-LCD设置界面显示入口*************/
  107. case UIS_MENU_SYS_LCD:
  108. uiShowLcdSel(StatusUpdate);
  109. break;
  110. /***********1.4.2级:系统设置-网络设置界面显示入口*************/
  111. case UIS_MENU_SYS_NET:
  112. // uiShowNetSel(StatusUpdate);
  113. break;
  114. /***********1.4.3级:系统设置-卡设置界面显示入口*************/
  115. case UIS_MENU_SYS_SIM:
  116. //uiShowSimSel(StatusUpdate);
  117. break;
  118. /***********1.4.4级:系统设置-功耗设置界面显示入口*************/
  119. case UIS_MENU_SYS_PWR:
  120. uiShowPwrSel(StatusUpdate);
  121. break;
  122. case UIS_MENU_SYS_SCENE:
  123. uiShowSceneSel(StatusUpdate);
  124. //void uiShowSceneSelResponse(void);
  125. break;
  126. /***********1.4.5.1级:系统设置-服务器密码设置界面显示入口*************/
  127. case UIS_MENU_SYS_SERVERPASS:
  128. //uiShowServerPassSel(StatusUpdate);
  129. break;
  130. /***********1.4.5.2级:系统设置-服务器设置界面显示入口*************/
  131. case UIS_MENU_SYS_SERVER:
  132. //uiShowServerSel(StatusUpdate);
  133. break;
  134. /***********1.4.6级:系统设置-版本设置界面显示入口*************/
  135. case UIS_MENU_SYS_VERSION:
  136. uiShowVersionSel(StatusUpdate);
  137. break;
  138. /***********1.4.7级:系统设置-提示音设置界面显示入口*****************/
  139. case UIS_MENU_SYS_NOTE:
  140. uiShowNoteSel(StatusUpdate);
  141. break;
  142. case UIS_MENU_SYS_FACTORY:
  143. //uiShowFactory(StatusUpdate);
  144. break;
  145. case UIS_MENU_SHUT_PWR:
  146. //uiShowShutDown(StatusUpdate);
  147. break;
  148. case UIS_MENU_SYS_CSQ:
  149. // uiShowCsqSel(StatusUpdate,exeInterval);
  150. break;
  151. case UIS_MENU_SYS_MIC:
  152. uiShowMicSel(StatusUpdate);
  153. break;
  154. case UIS_MENU_SYS_SPK:
  155. uiShowSpkSel(StatusUpdate);
  156. break;
  157. case UIS_MENU_SYS_FONT:
  158. //uiShowFontUpdate(StatusUpdate);
  159. break;
  160. case UIS_MENU_SYS_LOCK:
  161. //uiShowLockUpdate(StatusUpdate);
  162. break;
  163. case UIS_MENU_BLE_MAIN:
  164. uiShowBleMenuSysSetup(StatusUpdate);
  165. break;
  166. case UIS_MENU_BLE_ENABLE:
  167. uiShowBleEnableUpdate( StatusUpdate);
  168. break;
  169. case UIS_MENU_BLE_MATCH:
  170. uiShowBleMacth( StatusUpdate);
  171. break;
  172. case UIS_MENU_RING_MATCH:
  173. uiShowRingUpdate( StatusUpdate);
  174. break;
  175. case UIS_MENU_BLESPK_SEL:
  176. uiShowBleSpkUpdate( StatusUpdate);
  177. break;
  178. case UIS_MENU_BLEMIC_SEL:
  179. uiShowBleMicUpdate( StatusUpdate);
  180. break;
  181. case UIS_MENU_BLE_REBOOT:
  182. uiShowBleInitUpdate( StatusUpdate);
  183. break;
  184. case UIS_MENU_RING_REBOOT:
  185. uiShowRingInitUpdate( StatusUpdate);
  186. break;
  187. case UIS_MENU_GPS_ENABLE:
  188. uiShowMenuLocationSel(StatusUpdate);
  189. break;
  190. case UIS_MENU_GPS_STATION:
  191. uiShowFirmGPSPageShow(StatusUpdate);
  192. //uiShowXINBIAOStationUpdate(StatusUpdate);
  193. break;
  194. case UIS_MENU_XINBIAO_INFO:
  195. uiShowXINBIAOInfoUpdate(StatusUpdate);
  196. break;
  197. case UIS_MENU_XINBIAO_LIVE:
  198. uiShowXINBIAOEnableLive( StatusUpdate);
  199. break;
  200. case UIS_MENU_XINBIAO_SENDMODE:
  201. uiShowXINBIAOTriggerMode( StatusUpdate);
  202. break;
  203. case UIS_MENU_XINBIAO_TIME:
  204. uiShowXinbiaoTimeUpdate(StatusUpdate);
  205. break;
  206. case UIS_MENU_XINBIAO_IP:
  207. uiShowXINBIAOGateway( StatusUpdate);
  208. break;
  209. case UIS_MENU_XINBIAO_LISTCLEAR:
  210. uiShowXinbiaoClearlist( StatusUpdate);
  211. break;
  212. case UIS_MENU_ONLINE_XINBIAO:
  213. uiShowOnlineXINBIAOShow(StatusUpdate);
  214. break;
  215. case UIS_MENU_SYS_TTSON:
  216. uiShowMenuTTSEnableUpdate( StatusUpdate);
  217. break;
  218. case UIS_MENU_SYS_SHAKE:
  219. uiShowShakeEnableUpdate( StatusUpdate);
  220. break;
  221. case UIS_MENU_SYS_SOUNDSEL:
  222. uiShowPoc_soundUpdate(StatusUpdate);
  223. break;
  224. case UIS_MENU_CJ_MIAN:
  225. uiShowSideKeyMenuSysSetup(StatusUpdate);
  226. break;
  227. case UIS_MENU_CFUN_1_SEL:
  228. uiShowSideKeyFuncUpdate( StatusUpdate,0);
  229. break;
  230. case UIS_MENU_CFUN_2_SEL:
  231. uiShowSideKeyFuncUpdate( StatusUpdate,1);
  232. break;
  233. case UIS_MENU_SZ_MIAN:
  234. uiShowLeaderMenuSysSetup(StatusUpdate);
  235. break;
  236. case UIS_MENU_SZ_YAOYUN:
  237. ReFlashItemLeader(StatusUpdate,0);
  238. break;
  239. case UIS_MENU_SZ_YAOYBI:
  240. ReFlashItemLeader(StatusUpdate,1);
  241. break;
  242. case UIS_MENU_SZ_FORCEGPS:
  243. ReFlashItemLeader(StatusUpdate,2);
  244. break;
  245. case UIS_CALL_WINDOW:
  246. uiCallwindowShow(StatusUpdate,exeInterval);
  247. break;
  248. #ifdef ENABLE_DEBUG
  249. case UIS_DEBUG:
  250. //uiShowDebug(StatusUpdate);
  251. break;
  252. #endif
  253. case WRITE_PARA_WINDOW:
  254. uiShowWriteParaUpdate(StatusUpdate);
  255. break;
  256. case UIS_MENU_SYS_MAINMIC:
  257. uiShowMICgainSel(StatusUpdate);
  258. break;
  259. }
  260. uiShowStatusBar(StatusUpdate,exeInterval);
  261. }
  262. /********************************UI响应功能********************************/
  263. void uiResponse(unsigned int exeInterval){
  264. unsigned short key;
  265. unsigned char buf[50];
  266. if(0 != sutApp.gtTMode && sutUIstatus.Status!=UIS_MENU_SHUT_PWR) return;//关机界面允许接授键值
  267. if(!isKeyPress()) return;
  268. switch(sutUIstatus.Status){
  269. /****************0级:待机界面响应******************/
  270. case UIS_STANDBY:
  271. switch(getKeyValue()){
  272. case MKEY_VALUE_MENU:
  273. uISetNextStatus(UIS_MENU_MAIN);
  274. //uISetNextStatus(UIS_CALL_WINDOW);
  275. break;
  276. case MKEY_VALUE_ESC:
  277. if(sutPocStatus.danHuStatus!=0) {
  278. snprintf(buf, sizeof(buf),"AT+POC=090000%08x\r\n",sutPocStatus.LocalGroup.ID);
  279. msgAtSend(buf);
  280. }
  281. break;
  282. }
  283. break;
  284. /****************1级:主菜单界面响应***************/
  285. case UIS_MENU_MAIN:
  286. MenuMainResponse();
  287. break;
  288. /****************1.1级:群组选择界面响应*************/
  289. case UIS_MENU_GROUP_SEL:
  290. GroupSelResponse();
  291. break;
  292. /****************1.2级:成员选择界面响应*************/
  293. case UIS_MENU_USER_SEL:
  294. UserSelResponse();
  295. break;
  296. case UIS_MENU_FRIEND_SEL:
  297. FriendSelResponse();
  298. break;
  299. /****************1.3级:文本消息界面响应*************/
  300. case UIS_MENU_MAIL_SEL:
  301. MessageResponse();
  302. break;
  303. /****************1.4级:系统设置界面响应*/
  304. case UIS_MENU_SYS_SEL:
  305. sysTemSetResponse();
  306. break;
  307. /****************1.5级:定位设置界面响应*/
  308. case UIS_MENU_XINBIAO_MAIN:
  309. //loationSetResponse();
  310. sysXINBIAOSetResponse();
  311. break;
  312. /****************1.6级:终端信息界面响应*/
  313. case UIS_MENU_INFO_SEL:
  314. uiShowInformationResponse();
  315. break;
  316. /****************1.3.1文本消息菜单-消息读响应*/
  317. case UIS_MENU_MAIL_READ:
  318. MessageReadResponse();
  319. break;
  320. /****************1.3.2文本消息菜单-消息选项响应*/
  321. case UIS_MENU_MAIL_OPTION:
  322. MessageOptionResponse();
  323. break;
  324. /****************1.3.2.1文本消息菜单-消息删除响应*/
  325. case UIS_MENU_MAIL_DEL:
  326. MessageDeletResponse();
  327. break;
  328. /****************1.3.2.2文本消息菜单-消息格式化响应*/
  329. case UIS_MENU_MAIL_FORMAT:
  330. MessageFormatResponse();
  331. break;
  332. /****************1.4.1系统设置子菜单-LCD设置响应*/
  333. case UIS_MENU_SYS_LCD:
  334. uiShowLcdSelResponse();
  335. break;
  336. /****************1.4.2系统设置子菜单-网络设置响应*/
  337. case UIS_MENU_SYS_NET:
  338. uiShowNetSelResponse();
  339. break;
  340. /****************1.4.3系统设置子菜单-卡设置响应*/
  341. case UIS_MENU_SYS_SIM:
  342. uiShowSimSelResponse();
  343. break;
  344. /****************1.4.4系统设置子菜单-功耗设置响应*/
  345. case UIS_MENU_SYS_PWR:
  346. uiShowPwrSelResponse();
  347. break;
  348. /****************1.4.5.1系统设置子菜单-服务器密码设置响应*/
  349. case UIS_MENU_SYS_SERVERPASS:
  350. uiShowServerSelPassResponse();
  351. break;
  352. /****************1.4.5.2系统设置子菜单-服务器设置响应*/
  353. case UIS_MENU_SYS_SERVER:
  354. uiShowServerSelResponse();
  355. break;
  356. /****************1.4.6系统设置子菜单-版本设置响应*/
  357. case UIS_MENU_SYS_VERSION:
  358. uiShowVersionSelResponse();
  359. break;
  360. case UIS_MENU_SYS_FACTORY:
  361. uiShowFactoryResponse();
  362. break;
  363. /****************1.4.7系统设置子菜单-提示音设置响应*/
  364. case UIS_MENU_SYS_NOTE:
  365. uiShowNoteSelResponse();
  366. break;
  367. case UIS_MENU_SHUT_PWR:
  368. uiShowShutDownResponse();
  369. break;
  370. case UIS_MENU_SYS_CSQ:
  371. uiShowCsqSelResponse();
  372. break;
  373. case UIS_MENU_SYS_MIC:
  374. uiShowMicSelResponse();
  375. break;
  376. case UIS_MENU_SYS_SPK:
  377. uiShowSpkSelResponse();
  378. break;
  379. case UIS_MENU_SYS_FONT:
  380. uiShowFontUpdateResponse();
  381. break;
  382. case UIS_MENU_SYS_LOCK:
  383. uiShowLockUpdateResponse();
  384. break;
  385. case UIS_MENU_BLE_MAIN:
  386. sysBleSetResponse();
  387. break;
  388. case UIS_MENU_BLE_ENABLE:
  389. uiShowBleEnableUpdateResponse();
  390. break;
  391. case UIS_MENU_BLE_MATCH:
  392. uiShowBleMacthUpdateResponse();
  393. break;
  394. case UIS_MENU_RING_MATCH:
  395. uiShowRingUpdateResponse();
  396. break;
  397. case UIS_MENU_BLESPK_SEL:
  398. uiShowBleSpkUpdateResponse();
  399. break;
  400. case UIS_MENU_BLEMIC_SEL:
  401. uiShowBleMicUpdateResponse();
  402. break;
  403. case UIS_MENU_BLE_REBOOT:
  404. uiShowBleInitUpdateResponse();
  405. break;
  406. case UIS_MENU_RING_REBOOT:
  407. uiShowRingInitUpdateResponse();
  408. break;
  409. case UIS_MENU_GPS_ENABLE:
  410. loationSetResponse();
  411. break;
  412. case UIS_MENU_GPS_STATION:
  413. uiShowFirmGPSPageResponse();
  414. break;
  415. case UIS_MENU_XINBIAO_INFO:
  416. uiShowXINBIAOInfoResponse();
  417. break;
  418. case UIS_MENU_XINBIAO_LIVE:
  419. uiShowXINBIAOEnableLiveResponse();
  420. break;
  421. case UIS_MENU_XINBIAO_SENDMODE:
  422. uiShowXINBIAOTriggerModeResponse();
  423. break;
  424. case UIS_MENU_XINBIAO_TIME:
  425. uiShowXinbiaoTimeUpdateResponse();
  426. break;
  427. case UIS_MENU_XINBIAO_IP:
  428. uiShowXINBIAOGatewayResponse();
  429. break;
  430. case UIS_MENU_XINBIAO_LISTCLEAR:
  431. uiShowXinbiaoClearlistResponse();
  432. break;
  433. case UIS_MENU_ONLINE_XINBIAO:
  434. uiShowOnlineXINBIAOResponse();
  435. break;
  436. case UIS_MENU_SYS_TTSON:
  437. uiShowMenuTTSEnableUpdateResponse();
  438. break;
  439. case UIS_MENU_SYS_SHAKE:
  440. uiShowShakeEnableUpdateResponse();
  441. break;
  442. case UIS_MENU_SYS_SOUNDSEL:
  443. uiShowPoc_soundUpdateResponse();
  444. break;
  445. case UIS_MENU_CJ_MIAN:
  446. sysSetSideKeyResponse();
  447. break;
  448. case UIS_MENU_CFUN_1_SEL:
  449. uiShowSideKeyFuncUpdateResponse(0);
  450. break;
  451. case UIS_MENU_CFUN_2_SEL:
  452. uiShowSideKeyFuncUpdateResponse(1);
  453. break;
  454. case UIS_MENU_SZ_MIAN:
  455. sysSetLeaderResponse();
  456. break;
  457. case UIS_MENU_SZ_YAOYUN:
  458. uiShowLeaderFuncResponse();
  459. break;
  460. case UIS_MENU_SZ_YAOYBI:
  461. uiShowLeaderFuncResponse();
  462. break;
  463. case UIS_MENU_SZ_FORCEGPS:
  464. uiShowLeaderFuncResponse();
  465. //CompassPointResponse();
  466. break;
  467. case UIS_CALL_WINDOW:
  468. uiShowCallwindowResponse();
  469. break;
  470. #ifdef ENABLE_DEBUG
  471. case UIS_DEBUG:
  472. uiShowDebugResponse();
  473. break;
  474. #endif
  475. case WRITE_PARA_WINDOW:
  476. uiShowWriteParaResponse();
  477. break;
  478. case UIS_MENU_SYS_SCENE:
  479. uiShowSceneSelResponse();
  480. break;
  481. case UIS_MENU_SYS_MAINMIC:
  482. uiShowMICgainResponse();
  483. break;
  484. }
  485. if(have_encode){
  486. clearKeyNum();
  487. SetZeroKeyValue();
  488. }
  489. if(getKeyValue()==MKEY_VALUE_ESC) uiStack.esc=1;
  490. else uiStack.esc=0;
  491. }
  492. /**********************其它通用接口***********************************/
  493. void uiMenuShowBottomLine(void){
  494. guiDrawHLine(0,GLCD_WIDTH-1,UI_BOTTOM_LINE_Y,1,COLOR_STATUS_BAR);
  495. }
  496. void uiMenuShowBottomIndacitor(const char *infoLF, const char *infoRI){
  497. short x,y;
  498. unsigned short len;
  499. y=UI_BOTTOM_SHOW_Y;
  500. guiClearRect(0,y, GLCD_WIDTH-1, UI_LOCATION_SHOW_Y-1,guiGetBackColor());
  501. if(NULL != infoLF){
  502. x=2;
  503. guiShowStr(x, y,infoLF, FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor());
  504. }
  505. if(NULL != infoRI){
  506. len=strlen(infoRI)*16;//8
  507. x=GLCD_WIDTH-1-len;
  508. guiShowStr(x, y,infoRI, FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor());
  509. }
  510. }
  511. /*
  512. status: 0 超时10秒返回待机界面 else 直接返回界面界面
  513. */
  514. void uiTimeOutToStandby(char status, unsigned int timeinterval){
  515. static short cnt=0;
  516. bool needBackToStandBy=false;
  517. if(sutApp.gtTMode !=0 || sutApp.gtMode != 0) return;
  518. if(0==status){
  519. if(++sutApp.timeOutCnt<(10000/timeinterval)) return;
  520. sutApp.timeOutCnt=0;
  521. needBackToStandBy=true;
  522. }else needBackToStandBy=true;
  523. if(needBackToStandBy==false) return;
  524. MSG_INFO(1,"Back to standby");
  525. if(sutUIstatus.Status==UIS_STANDBY) return;
  526. if(sutUIstatus.Status==UIS_MENU_GROUP_SEL){
  527. appSleepCtl(ASLEEP_GGROUP, 0);
  528. }else if(sutUIstatus.Status==UIS_MENU_USER_SEL){
  529. appSleepCtl(ASLEEP_GUSER, 0);
  530. }
  531. UiassistEnd(0);
  532. uISetNextStatus(UIS_STANDBY);
  533. }