uiBlock.c 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872
  1. #include "includes.h"
  2. /****************************状态栏显示部分开始***********************************/
  3. #ifndef USE_HPOC_POC
  4. static char GUListBoxInited=0;
  5. unsigned char AscToHex(unsigned char aHex)
  6. {
  7. if((aHex>=0)&&(aHex<=9))
  8. aHex += 0x30;
  9. else if((aHex>=10)&&(aHex<=15))//A-F
  10. //aHex += 0x37;
  11. aHex += 0x57;
  12. else aHex = 0xff;
  13. return aHex;
  14. }
  15. void AscStrTurnHexStr(char *AscStr, char *HexStr)
  16. {
  17. char *pAscStr=AscStr;
  18. unsigned char d,h,l;
  19. while(0!=(d=(unsigned char)*pAscStr++)){
  20. l=d&0x0f;
  21. h=d>>4;
  22. *HexStr++=AscToHex(h);
  23. *HexStr++=AscToHex(l);
  24. }
  25. *HexStr=0;
  26. }
  27. #endif
  28. //显示信号强度
  29. static void ShowSingle(int CSQ){
  30. unsigned short x=SIGNAL_ICON_X;
  31. unsigned short y=2;
  32. if(sutApp.pocPpp == 0) guiShowBmp(x,y,"Single.bmp");
  33. else guiShowBmp(x,y,"SingleOK.bmp");
  34. //11 3格
  35. x += 7;
  36. if(CSQ<5 || CSQ==99){
  37. guiClearRect(x,y+1,x+10,y+9,COLOR_STATUS_BAR);
  38. }else if(CSQ<11){
  39. guiDrawVLine(x+2,y+8,x,y,guiGetBackColor());
  40. guiClearRect(x+2,y+1,x+10,y+9,COLOR_STATUS_BAR);
  41. }else if(CSQ<18){
  42. guiDrawVLine(x+2,y+8,x,y,guiGetBackColor());
  43. guiDrawVLine(x,y+8,x+3,y,guiGetBackColor());
  44. guiClearRect(x+6,y+1,x+10,y+9,COLOR_STATUS_BAR);
  45. }else if(CSQ<22){
  46. guiDrawVLine(x+2,y+8,x,y,guiGetBackColor());
  47. guiDrawVLine(x,y+8,x+3,y,guiGetBackColor());
  48. guiDrawVLine(x-2,y+8,x+6,y,guiGetBackColor());
  49. guiClearRect(x+9,y+1,x+10,y+9,COLOR_STATUS_BAR);
  50. }else{
  51. guiDrawVLine(x+2,y+8,x,y,guiGetBackColor());
  52. guiDrawVLine(x,y+8,x+3,y,guiGetBackColor());
  53. guiDrawVLine(x-2,y+8,x+6,y,guiGetBackColor());
  54. guiDrawVLine(x-4,y+8,x+9,y,guiGetBackColor());
  55. }
  56. }
  57. unsigned char netshowvalue=0xff;
  58. unsigned char ctecCurrentSet=0;
  59. //显示网络制式
  60. static void Show_Net(unsigned char s_netshowvalue){
  61. unsigned short y=0;
  62. if(s_netshowvalue==0){
  63. guiShowStr(NET_ICON_X, y+1,"2G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR);
  64. }else if(s_netshowvalue==4){
  65. if(sutApp.account.tnet==5)guiShowStr(NET_ICON_X, y+1,"5G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR);
  66. else guiShowStr(NET_ICON_X, y+1,"4G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR);
  67. }else guiClearRect(NET_ICON_X,y,NET_ICON_X+NET_ICON_WX,y+11,COLOR_STATUS_BAR);
  68. }
  69. static void gpsIconShow(char flash){
  70. typedef struct{
  71. unsigned char located:1;
  72. unsigned char auth:1;
  73. unsigned char gpsF:1;
  74. }TMP_GPS_DEF;
  75. static TMP_GPS_DEF tmpGps;
  76. unsigned short x=GPS_ICON_X,y=0;
  77. if(tmpGps.located==gpsInfo.gpsLocated && tmpGps.auth==gpsInfo.bbAuth && tmpGps.gpsF==gpsInfo.gpsF && flash==0) return;
  78. guiClearRect(x,y,x+GPS_ICON_WX,y+11,COLOR_STATUS_BAR);
  79. if(gpsInfo.gpsF==0){//GPS未打开时
  80. if(gpsInfo.bbAuth==1) guiShowBmp(x,y,"GPS3.bmp");//已鉴权
  81. }else{//GPS已打开
  82. if(gpsInfo.bbAuth==1) guiShowBmp(x,y,"GPS1.bmp");//已鉴权
  83. else if(gpsInfo.bbAuth==1) guiShowBmp(x,y,"GPSA.bmp");//未鉴权
  84. if(gpsInfo.gpsLocated==1) guiShowBmp(x+10,y,"GPS2.bmp");//已定位
  85. }
  86. tmpGps.located=gpsInfo.gpsLocated;
  87. tmpGps.auth=gpsInfo.bbAuth;
  88. tmpGps.gpsF=gpsInfo.gpsF;
  89. }
  90. static void ShowCardType(char card){
  91. unsigned short x= CARD_ICON_X;
  92. unsigned short y=3;
  93. if(card==0) guiShowBmp(x, y, "SIM1.bmp");
  94. else if(card==1) guiShowBmp(x, y, "SIM2.bmp");
  95. }
  96. //显示电量
  97. static void ShowBatttery(int bat,unsigned int exeInterval){
  98. static unsigned int flashCnt=0;
  99. static unsigned char flag=0;
  100. static unsigned short cnt=0;
  101. unsigned short x=BAT_ICON_X,y=2,h=y+2;
  102. if(bat<WARN_PWR_LEVEL){//请充电
  103. if(++cnt<(800/exeInterval)) return;
  104. cnt=0;
  105. if(sutApp.lowPwrWarn==0){
  106. sutApp.lowPwrWarn=1;
  107. sutApp.lowPwrCnt=0; //WARN_TTS_INTERVAL
  108. }
  109. if(flag==0){
  110. guiShowBmp(x,y,"VBAT1.bmp");
  111. flag=1;
  112. }else{
  113. flag=0;
  114. guiClearRect(x,y-2,x+21,y-2+1+12,COLOR_STATUS_BAR);
  115. }
  116. return;
  117. }else if(bat<355){//340<x<=355 1格
  118. guiShowBmp(x,y,"VBAT1.bmp");//3
  119. guiDrawVLine(h,h+5,x+16,y+1,guiGetBackColor());
  120. }
  121. else if(bat<375){//355<x<=375 2格
  122. guiShowBmp(x,y,"VBAT1.bmp");
  123. guiDrawVLine(h,h+5,x+12,y+1,guiGetBackColor());
  124. guiDrawVLine(h,h+5,x+16,y+1,guiGetBackColor());//5.12
  125. }
  126. else if(bat<400){//375<x<=400 3格
  127. guiShowBmp(x,y,"VBAT1.bmp");
  128. guiDrawVLine(h,h+5,x+8,y+1,guiGetBackColor());
  129. guiDrawVLine(h,h+5,x+12,y+1,guiGetBackColor());
  130. guiDrawVLine(h,h+5,x+16,y+1,guiGetBackColor());//5.12
  131. }
  132. else{//>=400 4格
  133. guiShowBmp(x,y,"VBAT1.bmp");
  134. guiDrawVLine(h,h+5,x+4,y+1,guiGetBackColor());
  135. guiDrawVLine(h,h+5,x+8,y+1,guiGetBackColor());
  136. guiDrawVLine(h,h+5,x+12,y+1,guiGetBackColor());
  137. guiDrawVLine(h,h+5,x+16,y+1,guiGetBackColor());//5.12
  138. }
  139. sutApp.lowPwrWarn=0;
  140. }
  141. //显示时间
  142. static void ShowTime(char flash,unsigned int exeInterval){
  143. static unsigned short nextExe=0;
  144. static unsigned char flag=0;
  145. MY_CLOCK myclock={0};
  146. char buf[30];
  147. //if(sutApp.bndPocDone==0)return;
  148. if(sutPocStatus.logined==0)return;
  149. if(nextExe==0 || flash){
  150. ohpocGetClock(&myclock);
  151. if(flag){
  152. snprintf(buf, sizeof(buf), "%02d:%02d",myclock.hour, myclock. min);
  153. flag=0;
  154. }else{
  155. snprintf(buf, sizeof(buf), "%02d %02d",myclock.hour, myclock. min);
  156. flag=1;
  157. }
  158. //MSG_INFO(1,buf);
  159. guiShowStr(TIME_ICON_X, 1,buf, FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR);
  160. }
  161. if(++nextExe>=(1000/exeInterval)) nextExe=0;//1000
  162. }
  163. //显示耳机接入状态
  164. static void ShowEarStatus(char flash){
  165. static unsigned char lastStatus=0;
  166. if(lastStatus==sutApp.earLev && flash==0) return;
  167. if(sutApp.earLev!=0) guiShowBmp(EAR_ICON_X, 1, "ear.bmp");
  168. else guiClearRect(EAR_ICON_X, 1, EAR_ICON_X+14,1+12, COLOR_STATUS_BAR);
  169. lastStatus=sutApp.earLev;
  170. }
  171. //显示键盘锁状态
  172. static void ShowKeyLocStatus(char flash){
  173. static unsigned char lastStatus=0;
  174. if(lastStatus==sutApp.keyLock && flash==0) return;
  175. if(sutApp.keyLock!=0) guiShowBmp(LOCK_ICON_X, 1, "lock.bmp");
  176. else guiClearRect(LOCK_ICON_X, 1, LOCK_ICON_X+LOCK_ICON_WX,12, COLOR_STATUS_BAR);
  177. lastStatus=sutApp.keyLock;
  178. }
  179. //显示状态栏
  180. void uiShowStatusBar(char flash,unsigned int exeInterval){
  181. static unsigned char s_netshowvalue=0xff;
  182. static unsigned char lastPPPStatus;
  183. static int siCSQ;
  184. static int siVbat;
  185. static unsigned short batFirstShow=0;
  186. static char lastEnable=0;
  187. static char cardType=0;
  188. char tempFlash=flash;
  189. if(sutApp.enableKey==0) return;
  190. if(lastEnable==0){
  191. lastEnable=1;
  192. tempFlash=1;
  193. guiFillRect(0, 0, GLCD_WIDTH-1, UI_STATUS_BAR_HEIGH-1,COLOR_STATUS_BAR);//清除第一区
  194. }
  195. //显示信号
  196. if(tempFlash || siCSQ!=sutApp.g_iCSQ || lastPPPStatus != sutApp.pocPpp){
  197. lastPPPStatus=sutApp.pocPpp;
  198. siCSQ=sutApp.g_iCSQ;
  199. ShowSingle(sutApp.g_iCSQ);
  200. }
  201. //显示卡选项
  202. if(tempFlash || cardType != sutApp.simSel){
  203. cardType=sutApp.simSel;
  204. ShowCardType(cardType);
  205. }
  206. //显示2G/3G/4G
  207. if(tempFlash || s_netshowvalue!=netshowvalue){
  208. s_netshowvalue=netshowvalue;
  209. Show_Net(s_netshowvalue);
  210. }
  211. //显示GPS是否正常及鉴权情况
  212. //gpsInfo.gpsLocated=1;
  213. //gpsInfo.bbAuth=1;
  214. //gpsInfo.gpsF=1;
  215. gpsIconShow(tempFlash);
  216. //电量显示
  217. if(batFirstShow < (1000/exeInterval)) {//开机前1秒显示一半电量
  218. sutApp.g_iBAT=360;
  219. batFirstShow++;
  220. }else if(tempFlash || siVbat!=sutApp.g_iBAT || sutApp.g_iBAT < WARN_PWR_LEVEL){
  221. siVbat=sutApp.g_iBAT;
  222. ShowBatttery(sutApp.g_iBAT,exeInterval);
  223. //MSG_INFO(1, "----%d", sutApp.g_iBAT);
  224. }
  225. //文本消息显示
  226. //sutSms.haveUnRead=1;
  227. ShowMessageFlag(0);
  228. //GPS显示
  229. //时间显示
  230. ShowTime(tempFlash,exeInterval);
  231. //显示耳机状态
  232. ShowEarStatus(tempFlash);
  233. //显示键盘锁状态
  234. ShowKeyLocStatus(tempFlash);
  235. }
  236. /****************************状态栏显示部分结束***********************************/
  237. /****************************待机界面显示部分开始***********************************/
  238. typedef enum{
  239. ME_NO_LOGIN,
  240. ME_NOBODY_SPEAK,
  241. ME_IAM_SPEAK,
  242. ME_SOMEBODY_SPEAK
  243. }ME_ENUM;
  244. static void uiShowGUName(int update);
  245. static void uiShowGuaDuan(unsigned char danhu);
  246. static void uiShowGroup(const char* info);
  247. static void uiShowUser(const char* info);
  248. static void uiShowHuaQuan(const char* info);
  249. static void uiShowCallUserName(void);
  250. static void uiShowOffLineMessage(void);
  251. static void uiShowCopsInfo(void){
  252. char info[50];
  253. switch(sutApp.copstype){
  254. case 0:case 2:case 4:case 7://中国移动
  255. snprintf(info, sizeof(info), "中国移动");
  256. break;
  257. case 1:case 6:case 9://中移联通
  258. snprintf(info, sizeof(info), "中国联通");
  259. break;
  260. case 3:case 8:case 11://中国电信
  261. snprintf(info, sizeof(info), "中国电信");
  262. break;
  263. default:snprintf(info, sizeof(info), "公网集群对讲系统");break;
  264. }
  265. guiFillRect(0, UI_STATUS_ITEM_Y, GLCD_WIDTH-1, UI_CONTENT_SHOW_Y-1, guiGetForeColor());//清除第二区
  266. guiShowCaption(0,info, UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  267. }
  268. void uiShowMainInterface(char status,unsigned int exeInterval){
  269. short Flag=ME_NO_LOGIN;//ME_ENUM
  270. static unsigned char danhu=0;
  271. static short lastFlag=-1;
  272. static unsigned short siCt=0;
  273. char info[20];
  274. static char firstRun=0;
  275. static unsigned short dly=0;
  276. char tmpStatus=status;
  277. static int copsStatus;
  278. #if 0
  279. /*延时一下1秒后才显示后面的,如果直接登录了,就跳出延时*/
  280. if(firstRun==0){
  281. if((++dly>=(1*1000/exeInterval)) || sutPocStatus.logined!=0){
  282. firstRun=1;
  283. tmpStatus=1;
  284. sutApp.enableKey=1;//延时按键操作完成
  285. }else return;
  286. }
  287. #endif
  288. /*逻辑处理开始*/
  289. if(tmpStatus){
  290. guiClearAll(guiGetBackColor());
  291. #ifdef AUTH_SKIP
  292. guiShowStr(1, UI_BOTTOM_SHOW_Y-12,"软件测试版本", FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR, guiGetBackColor());
  293. #else
  294. if(!newPara.newold_plam)guiShowStr(1, UI_BOTTOM_SHOW_Y,"菜单", FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR, guiGetBackColor());
  295. #endif
  296. danhu=sutPocStatus.danHuStatus;
  297. uiShowGuaDuan(danhu);
  298. lastFlag=-1;
  299. siCt=0;
  300. GUListBoxInited=0;
  301. //return;
  302. }
  303. if(copsStatus != sutApp.copstype || tmpStatus){
  304. copsStatus=sutApp.copstype;
  305. uiShowCopsInfo();
  306. }
  307. //更新单呼显示与否
  308. if(sutPocStatus.danHuStatus != danhu){
  309. danhu=sutPocStatus.danHuStatus;
  310. if(!newPara.newold_plam)uiShowGuaDuan(danhu);
  311. }
  312. //提示解锁
  313. if(sutApp.lockShow!=0){
  314. backLightReset();
  315. guiShowMessageBox("请先解锁!");
  316. LSAPI_OSI_ThreadSleep(500);
  317. guiClearRect(0,GLCD_HEIGHT/2-20,GLCD_WIDTH-1,GLCD_HEIGHT/2+20,guiGetBackColor());
  318. lastFlag=-1;//让以下刷新一下
  319. sutApp.lockShow=0;
  320. }
  321. //以下持续调用,以便动态更新信息
  322. if(0==sutPocStatus.logined) Flag=ME_NO_LOGIN;//未登录
  323. else if(0==sutPocStatus.spk && 0==sutPocStatus.mic){//已登录,无人说话
  324. Flag=ME_NOBODY_SPEAK;
  325. }else if(0!=sutPocStatus.mic) Flag=ME_IAM_SPEAK;//已登录,本机说话
  326. else if(0!=sutPocStatus.spk) Flag=ME_SOMEBODY_SPEAK;//有人说话
  327. switch(Flag){
  328. case ME_NO_LOGIN://未登录
  329. if(Flag != lastFlag){
  330. guiFillRect(0, UI_CONTENT_SHOW_Y, GLCD_WIDTH-1, UI_BOTTOM_SHOW_Y-1,guiGetBackColor());
  331. // guiShowBmp(0,UI_CONTENT_SHOW_Y, "logo.bmp");
  332. }
  333. break;
  334. case ME_NOBODY_SPEAK://已登录,无人说话
  335. if(Flag != lastFlag){
  336. if(ME_NO_LOGIN==lastFlag) guiFillRect(0, UI_CONTENT_SHOW_Y, GLCD_WIDTH-1, UI_CONTENT_SHOW_Y+16,guiGetBackColor());//从未登录到登录,'正在登录'那行也刷掉
  337. guiFillRect(0, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16,guiGetBackColor());
  338. uiShowHuaQuan("空闲");
  339. sutPocStatus.statusChaned = 1;
  340. }
  341. break;
  342. case ME_IAM_SPEAK://已登录,本机说话
  343. if(Flag != lastFlag){
  344. guiFillRect(0, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16,guiGetBackColor());
  345. uiShowHuaQuan("本机在讲话");
  346. }
  347. break;
  348. case ME_SOMEBODY_SPEAK://已登录,有人说话
  349. if(Flag != lastFlag){
  350. guiFillRect(0, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16,guiGetBackColor());
  351. sutPocStatus.statusChaned=1;//保证要刷新名字
  352. }
  353. uiShowCallUserName();
  354. break;
  355. }
  356. if(Flag>0){//已登录
  357. if(Flag != lastFlag && (lastFlag==-1 || ME_NO_LOGIN==lastFlag)) uiShowGUName(1);
  358. else uiShowGUName(0);
  359. }else{//未登录
  360. snprintf(info, sizeof(info),"正在登陆.");
  361. switch(siCt){//not finished yet
  362. case 0:
  363. strcat(info, " ");
  364. guiShowStr(1, UI_CONTENT_SHOW_Y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
  365. break;
  366. case (1000/APP_SUB_DIV_TIME):
  367. strcat(info, ". ");
  368. guiShowStr(1, UI_CONTENT_SHOW_Y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
  369. break;
  370. case (2000/APP_SUB_DIV_TIME):
  371. strcat(info, "..");
  372. guiShowStr(1, UI_CONTENT_SHOW_Y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
  373. break;
  374. }
  375. //显示登录状态
  376. uiShowOffLineMessage();
  377. }
  378. if(sutApp.weather[0]!=0&&newPara.WeatherEnable==0)guiLefItem(0,UI_BOTTOM_SHOW_Y,COLOR_STATUS_BAR, guiGetBackColor(),FONT_MODE_12X12,sutApp.weather);
  379. if(++siCt>=(3000/APP_SUB_DIV_TIME)) siCt=0;
  380. if(Flag != lastFlag) lastFlag=Flag;
  381. }
  382. static void uiShowGUName(int update){
  383. static char scNameUser[POC_GROUP_USER_NAME_LEN];
  384. static char scNameGroup[POC_GROUP_USER_NAME_LEN];
  385. char name[POC_GROUP_USER_NAME_LEN];
  386. unsigned short len;
  387. unsigned char danHuanBuffer[9]={0xB5,0xA5,0xBA,0xF4,0xC4,0xA3,0xCA,0xBD,0};
  388. char GroupShowUpdate=0;
  389. char UserShowUpdate=0;
  390. if(sutPocStatus.danHuStatus==0){
  391. if(0!=strcmp(sutPocStatus.LocalGroup.name,scNameGroup) || update!=0){
  392. memset(scNameGroup,0,sizeof(scNameGroup));
  393. memcpy(scNameGroup,sutPocStatus.LocalGroup.name,sizeof(scNameGroup));
  394. GroupShowUpdate=1;
  395. }
  396. }else{
  397. if(0!=strcmp((char *)danHuanBuffer,scNameGroup) || update!=0){
  398. memset(scNameGroup,0,sizeof(scNameGroup));
  399. memcpy(scNameGroup, danHuanBuffer,sizeof(danHuanBuffer));
  400. GroupShowUpdate=1;
  401. }
  402. }
  403. if(0!=strcmp(sutPocStatus.LocalUser.name,scNameUser) || update!=0){
  404. memset(scNameUser,0,sizeof(scNameUser));
  405. memcpy(scNameUser,sutPocStatus.LocalUser.name,sizeof(scNameUser));
  406. UserShowUpdate=1;
  407. }
  408. if(GroupShowUpdate){
  409. guiClearRect(0,UI_GROUP_SHOW_Y,GLCD_WIDTH-1,UI_GROUP_SHOW_Y+16+2,guiGetBackColor());//18
  410. //刷新群组栏
  411. if(sutPocStatus.danHuStatus==0) StrIntercept(name, scNameGroup, sizeof(name));
  412. else snprintf(name, sizeof(name), "单呼模式");
  413. uiShowGroup(name);
  414. sutPocStatus.statusChaned=1;
  415. }
  416. if(UserShowUpdate){
  417. guiClearRect(0,UI_USER_SHOW_Y,GLCD_WIDTH-1,UI_GROUP_SHOW_Y+16,guiGetBackColor());//18
  418. //刷新成员栏
  419. StrIntercept(name, scNameUser, sizeof(name));
  420. uiShowUser(name);
  421. }
  422. }
  423. static void uiShowGuaDuan(unsigned char danhu){
  424. if(danhu==0) guiClearArea(GLCD_WIDTH-32, UI_BOTTOM_SHOW_Y, 32, 14, guiGetBackColor());
  425. else guiShowStr(GLCD_WIDTH-32, UI_BOTTOM_SHOW_Y, "挂断", FONT_MODE_12X12, REVERSED_NO, COLOR_STATUS_BAR,guiGetBackColor());
  426. }
  427. static void uiShowGroup(const char* info){
  428. guiShowStr(2, UI_GROUP_SHOW_Y+2,"群组:", FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor());
  429. guiClearRect(2+30, UI_GROUP_SHOW_Y, GLCD_WIDTH-1, UI_GROUP_SHOW_Y+16, guiGetBackColor());
  430. #ifdef USE_12X12_FONT_ONLY
  431. guiShowStr(2+30, UI_GROUP_SHOW_Y+2,info, FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor());
  432. #else
  433. guiShowStr(2+30, UI_GROUP_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,COLOR_BLACK,guiGetBackColor());
  434. #endif
  435. }
  436. static void uiShowUser(const char* info){
  437. guiShowStr(2, UI_USER_SHOW_Y+2,"成员:", FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor());
  438. guiClearRect(2+30, UI_USER_SHOW_Y, GLCD_WIDTH-1, UI_USER_SHOW_Y+16, guiGetBackColor());
  439. #ifdef USE_12X12_FONT_ONLY
  440. guiShowStr(2+30, UI_USER_SHOW_Y+2,info, FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor());
  441. #else
  442. guiShowStr(2+30, UI_USER_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,COLOR_BLACK,guiGetBackColor());
  443. #endif
  444. }
  445. static void uiShowHuaQuan(const char* info){
  446. guiShowStr(2, UI_VOICE_SHOW_Y+2,"话权:", FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor());
  447. guiClearRect(2+30, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16, guiGetBackColor());
  448. #ifdef USE_12X12_FONT_ONLY
  449. guiShowStr(2+30, UI_VOICE_SHOW_Y+2,info, FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor());
  450. #else
  451. guiShowStr(2+30, UI_VOICE_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,COLOR_BLACK,guiGetBackColor());
  452. #endif
  453. }
  454. static void uiShowCallUserName(void){
  455. static char scName[POC_GROUP_USER_NAME_LEN];
  456. char name[POC_GROUP_USER_NAME_LEN];
  457. if(0 != strncmp(scName, sutPocStatus.CallName, POC_GROUP_USER_NAME_LEN) ||
  458. sutPocStatus.statusChaned){
  459. //当名字变更或UI切换了,刷新显示
  460. sutPocStatus.statusChaned=0;
  461. memcpy(scName, sutPocStatus.CallName, POC_GROUP_USER_NAME_LEN);
  462. uiShowHuaQuan(scName);
  463. }
  464. }
  465. static void uiShowOffLineMessage(void){
  466. static unsigned char laReason;
  467. char info[50],update=0;
  468. unsigned short y;
  469. if(sutUIstatus.Status != UIS_STANDBY) return;
  470. if(sutPocStatus.PocLineOffReason==laReason && sutUIstatus.ItemRefresh==0) return;
  471. sutUIstatus.ItemRefresh=0;
  472. laReason=sutPocStatus.PocLineOffReason;
  473. if(sutApp.cardStatus==0){
  474. snprintf(info, sizeof(info), "请插卡");
  475. update=1;
  476. }else{
  477. switch(sutPocStatus.PocLineOffReason){
  478. case 1:snprintf(info, sizeof(info), "无网络连接");break;
  479. case 2:snprintf(info, sizeof(info), "无法连接");break;
  480. case 3:snprintf(info, sizeof(info), "没有服务");break;
  481. case 4:snprintf(info, sizeof(info), "账号信息错误");break;
  482. }
  483. if(sutPocStatus.PocLineOffReason!=0) update=1;
  484. }
  485. if(update!=0){
  486. y=UI_CONTENT_SHOW_Y+2+12;
  487. guiClearRect(1,y, GLCD_WIDTH-1, y +12, guiGetBackColor());
  488. guiShowStr(1, y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
  489. }
  490. }
  491. /****************************待机界面显示部分结束***********************************/
  492. /****************************主菜单显示部分开始*************************************/
  493. #include "Palace.h"
  494. SUT_PALACE sutPalace;
  495. void uiShowMenuMain(char update){
  496. static const char *apcMenuMain[]={
  497. "群组选择",
  498. "成员选择",
  499. "文本信息",
  500. "系统设置",
  501. "定位设置",
  502. "终端信息",
  503. ""
  504. };
  505. if(update) PalaceInit(&sutPalace,apcMenuMain,"Palace","主菜单");
  506. }
  507. void MenuMainResponse(void){
  508. unsigned short key;
  509. key=PalaceResponse(&sutPalace);
  510. if(MKEY_VALUE_MENU==key){
  511. switch(sutPalace.Index){
  512. case 0:
  513. uISetNextStatus(UIS_MENU_GROUP_SEL);
  514. break;
  515. case 1:
  516. uISetNextStatus(UIS_MENU_USER_SEL);
  517. break;
  518. case 2:
  519. uISetNextStatus(UIS_MENU_MAIL_SEL);
  520. break;
  521. case 3:
  522. uISetNextStatus(UIS_MENU_SYS_SEL);
  523. break;
  524. case 4:
  525. uISetNextStatus(UIS_MENU_LOCATION_SEL);
  526. break;
  527. case 5:
  528. uISetNextStatus(UIS_MENU_INFO_SEL);
  529. break;
  530. }
  531. uiPushStack(sutPalace.Index);
  532. }
  533. else if(MKEY_VALUE_ESC==key){
  534. uISetNextStatus(UIS_STANDBY);
  535. }
  536. }
  537. /****************************主菜单显示部分结束*************************************/
  538. /*****************************群组选择/成员选择部分开始*********************************/
  539. static void ReFlashItemGU(char type);
  540. static void UserAssistAdd(void);
  541. void numGUFlash(int index, int total){
  542. char info[10];
  543. int x;
  544. snprintf(info, sizeof(info), "%d", total);
  545. x=GLCD_WIDTH-strlen(info)*8;
  546. guiClearRect(GLCD_WIDTH/2, UI_STATUS_ITEM_Y, GLCD_WIDTH-1, UI_STATUS_ITEM_Y+12, guiGetForeColor());
  547. guiShowStr(x, UI_STATUS_ITEM_Y+1, info, FONT_MODE_12X12, REVERSED_NO, guiGetBackColor(), guiGetForeColor());
  548. }
  549. static char SelMachine=0;
  550. bool setHandleToZero=true;
  551. void uiShowGUSel(char StatusUpdate,unsigned int exeInterval,char type){
  552. static char machine;
  553. static unsigned int timer;
  554. unsigned short timeout;
  555. char temp;
  556. if(StatusUpdate) machine=0;
  557. switch(machine){
  558. case 0:
  559. if(sutPocStatus.logined == 0){//not login
  560. guiShowMessageBox(" 请先登录 ");
  561. uTimerStart(&timer, 1000);
  562. machine=1;
  563. }else{
  564. if(type==0) appSleepCtl(ASLEEP_GGROUP, 1);//要获取群组信息,不让休眠,记得超时或获取成功或获取失败后需要释放
  565. else appSleepCtl(ASLEEP_GUSER, 1);
  566. UiassistStart(0);
  567. machine=2;
  568. setHandleToZero=true;
  569. }
  570. break;
  571. case 1:
  572. if(uTimerExpired(&timer)){
  573. uISetNextStatus(UIS_STANDBY);
  574. }
  575. break;
  576. case 2:
  577. temp=getAssistResult();
  578. if(temp){
  579. guiClearAll(guiGetBackColor());
  580. if(type==0){
  581. guiShowCaption(20,"群组选择",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //0
  582. uiMenuShowBottomIndacitor("确定", "返回");
  583. }else{
  584. guiShowCaption(20,"用户选择",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //0
  585. uiMenuShowBottomIndacitor("单呼", "返回");
  586. }
  587. ReFlashItemGU(type);
  588. uiMenuShowBottomLine();
  589. machine=3;
  590. //获取成功后退出释放休眠
  591. if(type==0) appSleepCtl(ASLEEP_GGROUP, 0);
  592. else appSleepCtl(ASLEEP_GUSER, 0);
  593. }
  594. break;
  595. }
  596. if(machine != 3) return;
  597. UserAssistAdd();
  598. }
  599. void GroupSelResponse(){
  600. unsigned int key;
  601. char buf[50];
  602. int i;
  603. key=getKeyValue();
  604. switch(SelMachine){
  605. case 0:
  606. if(GUListBoxInited==0) break;//还未初始化listbox时,不执行按键响应
  607. if(sutListBox.handle==0 && MKEY_VALUE_UP==key){
  608. UiassistStart(1);
  609. SelMachine=1;
  610. }else if(((sutListBox.handle+1) == sutListBox.itemnum) && (MKEY_VALUE_DOWN==key)){
  611. setHandleToZero=true;
  612. UiassistStart(2);
  613. SelMachine=2;
  614. }
  615. key=ListBoxResponse(&sutListBox);
  616. if(MKEY_VALUE_ESC==key){
  617. uiAssist.status=0;
  618. if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY);
  619. else uISetNextStatus(UIS_MENU_MAIN);
  620. appSleepCtl(ASLEEP_GGROUP, 0);//按键退出后释放休眠
  621. GUListBoxInited=0;
  622. }else if(MKEY_VALUE_MENU==key){
  623. if(0 == sutPocStatus.ListCurOnlineNum) break;
  624. ///////////////////////////////////////
  625. UiassistEnd(1);
  626. sutApp.groupTTSEnable=1;
  627. #ifndef USE_BND_POC
  628. snprintf(buf, sizeof(buf),"AT+POC=090000%08x\r\n",sutPocStatus.AllGroups[sutListBox.handle].ID);
  629. msgAtSend(buf);
  630. MSG_INFO(1,buf);
  631. snprintf(buf, sizeof(buf),"进入:%s",sutPocStatus.AllGroups[sutListBox.handle].name);
  632. MSG_INFO(1,buf);
  633. #else
  634. broad_joingroup(sutPocStatus.AllGroups[sutListBox.handle].ID);
  635. #endif
  636. uISetNextStatus(UIS_STANDBY);
  637. SelMachine=0;
  638. }
  639. break;
  640. }
  641. }
  642. void UserSelResponse(){
  643. char buf[50];
  644. unsigned int key;
  645. key=getKeyValue();
  646. switch(SelMachine){
  647. case 0:
  648. if(GUListBoxInited==0) break;//还未初始化listbox时,不执行按键响应
  649. if(sutListBox.handle==0 && MKEY_VALUE_UP==key){
  650. UiassistStart(1);
  651. SelMachine=1;
  652. }else if((sutListBox.handle+1) == sutListBox.itemnum && (MKEY_VALUE_DOWN==key)){
  653. setHandleToZero=true;
  654. UiassistStart(2);
  655. SelMachine=2;
  656. }
  657. key=ListBoxResponse(&sutListBox);
  658. if(MKEY_VALUE_ESC==key){
  659. uiAssist.status=0;
  660. if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY);
  661. else uISetNextStatus(UIS_MENU_MAIN);
  662. appSleepCtl(ASLEEP_GUSER, 0);//按键退出后释放休眠
  663. GUListBoxInited=0;
  664. }else if(MKEY_VALUE_MENU==key){
  665. if(0 == sutPocStatus.ListCurOnlineNum) break;
  666. broad_calluser(sutPocStatus.AllUsers[sutListBox.handle].ID, cb_callmember);
  667. MSG_INFO(1,"AllUsers[sutListBox.handle].ID===%d",sutPocStatus.AllUsers[sutListBox.handle].ID);
  668. uISetNextStatus(UIS_STANDBY);
  669. SelMachine=0;
  670. }
  671. break;
  672. }
  673. }
  674. static void UserAssistAdd(void){
  675. switch(SelMachine){
  676. case 1:
  677. if(getAssistResult()){
  678. if(sutUIstatus.Status==UIS_MENU_GROUP_SEL)ReFlashItemGU(0);
  679. else ReFlashItemGU(1);
  680. SelMachine=0;
  681. }
  682. break;
  683. case 2:
  684. if(getAssistResult()){
  685. if(sutUIstatus.Status==UIS_MENU_GROUP_SEL)ReFlashItemGU(0);
  686. else ReFlashItemGU(1);
  687. SelMachine=0;
  688. }
  689. break;
  690. }
  691. }
  692. static void ReFlashItemGU(char type){
  693. static unsigned short susCt=0;
  694. static const char *accIconFileName[]={
  695. "Group1.bmp",
  696. "Group2.bmp",
  697. "Group3.bmp",
  698. "people1.bmp",
  699. "people2.bmp",
  700. "people3.bmp",
  701. ""
  702. };
  703. static char *icons[4];
  704. int i;
  705. unsigned short timeout;
  706. static const char *NullGU="";
  707. static char *GUName[POC_ALL_GROUPS_NUM+1]; //5
  708. static char GUFeatures[POC_ALL_GROUPS_NUM+1];//5
  709. unsigned int showHandle;
  710. if(type==0){
  711. icons[0]=accIconFileName[0];
  712. icons[1]=accIconFileName[1];
  713. icons[2]=accIconFileName[2];
  714. }else{
  715. icons[0]=accIconFileName[3];
  716. icons[1]=accIconFileName[4];
  717. icons[2]=accIconFileName[5];
  718. }
  719. icons[3]=accIconFileName[6];
  720. for(i=0;i<=POC_ALL_GROUPS_NUM;i++){
  721. GUName[i]=NullGU;
  722. GUFeatures[i]=0;
  723. }
  724. for(i=0;i<sutPocStatus.ListFillIndex;i++){
  725. GUFeatures[i]=1;
  726. if(type==0){
  727. if(sutPocStatus.AllGroups[i].ID==sutPocStatus.LocalGroup.ID) GUFeatures[i]=0;
  728. GUName[i]=sutPocStatus.AllGroups[i].name;
  729. }else{
  730. if(sutPocStatus.AllUsers[i].status==1) GUFeatures[i]=0;
  731. else if(sutPocStatus.AllUsers[i].status==0)GUFeatures[i]=2;
  732. GUName[i]=sutPocStatus.AllUsers[i].name;
  733. }
  734. }
  735. if(sutPocStatus.ListCurOnlineNum==0 || sutPocStatus.ListDetailValid==0){//没有成员总数或没有获取到明细
  736. GUName[0]="空";
  737. GUFeatures[i]=0;
  738. }
  739. //初始化ListBox控件
  740. numGUFlash(0,sutPocStatus.ListCurOnlineNum);
  741. if(setHandleToZero==true){
  742. showHandle=0;
  743. setHandleToZero=false;
  744. }else{
  745. if(sutPocStatus.ListFillIndex) showHandle=sutPocStatus.ListFillIndex-1;
  746. else showHandle=0;
  747. }
  748. ListBoxInit(&sutListBox,GUName,0,icons,GUFeatures,showHandle);
  749. GUListBoxInited=1;
  750. }
  751. /*****************************群组选择/成员选择部分结束*********************************/
  752. /*****************************系统设置部分开始*********************************/
  753. void uiShowMenuSysSetup(char flash){
  754. char i=0;
  755. static char *p[7]={0};
  756. static const char *apcPtr[]={
  757. "1.LCD设置",
  758. "2.SIM选择",
  759. "3.按键音设置",
  760. "4.功耗模式设置",
  761. "5.平台切换",
  762. ""
  763. };
  764. static const char *XINapcPtr[]={
  765. "6.天气显示",
  766. ""
  767. };
  768. if(flash){
  769. msgAtSend("AT+RSIM\r\n");//进此菜单前查询一下卡用于后面显示
  770. guiClearAll(guiGetBackColor());
  771. if(newPara.newold_plam){
  772. for(i=0;i<5;i++)p[i]=apcPtr[i];
  773. for(i=0;i<2;i++)p[i+5]=XINapcPtr[i];
  774. }else {
  775. for(i=0;i<6;i++)p[i]=apcPtr[i];
  776. }
  777. guiShowCaption(0,"系统设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  778. uiMenuShowBottomLine();
  779. uiMenuShowBottomIndacitor("确认", "返回");
  780. uiMenuInit(&sutMenuSysSetup,p,FONT_MODE_12X12);
  781. }
  782. }
  783. void sysTemSetResponse(void){
  784. unsigned short key;
  785. key=uiMenuResponse(&sutMenuSysSetup);
  786. if(MKEY_VALUE_MENU==key){
  787. switch(sutMenuSysSetup.handle){
  788. case 0://LCD设置
  789. uISetNextStatus(UIS_MENU_SYS_LCD);
  790. break;
  791. case 1://SIM选择
  792. uISetNextStatus(UIS_MENU_SYS_SIM);
  793. break;
  794. case 2://提示音设置
  795. uISetNextStatus(UIS_MENU_SYS_NOTE);
  796. break;
  797. case 3:
  798. uISetNextStatus(UIS_MENU_SYS_PWR);
  799. break;
  800. case 4: //平台切换
  801. uISetNextStatus(UIS_MENU_SYS_SERVERPASS);
  802. break;
  803. case 5: //天气
  804. uISetNextStatus(UIS_MENU_SYS_WEATHER);
  805. break;
  806. // case 3://功耗模式设置
  807. // uISetNextStatus(UIS_MENU_SYS_PWR);
  808. // break;
  809. // case 4://服务器设置
  810. // uISetNextStatus(UIS_MENU_SYS_SERVERPASS);
  811. // break;
  812. // case 5://版本升级
  813. // uISetNextStatus(UIS_MENU_SYS_VERSION);
  814. // break;
  815. // case 6://提示音设置
  816. // uISetNextStatus(UIS_MENU_SYS_NOTE);
  817. // break;
  818. }
  819. if(sutMenuSysSetup.handle<=5) uiPushStack(sutMenuSysSetup.handle);
  820. }else if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_MAIN);
  821. }
  822. /*****************************系统设置部分结束*********************************/
  823. /*****************************定位设置部分开始*********************************/
  824. unsigned char tempGpsIndex;
  825. static locationTimeFlash(char type);
  826. static locationXYFlash(char flash);
  827. void uiShowMenuLocationSel(char flash){
  828. if(flash){
  829. guiClearAll(guiGetBackColor());
  830. guiShowCaption(0,"定位设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  831. uiMenuShowBottomLine();
  832. if(newPara.gpsEnable==0){
  833. uiMenuShowBottomIndacitor(NULL, "返回");
  834. guiShowMessageBox("版本不支持");
  835. LSAPI_OSI_ThreadSleep(1000);
  836. uISetNextStatus(UIS_MENU_MAIN);
  837. return;
  838. }
  839. uiMenuShowBottomIndacitor("保存", "返回");
  840. locationTimeFlash(0);
  841. }
  842. if(newPara.gpsEnable!=0) locationXYFlash(flash);
  843. }
  844. void loationSetResponse(void){
  845. unsigned short key;
  846. /*
  847. key=getKeyValue();
  848. if(MKEY_VALUE_UP==key) locationTimeFlash(1);
  849. else if(MKEY_VALUE_DOWN==key) locationTimeFlash(2);
  850. else if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_MAIN);
  851. else if(MKEY_VALUE_MENU==key){
  852. if(tempGpsIndex != newPara.gpsTimeIndex){
  853. MSG_INFO(1, "GPS timeIndex update:%d",getGPSTimeValue(tempGpsIndex));
  854. newPara.gpsTimeIndex=tempGpsIndex;
  855. sysIniSave();
  856. gpsCheckInfo();//检测一下
  857. }
  858. uISetNextStatus(UIS_MENU_MAIN);
  859. }
  860. */
  861. }
  862. static locationTimeFlash(char type){
  863. unsigned short gpsTimeValue;
  864. char buf[50];
  865. unsigned short y=70;
  866. if(type==0){
  867. tempGpsIndex=newPara.gpsTimeIndex;
  868. }else if(type==1){
  869. if(++tempGpsIndex>=GPS_TABLE_NUM) tempGpsIndex=0;
  870. }else if(type==2){
  871. if(tempGpsIndex>0) tempGpsIndex--;
  872. else tempGpsIndex=GPS_TABLE_NUM-1;
  873. }else return;
  874. gpsTimeValue=getGPSTimeValue(tempGpsIndex);
  875. if(gpsTimeValue==0) snprintf(buf, sizeof(buf), "定位上传设置:关闭");
  876. else snprintf(buf, sizeof(buf), "定位上传设置:%d秒",gpsTimeValue);
  877. guiClearRect(0,y,GLCD_WIDTH-1, y+12,guiGetBackColor());
  878. guiShowStr(30,y, buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
  879. }
  880. static locationXYFlash(char flash){
  881. char buf[50];
  882. unsigned short y=UI_CONTENT_SHOW_Y+2;
  883. if(gpsInfo.update==0 && flash==0) return;
  884. gpsInfo.update=0;
  885. guiClearRect(0, y,GLCD_WIDTH-1, y+12+5+12,guiGetBackColor());
  886. snprintf(buf, sizeof(buf), "纬度 S:%d.%05d",gpsInfo.Lat/1000000,gpsInfo.Lat%1000000);
  887. guiShowStr(30,y, buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
  888. y+=12+5;
  889. snprintf(buf, sizeof(buf), "经度 W:%d.%05d",gpsInfo.Long/1000000,gpsInfo.Long%1000000);
  890. guiShowStr(30,y, buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
  891. }
  892. /*****************************定位设置部分结束*********************************/
  893. /*******************************终端信息开始**********************************/
  894. unsigned char sysInfoType;
  895. static void sysInfoFlash(void){
  896. unsigned short x,y;
  897. char buf[50];
  898. unsigned char LineSpace=12+4;
  899. int len;
  900. static char *p=0;
  901. unsigned char Exseat=0;
  902. static char yunyingshang=0;
  903. QR_OUT testma;
  904. x=2,y=UI_CONTENT_SHOW_Y+3;
  905. guiClearRect(0,y,GLCD_WIDTH-1,GLCD_HEIGHT,guiGetBackColor());
  906. if(sysInfoType==0){
  907. switch(sutApp.copstype){
  908. case 0:case 2:case 4:case 7://中国移动
  909. yunyingshang=1;
  910. break;
  911. case 1:case 6:case 9://中移联通
  912. yunyingshang=2;
  913. break;
  914. case 3:case 8:case 11://中国电信
  915. yunyingshang=3;
  916. break;
  917. default:
  918. yunyingshang=0;
  919. break;
  920. }
  921. if(newPara.newold_plam==1){
  922. p=ohpocGetIMEI();
  923. // guiShowStr(NET_ICON_X, y+1,"4G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR);
  924. //guiShowCaption(0,"IMEI",UI_NOTE_LOCATION_Y,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  925. }else{
  926. Exseat=0;
  927. p=ohpocGetICCID();
  928. if(yunyingshang!=1){
  929. p[19]=0;
  930. }
  931. //guiShowCaption(0,"ICCID",UI_NOTE_LOCATION_Y,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  932. }
  933. if(p!=NULL){
  934. EncodeData(p,&testma);
  935. guiDrawQRimage(36,y+1,4,testma.data,testma.size);//32
  936. }else{
  937. guiShowMessageBox("获取失败");
  938. }
  939. MSG_INFO(1,"copstype==%d,yunyingshang==%d",sutApp.copstype,yunyingshang);
  940. }
  941. else if(sysInfoType==1){
  942. snprintf(buf, sizeof(buf),"ICCID:");
  943. guiShowStr(0,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  944. if(LSAPI_SIM_GetICCID(buf)==0&&yunyingshang!=0){
  945. strcpy(sutApp.ICCID, buf);
  946. if(yunyingshang!=1){
  947. sutApp.ICCID[19]=0;
  948. }
  949. snprintf(buf, sizeof(buf),"%s",sutApp.ICCID);
  950. MSG_INFO(1,"CCID========%s",sutApp.ICCID);
  951. len=strlen(buf);
  952. if(len>14){
  953. y+=LineSpace;
  954. Exseat+=LineSpace;
  955. guiShowStr(0,y,buf+14,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  956. buf[14]=0;
  957. y-=LineSpace;
  958. }
  959. guiShowStr(48,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  960. }
  961. else{
  962. snprintf(buf, sizeof(buf),"未知");
  963. guiShowStr(48,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  964. }
  965. y+=Exseat;//返回指向原始位置
  966. y+=LineSpace;
  967. Exseat=0;
  968. //IMEI
  969. snprintf(buf, sizeof(buf),"IMEI:");
  970. guiShowStr(0,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  971. memset(buf,0,sizeof(buf));
  972. if(LSAPI_SIM_GetIMEI(buf)==0){
  973. len=strlen(buf);
  974. if(len>15){
  975. y+=LineSpace;
  976. Exseat+=LineSpace;
  977. guiShowStr(0,y,buf+15,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  978. buf[15]=0;
  979. y-=LineSpace;
  980. }
  981. guiShowStr(40,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  982. }else{
  983. guiShowStr(40,y,"未知",FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  984. }
  985. y+=Exseat;//返回指向原始位置
  986. y+=LineSpace;
  987. //终端编码
  988. snprintf(buf,sizeof(buf),"PSN:%lu", sutApp.account.psn);
  989. len=strlen(buf);
  990. if(len>17){
  991. y+=LineSpace;
  992. guiShowStr(x+32,y,buf+17,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  993. buf[17]=0;
  994. y-=LineSpace;
  995. }
  996. guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  997. }else if(sysInfoType==2){
  998. //对讲平台
  999. //snprintf(buf, sizeof(buf),"对讲平台:%s", OHPOC_POC_PLATFORM);
  1000. if(newPara.newold_plam==0)snprintf(buf, sizeof(buf),"对讲平台:BND");
  1001. else snprintf(buf, sizeof(buf),"对讲平台:芯平台");
  1002. guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  1003. y+=LineSpace;
  1004. //对讲版本号
  1005. snprintf(buf, sizeof(buf),"对讲版本:%s",sutApp.pocVersion);
  1006. guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  1007. y+=LineSpace;
  1008. //模块
  1009. memset(buf,sizeof(buf),0);
  1010. snprintf(buf,sizeof(buf),"模块:%s", sutApp.modemVer);
  1011. len=strlen(buf);
  1012. if(len>20){
  1013. y+=LineSpace;
  1014. guiShowStr(x+32,y,buf+20,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  1015. buf[20]=0;
  1016. y-=LineSpace;
  1017. }
  1018. guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  1019. y+=LineSpace;
  1020. //应用版本
  1021. snprintf(buf, sizeof(buf),"应用版本:%s",OHPOC_VERSION);
  1022. guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  1023. y+=LineSpace;
  1024. //内部版本
  1025. snprintf(buf, sizeof(buf),"内部版本:%d",CUSTOMER_CODE);
  1026. guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor());
  1027. }
  1028. }
  1029. void uiShowInformation(char update){
  1030. if(update){
  1031. sysInfoType=0;
  1032. guiClearAll(guiGetBackColor());
  1033. guiShowCaption(0,"终端信息",UI_STATUS_BAR_HEIGH,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1034. uiMenuShowBottomLine();
  1035. uiMenuShowBottomIndacitor(NULL, "返回");
  1036. sysInfoFlash();
  1037. }
  1038. }
  1039. void uiShowInformationResponse(void){
  1040. unsigned short key=getKeyValue();
  1041. if(MKEY_VALUE_ESC==key) {
  1042. if(sutApp.platfrom_err){
  1043. sutApp.platfrom_err=0;
  1044. uISetNextStatus(UIS_STANDBY);
  1045. }
  1046. uISetNextStatus(sutUIstatus.LastStatus);
  1047. }
  1048. else if(MKEY_VALUE_DOWN==key || MKEY_VALUE_UP==key){
  1049. if(sysInfoType==0) sysInfoType=1;
  1050. else if(sysInfoType==1)sysInfoType=2;
  1051. else sysInfoType=0;
  1052. sysInfoFlash();
  1053. }else if(MKEY_VALUE_CB_IP==key){
  1054. sysInfoType=2;
  1055. sysInfoFlash();
  1056. }
  1057. }
  1058. /*****************************终端信息结束**********************************/
  1059. static const char *commonIcon2[]={
  1060. "APN.bmp",
  1061. "APN1.bmp",
  1062. ""
  1063. };
  1064. /*****************************LCD设置开始**********************************/
  1065. unsigned char lcdTmpIndex;
  1066. static void lcdTimeFlash(char type){
  1067. char buf[50];
  1068. unsigned short x=4,y=56,value;
  1069. if(type==0) guiShowStr(x+25, y, "背光时间:", FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
  1070. else if(type==1){
  1071. if(++lcdTmpIndex>=5) lcdTmpIndex=0;
  1072. }else if(type==2){
  1073. if(lcdTmpIndex>0) lcdTmpIndex--;
  1074. else lcdTmpIndex=4;
  1075. }
  1076. value=newPara.lcdParaList[lcdTmpIndex];
  1077. if(value==0) snprintf(buf, sizeof(buf), " 常亮 ");
  1078. else snprintf(buf, sizeof(buf), "%3d 秒", value);
  1079. guiShowStr(x+85, y, buf, FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
  1080. }
  1081. void uiShowLcdSel(char StatusUpdate){
  1082. if(StatusUpdate){
  1083. guiClearAll(guiGetBackColor());
  1084. guiShowCaption(0,"LCD设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1085. uiMenuShowBottomLine();
  1086. lcdTmpIndex=newPara.lcdParaDefaultIndex;
  1087. lcdTimeFlash(0);
  1088. uiMenuShowBottomIndacitor("保存", "返回");
  1089. }
  1090. }
  1091. void uiShowLcdSelResponse(void){
  1092. unsigned short key=getKeyValue();
  1093. if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
  1094. else if(MKEY_VALUE_DOWN==key)lcdTimeFlash(1);
  1095. else if(MKEY_VALUE_UP==key) lcdTimeFlash(2);
  1096. else if(MKEY_VALUE_MENU==key){
  1097. getStackStruct()->ok_back=1;
  1098. if(lcdTmpIndex != newPara.lcdParaDefaultIndex){
  1099. newPara.lcdParaDefaultIndex=lcdTmpIndex;
  1100. MSG_INFO(1, "LCD TimeUpdate");
  1101. backLightReset();
  1102. sysIniSave();
  1103. }
  1104. uISetNextStatus(UIS_MENU_SYS_SEL);
  1105. }
  1106. }
  1107. /*****************************LCD设置结束**********************************/
  1108. /*****************************网络设置开始**********************************/
  1109. const unsigned char netModeSetTable[3]={1,2,4};//设置制式:AUTH,2G,4G
  1110. /*输入制式源始值,返回索引值对应值*/
  1111. unsigned char getNetModeIndex(unsigned char netModeValue){
  1112. unsigned char i;
  1113. for(i=0;i<sizeof(netModeSetTable);i++){
  1114. if(netModeValue==netModeSetTable[i]) return i;
  1115. }
  1116. return 0xff;//无对应值
  1117. }
  1118. /*输入制式索引值,返回制式源始值*/
  1119. unsigned char getNetModeValue(unsigned char netModeIndex){
  1120. if(netModeIndex>=sizeof(netModeSetTable)) return 0xff;
  1121. else return netModeSetTable[netModeIndex];
  1122. }
  1123. /*输入制式索引值,发送对应该命令给模块*/
  1124. void netModeSetCmd(unsigned char netMode){
  1125. char buf[30];
  1126. snprintf(buf, sizeof(buf), "AT+CTEC=%d,%d\r\n",ctecCurrentSet, netMode);
  1127. msgAtSend(buf);
  1128. }
  1129. #define NET_MODE_NUM 3
  1130. void uiShowNetSel(char StatusUpdate){
  1131. static const char *netMode[NET_MODE_NUM+1]={
  1132. "AUTO",
  1133. "2G",
  1134. "4G",
  1135. ""
  1136. };
  1137. char Features[NET_MODE_NUM];
  1138. unsigned char i;
  1139. if(StatusUpdate){
  1140. guiClearAll(guiGetBackColor());
  1141. guiShowCaption(0,"网络设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1142. uiMenuShowBottomLine();
  1143. for(i=0;i<NET_MODE_NUM;i++){
  1144. if(i==newPara.netMode) Features[i]=1;
  1145. else Features[i]=0;
  1146. }
  1147. ListBoxInit(&sutListBox,netMode,0,commonIcon2,Features,0);
  1148. uiMenuShowBottomIndacitor("保存", "返回");
  1149. }
  1150. }
  1151. void uiShowNetSelResponse(void){
  1152. unsigned short key=ListBoxResponse(&sutListBox);
  1153. if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
  1154. else if(MKEY_VALUE_MENU==key){
  1155. getStackStruct()->ok_back=1;
  1156. if(sutListBox.handle*2 != newPara.netMode){
  1157. newPara.netMode=sutListBox.handle*2;
  1158. MSG_INFO(1, "netMode update:%d", newPara.netMode);
  1159. sysIniSave();
  1160. netModeSetCmd(newPara.netMode);
  1161. }
  1162. uISetNextStatus(UIS_MENU_SYS_SEL);
  1163. }
  1164. }
  1165. /*****************************网络设置结束**********************************/
  1166. /*****************************卡选择设置开始**********************************/
  1167. #define SIM_MODE_NUM 2
  1168. void uiShowSimSel(char StatusUpdate){
  1169. static const char *simMode[SIM_MODE_NUM+1]={
  1170. "卡1",
  1171. "卡2",
  1172. ""
  1173. };
  1174. char Features[SIM_MODE_NUM];
  1175. unsigned char i;
  1176. if(StatusUpdate){
  1177. guiClearAll(guiGetBackColor());
  1178. guiShowCaption(0,"SIM设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1179. uiMenuShowBottomLine();
  1180. for(i=0;i<SIM_MODE_NUM;i++){
  1181. if(i==sutApp.simSel) Features[i]=1;
  1182. else Features[i]=0;
  1183. }
  1184. ListBoxInit(&sutListBox,simMode,0,commonIcon2,Features,sutApp.simSel);
  1185. uiMenuShowBottomIndacitor("保存", "返回");
  1186. }
  1187. }
  1188. void uiShowSimSelResponse(void){
  1189. char buf[30];
  1190. unsigned short key=ListBoxResponse(&sutListBox);
  1191. if(MKEY_VALUE_ESC==key){
  1192. if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY);
  1193. else uISetNextStatus(UIS_MENU_SYS_SEL);
  1194. }else if(MKEY_VALUE_MENU==key){
  1195. getStackStruct()->ok_back=1;
  1196. if(sutListBox.handle != sutApp.simSel){
  1197. snprintf(buf, sizeof(buf), "AT+SIMCROSS=%d\r\n",sutListBox.handle);
  1198. msgAtSend(buf);
  1199. guiShowMessageBox("请重启设备");
  1200. msgAtSend("AT+TRB\r\n");
  1201. LSAPI_OSI_ThreadSleep(1000);
  1202. for(;;){
  1203. MSG_INFO(1, "card changed, wait user reboot");
  1204. CTL_POWER_HOLD(0);
  1205. LSAPI_OSI_ThreadSleep(1000);
  1206. }
  1207. }
  1208. uISetNextStatus(UIS_MENU_SYS_SEL);
  1209. }
  1210. }
  1211. /*****************************卡选择设置结束**********************************/
  1212. /*****************************功耗设置开始**********************************/
  1213. typedef enum{
  1214. PMODE_DEFAULT_LOW,
  1215. PMODE_SUPER_LOW,
  1216. PMODE_NORMAL
  1217. }PWR_ENUMDEF;
  1218. //低功耗模式
  1219. #define MODE_LOW_PWR_NONE_4G 5
  1220. #define MODE_LOW_PWR_IS_4G 25
  1221. //超长待机模式
  1222. #define MODE_LONG_LOW_PWR_NONE_4G 5
  1223. #define MODE_LONG_LOW_PWR_IS_4G 55
  1224. //常规模式
  1225. #define MODE_NORMAL__NONE_4G 5
  1226. #define MODE_NORMAL__IS_4G 5
  1227. //终端放弃设置模式,由服务器决定使用什么
  1228. #define MODE_AUTO____NONE_4G 0
  1229. #define MODE_AUTO____IS_4G 0
  1230. //默认功耗模式
  1231. #define MODE_PWR_DEFAULT_NONE_4G MODE_LOW_PWR_NONE_4G
  1232. #define MODE_PWR_DEFAULT_IS_4G MODE_LOW_PWR_IS_4G
  1233. static void pwrModeSetCmd(unsigned char pwrMode){
  1234. unsigned char seg1,seg2;
  1235. char buf[30];
  1236. if(pwrMode==PMODE_DEFAULT_LOW){
  1237. seg1=MODE_PWR_DEFAULT_NONE_4G;
  1238. seg2=MODE_PWR_DEFAULT_IS_4G;
  1239. }else if(pwrMode==PMODE_SUPER_LOW){
  1240. seg1=MODE_LONG_LOW_PWR_NONE_4G;
  1241. seg2=MODE_LONG_LOW_PWR_IS_4G;
  1242. }else if(pwrMode==PMODE_NORMAL){
  1243. seg1=MODE_NORMAL__NONE_4G;
  1244. seg2=MODE_NORMAL__IS_4G;
  1245. }else return;
  1246. snprintf(buf, sizeof(buf), "AT+UDP=%d,%d\r\n",seg1,seg2);
  1247. msgAtSend(buf);
  1248. }
  1249. void pwrModeAckHandler(unsigned char seg1, unsigned char seg2){
  1250. if(seg1==MODE_PWR_DEFAULT_NONE_4G && seg2==MODE_PWR_DEFAULT_IS_4G && newPara.pwrMode != PMODE_DEFAULT_LOW){
  1251. goto SAVE_PWR_MODE;
  1252. }else if(seg1==MODE_LONG_LOW_PWR_NONE_4G && seg2==MODE_LONG_LOW_PWR_IS_4G && newPara.pwrMode != PMODE_SUPER_LOW){
  1253. goto SAVE_PWR_MODE;
  1254. }else if(seg1==MODE_NORMAL__NONE_4G && seg2==MODE_NORMAL__IS_4G && newPara.pwrMode != PMODE_NORMAL){
  1255. goto SAVE_PWR_MODE;
  1256. }else if(seg2!=MODE_LOW_PWR_IS_4G&&seg2!=MODE_LONG_LOW_PWR_IS_4G&& seg2!=MODE_NORMAL__IS_4G){
  1257. //Seg2 3个模式都不满足则切换为默认模式
  1258. newPara.pwrMode = PMODE_DEFAULT_LOW;
  1259. goto SAVE_PWR_MODE;
  1260. }
  1261. return;
  1262. SAVE_PWR_MODE:
  1263. sysIniSave();
  1264. pwrModeSetCmd(newPara.pwrMode);
  1265. }
  1266. #define PWR_MODE_NUM 3
  1267. void uiShowPwrSel(char StatusUpdate){
  1268. static const char *pwrMode[PWR_MODE_NUM+1]={
  1269. "低功耗模式",
  1270. "超长待机模式",
  1271. "常规模式",
  1272. "",
  1273. };
  1274. char Features[PWR_MODE_NUM];
  1275. unsigned char i;
  1276. if(StatusUpdate){
  1277. guiClearAll(guiGetBackColor());
  1278. guiShowCaption(0,"功耗设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1279. uiMenuShowBottomLine();
  1280. for(i=0;i<PWR_MODE_NUM;i++){
  1281. if(i==newPara.pwrMode) Features[i]=1;
  1282. else Features[i]=0;
  1283. }
  1284. ListBoxInit(&sutListBox,pwrMode,0,commonIcon2,Features,0);
  1285. uiMenuShowBottomIndacitor("保存", "返回");
  1286. }
  1287. }
  1288. void uiShowPwrSelResponse(void){
  1289. unsigned short key=ListBoxResponse(&sutListBox);
  1290. if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
  1291. else if(MKEY_VALUE_MENU==key){
  1292. getStackStruct()->ok_back=1;
  1293. if(sutListBox.handle != newPara.pwrMode){
  1294. newPara.pwrMode=sutListBox.handle;
  1295. MSG_INFO(1, "pwrMode update:%d", newPara.pwrMode);
  1296. sysIniSave();
  1297. //pwrModeSetCmd(newPara.pwrMode);
  1298. }
  1299. uISetNextStatus(UIS_MENU_SYS_SEL);
  1300. }
  1301. }
  1302. /*****************************功耗设置结束**********************************/
  1303. /*****************************平台选择设置输入密码开始**********************************/
  1304. void uiShowServerPassSel(char StatusUpdate){
  1305. if(StatusUpdate){
  1306. guiClearAll(guiGetBackColor());
  1307. guiShowCaption(0,"密码验证",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1308. uiMenuShowBottomLine();
  1309. NumEditInit(&sutNumEdit,(GLCD_WIDTH-6*8)/2,(GLCD_HEIGHT-16)/2,"000000");
  1310. NumEditShow(&sutNumEdit);
  1311. uiMenuShowBottomIndacitor("[上]加值", "[下]移动");
  1312. }
  1313. }
  1314. void uiShowServerSelPassResponse(void){
  1315. unsigned short key=getKeyValue();
  1316. NumEditResponse(&sutNumEdit);
  1317. if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
  1318. else if(MKEY_VALUE_MENU==key){
  1319. if(memcmp(sutNumEdit.buffer, getMenuKey(), 6)==0) uISetNextStatus(UIS_MENU_SYS_PLAT);
  1320. else{
  1321. guiShowMessageBox("密码错误");
  1322. LSAPI_OSI_ThreadSleep(1000);
  1323. getStackStruct()->ok_back=1;
  1324. uISetNextStatus(UIS_MENU_SYS_SEL);
  1325. }
  1326. }
  1327. }
  1328. /*****************************服务器设置输入密码结束**********************************/
  1329. /*****************************服务器设置开始**********************************/
  1330. void uiShowServerSel(char StatusUpdate){
  1331. static const char *serIcons[]={
  1332. "Ser.bmp",
  1333. "Sersel.bmp",
  1334. ""
  1335. };
  1336. static const char *serName[]={
  1337. "杭州服务器",
  1338. "山东服务器",
  1339. "IP分发服务器",
  1340. "集群服务器",
  1341. "自定义服务器",
  1342. "",
  1343. };
  1344. char Features[5];
  1345. unsigned char tempSer,i;
  1346. if(StatusUpdate){
  1347. guiClearAll(guiGetBackColor());
  1348. guiShowCaption(0,"服务器列表",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1349. uiMenuShowBottomLine();
  1350. uiMenuShowBottomIndacitor("确认", "返回");
  1351. tempSer=newPara.serList.defaultuse;
  1352. for(i=0;i<=SERVER_UR;i++){
  1353. if(i==tempSer) Features[i]=1;
  1354. else Features[i]=0;
  1355. }
  1356. ListBoxInit(&sutListBox,serName,0,serIcons,Features,0);
  1357. }
  1358. }
  1359. void uiShowServerSelResponse(void){
  1360. unsigned char tempSer;
  1361. char buf[50],buf1[100];
  1362. unsigned short key=ListBoxResponse(&sutListBox);
  1363. if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
  1364. else if(MKEY_VALUE_MENU==key){
  1365. tempSer=sutListBox.handle;
  1366. if(tempSer != newPara.serList.defaultuse){
  1367. newPara.serList.defaultuse=tempSer;
  1368. sysIniSave();
  1369. getGIPAddr();
  1370. snprintf(buf, sizeof(buf), "ip=%s;domain=%s;",getPIPAddr(),getDOMAINAddr());
  1371. AscStrTurnHexStr(buf,buf1);
  1372. msgAtSend("AT+POC=010000");
  1373. msgAtSend(buf1);
  1374. msgAtSend("\r\n");
  1375. LSAPI_OSI_ThreadSleep(100);
  1376. msgAtSend("AT+POC=040000\r\n");
  1377. }
  1378. uISetNextStatus(UIS_STANDBY );
  1379. }
  1380. }
  1381. /*****************************服务器设置结束**********************************/
  1382. /*****************************版本设置开始**********************************/
  1383. unsigned char fotaStep;
  1384. unsigned int fotaTick;
  1385. void fotaStepSet(unsigned char newStep){
  1386. fotaStep=newStep;
  1387. }
  1388. void fotaMsgShow(char *msg){
  1389. #ifdef USE_12X12_FONT_ONLY
  1390. int len=guiGetStrXLen((char *)msg,FONT_MODE_12X12);
  1391. #else
  1392. int len=guiGetStrXLen((char *)msg,FONT_MODE_16X16);
  1393. #endif
  1394. guiClearRect(0, 60, GLCD_WIDTH-1, 60+16,guiGetBackColor());
  1395. #ifdef USE_12X12_FONT_ONLY
  1396. guiShowStr((GLCD_WIDTH-len)/2,60+2, msg,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
  1397. #else
  1398. guiShowStr((GLCD_WIDTH-len)/2,60, msg,FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
  1399. #endif
  1400. }
  1401. char loadMsg=0;
  1402. void showLoading(void){
  1403. loadMsg=1;
  1404. }
  1405. void uiShowVersionSel(char StatusUpdate){
  1406. char buf[50];
  1407. if(StatusUpdate){
  1408. sutApp.fotaVersion[0]=0;
  1409. guiClearAll(guiGetBackColor());
  1410. guiShowCaption(0,"版本更新",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1411. msgAtSend("AT+FOTA?\r\n");
  1412. fotaStep=0;
  1413. loadMsg=0;
  1414. fotaMsgShow("正在检测版本");
  1415. uiMenuShowBottomLine();
  1416. uiMenuShowBottomIndacitor("确定", "返回");
  1417. uTimerStart(&fotaTick, 5000);
  1418. }
  1419. switch(fotaStep){
  1420. case 0:
  1421. if(uTimerExpired(&fotaTick)){
  1422. fotaMsgShow("检测超时");
  1423. fotaStep=4;
  1424. }
  1425. break;
  1426. case 1://等待用户确定
  1427. break;
  1428. case 2://用户确定后等待结果
  1429. if(uTimerExpired(&fotaTick)){
  1430. fotaMsgShow("超时退出");
  1431. fotaStep=4;
  1432. }
  1433. if(loadMsg!=0){
  1434. fotaMsgShow("正在下载");
  1435. loadMsg=0;
  1436. }
  1437. break;
  1438. case 3://升级成功,等待重启
  1439. msgAtSend("AT+POC=050000\r\n");//停止POC后复位
  1440. MSG_INFO(1, "Stop poc");
  1441. LSAPI_OSI_ThreadSleep(2000);
  1442. msgAtSend("AT+TRB\r\n");
  1443. MSG_INFO(1, "Reset system!!!");
  1444. while(1){LSAPI_OSI_ThreadSleep(1000);}
  1445. break;
  1446. case 4://延时显示2秒后退出
  1447. uTimerStart(&fotaTick, 2000);
  1448. fotaStep=5;
  1449. break;
  1450. case 5://退出升级流程
  1451. if(uTimerExpired(&fotaTick)) uISetNextStatus(UIS_MENU_SYS_SEL);
  1452. break;
  1453. case 6://无更新版本
  1454. fotaMsgShow("无更新版本");
  1455. fotaStep=4;
  1456. break;
  1457. case 7://升级失败
  1458. fotaMsgShow("升级失败");
  1459. fotaStep=4;
  1460. break;
  1461. case 8://下载成功
  1462. fotaMsgShow("下载成功,重启更新");
  1463. fotaStep=3;
  1464. break;
  1465. case 9://
  1466. snprintf(buf, sizeof(buf), "是否更新到:%s",sutApp.fotaVersion);
  1467. fotaMsgShow(buf);
  1468. fotaStep=1;
  1469. break;
  1470. }
  1471. }
  1472. void uiShowVersionSelResponse(void){
  1473. unsigned char key=getKeyValue();
  1474. if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
  1475. else if(MKEY_VALUE_MENU==key){
  1476. if(fotaStep==1){
  1477. fotaMsgShow("请勿断电!");
  1478. fotaStep=2;
  1479. msgAtSend("AT+FOTA=1\r\n");
  1480. uTimerStart(&fotaTick, 1000);
  1481. }
  1482. }
  1483. }
  1484. /*****************************版本设置结束**********************************/
  1485. /*****************************提示音设置开始********************************/
  1486. unsigned char noteSetTmp;
  1487. static void switchFlash(void){
  1488. char info[30];
  1489. unsigned short x,y,len;
  1490. if(noteSetTmp==0) snprintf(info, sizeof(info), "关闭");
  1491. else snprintf(info, sizeof(info), "打开");
  1492. len=guiGetStrXLen((char *)info, FONT_MODE_12X12);
  1493. x=(GLCD_WIDTH-len)/2;
  1494. y=UI_CONTENT_SHOW_Y+(GLCD_HEIGHT-UI_CONTENT_SHOW_Y)/2-12;
  1495. guiShowStr(x,y,info, FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
  1496. }
  1497. void uiShowNoteSel(char StatusUpdate){
  1498. if(StatusUpdate){
  1499. guiClearAll(guiGetBackColor());
  1500. guiShowCaption(0,"按键音设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1501. uiMenuShowBottomLine();
  1502. noteSetTmp=newPara.KeySound;
  1503. switchFlash();
  1504. uiMenuShowBottomIndacitor("保存", "返回");
  1505. }
  1506. }
  1507. void uiShowNoteSelResponse(void){
  1508. unsigned short key=getKeyValue();
  1509. if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
  1510. else if(MKEY_VALUE_MENU==key){
  1511. getStackStruct()->ok_back=1;
  1512. if(newPara.KeySound != noteSetTmp){
  1513. newPara.KeySound=noteSetTmp;
  1514. #ifndef ENABLE_PWM_BEEP
  1515. if(noteSetTmp==0) msgAtSend("AT+TONES=0\r\n");
  1516. else msgAtSend("AT+TONES=1\r\n");
  1517. #endif
  1518. sysIniSave();
  1519. }
  1520. uISetNextStatus(UIS_MENU_SYS_SEL);
  1521. }else if(MKEY_VALUE_DOWN || MKEY_VALUE_UP){
  1522. if(noteSetTmp==0) noteSetTmp=1;
  1523. else noteSetTmp=0;
  1524. switchFlash();
  1525. }
  1526. }
  1527. /*****************************提示音设置结束********************************/
  1528. /*****************************BND 新旧平台选择**********************************/
  1529. void uiShowPingTaiSel(char StatusUpdate){
  1530. static const char *simMode[2+1]={
  1531. "博纳德",
  1532. "芯平台",
  1533. ""
  1534. };
  1535. char Features[2];
  1536. unsigned char i;
  1537. if(StatusUpdate){
  1538. guiClearAll(guiGetBackColor());
  1539. guiShowCaption(0,"平台选择",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1540. uiMenuShowBottomLine();
  1541. for(i=0;i<2;i++){
  1542. if(i==newPara.newold_plam) Features[i]=1;
  1543. else Features[i]=0;
  1544. }
  1545. ListBoxInit(&sutListBox,simMode,0,commonIcon2,Features,newPara.newold_plam);
  1546. uiMenuShowBottomIndacitor("保存", "返回");
  1547. }
  1548. }
  1549. void uiShowPingTaiSelResponse(void){
  1550. char buf[30];
  1551. unsigned short key=ListBoxResponse(&sutListBox);
  1552. if(MKEY_VALUE_ESC==key){
  1553. if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY);
  1554. else uISetNextStatus(UIS_MENU_SYS_SEL);
  1555. }else if(MKEY_VALUE_MENU==key){
  1556. getStackStruct()->ok_back=1;
  1557. if(sutListBox.handle != newPara.newold_plam){
  1558. newPara.newold_plam=sutListBox.handle;
  1559. if(sutListBox.handle==0){
  1560. broad_write_custom(CHANGE_PLATFORM_CONTEXT,"std");
  1561. }else broad_write_custom(CHANGE_PLATFORM_CONTEXT,"xin");
  1562. sysIniSave();
  1563. guiShowMessageBox("请重启设备");
  1564. msgAtSend("AT+TRB\r\n");
  1565. LSAPI_OSI_ThreadSleep(1000);
  1566. for(;;){
  1567. MSG_INFO(1, "平台正在切换,等待用户重启");
  1568. CTL_POWER_HOLD(0);
  1569. LSAPI_OSI_ThreadSleep(1000);
  1570. }
  1571. }
  1572. uISetNextStatus(UIS_MENU_SYS_SEL);
  1573. }
  1574. }
  1575. /*****************************BND 新旧平台选择结束**********************************/
  1576. /*****************************关机界面提示结束**********************************/
  1577. void uiShowShutDown(char update){
  1578. if(update){
  1579. lcdBackLightApi(1);
  1580. guiClearAll(guiGetBackColor());
  1581. guiShowCaption(0,"关机",UI_STATUS_BAR_HEIGH,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1582. guiShowMessageBox("确定关机?");
  1583. uiMenuShowBottomLine();
  1584. uiMenuShowBottomIndacitor("确定", "取消");
  1585. }
  1586. }
  1587. void uiShowShutDownResponse(void){
  1588. unsigned short key=getKeyValue();
  1589. if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_STANDBY);
  1590. else if(MKEY_VALUE_MENU==key){
  1591. MSG_INFO(1, "Power is off!");
  1592. appSleepCtl(ASLEEP_PWR, 1);
  1593. }
  1594. }
  1595. /*****************************关机界面提示结束**********************************/
  1596. /*****************************基站定位**********************************/
  1597. void uiShowLBS_MAP(char update){
  1598. static char zoom;//Z8
  1599. static int cnt;
  1600. static char calc;
  1601. static signed char lastLbsMapZoom=-1;
  1602. if(update){
  1603. guiClearAll(guiGetBackColor());
  1604. guiShowCaption(0,"基站定位",UI_STATUS_BAR_HEIGH,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1605. //正在获取
  1606. guiShowMessageBox("正在获取");
  1607. Lbs_Sendto_bnd();
  1608. calc=0;
  1609. cnt=0;
  1610. sutPocStatus.GetLbsOnce=0;
  1611. lastLbsMapZoom=-1;
  1612. }
  1613. if(++cnt<1000/APP_SUB_DIV_TIME) return;
  1614. cnt=0;
  1615. backLightReset();
  1616. if(sutPocStatus.GetLbsOnce){
  1617. sutPocStatus.GetLbsOnce=2;
  1618. if(lastLbsMapZoom!=newPara.LbsMapZoom){
  1619. switch(newPara.LbsMapZoom){
  1620. case 0:
  1621. guishow_png(0,UI_CONTENT_SHOW_Y,"z8.png");
  1622. break;
  1623. case 1:
  1624. guishow_png(0,UI_CONTENT_SHOW_Y,"z12.png");
  1625. break;
  1626. case 2:
  1627. guishow_png(0,UI_CONTENT_SHOW_Y,"z16.png");
  1628. break;
  1629. }
  1630. calc=0;
  1631. lastLbsMapZoom=newPara.LbsMapZoom;
  1632. }
  1633. }else{
  1634. if(calc++<30){
  1635. //获取失败
  1636. if(calc==20)guiShowMessageBox("获取失败!");
  1637. else if(calc==22)uISetNextStatus(UIS_MENU_MAIN);
  1638. //
  1639. }
  1640. if(calc<20)Lbs_Sendto_bnd();
  1641. }
  1642. }
  1643. void uiShowLBS_MAPResponse(void){
  1644. unsigned short key=getKeyValue();
  1645. if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_MAIN);
  1646. else if(MKEY_VALUE_UP==key){
  1647. if(newPara.LbsMapZoom>0){
  1648. newPara.LbsMapZoom--;
  1649. }
  1650. }else if(MKEY_VALUE_DOWN==key){
  1651. if(newPara.LbsMapZoom<2)newPara.LbsMapZoom++;
  1652. }
  1653. }
  1654. /*****************************关机界面提示结束**********************************/
  1655. /*****************************天气显示**********************************/
  1656. void uiShowWeatherSel(char StatusUpdate){
  1657. static const char *EnableMode[2+1]={
  1658. "打开",
  1659. "关闭",
  1660. ""
  1661. };
  1662. char Features[2];
  1663. unsigned char i;
  1664. if(StatusUpdate){
  1665. guiClearAll(guiGetBackColor());
  1666. guiShowCaption(0,"天气显示",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
  1667. uiMenuShowBottomLine();
  1668. for(i=0;i<2;i++){
  1669. if(i==newPara.WeatherEnable) Features[i]=1;
  1670. else Features[i]=0;
  1671. }
  1672. ListBoxInit(&sutListBox,EnableMode,0,commonIcon2,Features,newPara.WeatherEnable);
  1673. uiMenuShowBottomIndacitor("保存", "返回");
  1674. }
  1675. }
  1676. void uiShowWeatherSelResponse(void){
  1677. unsigned short key=ListBoxResponse(&sutListBox);
  1678. if(MKEY_VALUE_ESC==key){
  1679. if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY);
  1680. else uISetNextStatus(UIS_MENU_SYS_SEL);
  1681. }else if(MKEY_VALUE_MENU==key){
  1682. getStackStruct()->ok_back=1;
  1683. if(sutListBox.handle != newPara.WeatherEnable){
  1684. newPara.WeatherEnable=sutListBox.handle;
  1685. sysIniSave();
  1686. }
  1687. uISetNextStatus(UIS_MENU_SYS_SEL);
  1688. }
  1689. }
  1690. /*****************************天气显示**********************************/