UI.c 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025
  1. /********************************************************************************
  2. * File Name: UI.c
  3. * Function Describe:user interface module
  4. * Relate Module:
  5. * Explain: 用户界面,注意,为避免操作系统中多任务调用而导致资源访问冲突,只允许在同一个任务中调用。目前设定在MainTask任务中调用!
  6. * Writer: ShiLiangWen
  7. * Date: 2016.1.28
  8. *******************************************************************************/
  9. #include "includes.h"
  10. #include "LCD.h"
  11. unsigned char lastOption;//向下
  12. //LASTOPTION lastoption;
  13. SUT_UI_STATUS sutUIstatus;
  14. void UISetNextStatus(unsigned char status);
  15. void ShowStatusBar(int Update);//显示状态栏
  16. void ShowButton(u16 x,u16 y,const char *str);//显示一个按钮
  17. void ShowMessageBox(char *msg);
  18. int siCt1=-1;
  19. signed char ChangeIng=0;//-1
  20. char ChangeIngCt=0;
  21. SUT_LIST_BOX sutListBox;//ListBox控件,因为内部用到了features[]数据比较大,为节省内存控件,建议整个项目共用一个list
  22. UI_STACK UI_Stack;
  23. /******************************************************
  24. 在同一个位置交替显示本机用户名和本机当前群组名
  25. 参数:x,y 显示位置左上角的坐标
  26. update ==0 时根据内部静态群组名比较决定是否刷屏显示
  27. update !=0 时强制刷屏显示
  28. ******************************************************/
  29. void ShowGroupAndUserName(u16 x,u16 y,int update)
  30. {
  31. #if POC_USER_NAME_LEN>POC_GROUP_NAME_LEN
  32. static char scName[POC_USER_NAME_LEN];
  33. char name[POC_USER_NAME_LEN];
  34. #else
  35. static char scName[POC_GROUP_NAME_LEN];
  36. char name[POC_GROUP_NAME_LEN];
  37. #endif
  38. static char scCt=0;//0~2--显示群组名 3~5--显示用户名
  39. u16 len;
  40. unsigned char danHuanBuffer[9]={0xB5,0xA5,0xBA,0xF4,0xC4,0xA3,0xCA,0xBD,0};
  41. char GroupShowUpdate=0;
  42. if(++scCt>=6 || update!=0)scCt=0;
  43. if(scCt<3){
  44. if(sutPocStatus.danHunStatus==0){
  45. if(0!=strcmp(sutPocStatus.LocalGroup.name,scName) || update!=0){
  46. memcpy(scName,sutPocStatus.LocalGroup.name,sizeof(scName));
  47. GroupShowUpdate=1;
  48. }
  49. }else{
  50. if(0!=strcmp((char *)danHuanBuffer,scName) || update!=0){
  51. memcpy(scName, danHuanBuffer,sizeof(danHuanBuffer));
  52. GroupShowUpdate=1;
  53. }
  54. }
  55. if(GroupShowUpdate){
  56. GuiClearRect(x,y,160,y+18);//16
  57. StrIntercept(name,scName,sizeof(name));
  58. GuiShowStr(x,y+4,name,0x01);
  59. GuiReverseRect(x,y,160,18);//测试
  60. sutPocStatus.statusChaned=1;
  61. }
  62. }else{
  63. if(0!=strcmp(sutPocStatus.LocalUser.name,scName) || update!=0){
  64. memcpy(scName,sutPocStatus.LocalUser.name,sizeof(scName));
  65. GuiClearRect(x,y,160,y+18);//16
  66. StrIntercept(name,scName,sizeof(name));;
  67. GuiShowStr(x,y+4,name,0x01);
  68. GuiReverseRect(x,y,160,18);//测试
  69. sutPocStatus.statusChaned=1;
  70. }
  71. }
  72. }
  73. void ShowGroupAndUserNameM20(u16 x,u16 y,int update)
  74. {
  75. #if POC_USER_NAME_LEN>POC_GROUP_NAME_LEN
  76. static char scNameUser[POC_GROUP_NAME_LEN];
  77. static char scNameGroup[POC_GROUP_NAME_LEN];
  78. char name[POC_GROUP_NAME_LEN];
  79. #else
  80. static char scNameUser[POC_GROUP_NAME_LEN];
  81. static char scNameGroup[POC_GROUP_NAME_LEN];
  82. char name[POC_GROUP_NAME_LEN];
  83. #endif
  84. unsigned char danHuanBuffer[]={0xB5,0xA5,0xBA,0xF4,0};//0xB5,0xA5,0xBA,0xF4,0xC4,0xA3,0xCA,0xBD,
  85. unsigned char endanHuanBuffer[]="Separate Call";
  86. unsigned char SosBuffer[]="SOS";
  87. char GroupShowUpdate=0;
  88. if(sutPocStatus.SOS_Flag==1){ //SOS
  89. if(0!=strcmp(SosBuffer,scNameGroup)|| update!=0){
  90. memcpy(scNameGroup,SosBuffer,sizeof(SosBuffer));
  91. GroupShowUpdate=1;
  92. }
  93. }else if(sutPocStatus.danHunStatus>0){
  94. if(0==strcmp(sutProductPara.Language,"cn")){
  95. if(0!=strcmp(danHuanBuffer,scNameGroup)|| update!=0){
  96. memcpy(scNameGroup,danHuanBuffer,sizeof(danHuanBuffer));
  97. GroupShowUpdate=1;
  98. }
  99. }else {
  100. if(0!=strcmp(endanHuanBuffer,scNameGroup)|| update!=0){
  101. memcpy(scNameGroup,endanHuanBuffer,sizeof(endanHuanBuffer));
  102. GroupShowUpdate=1;
  103. }
  104. }
  105. }else if(0!=strcmp(sutPocStatus.LocalGroup.name,scNameGroup) || update!=0){
  106. memcpy(scNameGroup,sutPocStatus.LocalGroup.name,sizeof(scNameGroup));
  107. GroupShowUpdate=1;
  108. }
  109. if(0!=strcmp(sutPocStatus.LocalUser.name,scNameUser) || update!=0){
  110. memcpy(scNameUser,sutPocStatus.LocalUser.name,sizeof(scNameUser));
  111. GroupShowUpdate=1;
  112. }
  113. if(GroupShowUpdate){
  114. GuiClearRect(x,y,160,y+19);//18
  115. GuiClearRect(x,y+18,160,y+19);//18
  116. if(sutPocStatus.danHunStatus==0&&sutPocStatus.SOS_Flag==0)
  117. {
  118. GuiShowBmp(x+5,y+4,"Group2.bmp");
  119. }else if(sutPocStatus.SOS_Flag==1) GuiShowBmp(x+5,y+4,"SOS.bmp");//GuiShowStr(x,y+4,"模式:",0x01);
  120. else{
  121. GuiShowBmp(x+5,y+4,"Onecall.bmp");
  122. }
  123. GuiShowBmp(x+5,y+4+18,"people2.bmp");
  124. StrIntercept(name,scNameGroup,sizeof(name));
  125. /**************英文 位置不同*********************************/
  126. if(0==strcmp(sutProductPara.Language,"en")){
  127. if(sutPocStatus.SOS_Flag==1){
  128. GuiShowStr(x+30,y+4,name,0x11);//48
  129. }
  130. }
  131. if(sutPocStatus.danHunStatus==0)GuiShowStr(x+30,y+4,name,0x11);//0x01
  132. else {
  133. memset(name,0,sizeof( name));
  134. strcpy(name,sutPocStatus.Callname); //
  135. GuiShowStr(x+30,y+4,name,0x11);///
  136. }
  137. SlwTrace(INF,name,1);
  138. StrIntercept(name,scNameUser,sizeof(name));
  139. //GuiShowStr(x+30,y+4+18,name,0x01);
  140. GuiShowStr(x+30,y+4+18,name,0x11);
  141. if(sutPocStatus.danHunStatus==2){
  142. if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStrM20(127,111,"挂断",0x11,COLOR_WHITE,OrangeColorId);//135 113
  143. else GuiShowStrM20(105,111,"HangUp",0x11,COLOR_WHITE,OrangeColorId);//113
  144. }else if(sutPocStatus.danHunStatus==0){
  145. GuiClearAreaFixColor(100,111,60,18,OrangeColorId);
  146. }
  147. //sutPocStatus.statusChaned=1;
  148. }
  149. GroupShowUpdate=0;
  150. //sutPocStatus.statusChaned=1;
  151. }
  152. void ShowCallUserName(u16 x,u16 y)
  153. {
  154. static char scName[POC_USER_NAME_LEN];
  155. char name[POC_USER_NAME_LEN];
  156. uint8_t thisName;
  157. static uint8_t siCt=0;
  158. if(siCt==0||siCt==20||siCt==40 || siCt==60||siCt==80||siCt==100)
  159. {
  160. if(strncmp(scName, sutPocStatus.Callname,sizeof(scName)) != 0 ||
  161. strncmp(scName, sutPocStatus.Callname,sizeof(sutPocStatus.Callname))!=0 ||
  162. sutPocStatus.statusChaned)
  163. {//当名字变更后,刷新
  164. //GuiClearRect(x+30,y,159,y+18);
  165. GuiClearArea(x+30,y,124,18);
  166. memcpy(scName,sutPocStatus.Callname,sizeof(sutPocStatus.Callname));
  167. sutPocStatus.statusChaned=0;
  168. // SlwTrace(INF,"------------------\r\n",1);
  169. // printf("-------------suct=%d\r\n",siCt);
  170. }
  171. StrIntercept(name,scName,sizeof(name));
  172. GuiShowStrM20(x+30,y,sutPocStatus.Callname,0x11,BlueColorId,COLOR_WHITE);
  173. }
  174. if(++siCt>100) siCt=0;
  175. }
  176. /**********************************************************
  177. 显示主界面
  178. ************************************************************/
  179. void UIShowMainInterface(int StatusUpdate)
  180. {
  181. int Flag;//主界面状态:0--未登录 1--无人说话 2--本机说话 3--对方说话
  182. static int siLastFlag=-1;//上一个Flag状态值
  183. static int siCt=0;
  184. char info[20];
  185. static unsigned char lastLoginResult=0xff;
  186. if(StatusUpdate){
  187. GuiClearAllM20();
  188. siLastFlag=-1;
  189. siCt=0;
  190. ShowStatusBar(StatusUpdate);
  191. if(0==strcmp(sutProductPara.Language,"cn"))
  192. {
  193. GuiShowStr(0,111,"菜单 ",0x11);//113
  194. GuiReverseRect(0,110,160,18);//测试
  195. }else{
  196. GuiShowStr(1,111,"Menu ",0x11);///test
  197. GuiReverseRect(0,110,160,18);//测试
  198. }
  199. if(1==sutPocStatus.Logined) ShowGroupAndUserNameM20(0,19,1);
  200. return;
  201. }
  202. if(Ui_LockFlag==1){
  203. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("请先解锁!");
  204. else ShowMessageBox("Please unlock");
  205. os_dly_wait(50);
  206. GuiClearRect(0,LCD_HEIGHT/2-20,159,LCD_HEIGHT/2+20);
  207. if(1==sutPocStatus.Logined) ShowGroupAndUserNameM20(0,19,1);
  208. }
  209. //======以下持续调用,以便动态更新信息==========
  210. //----顶部显示状态栏-----------
  211. ShowStatusBar(StatusUpdate);
  212. //-----登陆状态标志更新--------
  213. if(0==sutPocStatus.Logined){//未登录时,显示LOGO
  214. Flag=0;
  215. }else if(sutPocStatus.Speaker==0 && sutPocStatus.PPTpress==0){//对方未说话,本机未说话
  216. Flag=1;
  217. siCt1=0;
  218. }else if(sutPocStatus.Speaker==0 && sutPocStatus.PPTpress==1){//对方未说话,本机说话
  219. Flag=2;
  220. }else if(sutPocStatus.Speaker>0){//对方说话了
  221. Flag=3;
  222. }
  223. //-------中间图片显示-------
  224. switch(Flag){
  225. case 0://未登录
  226. if(Flag!=siLastFlag||Ui_LockFlag==1){
  227. GuiClearRect(0,19,159,19+59);
  228. GuiShowBmp(30,19,"logo.bmp"); //38
  229. Ui_LockFlag=0;
  230. }
  231. break;
  232. case 1://已登录,但无人说话
  233. if(Flag!=siLastFlag||Ui_LockFlag==1){
  234. GuiClearRect(36,60,159,60+18); //38+59
  235. if(0==strcmp(sutProductPara.Language,"cn")) {
  236. GuiShowBmp(5,60,"Phone.bmp");
  237. GuiShowStr(30,60,"空闲",0x11);
  238. }else {
  239. GuiShowBmp(5,60,"Phone.bmp");
  240. GuiShowStr(30,60,"Free",0x11);
  241. }
  242. // sutPocStatus.statusChaned = 1;
  243. Ui_LockFlag=0;
  244. }
  245. break;
  246. case 2://已登录,本机说话
  247. if(Flag!=siLastFlag||Ui_LockFlag==1){
  248. //GuiClearRect(36,60,159,60+18);//38+59
  249. GuiClearRect(0,60,159,60+18);//38+59
  250. if(0==strcmp(sutProductPara.Language,"cn")){
  251. //GuiShowBmp(5,60,"Phone.bmp");
  252. GuiShowBmp(5,60,"Csend.bmp");
  253. if(sutPocStatus.SOS_Flag==0) GuiShowStrM20(30,60,"本机在讲话",0x11,RedColorId,COLOR_WHITE);
  254. else GuiShowStrM20(30,60,"按PTT退出SOS",0x11,RedColorId,COLOR_WHITE);
  255. }else{
  256. //GuiShowBmp(5,60,"Phone.bmp");
  257. GuiShowBmp(5,60,"Csend.bmp");
  258. if(sutPocStatus.SOS_Flag==0)GuiShowStrM20(30,60,"Native",0x11,RedColorId,COLOR_WHITE);
  259. else GuiShowStrM20(30,60,"Press PTT Exit",0x11,RedColorId,COLOR_WHITE);
  260. }
  261. sutPocStatus.statusChaned = 1;
  262. Ui_LockFlag=0;
  263. }
  264. break;
  265. case 3://已登录,对方说话
  266. if(Flag!=siLastFlag||Ui_LockFlag==1){
  267. //GuiShowBmp(5,60,"Phone.bmp");
  268. GuiShowBmp(5,60,"Creceive.bmp");
  269. sutPocStatus.statusChaned = 1;
  270. Ui_LockFlag=0;
  271. }
  272. // //显示对方名字
  273. ShowCallUserName(0,60); //18
  274. break;
  275. }
  276. //------群组、用户显示--------
  277. if(Flag>0){//已登陆
  278. // if(siCt==0 || siCt==100 || siCt==200){//每秒刷一次,以便及时更新。刷太快也影响
  279. if(Flag!=siLastFlag && siLastFlag==0)
  280. {
  281. ShowGroupAndUserNameM20(0,19,1);
  282. }else
  283. {
  284. ShowGroupAndUserNameM20(0,19,0);
  285. }
  286. }else{//未登陆
  287. if(lastLoginResult != sutPocStatus.loginResult || siLastFlag==-1)
  288. {
  289. lastLoginResult=sutPocStatus.loginResult;
  290. if(lastLoginResult==1) snprintf(info, sizeof(info), "账号信息错误");
  291. else if(lastLoginResult==2) snprintf(info, sizeof(info), "无网络连接 ");
  292. else if(lastLoginResult==4){
  293. if(0==strcmp(sutProductPara.Language,"cn")) snprintf(info, sizeof(info), "请插卡 ");
  294. else {
  295. snprintf(info, sizeof(info), "No Card");
  296. }
  297. }
  298. else if(lastLoginResult==5) snprintf(info, sizeof(info), "无法连接");
  299. else if(lastLoginResult==6) snprintf(info, sizeof(info), "没有服务");
  300. else goto NEXT_STEP;
  301. GuiShowStr(0,38,info,0x11);
  302. }
  303. if(0==strcmp(sutProductPara.Language,"cn")) {
  304. memset(info, ' ',sizeof(info));
  305. memcpy(info, "正在登陆.", 9);
  306. if(0==siCt)
  307. {
  308. GuiShowStr(0,19,info,0x11);
  309. }
  310. else if(100==siCt)
  311. {
  312. info[9]='.';
  313. GuiShowStr(0,19,info,0x11);
  314. }
  315. else if(200==siCt)
  316. {
  317. info[9]='.';info[10]='.';
  318. GuiShowStr(0,19,info,0x11);
  319. }
  320. }else{
  321. memset(info, ' ',sizeof(info));
  322. memcpy(info, "Loging.", 7);
  323. if(0==siCt)
  324. {
  325. GuiShowStr(0,19,info,0x11);
  326. }
  327. else if(100==siCt)
  328. {
  329. info[7]='.';
  330. GuiShowStr(0,19,info,0x11);
  331. }
  332. else if(200==siCt)
  333. {
  334. info[7]='.';info[8]='.';
  335. GuiShowStr(0,19,info,0x11);
  336. }
  337. }
  338. }
  339. NEXT_STEP:
  340. if(++siCt>=300)siCt=0;
  341. if(Flag!=siLastFlag){//状态变化 才更新 分页
  342. siLastFlag=Flag;
  343. siCt=0;
  344. }
  345. }
  346. void UI_Init(void)
  347. {
  348. memset(&sutUIstatus,0,sizeof(SUT_UI_STATUS));
  349. UISetNextStatus(UIS_STANDBY);
  350. }
  351. /******************************************************
  352. UIShowMenuMain
  353. 显示主菜单
  354. *******************************************************/
  355. SUT_MENU sutMenuMain;
  356. void UIShowMenuMain(int update)
  357. {
  358. char**p=NULL;
  359. static const char *apcMenuMain[]={
  360. "群组选择",
  361. "成员选择",
  362. "LCD设置",
  363. //"语音记录",
  364. "系统设置",
  365. "终端信息",
  366. //"固件升级",
  367. ""
  368. };
  369. static const char *apcMenuMainEn[]={
  370. "Group Option",
  371. "Member Option",
  372. //"Voice record",
  373. "System Set",
  374. "Device Info",
  375. //"HARD UPDATE ",
  376. ""
  377. };
  378. if(0==strcmp(sutProductPara.Language,"cn"))
  379. {
  380. p=apcMenuMain;
  381. }else{
  382. p=apcMenuMainEn;
  383. }
  384. if(update){
  385. GuiClearAll();
  386. if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("主菜单",3); //0的话有点靠顶
  387. else ShowCaption("Menu",3);
  388. GuiDrawHLine(0,159,20,1);
  389. MenuInit(&sutMenuMain,p);
  390. return;
  391. }
  392. //如果有需要持续调用,则在以下添加代码
  393. }
  394. /******************************************************
  395. 工厂菜单
  396. *******************************************************/
  397. void UIShowFactoryMenu(int update)
  398. {
  399. char**p=NULL;
  400. static const char *apcMenuMain[]={
  401. "GPS测试",
  402. "按键测试",
  403. "LCD测试",
  404. "LED测试",
  405. "电压值",
  406. "综测",
  407. ""
  408. };
  409. p=apcMenuMain;
  410. if(update){
  411. GuiClearAll();
  412. ShowCaption("工厂模式",3); //0的话有点靠顶
  413. GuiDrawHLine(0,159,20,1);
  414. MenuInit(&sutMenuMain,p);
  415. return;
  416. }
  417. //如果有需要持续调用,则在以下添加代码
  418. }
  419. /******************************************************
  420. UIShowMenuSysSetup
  421. 系统设置菜单
  422. *******************************************************/
  423. //SUT_MENU sutMenuSysSetup;
  424. void UIShowMenuSysSetup(int update)
  425. {
  426. char **p=NULL;
  427. static const char *apcMenuSysSetup[]={
  428. //"语种选择",
  429. //"APN设置",
  430. //"北斗设置",
  431. //"LCD设置",
  432. //"网络设置",
  433. //"低功耗设置",
  434. "按键音设置",
  435. "PTT提示音",
  436. //"功放模式设置",
  437. //"快捷界面设置",
  438. "对讲版本升级",
  439. "USB调试",
  440. "固件升级",
  441. ""
  442. };
  443. static const char *apcMenuSysSetupEn[]={
  444. //"Languages Set",
  445. //"APN设置",
  446. //"GPS Set",
  447. //"LCD Set",
  448. //"NET Set",
  449. //"LowConsumption",
  450. "KeySound Set",
  451. "PttTone Set",
  452. //"AWMode Set",
  453. "Fast Interface",
  454. "System Update",
  455. "USB debug",
  456. "HARD Update",
  457. ""
  458. };
  459. if(0==strcmp(sutProductPara.Language,"cn")) p=apcMenuSysSetup;
  460. else p=apcMenuSysSetupEn;
  461. if(update){
  462. GuiClearAll();
  463. if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("系统设置",3); //0
  464. else ShowCaption("System Set",3);
  465. GuiDrawHLine(0,159,20,1);
  466. MenuInit(&sutMenuSysSetup,p);
  467. return;
  468. }
  469. }
  470. void UIShowGroupSel(int update)
  471. {
  472. static unsigned short susCt=0;
  473. unsigned short timeout;
  474. if(update){
  475. if(sutPocStatus.Logined == 0)//not login
  476. {
  477. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox(" 请先登录... ");
  478. else ShowMessageBox("Please login first... ");
  479. timeout=50;
  480. while(timeout--)OsDelayTime(1);
  481. UISetNextStatus(UIS_STANDBY);
  482. return;
  483. }else if(sutPocStatus.danHunStatus==2){
  484. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("单呼禁止操作!");
  485. else ShowMessageBox("Can't do that");
  486. timeout=50;
  487. while(timeout--)
  488. OsDelayTime(1);
  489. UISetNextStatus(UIS_STANDBY);
  490. return;
  491. }
  492. SimpleGroupInfoScan(1, 1);
  493. susCt=0;
  494. GuiClearAll();
  495. if(0==strcmp(sutProductPara.Language,"cn")){
  496. if(sutPocStatus.recordflag==1)ShowCaption("群组语音",3); //0
  497. else ShowCaption("群组选择",3);
  498. }
  499. else{
  500. if(sutPocStatus.recordflag==1)ShowCaption("Group Voice",3); //0
  501. else ShowCaption("Group Selection",3); //0
  502. }
  503. GuiDrawHLine(0,159,20,1);
  504. ReFlashItem2();
  505. GuiDrawHLine(0,159,104,1);
  506. return;
  507. }
  508. //按键提示
  509. if(susCt==0){
  510. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
  511. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  512. }else if(susCt==200){
  513. if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(0,110,"[M]确定 [EXIT]退出",0x01);
  514. else GuiShowStr(0,110,"[M]OK [EXIT]",0x01);
  515. }
  516. if(++susCt>=400)susCt=0;
  517. }
  518. void ReFlashItem(void)
  519. {
  520. //char buf[100];
  521. static unsigned short susCt=0;
  522. static const char *accIconFileName[]={
  523. "people2.bmp",
  524. "people2.bmp",
  525. "people1.bmp",
  526. ""
  527. };
  528. int i;
  529. unsigned short timeout;
  530. static char NullUser=0;
  531. static char *UsersName[POC_ALL_USERS_NUM+1]; //5
  532. static char UserFeatures[POC_ALL_USERS_NUM+1];//5
  533. //----------------------------
  534. for(i=0;i<=POC_ALL_USERS_NUM;i++){
  535. UsersName[i]=&NullUser;
  536. UserFeatures[i]=0;
  537. }
  538. for(i=0;i<sutPocStatus.FillUserIndex;i++)
  539. {
  540. if(strcmp(sutPocStatus.LocalUser.name,sutPocStatus.AllUsers[i].name)==0){
  541. UserFeatures[i]=1;
  542. }else UserFeatures[i]=2;//sutPocStatus.AllUsers[i].status-1;
  543. UsersName[i]=sutPocStatus.AllUsers[i].name;
  544. }
  545. if(sutPocStatus.UserOnLineNum==0)
  546. {
  547. UsersName[0]="空";
  548. UserFeatures[i]=0;
  549. }
  550. //初始化ListBox控件
  551. ListBoxInit(&sutListBox,UsersName,0,accIconFileName,UserFeatures);
  552. }
  553. void ReFlashItem2(void)
  554. {
  555. //char buf[100];
  556. static unsigned short susCt=0;
  557. static const char *accIconFileName[]={
  558. "Group2.bmp",
  559. "Group2.bmp",
  560. "Group1.bmp",
  561. ""
  562. };
  563. int i;
  564. unsigned short timeout;
  565. static char NullUser=0;
  566. static char *GroupsName[POC_ALL_GROUPS_NUM+1]; //5
  567. static char GroupFeatures[POC_ALL_GROUPS_NUM+1];//5
  568. //----------------------------
  569. for(i=0;i<=POC_ALL_GROUPS_NUM;i++){
  570. GroupsName[i]=&NullUser;
  571. GroupFeatures[i]=0;
  572. }
  573. for(i=0;i<sutPocStatus.FillGroupIndex;i++)
  574. {
  575. if(strcmp(sutPocStatus.LocalGroup.name,sutPocStatus.AllGroups[i].name)==0) {
  576. GroupFeatures[i]=1;
  577. }else GroupFeatures[i]=2;
  578. GroupsName[i]=sutPocStatus.AllGroups[i].name;
  579. }
  580. if(sutPocStatus.GroupOnLineNum==0)
  581. {
  582. GroupsName[0]="空";
  583. GroupFeatures[i]=0;
  584. }
  585. //初始化ListBox控件
  586. ListBoxInit(&sutListBox,GroupsName,0,accIconFileName,GroupFeatures);
  587. }
  588. void ReFlashItemVoice(void)
  589. {
  590. static unsigned short susCt=0;
  591. static const char *accIconFileNameM20[]={
  592. "voice1.bmp",
  593. "voice2.bmp",
  594. "voice2.bmp",
  595. ""
  596. };
  597. int i;
  598. unsigned short timeout;
  599. static char NullVoice=0;
  600. static char *VoicesName[POC_ALL_VOICES_NUM+1]; //5
  601. static char VoiceFeatures[POC_ALL_VOICES_NUM+1];//5
  602. static char Voicetime[POC_ALL_VOICES_NUM+1];
  603. //----------------------------
  604. for(i=0;i<=POC_ALL_VOICES_NUM;i++){
  605. VoicesName[i]=&NullVoice;
  606. VoiceFeatures[i]=0;
  607. //Voicetime[i]=0;
  608. }
  609. for(i=0;i<sutPocStatus.FillVoiceIndex;i++)
  610. {
  611. VoiceFeatures[i]= !sutPocStatus.AllVoices[sutPocStatus.FillVoiceIndex-i-1].type;
  612. VoicesName[i]=sutPocStatus.AllVoices[sutPocStatus.FillVoiceIndex-i-1].name;
  613. Voicetime[i]=sutPocStatus.AllVoices[sutPocStatus.FillVoiceIndex-i-1].time;
  614. }
  615. if(sutPocStatus.VoiceOnLineNum==0)
  616. {
  617. VoicesName[0]="空";
  618. VoiceFeatures[i]=0;
  619. Voicetime[i]=0;
  620. }
  621. if(sutPocStatus.VoiceOnLineNum==0)sutListBox.handle=0;
  622. else sutListBox.handle=sutPocStatus.FillVoiceIndex-1;
  623. if(lastOption){
  624. sutListBox.handle=0;
  625. lastOption=0;
  626. }
  627. //初始化ListBox控件
  628. ListBoxInitM20(&sutListBox,VoicesName,0,accIconFileNameM20,VoiceFeatures,Voicetime);
  629. }
  630. /******************************************************
  631. UIShowUserSel
  632. 用户选择
  633. *******************************************************/
  634. void UIShowUserSel(int update)
  635. {
  636. static unsigned short susCt=0;
  637. unsigned short timeout;
  638. if(update){
  639. if(sutPocStatus.Logined == 0)//not login
  640. {
  641. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox(" 请先登录... ");
  642. else ShowMessageBox(" Please login first...");
  643. timeout=50;
  644. while(timeout--)
  645. OsDelayTime(1);
  646. UISetNextStatus(UIS_STANDBY);
  647. return;
  648. }else if(sutPocStatus.danHunStatus==2||sutPocStatus.Speaker!=0){
  649. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("禁止操作!");
  650. else ShowMessageBox("Can't do that");
  651. timeout=50;
  652. while(timeout--)
  653. OsDelayTime(1);
  654. UISetNextStatus(UIS_MENU_MAIN);
  655. return;
  656. }
  657. SimpleUserInfoScan(1, 1);
  658. susCt=0;
  659. GuiClearAll();
  660. if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("用户选择",3); //0
  661. else ShowCaption("User Selection",3);
  662. GuiDrawHLine(0,159,20,1);
  663. ReFlashItem();
  664. GuiDrawHLine(0,159,104,1);
  665. return;
  666. }
  667. //按键提示
  668. if(susCt==0&& sutPocStatus.danHunStatus!=1){
  669. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
  670. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  671. }else if(susCt==200 && sutPocStatus.danHunStatus!=1){
  672. if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(0,110,"[M]单呼 [EXIT]退出",0x01);
  673. else GuiShowStr(0,110,"[M]Call [EXIT]",0x01);
  674. }
  675. if(++susCt>=400)susCt=0;
  676. }
  677. /******************************************************
  678. 语音记录
  679. *******************************************************/
  680. void UIShowVoiceShow(int update)
  681. {
  682. static unsigned short susCt=0;
  683. unsigned short timeout;
  684. if(update){
  685. if(sutPocStatus.Logined == 0)//not login
  686. {
  687. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox(" 请先登录... ");
  688. else ShowMessageBox(" Please login first...");
  689. timeout=50;
  690. while(timeout--)
  691. OsDelayTime(1);
  692. UISetNextStatus(UIS_STANDBY);
  693. return;
  694. }else if(sutPocStatus.danHunStatus==2||sutPocStatus.Speaker!=0){
  695. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("禁止操作!");
  696. else ShowMessageBox("Can't do that");
  697. timeout=50;
  698. while(timeout--)
  699. OsDelayTime(1);
  700. UISetNextStatus(UIS_MENU_MAIN);
  701. return;
  702. }
  703. SimpleVoiceInfoScan(1,1);
  704. susCt=0;
  705. GuiClearAll();
  706. if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("语音记录",3); //0
  707. else ShowCaption("voice record",3);
  708. GuiDrawHLine(0,159,20,1);
  709. ReFlashItemVoice();
  710. GuiDrawHLine(0,159,104,1);
  711. return;
  712. }
  713. //按键提示
  714. if(susCt==0){
  715. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
  716. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  717. }else if(susCt==200){
  718. if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(0,110,"[M]播放 [EXIT]退出",0x01);
  719. else GuiShowStr(0,110,"[M]PLAY [EXIT]",0x01);
  720. }
  721. if(++susCt>=400)susCt=0;
  722. }
  723. /******************************************************
  724. UIShowInformation
  725. 用户选择
  726. *******************************************************/
  727. void UIShowInformation(int update)
  728. {
  729. u16 x,y;
  730. char temp[20];
  731. char buf[50];
  732. static unsigned char flag=0;
  733. if(update)
  734. {
  735. flag=0;
  736. GuiClearAll();
  737. if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("终端信息",3); //0
  738. else ShowCaption("Device Info",3); //0
  739. GuiDrawHLine(0,159,20,1);
  740. }
  741. x=2,y=22;
  742. if(update||KEY_PANEL_UP == g_ulKeyValue &&flag==0)
  743. {
  744. g_ulKeyValue = 0;
  745. // if(flag==0 || flag==2)
  746. // {
  747. //显示PSN
  748. GuiClearRect(0,y,LCD_WIDTH-1,LCD_HEIGHT-1);
  749. //终端型号
  750. if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"终端型号:%s",sutProductPara.ProductName);
  751. else snprintf(buf, sizeof(buf),"Device Name:%s",sutProductPara.ProductName);
  752. GuiShowStr(x,y,buf,0x01);
  753. y+=20;
  754. //终端编码
  755. if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"ID:%s",sutProductPara.IMEI);
  756. else snprintf(buf, sizeof(buf),"ID:%s",sutProductPara.IMEI);
  757. GuiShowStr(x,y,buf,0x01);
  758. y+=20;
  759. //应用版本号
  760. if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"应用版本:V%d.%d",sutProductPara.ProductVersion,INTER_VER);
  761. else snprintf(buf, sizeof(buf),"MCU Ver:V%d.%d",sutProductPara.ProductVersion,INTER_VER);
  762. GuiShowStr(x,y,buf,0x01);
  763. y+=20;
  764. //对讲版本号
  765. if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"对讲版本:%s",g_iPocVer);
  766. else snprintf(buf, sizeof(buf),"POC Ver:%s",g_iPocVer);
  767. GuiShowStr(x,y,buf,0x01);
  768. y+=20;
  769. memset(buf,sizeof(buf),0);
  770. if(Modem_type==Un_KnownModem){
  771. if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf,sizeof(buf),"模块类型:未知");
  772. else snprintf(buf,sizeof(buf),"Module:Unknown");
  773. }
  774. else if(Modem_type==USA_Modem)
  775. {
  776. if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf,sizeof(buf),"模块类型:美版");
  777. else snprintf(buf,sizeof(buf),"Module:US");
  778. }
  779. else if(Modem_type==Europe_Modem) {
  780. if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf,sizeof(buf),"模块类型:欧版");
  781. else snprintf(buf,sizeof(buf),"Module:EU");
  782. }
  783. //snprintf(buf, sizeof(buf),"模块类型:%s",buf);
  784. GuiShowStr(x,y,buf,0x01);
  785. flag=2;
  786. }else if(KEY_PANEL_DOWN == g_ulKeyValue && flag==2)
  787. {
  788. g_ulKeyValue=0;
  789. GuiClearRect(0,y,LCD_WIDTH-1,LCD_HEIGHT-1);
  790. // HardRevision
  791. if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"固件版本:");
  792. else snprintf(buf, sizeof(buf),"HardRevision:");
  793. GuiShowStr(x,y,buf,0x01);
  794. y+=20;
  795. strncpy(temp,HardRevision,sizeof(temp));
  796. GuiShowStr(x,y,temp,0x01);
  797. snprintf(buf, sizeof(buf),"%s",&HardRevision[19]);
  798. y+=20;
  799. GuiShowStr(x,y,buf,0x01);
  800. flag=0;
  801. // g_ulKeyValue=0;
  802. // if(flag==1 || flag==2)
  803. // {
  804. // //显示IP
  805. // GuiClearRect(0,y,LCD_WIDTH-1,LCD_HEIGHT-1);
  806. // //交换IP
  807. // GuiShowStr(x,y,"交换服务器:",0x01);
  808. // y+= 20;
  809. // snprintf(buf, sizeof(buf),"%s",sutProductPara.PIP);
  810. // GuiShowStr(x,y,buf,0x01);
  811. // y+=20;
  812. // //GPS IP
  813. // GuiShowStr(x,y,"北斗服务器:",0x01);
  814. // y+= 20;
  815. // snprintf(buf, sizeof(buf),"%s",sutProductPara.GIP);
  816. // GuiShowStr(x,y,buf,0x01);
  817. // y+=20;
  818. // snprintf(buf, sizeof(buf),"PORT:%d",sutProductPara.GpsPort);
  819. // GuiShowStr(x,y,buf,1);
  820. // flag=0;
  821. // }
  822. }
  823. }
  824. /******************************************************
  825. UI_Loop
  826. UI循环调用,需要在MainTask的主循环中持续调用,及时处理状态发生变化时的UI显示
  827. 此处按下OK键显示里面内容
  828. *******************************************************/
  829. void UI_Loop(void)
  830. {
  831. int StatusUpdate;
  832. if(fota_update.NewPocFlag==1)
  833. {//显示正在升级;
  834. UISetNextStatus(UIS_UPDATA_SHOW);
  835. }
  836. if(sutUIstatus.Status!=sutUIstatus.NextStatus){//状态发生变更
  837. sutUIstatus.LastStatus=sutUIstatus.Status;
  838. sutUIstatus.Status=sutUIstatus.NextStatus;
  839. StatusUpdate=1;
  840. }else{//状态没有发生变更
  841. StatusUpdate=0;
  842. }
  843. switch(sutUIstatus.Status){
  844. case UIS_STANDBY:
  845. Init_stack(&UI_Stack);//UI 返回栈
  846. UIShowMainInterface(StatusUpdate);
  847. sutUIstatus.LastHandle=0;
  848. sutUIstatus.LastPage=0;
  849. break;
  850. case UIS_MENU_MAIN:
  851. UIShowMenuMain(StatusUpdate);
  852. break;
  853. case UIS_MENU_USER_SEL:
  854. UIShowUserSel(StatusUpdate);
  855. break;
  856. case UIS_MENU_GROUP_SEL:
  857. UIShowGroupSel(StatusUpdate);
  858. break;
  859. case UIS_MAIL_BOX:
  860. UIShowMailBox(StatusUpdate);
  861. break;
  862. case UIS_MENU_SYS_SET:
  863. UIShowMenuSysSetup(StatusUpdate);
  864. break;
  865. case UIS_MENU_INFO:
  866. UIShowInformation(StatusUpdate);
  867. break;
  868. case UIS_MESSAGE_OPTION:
  869. MessageOptionShow(StatusUpdate);
  870. break;
  871. case UIS_MESSAGE_READ:
  872. MessageReadShow(StatusUpdate);
  873. break;
  874. case UIS_MESSAGE_DELE:
  875. MessageDeletShow(StatusUpdate);
  876. break;
  877. case UIS_MESSAGE_FORMAT:
  878. MessageFormatShow(StatusUpdate);
  879. break;
  880. case UIS_SET_APN:
  881. SetAPNShow(StatusUpdate);
  882. break;
  883. case UIS_APN_DETAIL:
  884. SetApnDetailShow(StatusUpdate);
  885. break;
  886. case UIS_SET_GPS:
  887. SetGPSShow(StatusUpdate);
  888. break;
  889. case UIS_SET_LCD:
  890. SetLCDShow(StatusUpdate);
  891. break;
  892. ////////////////////////////
  893. case UIS_SET_NET:
  894. SetNetModeShow(StatusUpdate);
  895. break;
  896. ///////////////////////////
  897. case UIS_UP_APPRICATION_VER:
  898. SetUpAppricationVerShow(StatusUpdate);
  899. break;
  900. case UIS_UP_APP_PENDING:
  901. SetUpAppricationVerPending();
  902. break;
  903. case UIS_UP_INTERCOM_VER:
  904. SetUpIntercomVerShow(StatusUpdate);
  905. break;
  906. case UIS_UPDATA_SHOW:
  907. Fota_Update_Show(StatusUpdate);
  908. break;
  909. case UIS_SET_LANGUAGE:
  910. SetLanguageShow(StatusUpdate);
  911. break;
  912. case UIS_Voice_Record:
  913. UIShowVoiceShow(StatusUpdate);
  914. break;
  915. case UIS_SET_KEYSound:
  916. SetKeySoundShow(StatusUpdate);
  917. break;
  918. case UIS_START_INFOSET:
  919. SetStartInfoShow(StatusUpdate);
  920. break;
  921. case UIS_FASTINTERFACE:
  922. SetFastInterfaceModeShow(StatusUpdate);
  923. break;
  924. case UIS_AWMODESET:
  925. SetAwModeShow(StatusUpdate);
  926. break;
  927. case UIS_LOW_CONSUMPTION:
  928. SetLowConsumptionModeShow(StatusUpdate);
  929. break;
  930. case UIS_FACTORY_MENU:
  931. UIShowFactoryMenu(StatusUpdate);
  932. break;
  933. case UIS_WAIT_ONECALL:
  934. WaitOneCallShow(StatusUpdate);
  935. break;
  936. case UIS_FACTORY_KEY:
  937. SetFactory_KeyShow(StatusUpdate);
  938. break;
  939. case UIS_FACTORY_LCD:
  940. SetFactory_LCDShow(StatusUpdate);
  941. break;
  942. case UIS_FACTORY_LED:
  943. SetFactory_LEDShow(StatusUpdate);
  944. break;
  945. case UIS_FACTORY_VBAT:
  946. SetFactory_VBATShow(StatusUpdate);
  947. break;
  948. case UIS_SET_PTTTONE:
  949. SetPttToneModeShow(StatusUpdate);
  950. break;
  951. case UIS_SET_ADB:
  952. SetADBDebugShow(StatusUpdate);
  953. break;
  954. case UIS_SET_BOOT:
  955. SetBOOTDebugShow(StatusUpdate);
  956. break;
  957. case UIS_POWEROFF:
  958. PowerOffShow(StatusUpdate);
  959. break;
  960. case UIS_BOOTUPATE_SHOW:
  961. BootUptating(StatusUpdate);
  962. break;
  963. }
  964. }
  965. /******************************************************
  966. UI_Key
  967. 按键处理
  968. *******************************************************/
  969. void UI_Key(void)
  970. {
  971. char buf[100];
  972. unsigned long key;
  973. int i,temp;
  974. if(LcdSleepFlag==1){
  975. LcdSleepFlag=0;
  976. return;
  977. }
  978. switch(sutUIstatus.Status){
  979. case UIS_STANDBY://----待机界面---
  980. switch(g_ulKeyValue){
  981. // case KEY_PANEL_MENU:
  982. // if(g_uslockflag==1)return;
  983. // UISetNextStatus(UIS_MENU_MAIN);
  984. // break;
  985. case KEY_PANEL_EXIT:
  986. if(g_uslockflag==1)return;
  987. if(sutPocStatus.danHunStatus==2){
  988. snprintf(buf,sizeof(buf),"AT+POC=540&2&%d\r\n",sutPocStatus.CallID);
  989. ModemSendAT(buf);
  990. }else {
  991. // if(LastLcdSleepFlag==0){
  992. // LCDTimeOut(1);
  993. // sutLcdParam.OnTimeCt=g_ausTimeOut[sutProductPara.LCDSetIndex];
  994. // }
  995. // else {
  996. // LCDTimeOut(0);
  997. // sutLcdParam.OnTimeCt=0;
  998. // }
  999. }
  1000. break;
  1001. case KEY_PANEL_UP:
  1002. sutUIstatus.ShortCut=1;
  1003. UISetNextStatus(UIS_MENU_GROUP_SEL);
  1004. break;
  1005. case KEY_PANEL_DOWN:
  1006. sutUIstatus.ShortCut=1;
  1007. UISetNextStatus(UIS_MENU_USER_SEL);
  1008. break;
  1009. }
  1010. break;
  1011. case UIS_MENU_MAIN://----主菜单----
  1012. key=MenuResponse(&sutMenuMain);
  1013. if(KEY_PANEL_MENU==key){
  1014. switch(sutMenuMain.handle){
  1015. case 0://群组选择
  1016. UISetNextStatus(UIS_MENU_GROUP_SEL);
  1017. break;
  1018. case 1://成员选择
  1019. UISetNextStatus(UIS_MENU_USER_SEL);
  1020. break;
  1021. // case 2://语音记录
  1022. // sutPocStatus.recordflag=1; //语音记录先进群组
  1023. // UISetNextStatus(UIS_MENU_GROUP_SEL);
  1024. break;
  1025. case 2:
  1026. UISetNextStatus(UIS_SET_LCD);
  1027. break;
  1028. case 3://系统设置
  1029. UISetNextStatus(UIS_MENU_SYS_SET);
  1030. break;
  1031. case 4://终端信息
  1032. UISetNextStatus(UIS_MENU_INFO);
  1033. break;
  1034. // case 4://固件升级
  1035. // UISetNextStatus(UIS_SET_BOOT);
  1036. // break;
  1037. }
  1038. PushUiStack(&UI_Stack,sutMenuMain.handle);
  1039. }
  1040. else if(KEY_PANEL_EXIT==key){
  1041. UISetNextStatus(UIS_STANDBY);
  1042. }
  1043. break;
  1044. case UIS_FACTORY_MENU:
  1045. key=MenuResponse(&sutMenuMain);
  1046. if(KEY_PANEL_MENU==key){
  1047. switch(sutMenuMain.handle){
  1048. case 0:
  1049. UISetNextStatus(UIS_SET_GPS);
  1050. GPS_PWREN_HIGH;
  1051. break;
  1052. case 1:
  1053. UISetNextStatus(UIS_FACTORY_KEY);
  1054. break;
  1055. case 2:
  1056. UISetNextStatus(UIS_FACTORY_LCD);
  1057. break;
  1058. case 3:
  1059. UISetNextStatus(UIS_FACTORY_LED);
  1060. break;
  1061. case 4:
  1062. UISetNextStatus(UIS_FACTORY_VBAT);
  1063. break;
  1064. }
  1065. PushUiStack(&UI_Stack,sutMenuMain.handle);
  1066. }
  1067. break;
  1068. case UIS_MENU_GROUP_SEL://-----群组选择-----
  1069. if(sutListBox.handle==0 &&(KEY_PANEL_UP==g_ulKeyValue) )
  1070. {
  1071. sutPocStatus.Page_Up=4;
  1072. if(sutPocStatus.handleIndex>0 && sutPocStatus.handleIndex<6){
  1073. sutPocStatus.handleIndex=0;
  1074. sutPocStatus.Page_Up=4;
  1075. }else if(sutPocStatus.handleIndex==0){
  1076. if(sutPocStatus.GroupOnLineNum%5==0){
  1077. sutPocStatus.handleIndex=sutPocStatus.GroupOnLineNum-5;
  1078. sutPocStatus.Page_Up=4;
  1079. }else {
  1080. sutPocStatus.handleIndex=sutPocStatus.GroupOnLineNum-sutPocStatus.GroupOnLineNum%5;
  1081. sutPocStatus.Page_Up=sutPocStatus.GroupOnLineNum%5-1;
  1082. }
  1083. }else{
  1084. sutPocStatus.handleIndex -=5;
  1085. sutPocStatus.Page_Up=4;
  1086. }
  1087. printf("sutPocStatus.handleIndex==%d\r\n",sutPocStatus.handleIndex);
  1088. SimpleGroupInfoScan(0,0);
  1089. ReFlashItem2();//指针会被重置到0位置
  1090. break;
  1091. }else if((sutListBox.handle+1) == sutListBox.itemnum && (KEY_PANEL_DOWN==g_ulKeyValue))
  1092. {
  1093. sutPocStatus.Page_Up=0;
  1094. if(sutPocStatus.GroupOnLineNum%5==0)sutPocStatus.Top_Index=5;
  1095. else sutPocStatus.Top_Index=sutPocStatus.GroupOnLineNum%5;
  1096. //最后一页
  1097. if(sutPocStatus.handleIndex==sutPocStatus.GroupOnLineNum-sutPocStatus.Top_Index){
  1098. sutPocStatus.handleIndex=0;
  1099. //sutPocStatus.Page_Up=sutPocStatus.handleIndex%5;
  1100. }else{
  1101. sutPocStatus.handleIndex+=5;
  1102. }
  1103. printf("sutPocStatus.handleIndex==%d\r\n",sutPocStatus.handleIndex);
  1104. if(sutPocStatus.handleIndex>sutPocStatus.GroupOnLineNum) sutPocStatus.handleIndex=0;
  1105. sutPocStatus.Page_Up=0;
  1106. SimpleGroupInfoScan(0,1);
  1107. ReFlashItem2();//指针会被重置到0位置
  1108. //reload down
  1109. break;
  1110. }
  1111. key=ListBoxResponse(&sutListBox);
  1112. if(KEY_PANEL_EXIT==g_ulKeyValue)
  1113. {
  1114. //lastOption=0;
  1115. sutPocStatus.Page_Up=0;
  1116. sutPocStatus.recordflag=0;
  1117. if(sutUIstatus.ShortCut==1){
  1118. sutUIstatus.ShortCut=0;
  1119. UISetNextStatus(UIS_STANDBY);
  1120. }else UISetNextStatus(UIS_MENU_MAIN);
  1121. }
  1122. else if(KEY_PANEL_MENU==key){
  1123. sutPocStatus.Page_Up=0;
  1124. g_cMenuBack=1;
  1125. //群组选择
  1126. ///////////////////////////////////////
  1127. if(0 == sutPocStatus.GroupOnLineNum)
  1128. {
  1129. break;
  1130. }
  1131. ///////////////////////////////////////
  1132. if(sutPocStatus.recordflag==1){
  1133. sutPocStatus.recordflag=0;
  1134. sutPocStatus.recordID=sutPocStatus.AllGroups[sutListBox.handle].ID;
  1135. UISetNextStatus(UIS_Voice_Record);
  1136. }else{
  1137. if(sutPocStatus.LocalGroup.ID==sutPocStatus.AllGroups[sutListBox.handle].ID)
  1138. {
  1139. if(0==strcmp(sutProductPara.Language,"cn"))sprintf(buf, "已经在此群组");
  1140. else sprintf(buf, "Already");
  1141. ShowMessageBox(buf);
  1142. OsDelayTime(100);
  1143. UISetNextStatus(sutUIstatus.LastStatus);
  1144. //UISetNextStatus(UIS_STANDBY);
  1145. break;
  1146. }
  1147. snprintf(buf, sizeof(buf),"AT+POC=529&%d\r\n",sutPocStatus.AllGroups[sutListBox.handle].ID);
  1148. ModemSendAT(buf);
  1149. SlwTrace(INF,buf,1);
  1150. if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf, sizeof(buf),"进入:%s",sutPocStatus.AllGroups[sutListBox.handle].name);
  1151. else snprintf(buf, sizeof(buf),"Enter:%s",sutPocStatus.AllGroups[sutListBox.handle].name);
  1152. ShowMessageBox(buf);
  1153. OsDelayTime(100);
  1154. UISetNextStatus(UIS_STANDBY);
  1155. }
  1156. }
  1157. break;
  1158. case UIS_MENU_USER_SEL://-----成员选择-----
  1159. if(sutListBox.handle==0 && KEY_PANEL_UP==g_ulKeyValue)
  1160. {
  1161. sutPocStatus.Page_Up=4;
  1162. if(sutPocStatus.handleIndex>0 && sutPocStatus.handleIndex<6){
  1163. sutPocStatus.handleIndex=0;
  1164. sutPocStatus.Page_Up=4;
  1165. }else if(sutPocStatus.handleIndex==0){
  1166. if(sutPocStatus.UserOnLineNum%5==0){
  1167. sutPocStatus.handleIndex=sutPocStatus.UserOnLineNum-5;
  1168. sutPocStatus.Page_Up=4;
  1169. }else {
  1170. sutPocStatus.handleIndex=sutPocStatus.UserOnLineNum-sutPocStatus.UserOnLineNum%5;
  1171. sutPocStatus.Page_Up=sutPocStatus.UserOnLineNum%5-1;
  1172. }
  1173. }else{
  1174. sutPocStatus.handleIndex -=5;
  1175. sutPocStatus.Page_Up=4;
  1176. }
  1177. printf("sutPocStatus.handleIndex==%d\r\n",sutPocStatus.handleIndex);
  1178. SimpleUserInfoScan(0,0);
  1179. ReFlashItem();//指针会被重置到0位置
  1180. //lastOption=1;
  1181. //reload up
  1182. break;
  1183. }else if((sutListBox.handle+1) == sutListBox.itemnum && (KEY_PANEL_DOWN==g_ulKeyValue))
  1184. {
  1185. sutPocStatus.Page_Up=0;
  1186. //sutPocStatus.handleIndex += sutListBox.itemnum-1; ///
  1187. if(sutPocStatus.UserOnLineNum%5==0)sutPocStatus.Top_Index=5;
  1188. else sutPocStatus.Top_Index=sutPocStatus.UserOnLineNum%5;
  1189. //最后一页
  1190. if(sutPocStatus.handleIndex==sutPocStatus.UserOnLineNum-sutPocStatus.Top_Index){
  1191. sutPocStatus.handleIndex=0;
  1192. //sutPocStatus.Page_Up=sutPocStatus.handleIndex%5;
  1193. }else{
  1194. sutPocStatus.handleIndex+=5;
  1195. }
  1196. printf("sutPocStatus.handleIndex==%d\r\n",sutPocStatus.handleIndex);
  1197. if(sutPocStatus.handleIndex>sutPocStatus.UserOnLineNum) sutPocStatus.handleIndex=0;
  1198. SimpleUserInfoScan(0,1);
  1199. sutPocStatus.Page_Up=0;
  1200. ReFlashItem();//指针会被重置到0位置
  1201. break;
  1202. }
  1203. key=ListBoxResponse(&sutListBox);
  1204. if(KEY_PANEL_EXIT==g_ulKeyValue)
  1205. {
  1206. if(sutUIstatus.ShortCut==1){
  1207. sutUIstatus.ShortCut=0;
  1208. UISetNextStatus(UIS_STANDBY);
  1209. }else UISetNextStatus(UIS_MENU_MAIN);
  1210. sutPocStatus.Page_Up=0;
  1211. }
  1212. else if(KEY_PANEL_MENU==key){
  1213. sutPocStatus.Page_Up=0;
  1214. g_cMenuBack=1;
  1215. //单呼成员
  1216. ///////////////////////////////////////
  1217. if(0 == sutPocStatus.UserOnLineNum)
  1218. {
  1219. // sprintf(buf, "无法呼叫自己");
  1220. // ShowMessageBox(buf);
  1221. // OsDelayTime(200);
  1222. //// UISetNextStatus(sutUIstatus.LastStatus);
  1223. // UISetNextStatus(UIS_STANDBY);
  1224. // return;
  1225. break;
  1226. }
  1227. if(sutPocStatus.LocalUser.ID==sutPocStatus.AllUsers[sutListBox.handle].ID)
  1228. {
  1229. if(0==strcmp(sutProductPara.Language,"cn"))sprintf(buf, "无法呼叫自己");
  1230. else sprintf(buf, "Can't call");
  1231. ShowMessageBox(buf);
  1232. OsDelayTime(200);
  1233. UISetNextStatus(sutUIstatus.LastStatus);
  1234. //UISetNextStatus(UIS_STANDBY);
  1235. break;
  1236. }
  1237. snprintf(buf, sizeof(buf),"AT+POC=540&1&%d\r\n",sutPocStatus.AllUsers[sutListBox.handle].ID);
  1238. if(sutPocStatus.LocalUser.ID==sutPocStatus.AllUsers[sutListBox.handle].ID)
  1239. sutPocStatus.CallID=sutPocStatus.AllUsers[sutListBox.handle].ID;//主呼ID
  1240. ModemSendAT(buf);
  1241. if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf, sizeof(buf),"呼叫:%s",sutPocStatus.AllUsers[sutListBox.handle].name);
  1242. else snprintf(buf, sizeof(buf),"Call:%s",sutPocStatus.AllUsers[sutListBox.handle].name);
  1243. strcpy(sutPocStatus.Callname,sutPocStatus.AllUsers[sutListBox.handle].name);
  1244. // ShowMessageBox(buf);
  1245. // OsDelayTime(200);
  1246. // UISetNextStatus(UIS_STANDBY);
  1247. UISetNextStatus(UIS_WAIT_ONECALL);
  1248. }
  1249. break;
  1250. case UIS_Voice_Record://-----语音记录-----
  1251. if(sutListBox.handle==0 && KEY_PANEL_UP==g_ulKeyValue)
  1252. {
  1253. if(sutPocStatus.voicehandleIndex >=5) {
  1254. /***提示已经到顶部**/
  1255. //sutPocStatus.handleIndex -=5;
  1256. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("没有更多记录");
  1257. else ShowMessageBox("Record the top!");
  1258. os_dly_wait(1);
  1259. lastOption=1;
  1260. }
  1261. else if(sutPocStatus.voicehandleIndex==0){
  1262. // if(sutPocStatus.VoiceOnLineNum==5){
  1263. // sutPocStatus.voicehandleIndex=0;
  1264. // if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("没有更多记录");
  1265. // else ShowMessageBox("Record the top!");
  1266. // os_dly_wait(1);
  1267. // }else
  1268. if(sutPocStatus.VoiceOnLineNum>5){
  1269. sutPocStatus.voicehandleIndex=5;
  1270. }else{
  1271. sutPocStatus.voicehandleIndex=0;
  1272. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("没有更多记录");
  1273. else ShowMessageBox("Record the top!");
  1274. os_dly_wait(1);
  1275. lastOption=1;
  1276. }
  1277. }
  1278. SimpleVoiceInfoScan(0,0);
  1279. ReFlashItemVoice();//指针会被重置到0位置
  1280. //reload up
  1281. break;
  1282. }else if((sutListBox.handle+1) == sutListBox.itemnum && KEY_PANEL_DOWN==g_ulKeyValue)
  1283. {
  1284. if(sutPocStatus.voicehandleIndex >=5) {
  1285. sutPocStatus.voicehandleIndex -=5;
  1286. lastOption=1;
  1287. }else if(sutPocStatus.voicehandleIndex==0){
  1288. if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("已经是最新一条!");
  1289. else ShowMessageBox("The latest record!");
  1290. os_dly_wait(1);
  1291. }
  1292. printf("sutPocStatus.recordID1111===%d\r\n",sutPocStatus.recordID);
  1293. SimpleVoiceInfoScan(1,1); //0.1
  1294. ReFlashItemVoice();//指针会被重置到0位置
  1295. printf("sutPocStatus.recordID222222===%d\r\n",sutPocStatus.recordID);
  1296. //reload down
  1297. break;
  1298. }
  1299. key=ListBoxResponseM20(&sutListBox);
  1300. if(KEY_PANEL_EXIT==g_ulKeyValue)
  1301. {
  1302. lastOption=0;
  1303. UISetNextStatus(sutUIstatus.LastStatus);
  1304. sutPocStatus.recordflag=1;
  1305. }
  1306. // else if(KEY_PANEL_MENU==g_ulKeyValue)
  1307. // {
  1308. // lastOption=0;
  1309. // UISetNextStatus(UIS_MENU_MAIN);
  1310. // }
  1311. else if(KEY_PANEL_MENU==key){
  1312. if(sutPocStatus.VoiceOnLineNum!=0){
  1313. snprintf(buf, sizeof(buf),"AT+POC=552&%d&%d\r\n",sutPocStatus.recordID,sutPocStatus.AllVoices[sutPocStatus.FillVoiceIndex-sutListBox.handle-1].ID);///*****
  1314. ModemSendAT(buf);
  1315. SlwTrace(INF,buf,1);
  1316. }
  1317. }
  1318. break;
  1319. case UIS_MAIL_BOX://-----短信查阅-----
  1320. MessageResponse();
  1321. break;
  1322. case UIS_MENU_SYS_SET://-----系统设置-----
  1323. SetSYSResponse(); //名字没取好,实际上是系统
  1324. break;
  1325. case UIS_MENU_INFO://-----终端信息-----
  1326. if(KEY_PANEL_EXIT==g_ulKeyValue){
  1327. UISetNextStatus(sutUIstatus.LastStatus);//UIS_STANDBY
  1328. }
  1329. //else if(KEY_PANEL_MENU==g_ulKeyValue)UISetNextStatus(UIS_MENU_MAIN);
  1330. break;
  1331. case UIS_MESSAGE_OPTION:
  1332. MessageOptionResponse();
  1333. break;
  1334. case UIS_MESSAGE_READ:
  1335. MessageReadResponse();
  1336. break;
  1337. case UIS_MESSAGE_FORMAT:
  1338. MessageFormatResponse();
  1339. break;
  1340. case UIS_MESSAGE_DELE:
  1341. MessageDeletResponse();
  1342. break;
  1343. case UIS_SET_APN: //-----系统设置-------
  1344. SetAPNResponse();
  1345. break;
  1346. case UIS_APN_DETAIL:
  1347. SetApnDetailResponse();
  1348. break;
  1349. case UIS_SET_GPS:
  1350. SetGPSResponse();
  1351. break;
  1352. case UIS_SET_LCD:
  1353. SetLCDResponse();
  1354. break;
  1355. ////////////////////////////////////
  1356. case UIS_SET_NET:
  1357. SetNetModeResponse();
  1358. break;
  1359. //////////////////////////////////
  1360. case UIS_UP_APPRICATION_VER:
  1361. SetUpAppricationVerResponse();
  1362. break;
  1363. case UIS_UP_INTERCOM_VER:
  1364. SetUpIntercomVerResponse();
  1365. break;
  1366. case UIS_SET_LANGUAGE:
  1367. SetLanguageResponse();
  1368. break;
  1369. case UIS_SET_KEYSound:
  1370. SetKeysoundResponse();
  1371. break;
  1372. case UIS_FASTINTERFACE:
  1373. SetFastInterfaceModeResponse();
  1374. break;
  1375. case UIS_AWMODESET:
  1376. SetAwModeResponse();
  1377. break;
  1378. case UIS_LOW_CONSUMPTION:
  1379. SetLowConsumptionResponse();
  1380. break;
  1381. case UIS_WAIT_ONECALL:
  1382. WaitOneCallResponse();
  1383. break;
  1384. case UIS_FACTORY_KEY:
  1385. Factory_KeyResponse();
  1386. break;
  1387. case UIS_FACTORY_LCD:
  1388. Factory_LcdResponse();
  1389. break;
  1390. case UIS_FACTORY_LED:
  1391. Factory_LEDResponse();
  1392. break;
  1393. case UIS_FACTORY_VBAT:
  1394. Factory_VBATResponse();
  1395. break;
  1396. case UIS_SET_PTTTONE:
  1397. SetPttToneResponse();
  1398. break;
  1399. case UIS_SET_ADB:
  1400. SetAdbDebugResponse();
  1401. break;
  1402. case UIS_SET_BOOT:
  1403. SetBOOTDebugResponse();
  1404. break;
  1405. case UIS_POWEROFF:
  1406. SetPowerOffResponse();
  1407. break;
  1408. default:
  1409. break;
  1410. }
  1411. }
  1412. /******************************************************
  1413. UISetNextStatus
  1414. 设置下一个UI状态
  1415. *******************************************************/
  1416. void UISetNextStatus(unsigned char status)
  1417. {
  1418. if(status==sutUIstatus.Status) return;
  1419. sutUIstatus.LastStatus=sutUIstatus.NextStatus;
  1420. sutUIstatus.NextStatus=status;
  1421. }
  1422. /******************************************************
  1423. 显示开机动画
  1424. 完整图片 尺寸
  1425. logo.bmp 100*59
  1426. 子图片 与主图片坐标偏移
  1427. logo-down 2,42
  1428. logo-g 38,25
  1429. logo-h 4,10
  1430. logo-i 29,19
  1431. logo-o 59,25
  1432. logo-s 77,25
  1433. logo-up 2,0
  1434. *******************************************************/
  1435. void ShowBootAnimation(void)
  1436. {
  1437. int i;
  1438. int x,y;
  1439. int w,h;
  1440. x=30;y=34;//最终整张logo图片的位置
  1441. w=100;h=59;//整张图片的尺寸
  1442. LCD_BL_HIGH; //改正用户体验
  1443. KEY_LED(0);
  1444. GuiClearAll();
  1445. GuiShowBmp(0,0,"welcome.bmp");
  1446. for(i=0;i<5000;i++)//4000000
  1447. {
  1448. if(i%100==0) IWDG_ReloadCounter();
  1449. }
  1450. }
  1451. /***********************************
  1452. 显示信号状态
  1453. **********************************/
  1454. void ShowSingle(int CSQ)
  1455. {
  1456. GuiShowBmp(0,0+2,"SingleOK.bmp");
  1457. if(CSQ<1 || CSQ==99){
  1458. GuiClearRectM20(7,4,21,14);
  1459. }else if(CSQ<8){
  1460. GuiDrawVLine(12,14,7,2,COLOR_DEFAULT_BLUE);
  1461. GuiClearRectM20(11,4,21,14);
  1462. }else if(CSQ<16){
  1463. GuiDrawVLine(12,14,7,2,COLOR_DEFAULT_BLUE);
  1464. GuiDrawVLine(9,14,11,2,COLOR_DEFAULT_BLUE);
  1465. GuiClearRectM20(15,4,21,14);
  1466. }else if(CSQ<22){
  1467. GuiDrawVLine(12,14,7,2,COLOR_DEFAULT_BLUE);
  1468. GuiDrawVLine(9,14,11,2,COLOR_DEFAULT_BLUE);
  1469. GuiDrawVLine(7,14,15,2,COLOR_DEFAULT_BLUE);
  1470. GuiClearRectM20(19,4,21,14);
  1471. }else{
  1472. GuiDrawVLine(12,14,7,2,COLOR_DEFAULT_BLUE);
  1473. GuiDrawVLine(9,14,11,2,COLOR_DEFAULT_BLUE);
  1474. GuiDrawVLine(7,14,15,2,COLOR_DEFAULT_BLUE);
  1475. GuiDrawVLine(4,14,19,2,COLOR_DEFAULT_BLUE);
  1476. }
  1477. }
  1478. /************************************************************************
  1479. 显示电量
  1480. *************************************************************************/
  1481. void ShowBatttery(int bat,char Update)
  1482. {
  1483. static unsigned int flashCnt=0;
  1484. static unsigned char flag=0;
  1485. static signed char VbatStatue=-1;
  1486. static signed char LastVbatStatue=-1;
  1487. static unsigned short temp=0;
  1488. static unsigned short BatCnt=0;
  1489. int x=90; //46
  1490. unsigned char Color;
  1491. if(ChangeIng){
  1492. Color=COLOR_CHARGE_BLUE;
  1493. if((bat>422)||(GPIO_ReadInputDataBit(CHARGE_STATUE_PORT,CHARGE_STATUE_PIN)==RESET)){
  1494. if(ChangeIngCt==0 && ReCharge==0){
  1495. GuiShowBmp(x+41,3,"CHARGEBAT.bmp");
  1496. CHARGE_LED_HIGH;
  1497. return;
  1498. }
  1499. CHARGE_LED_LOW;
  1500. }
  1501. temp=420;
  1502. }else{
  1503. CHARGE_LED_LOW;
  1504. Color=COLOR_DEFAULT_BLUE;
  1505. temp=407;
  1506. }
  1507. if(bat<WARN_PWR_LEVEL){//请充电 340
  1508. if(os_time_get()< flashCnt) return;
  1509. flashCnt=os_time_get()+80;
  1510. if(flag==0)
  1511. {
  1512. LastVbatStatue=0;
  1513. flag=1;
  1514. }else{
  1515. flag=0;
  1516. LastVbatStatue=1;
  1517. }
  1518. } else if(bat<362)LastVbatStatue=2;
  1519. else if(bat<385)LastVbatStatue=3;
  1520. else if(bat<temp)LastVbatStatue=4;
  1521. else LastVbatStatue=5;
  1522. if(VbatStatue!=LastVbatStatue||Update){
  1523. if(bat<WARN_PWR_LEVEL){//请充电 340
  1524. // if(flag==0)
  1525. // {
  1526. // GuiShowBmp(x+41,3,"VBAT1.bmp");
  1527. // flag=1;
  1528. // }else{
  1529. // flag=0;
  1530. if(ChangeIng)GuiShowBmp(x+41,3,"VBAT3.bmp");
  1531. else GuiShowBmp(x+41,3,"VBAT2.bmp");
  1532. // }
  1533. }
  1534. else if(bat<362){//340<x<=355 1格
  1535. GuiShowBmp(x+41,3,"VBAT1.bmp");
  1536. GuiDrawVLine(5,12,62+x,4,Color);
  1537. }
  1538. else if(bat<385){//355<x<=375 2格
  1539. GuiShowBmp(x+41,3,"VBAT1.bmp");
  1540. GuiDrawVLine(5,12,57+x,4,Color);
  1541. GuiDrawVLine(5,12,62+x,4,Color);
  1542. }
  1543. else if(bat<temp){//375<x<=425 3格
  1544. GuiShowBmp(x+41,3,"VBAT1.bmp");
  1545. GuiDrawVLine(5,12,52+x,4,Color);
  1546. GuiDrawVLine(5,12,57+x,4,Color);
  1547. GuiDrawVLine(5,12,62+x,4,Color);
  1548. }
  1549. else{//>=425 4格
  1550. GuiShowBmp(x+41,3,"VBAT1.bmp");
  1551. GuiDrawVLine(5,12,47+x,4,Color);
  1552. GuiDrawVLine(5,12,52+x,4,Color);
  1553. GuiDrawVLine(5,12,57+x,4,Color);
  1554. GuiDrawVLine(5,12,62+x,4,Color);
  1555. }
  1556. VbatStatue=LastVbatStatue;
  1557. }
  1558. }
  1559. void ShowTime(char Update)
  1560. {
  1561. static int lastS=-1;
  1562. int s;
  1563. USER_RTC_DEF Temptime;
  1564. char buf[30];
  1565. //if(sutPocStatus.FirstLogined==0) return; //M20
  1566. RTC_UserGetTime(&Temptime);
  1567. s=Temptime.min;
  1568. if(lastS!=s||Update){
  1569. lastS=s;
  1570. snprintf(buf, sizeof(buf),"%02d:%02d",Temptime.hour,Temptime.min);//-02d"g_usModeMTime,g_usModeSTime
  1571. GuiShowStrM20(67,5,buf,0x01,COLOR_WHITE,COLOR_BLACK); //75
  1572. }
  1573. }
  1574. void ShowGPSICon(char y)
  1575. {
  1576. GuiClearRectM20(45,y,50,18);//18<->20
  1577. if(0== sutGpsInfo.isGpsWork) GuiClearRectM20(45,y,67,18);//未工作或未检测到 //75
  1578. else
  1579. {
  1580. //GPS已工作
  1581. if(0 == sutGpsInfo.isGpsValid)
  1582. {//未定位
  1583. if(sutGpsInfo.isGpsAuthOk==0)//未鉴权
  1584. {
  1585. GuiShowBmp(45,y,"GPS1.bmp");
  1586. }else//已鉴权
  1587. {
  1588. GuiShowBmp(45,y,"GPSA.bmp");//已鉴权
  1589. }
  1590. }else
  1591. {//已定位
  1592. if(sutGpsInfo.isGpsAuthOk==0)//未鉴权
  1593. {
  1594. GuiShowBmp(45,y,"GPS1.bmp");
  1595. }else//已鉴权
  1596. {
  1597. GuiShowBmp(45,y,"GPSA.bmp");//已鉴权
  1598. }
  1599. GuiShowBmp(45+10-2,y+2,"GPS2.bmp");//定位辐射放最后
  1600. }
  1601. }
  1602. }
  1603. /************************************************************************
  1604. ShowStatusBar
  1605. 显示状态栏
  1606. *************************************************************************/
  1607. void ShowStatusBar(int Update)
  1608. {
  1609. static char batFirstShow=0;
  1610. static uint8_t siHNS;
  1611. static int siCSQ;
  1612. static int siVbat;
  1613. unsigned short usGps;
  1614. static unsigned short susGps;
  1615. static STATUE lastPPPStatus;
  1616. static signed int s_netshowvalue=-1;
  1617. static signed char EarFlag= -1;//
  1618. static unsigned char VbatStatue=0;
  1619. char buf[20];
  1620. if(Update){
  1621. GuiClearRectM20(0,0,160,18);
  1622. siCSQ=g_iCSQ;
  1623. ShowSingle(g_iCSQ);
  1624. siVbat=g_iVbat;
  1625. ShowGPSICon(0);
  1626. ShowBatttery(g_iVbat,Update);
  1627. //ShowMessageFlag(1);
  1628. ShowTime(1);
  1629. s_netshowvalue=netshowvalue;
  1630. Show_Net(s_netshowvalue);
  1631. if(!Earcheck){
  1632. GuiClearRectM20(110,3,110+16,16);
  1633. }
  1634. else GuiShowBmp(110,3,"Ear.bmp");
  1635. EarFlag=Earcheck;
  1636. return;
  1637. }
  1638. //2G-4G显示
  1639. if(s_netshowvalue!=netshowvalue){
  1640. s_netshowvalue=netshowvalue;
  1641. Show_Net(s_netshowvalue);
  1642. }
  1643. //信号显示
  1644. if(siCSQ!=g_iCSQ || lastPPPStatus != sutGpsStatus.PPPStatus){
  1645. lastPPPStatus=sutGpsStatus.PPPStatus;
  1646. siCSQ=g_iCSQ;
  1647. ShowSingle(g_iCSQ);
  1648. }
  1649. //消息显示
  1650. // ShowMessageFlag(0);
  1651. //GPS显示
  1652. usGps=((unsigned short)sutGpsInfo.isGpsWork<<8) | ((unsigned short)sutGpsInfo.isGpsValid) | ((unsigned short)sutGpsInfo.isGpsAuthOk<<2);
  1653. if(susGps!=usGps ){
  1654. susGps =usGps;
  1655. ShowGPSICon(0);
  1656. }
  1657. //时间显示
  1658. ShowTime(0);
  1659. //锁和耳机标志
  1660. if(g_uslockflag==1){
  1661. GuiShowBmp(72,110,"lock.bmp");
  1662. }
  1663. if(Earcheck!=EarFlag)
  1664. {
  1665. if(!Earcheck){
  1666. GuiClearRectM20(110,3,110+16,16);
  1667. }else GuiShowBmp(110,3,"Ear.bmp");
  1668. EarFlag=Earcheck;
  1669. }
  1670. if(ChangeIng!=GPIO_ReadInputDataBit(CHARGEChek_PORT,CHARGEChek_PIN)){
  1671. ChangeIngCt=5;
  1672. MODEM_VBUS_EN_LOW;
  1673. os_dly_wait(100);
  1674. MODEM_VBUS_EN_HIGH;
  1675. LCDTimeOut(0); //插USB亮屏
  1676. ChangeIng=GPIO_ReadInputDataBit(CHARGEChek_PORT,CHARGEChek_PIN);
  1677. VbatStatue=1;
  1678. }
  1679. //电量显示
  1680. if(!sutPocStatus.Speaker &&!sutPocStatus.PPTpress)//防止对讲时候拉低低压,显示不准
  1681. {
  1682. if(siVbat!=g_iVbat || g_iVbat < WARN_PWR_LEVEL||VbatStatue){
  1683. siVbat=g_iVbat;
  1684. ShowBatttery(g_iVbat,VbatStatue);
  1685. VbatStatue=0;
  1686. }
  1687. }
  1688. }
  1689. void ShowMessageBox(char *msg)
  1690. {
  1691. char buf[70];
  1692. u16 len,x,y;
  1693. y=LCD_HEIGHT/2;
  1694. GuiClearRect(0,y-20,159,y+20);
  1695. GuiDrawRect(2,y-18,157,y+18,1);
  1696. StrIntercept(buf,msg,18);//18
  1697. len=GetStrXLen(buf);
  1698. x=(LCD_WIDTH-len)/2;
  1699. GuiShowStr(x,y-8,buf,0x01);
  1700. }
  1701. void ShowNumBox(unsigned short msg)
  1702. {
  1703. char buf[10];
  1704. u16 len,x,y;
  1705. y=LCD_HEIGHT/2; //中间
  1706. GuiClearRect(0,y-20,159,y+20);
  1707. //GuiDrawRect(2,y-6,157,y+16,1); //上面显示要修改的号码 下面显示文字
  1708. GuiDrawRect(2,y-6,130,y+16,1);
  1709. // StrIntercept(buf,(char *)msg,18);
  1710. snprintf(buf, sizeof(buf),"%u",msg);
  1711. len=GetStrXLen(buf);
  1712. //x=(LCD_WIDTH-len)/2;
  1713. GuiShowStr(4,y,buf,0x01);
  1714. }
  1715. /************************************************************************
  1716. ShowButton
  1717. 显示一个按钮
  1718. *************************************************************************/
  1719. void ShowButton(u16 x,u16 y,const char *str)
  1720. {
  1721. int len;
  1722. len=GetStrXLen((char *)str);
  1723. GuiClearRect(x,y,x+len+8,y+20);
  1724. GuiShowStr(x+4,y+2,str,0x01);
  1725. GuiReverseRect(x,y,(x+len+8),(y+16+4));
  1726. }
  1727. void ShowButton2(u16 x,u16 y,const char *str)
  1728. {
  1729. int len;
  1730. len=GetStrXLen((char *)str);
  1731. GuiClearRect(x,y,x+len+8,y+20);
  1732. GuiShowStr(x+4,y+2,str,0x01);
  1733. GuiReverseRect(x,y,(x+len+8),(y+16+4));
  1734. }
  1735. void Show_Net(unsigned int s_netshowvalue)
  1736. {
  1737. if(s_netshowvalue==0||s_netshowvalue==2){
  1738. GuiShowStrM20(28,4,"2G",1,COLOR_WHITE,COLOR_BLACK);
  1739. }else if(s_netshowvalue==4){
  1740. GuiShowStrM20(28,4,"4G",1,COLOR_WHITE,COLOR_BLACK);
  1741. }else {
  1742. GuiClearRectM20(28,4,45,18);
  1743. }
  1744. }
  1745. //stack init
  1746. void Init_stack(struct UI_STACK* s)
  1747. {
  1748. memset(s->sta,0,sizeof(s->sta));
  1749. s->top=-1;
  1750. }
  1751. //push stack
  1752. int PushUiStack(struct UI_STACK *s,int data)
  1753. {
  1754. if(s->top==4){
  1755. printf("stack full\r\n");
  1756. return 1;
  1757. }
  1758. (s->top)++;
  1759. s->sta[s->top]=data;
  1760. return 0;
  1761. }
  1762. //pull stack
  1763. int PullUiStack(struct UI_STACK *s)
  1764. {
  1765. int tmp;
  1766. if(s->top<0){
  1767. printf("stack is empty\r\n");
  1768. return -1;
  1769. }else {
  1770. tmp=(s->sta)[s->top];
  1771. (s->top)--;
  1772. return tmp;
  1773. }
  1774. }