uiEntry.c 14 KB

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