SetSystemPara.c 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091
  1. /*****************************************************************************
  2. SetSystemPara.c
  3. *****************************************************************************/
  4. #include "includes.h"
  5. SUT_MENU sutMenuSysSetup;
  6. unsigned char Net_temp_flag;
  7. SUT_LCDGPS_SEND_DATA sutLcdGpsSendData;
  8. char ReadApnData(unsigned char *source,unsigned char witchone,char *apnapn,char *apnname,char *apnpass);
  9. unsigned short g_ausTimeOut[5]={10,30,60,300,0};
  10. static char Languagecnt=0;
  11. int ApnFileIndex;
  12. /*************************************************************************/
  13. unsigned int g_uiGpsStat = 1; //1
  14. SUT_LCD_PARAM sutLcdParam;
  15. unsigned short g_UpdatePocCount;
  16. static char AdbDebug=0;
  17. char BOOTDebug=0;
  18. char showApnTable[2*APN_NUM][31];
  19. char *APNNAME[APN_NUM+1]=
  20. {
  21. "APN1",
  22. "APN2",
  23. "APN3",
  24. "APN4",
  25. ""
  26. };
  27. void SetAPNShow(int update)
  28. {
  29. #if 1
  30. int i;
  31. static const char *accIconFileName[]={
  32. "APN.bmp",
  33. "APN1.bmp",
  34. ""
  35. };
  36. static char GroupsFeatures[APN_NUM];
  37. if(update){
  38. if(showApn!=1)
  39. {
  40. ShowMessageBox("禁止修改");
  41. os_dly_wait(200);
  42. UISetNextStatus(UIS_MENU_SYS_SET);
  43. return;
  44. }
  45. if(validApnNum==1)
  46. {
  47. ShowMessageBox("配置文件无APN");
  48. os_dly_wait(200);
  49. UISetNextStatus(UIS_MENU_SYS_SET);
  50. return;
  51. }
  52. GuiClearAll();
  53. ShowCaption("设置APN",2);//
  54. GuiDrawHLine(0,159,20,1);
  55. //设置Features 将决定选择图标
  56. GroupsFeatures[sutProductPara.APNIndex]=1;
  57. ListBoxInit(&sutListBox,APNNAME,0,accIconFileName,GroupsFeatures);
  58. //----------------------------
  59. GuiDrawHLine(0,159,104,1);
  60. GuiShowStr(0,110,"[OK]切换 [P1]详情",0x01);
  61. }
  62. #else
  63. int i;
  64. static unsigned short susCt=0;
  65. static const char *accIconFileName[]={"APN.bmp","APN1.bmp",""};
  66. unsigned char buf[300];
  67. static char NullGroup=0;
  68. static char GroupsFeatures[APN_NUM];
  69. static char *APNAPN[APN_NUM];
  70. char NullPtr[]="";
  71. if(update){
  72. susCt=0;
  73. GuiClearAll();
  74. ShowCaption("设置APN",1);//
  75. GuiDrawHLine(0,159,20,1);
  76. ReadFileData(ApnFileIndex,0,sizeof(buf),buf);
  77. for(i=0;i<3;i++)
  78. {//读取三组接入点名称
  79. if(ReadApnData(buf, i, &showApn[i][0], 0,0))
  80. {
  81. return;
  82. }
  83. }
  84. //付给用于显示的指针
  85. APNAPN[0]=&showApn[0][0];
  86. APNAPN[1]=&showApn[1][0];
  87. APNAPN[2]=&showApn[2][0];
  88. APNAPN[3]=NullPtr;
  89. APNAPN[4]=NullPtr;
  90. //----------------------------
  91. for(i=0;i<APN_NUM;i++){
  92. GroupsFeatures[i]=0;
  93. }
  94. //设置Features 将决定选择图标
  95. if(0==strcmp(sutProductPara.APNApn, APNAPN[0])) GroupsFeatures[0]=1;
  96. else if(0==strcmp(sutProductPara.APNApn, APNAPN[1])) GroupsFeatures[1]=1;
  97. else if(0==strcmp(sutProductPara.APNApn, APNAPN[2])) GroupsFeatures[2]=1;
  98. else{
  99. //如果以上三种都不是,则认为是用户自定义的了
  100. APNAPN[3]=sutProductPara.APNApn;
  101. GroupsFeatures[3]=1;
  102. }
  103. ListBoxInit(&sutListBox,APNAPN,0,accIconFileName,GroupsFeatures);
  104. //----------------------------
  105. GuiDrawHLine(0,159,104,1);
  106. GuiShowStr(0,110,"[M]切换 ",0x01);
  107. }
  108. #endif
  109. }
  110. void SetSYSResponse(void)
  111. {
  112. unsigned long key;
  113. key=MenuResponse(&sutMenuSysSetup);
  114. if(KEY_PANEL_MENU==key){
  115. switch(sutMenuSysSetup.handle){
  116. // case 0:
  117. // UISetNextStatus(UIS_SET_LANGUAGE);
  118. //
  119. // break;
  120. // case 1:
  121. // UISetNextStatus(UIS_SET_GPS);
  122. // break;
  123. // case 2:
  124. // UISetNextStatus(UIS_SET_LCD);
  125. // break;
  126. // case 3:
  127. // UISetNextStatus(UIS_SET_NET);
  128. // break;
  129. case 0:
  130. UISetNextStatus(UIS_SET_KEYSound);
  131. break;
  132. case 1:
  133. UISetNextStatus(UIS_SET_PTTTONE);
  134. break;
  135. // case 6:
  136. // UISetNextStatus(UIS_AWMODESET);
  137. // break;
  138. // case 2:
  139. // UISetNextStatus(UIS_FASTINTERFACE);
  140. // break;
  141. case 2:
  142. UISetNextStatus(UIS_UP_INTERCOM_VER);
  143. break;
  144. case 3:
  145. UISetNextStatus(UIS_SET_ADB);
  146. break;
  147. case 4://固件升级
  148. UISetNextStatus(UIS_SET_BOOT);
  149. break;
  150. }
  151. PushUiStack(&UI_Stack,sutMenuSysSetup.handle);
  152. }
  153. else if(KEY_PANEL_EXIT==key){
  154. UISetNextStatus(UIS_MENU_MAIN); //UIS_MENU_SYS_SET
  155. }
  156. }
  157. /***************************************
  158. 注意:CDMA的APN形式跟WCDMA大不相同
  159. W机子是不需要改来改去的 "IP","UNIM2M.NJM2MAPN","0.0.0.0"
  160. ****************************************/
  161. void SetAPNResponse(void)
  162. {
  163. unsigned long key;
  164. key=ListBoxResponse(&sutListBox);
  165. if(KEY_PANEL_MENU==key)
  166. {
  167. ShowMessageBox("即将重启更新...");
  168. sutProductPara.APNIndex=sutListBox.handle;
  169. strcpy(sutProductPara.APNName, showApnTable[2*sutProductPara.APNIndex]);
  170. strcpy(sutProductPara.APNPass, showApnTable[2*sutProductPara.APNIndex+1]);
  171. SaveProductParaToFlash("MENU_SWAPN");
  172. os_dly_wait(200);
  173. modemPwrOffNow=1;
  174. }else if(KEY_INFO==key) UISetNextStatus(UIS_APN_DETAIL);
  175. else if(KEY_PANEL_EXIT==key)UISetNextStatus(UIS_MENU_SYS_SET);
  176. }
  177. char showIndex;
  178. void ShowAPNMessage(char index)
  179. {
  180. char buf[40];
  181. char temp[40];
  182. unsigned char len;
  183. unsigned char i,y,maxLen;
  184. i=0;
  185. y=22;
  186. maxLen=14;
  187. GuiClearRect(0, y, LCD_WIDTH-1,LCD_HEIGHT-25);
  188. snprintf(buf, sizeof(buf), "%s:",APNNAME[showIndex]);
  189. GuiShowStr(1,y+16*i++,buf,0x01);
  190. len=strlen(showApnTable[2*showIndex]);
  191. memcpy(temp, showApnTable[2*showIndex], maxLen);
  192. temp[maxLen]=0;
  193. snprintf(buf, sizeof(buf), "Name:%s",temp);
  194. GuiShowStr(1,y+16*i++,buf,0x01);
  195. if(len > maxLen)
  196. {
  197. strcpy(temp, &showApnTable[2*showIndex][maxLen]);
  198. snprintf(buf, sizeof(buf), "%s",temp);
  199. buf[len-maxLen]=0;
  200. GuiShowStr(1,y+16*i++,buf,0x01);
  201. }
  202. len=strlen(showApnTable[2*showIndex+1]);
  203. memcpy(temp, showApnTable[2*showIndex+1], maxLen);
  204. temp[maxLen]=0;
  205. snprintf(buf, sizeof(buf), "Pass:%s",temp);
  206. GuiShowStr(1,y+16*i++,buf,0x01);
  207. if(len > maxLen)
  208. {
  209. strcpy(temp, &showApnTable[2*showIndex+1][maxLen]);
  210. snprintf(buf, sizeof(buf), "%s",temp);
  211. buf[len-maxLen]=0;
  212. GuiShowStr(1,y+16*i++,buf,0x01);
  213. }
  214. }
  215. void SetApnDetailShow(int update)
  216. {
  217. char buf[40];
  218. if(update)
  219. {
  220. GuiClearAll();
  221. ShowCaption("APN详情",2);//
  222. GuiDrawHLine(0,159,20,1);
  223. showIndex=0;
  224. ShowAPNMessage(showIndex);
  225. //----------------------------
  226. GuiDrawHLine(0,159,104,1);
  227. GuiShowStr(0,110,"[EXIT]返回 ",0x01);
  228. }
  229. }
  230. void SetApnDetailResponse(void)
  231. {
  232. if(KEY_PANEL_DOWN==g_ulKeyValue)
  233. {
  234. showIndex++;
  235. if(showIndex >= validApnNum) showIndex=0;
  236. ShowAPNMessage(showIndex);
  237. }else if(KEY_PANEL_UP==g_ulKeyValue)
  238. {
  239. if(showIndex==0) showIndex=validApnNum;
  240. if(showIndex > 0) showIndex--;
  241. ShowAPNMessage(showIndex);
  242. }
  243. else if(KEY_PANEL_EXIT==g_ulKeyValue) UISetNextStatus(UIS_SET_APN);
  244. }
  245. void MakeGpsSendData(void)
  246. {
  247. unsigned char *data=(unsigned char *)&sutLcdGpsSendData;
  248. memset(data, 0, sizeof(SUT_LCDGPS_SEND_DATA));
  249. data[0] = (sutGpsInfo.latitue>>24)&0xFF;
  250. data[1] = (sutGpsInfo.latitue>>16)&0xFF;
  251. data[2] = (sutGpsInfo.latitue>>8)&0xFF;
  252. data[3] = (sutGpsInfo.latitue)&0xFF;
  253. data[4] = (sutGpsInfo.longitue>>24)&0xFF;
  254. data[5] = (sutGpsInfo.longitue>>16)&0xFF;
  255. data[6] = (sutGpsInfo.longitue>>8)&0xFF;
  256. data[7] = (sutGpsInfo.longitue)&0xFF;
  257. }
  258. /*****************************************************
  259. 深圳北纬22.33 东经114.07
  260. 经过试验数据比较准确,但是东西南北不知道
  261. ******************************************************/
  262. void GetCoordinates(unsigned char type)
  263. {
  264. //type 0 UI时调用
  265. // 1 上传时调用
  266. char buf[30];
  267. //char buf0[15]={0};
  268. char buf1[8];
  269. char buf2[4]={0};
  270. char temp[3];
  271. char temp1[3];
  272. char temp2[5];
  273. char temp3[5];
  274. int i,num,num1,w,j;
  275. double Jnum1,Jnum2,Jnum3;//有小数位 8位有效
  276. double Wnum1,Wnum2,Wnum3;//有小数位 8位有效
  277. // char* g_cGetlongitude;
  278. // char* g_cGetlatitude;
  279. MakeGpsSendData();
  280. AscStrTurnHexStr((char *)sutLcdGpsSendData.JJJJ,buf1);
  281. memset(temp, 0, sizeof(temp));
  282. for(i=0;i<3;i++){
  283. temp[i]=buf1[i];
  284. }
  285. j=atoi(temp);
  286. memset(temp2, 0, sizeof(temp2));
  287. for(i=0;i<6;i++){
  288. temp2[i]=buf1[i+3];
  289. }
  290. num=atoi(temp2);
  291. Jnum1=num/1000;
  292. Jnum1 /=60;
  293. Jnum2 = (num%1000)*60;
  294. Jnum2 /=3600000;
  295. Jnum3=Jnum1+Jnum2;
  296. //sutLcdGpsSendData.j=j*1000000+Jnum3*1000000;
  297. // sutLcdGpsSendData.j = (j+Jnum3)*1000000;
  298. //Getlongitude;
  299. //Getlatitude;
  300. sutGpsInfo.testJD = j*1000000+Jnum3*1000000;//上传时使用
  301. // if(type == 0){//UI时要显示
  302. // sprintf(buf,"经度 %s: %d.%05d","W",j,(unsigned int)(Jnum3*100000));
  303. // GuiShowStr(0,40,buf,0x01);
  304. // }
  305. AscStrTurnHexStr((char *)sutLcdGpsSendData.WWWW,buf2);
  306. for(i=0;i<3;i++){
  307. temp1[i]=buf2[i];
  308. }
  309. w=atoi(temp1);
  310. for(i=0;i<6;i++){//5
  311. temp3[i]=buf2[i+3];
  312. }
  313. num1=atoi(temp3);
  314. Wnum1=num1/1000;
  315. Wnum1 /=60;
  316. Wnum2 = (num1%1000)*60;
  317. Wnum2 /=3600000;
  318. Wnum3=Wnum1+Wnum2;
  319. sutGpsInfo.testWD = w*1000000+Wnum3*1000000; //6 10000000
  320. if(type == 0){//UI时要显示
  321. if(0==strcmp(sutProductPara.Language,"cn"))
  322. {
  323. snprintf(buf, sizeof(buf)," 纬度 %c: %.3d.%06d",sutGpsInfo.NSFlag,w,(unsigned int)(Wnum3*1000000)); //
  324. GuiShowStr(0,24,buf,0x01);
  325. snprintf(buf, sizeof(buf)," 经度 %c: %d.%06d",sutGpsInfo.EWFlag,j,(unsigned int)(Jnum3*1000000)); //
  326. GuiShowStr(0,40,buf,0x01);
  327. }else{
  328. snprintf(buf, sizeof(buf),"Latitude: %.3d.%06d",w,(unsigned int)(Wnum3*1000000)); //
  329. GuiShowStr(0,24,buf,0x01);
  330. snprintf(buf, sizeof(buf),"Longitude: %d.%06d",j,(unsigned int)(Jnum3*1000000)); //
  331. GuiShowStr(0,40,buf,0x01);
  332. }
  333. }
  334. }
  335. void SetGPSTimeShowDetail(unsigned char timeIndex)
  336. {
  337. unsigned short tempTime;
  338. char buf[10];
  339. tempTime = GPS_TimeTable[timeIndex];
  340. if(tempTime==0)
  341. {
  342. GuiShowStr(100,56," 关闭 ",0x01);//130
  343. GuiReverseRect(108,56,16*2,14);
  344. }else
  345. {
  346. snprintf(buf, sizeof(buf)," %02d 秒",tempTime);
  347. GuiShowStr(100,56,buf,0x01);//130
  348. GuiReverseRect(108,56,16,14);
  349. }
  350. }
  351. /*********************************************************/
  352. void SetGPSShow(int update)
  353. {
  354. char tempbuf[30];
  355. static unsigned char susCt=0;
  356. unsigned short usGps;
  357. static unsigned short susGps;
  358. static unsigned char GpsStart=-1;
  359. if(update){
  360. GuiClearAll();
  361. if(sutPocStatus.Modeminited==0&&g_uGtFactory==0){
  362. if(0==strcmp(sutProductPara.Language,"cn"))ShowMessageBox("模块初始化中");
  363. else ShowMessageBox("Modem init!");
  364. os_dly_wait(50);
  365. UISetNextStatus(UIS_STANDBY);
  366. return ;
  367. }
  368. if(g_uGtFactory==0&&sutGpsInfo.isGpsWork==0){
  369. if(sutGpsInfo.GpsOpened){
  370. if(0==strcmp(sutProductPara.Language,"cn"))ShowMessageBox("未打开");
  371. else ShowMessageBox("not open!");
  372. }else {
  373. if(0==strcmp(sutProductPara.Language,"cn"))ShowMessageBox("不支持");
  374. else ShowMessageBox("no support!");
  375. }
  376. os_dly_wait(50);
  377. UISetNextStatus(UIS_STANDBY);
  378. return ;
  379. }
  380. if(0==strcmp(sutProductPara.Language,"cn"))
  381. {
  382. ShowCaption("北斗设置",1);//
  383. snprintf(tempbuf,sizeof(tempbuf)," 北斗上传时间:%d 秒",sutGpsInfo.GPS_UploadTime);
  384. GuiShowStr(0,56,tempbuf,0x01); //sutGpsInfo.SendTime
  385. //sutGpsInfo.startnum
  386. snprintf(tempbuf,sizeof(tempbuf)," 有效卫星:%d ",sutGpsInfo.startnum);
  387. GuiShowStr(0,74,tempbuf,0x01); //sutGpsInfo.SendTime
  388. }else {
  389. ShowCaption("GPS Set",1);//
  390. snprintf(tempbuf,sizeof(tempbuf),"Upload time: %d S",sutGpsInfo.GPS_UploadTime);
  391. GuiShowStr(0,56,tempbuf,0x01); //sutGpsInfo.SendTime
  392. snprintf(tempbuf,sizeof(tempbuf),"Start Number:%d ",sutGpsInfo.startnum);
  393. GuiShowStr(0,74,tempbuf,0x01); //sutGpsInfo.SendTime
  394. }
  395. GpsStart=sutGpsInfo.startnum;
  396. GuiDrawHLine(0,159,20,1);
  397. GetCoordinates(0);
  398. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110," [EXIT]退出",0x01);
  399. else GuiShowStr(0,110," [EXIT]",0x01);
  400. if(g_uGtFactory)ShowGPSICon(92);
  401. }
  402. usGps=((unsigned short)sutGpsInfo.isGpsWork<<8) | ((unsigned short)sutGpsInfo.isGpsValid) | ((unsigned short)sutGpsInfo.isGpsAuthOk<<2);
  403. if(susGps!=usGps){
  404. susGps =usGps;
  405. if(g_uGtFactory)ShowGPSICon(92);
  406. }
  407. if(++susCt>=200){
  408. GetCoordinates(0);
  409. if(GpsStart!=sutGpsInfo.startnum){
  410. if(0==strcmp(sutProductPara.Language,"cn")){
  411. snprintf(tempbuf,sizeof(tempbuf)," 有效卫星:%d ",sutGpsInfo.startnum);
  412. GuiShowStr(0,74,tempbuf,0x01); //sutGpsInfo.SendTime
  413. }else{
  414. snprintf(tempbuf,sizeof(tempbuf),"Start Number:%d ",sutGpsInfo.startnum);
  415. GuiShowStr(0,74,tempbuf,0x01); //sutGpsInfo.SendTime
  416. }
  417. GpsStart=sutGpsInfo.startnum;
  418. }
  419. susCt=0;
  420. }
  421. }
  422. void SetGPSResponse(void)
  423. {
  424. switch(g_ulKeyValue)
  425. {
  426. case KEY_PANEL_UP:
  427. break;
  428. case KEY_PANEL_DOWN:
  429. printf("GPS DOWN--------------\r\n");
  430. // if(g_ulKeyValue==KEY_PANEL_UP)
  431. // {
  432. // if(sutGpsInfo.GPS_TimeIndexBackup<(sizeof(GPS_TimeTable)-1))
  433. // sutGpsInfo.GPS_TimeIndexBackup++;
  434. // else
  435. // sutGpsInfo.GPS_TimeIndexBackup=0;
  436. // }else{
  437. // if(sutGpsInfo.GPS_TimeIndexBackup==0)
  438. // sutGpsInfo.GPS_TimeIndexBackup=sizeof(GPS_TimeTable)-1;
  439. // else
  440. // sutGpsInfo.GPS_TimeIndexBackup--;
  441. // }
  442. // SetGPSTimeShowDetail(sutGpsInfo.GPS_TimeIndexBackup);
  443. break;
  444. case KEY_PANEL_MENU:
  445. // if(sutGpsInfo.GPS_TimeIndexBackup != sutProductPara.m_GPS_TimeIndex)
  446. // {//changed
  447. // sutProductPara.m_GPS_TimeIndex = sutGpsInfo.GPS_TimeIndexBackup;
  448. // // GpsTimeUpdate();
  449. // SaveProductParaToFlash("MENU_SWGPS");
  450. // }
  451. //
  452. // UISetNextStatus(UIS_STANDBY);
  453. break;
  454. case KEY_PANEL_EXIT:
  455. if(!g_uGtFactory)UISetNextStatus(UIS_MENU_SYS_SET);
  456. else UISetNextStatus(UIS_FACTORY_MENU);
  457. break;
  458. //case KEY_PANEL_MENU: UISetNextStatus(UIS_MENU_MAIN);break;
  459. }
  460. }
  461. void SetLCDShow(int update)
  462. {
  463. static unsigned short susCt=0;
  464. char buf[10];
  465. char buf1[6];
  466. int x=4;//4
  467. int i;
  468. if(update==1){
  469. sutLcdParam.SetTimeIndex=sutProductPara.LCDSetIndex;
  470. GuiClearAll();
  471. if(0==strcmp(sutProductPara.Language,"cn")){
  472. ShowCaption("LCD设置",1);//0
  473. GuiDrawHLine(0,159,20,1);
  474. GuiShowStr(x,56," 背光时间: ",1);
  475. }else {
  476. ShowCaption("LCD Set",1);//0
  477. GuiDrawHLine(0,159,20,1);
  478. GuiShowStr(x,56,"LightTime: ",1);
  479. }
  480. if(sutLcdParam.SetTimeIndex==4)
  481. {
  482. if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf, sizeof(buf),"常亮");
  483. else snprintf(buf, sizeof(buf),"Keep");
  484. }
  485. else {
  486. snprintf(buf, sizeof(buf),"%3d",g_ausTimeOut[sutLcdParam.SetTimeIndex]);
  487. GuiShowStr(x+(16*5)+49,56," S",1);
  488. }
  489. ShowCaptionArea(buf,(x+(16*5)),(x+(16*5))+48,56);
  490. GuiReverseRect(x+(16*5),56,48,14);
  491. snprintf(buf1, sizeof(buf1),"%3d",sutLcdParam.SetTimeIndex);
  492. SlwTrace(INF,buf1,1);
  493. GuiDrawHLine(0,159,104,1);
  494. susCt=0;
  495. //return;
  496. }else if(update == 2){
  497. GuiClearRect(x+(16*5),56,160,76);//
  498. if(sutLcdParam.SetTimeIndex==4){
  499. if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf, sizeof(buf),"常亮");
  500. else snprintf(buf, sizeof(buf),"Keep");
  501. }
  502. else {
  503. snprintf(buf, sizeof(buf),"%3d",g_ausTimeOut[sutLcdParam.SetTimeIndex]);
  504. GuiShowStr(x+(16*5)+49,56," S",1);
  505. }
  506. ShowCaptionArea(buf,(x+(16*5)),(x+(16*5))+48,56);
  507. GuiReverseRect(x+(16*5),56,48,14);
  508. GuiDrawHLine(0,159,104,1);
  509. }
  510. if(susCt==0){
  511. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
  512. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  513. }else if(susCt==200){
  514. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[M]保存 [EXIT]退出",0x01);
  515. else GuiShowStr(0,110,"[SAVE] [EXIT]",0x01);
  516. }
  517. if(++susCt>=400)susCt=0;
  518. }
  519. void SetLCDResponse(void)
  520. {
  521. int FileIndex;
  522. unsigned long key;
  523. char Buf[10];
  524. int x=4;//4
  525. switch(g_ulKeyValue){
  526. case KEY_PANEL_UP:
  527. if(++sutLcdParam.SetTimeIndex>=5)sutLcdParam.SetTimeIndex=0;
  528. SetLCDShow(2);//0
  529. break;
  530. case KEY_PANEL_DOWN:
  531. if(sutLcdParam.SetTimeIndex>0)sutLcdParam.SetTimeIndex--;
  532. else sutLcdParam.SetTimeIndex=4;
  533. SetLCDShow(2);//0
  534. break;
  535. case KEY_PANEL_MENU:
  536. if(sutProductPara.LCDSetIndex!=sutLcdParam.SetTimeIndex)
  537. {
  538. fanhui=1;
  539. sutProductPara.LCDSetIndex=sutLcdParam.SetTimeIndex;
  540. SaveProductParaToFlash("LCDparm");
  541. UISetNextStatus(UIS_MENU_MAIN);
  542. }
  543. break;
  544. case KEY_PANEL_EXIT:
  545. UISetNextStatus(UIS_MENU_MAIN);
  546. break;
  547. }
  548. }
  549. unsigned char modemProcessFlash=0;
  550. MODEM_UPDATE_DEF m_updStatus;
  551. unsigned char m_process=0;
  552. int m_updateTimeout=0;
  553. char updateStart=0;
  554. void UpdateStatus(MODEM_UPDATE_DEF status)
  555. {
  556. modemProcessFlash=1;
  557. m_updStatus=status;
  558. m_updateTimeout=0;
  559. }
  560. void SetUpIntercomVerShow(int update)
  561. {
  562. char buf[19];
  563. if(update){
  564. GuiClearAll();
  565. if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("升级对讲版本",1);
  566. else ShowCaption("System Update",1);
  567. GuiDrawHLine(0,159,20,1);
  568. if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(16,56,"升级到最新版本? ",1);
  569. else GuiShowStr(0,56,"Upgrade New Version",1);
  570. //Upgrade to The latest version
  571. GuiDrawHLine(0,159,104,1);
  572. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[M]升级 [EXIT]退出",0x01);
  573. else GuiShowStr(0,110,"[OK] [EXIT]",0x01);
  574. }
  575. }
  576. void SetUpIntercomVerResponse(void)
  577. {
  578. static char cnt=0;
  579. //if(updateStart) return;
  580. if(KEY_PANEL_MENU==g_ulKeyValue)
  581. {
  582. // if(sutGpsStatus.PPPStatus != OPEN)
  583. // {
  584. // ShowMessageBox("无网络");
  585. // os_dly_wait(100);
  586. // UISetNextStatus(UIS_MENU_SYS_SET);
  587. // return;
  588. // }
  589. // updateStart++;
  590. // GuiClearArea(0, 22, LCD_WIDTH-1, LCD_HEIGHT-22);
  591. // UpdateStatus(MODEM_STATUS_TRIGGER);
  592. //AT+POC=542&0&0
  593. if(0==strcmp(sutProductPara.Language,"cn"))ShowMessageBox("升级至最新版本?");
  594. else ShowMessageBox("Upgrade New Version?"); //GuiShowStr(0,56,"Upgrade New Version",1);
  595. cnt++;
  596. if(cnt==2){
  597. cnt=0;
  598. ModemSendAT("AT+POC=542&0&0\r\n");
  599. UISetNextStatus(UIS_STANDBY);
  600. }
  601. }
  602. if(KEY_PANEL_EXIT==g_ulKeyValue){
  603. cnt=0;
  604. UISetNextStatus(UIS_MENU_SYS_SET);
  605. }
  606. }
  607. char GetApnPara(unsigned char *source, unsigned char whitchOne,unsigned short *accessP, unsigned short *account,unsigned short *passw)
  608. {
  609. unsigned char *ptr=source;
  610. unsigned char getFlag=0;
  611. unsigned short i,noteAddress[9];//总共3组,共9个;号
  612. if(whitchOne >=3) return 1;//只有3组值
  613. i=0;
  614. while(*ptr != 0)
  615. {
  616. if(*ptr == ';')
  617. {
  618. if(getFlag < 9)
  619. {
  620. noteAddress[getFlag++]=i;
  621. }else{
  622. //收够了
  623. break;
  624. }
  625. }
  626. i++;
  627. ptr++;
  628. }
  629. if(getFlag != 9) return 2;//资源文件内容有错误
  630. switch(whitchOne)
  631. {
  632. case 0:*accessP=0;*account=noteAddress[0]+1;*passw=noteAddress[1]+1;break;
  633. case 1:*accessP=noteAddress[2]+1;*account=noteAddress[3]+1;*passw=noteAddress[4]+1;break;
  634. case 2:*accessP=noteAddress[5]+1;*account=noteAddress[6]+1;*passw=noteAddress[7]+1;break;
  635. }
  636. return 0;
  637. }
  638. char ReadApnData(unsigned char *source,unsigned char witchone,char *apnapn,char *apnname,char *apnpass)
  639. {//从缓存中获取数据段,一次一组
  640. unsigned char *accessPV,*accountV,*passwV;
  641. unsigned short accessP,account,passw;
  642. unsigned short i;
  643. char buf[30];
  644. if(GetApnPara(source, witchone, &accessP, &account, &passw))
  645. {
  646. SlwTrace(INF, "HGS.apn dataErr",1);//如果初始化失败,则直接使用内存中的了
  647. return 1;
  648. }
  649. accessPV=source+accessP;
  650. accountV=source+account;
  651. passwV=source+passw;
  652. //accesspoint
  653. if(apnapn != 0)
  654. {
  655. if(*accessPV == ';') apnapn[0] = 0;//空数据段
  656. else{
  657. for(i=0;i<APN_LEN;i++)
  658. {
  659. if(accessPV[i] != ';') apnapn[i]=accessPV[i];
  660. else{
  661. apnapn[i]=0;
  662. break;
  663. }
  664. }
  665. }
  666. }
  667. //account name
  668. if(apnname != 0)
  669. {
  670. if(*accountV == ';') apnname[0] = 0;//空数据段
  671. else{
  672. for(i=0;i<APN_LEN;i++)
  673. {
  674. if(accountV[i] != ';') apnname[i]=accountV[i];
  675. else{
  676. apnname[i]=0;
  677. break;
  678. }
  679. }
  680. }
  681. }
  682. //password
  683. if(apnpass != 0)
  684. {
  685. if(*passwV == ';') apnpass[0] = 0;//空数据段
  686. else{
  687. for(i=0;i<APN_LEN;i++)
  688. {
  689. if(passwV[i] != ';') apnpass[i]=passwV[i];
  690. else{
  691. apnpass[i]=0;
  692. break;
  693. }
  694. }
  695. }
  696. }
  697. return 0;
  698. }
  699. //读取Para.ini配置文件获取LCD模式
  700. char GetApnFromSrc(char *src, char index,char *name, char *pass)
  701. {
  702. char target[15];
  703. char finalData[62];
  704. unsigned char tempLen,i,j;
  705. j=0;
  706. index +=1;
  707. switch(index)
  708. {
  709. case 1:case 2:case 3:case 4:
  710. snprintf(target, sizeof(target), "APN%d", index);
  711. break;
  712. default:return 0;
  713. }
  714. tempLen=GetParaFromStr(src, target, finalData);
  715. if(tempLen == 0) return 0;
  716. for(i=0;i<tempLen;i++)
  717. {
  718. if(finalData[i]==',')
  719. {
  720. j=i+1;
  721. finalData[i]=0;
  722. i=tempLen;
  723. }
  724. }
  725. tempLen=strlen(finalData);
  726. if(tempLen>30) tempLen=30;
  727. memcpy(name, finalData, tempLen);
  728. name[tempLen]=0;
  729. tempLen=strlen(finalData+j);
  730. if(tempLen>30) tempLen=30;
  731. memcpy(pass, finalData+j, tempLen);
  732. pass[tempLen]=0;
  733. return 1;
  734. }
  735. int HgsApnLen;
  736. unsigned char validApnNum;
  737. void APNFileInit(void)
  738. {
  739. char tempData[400];//3组APN,每组中每参数30个
  740. char name[APN_LEN+1];
  741. char pass[APN_LEN+1];
  742. int tempLen,i;
  743. ApnFileIndex=GetFileIndex("HGS.apn");
  744. if(ApnFileIndex == -1)
  745. {
  746. printf("No HGS.apn file\r\n");
  747. goto READ_EXIT;
  748. }
  749. HgsApnLen=GetFileLen(ApnFileIndex);
  750. if(HgsApnLen==0)
  751. {
  752. printf("HGS.apn empty\r\n");
  753. goto READ_EXIT;
  754. }
  755. //读出数据
  756. if(HgsApnLen > sizeof(tempData))
  757. {
  758. printf("Hgs.apn len=%d,should <=%d\r\n",HgsApnLen,sizeof(tempData));
  759. HgsApnLen=sizeof(tempData);
  760. }
  761. tempLen=ReadFileData(ApnFileIndex,0,HgsApnLen,(u8*)tempData);
  762. //检测是否显示APN
  763. tempLen=GetParaFromStr(tempData, "APNSHOW", name);
  764. if(tempLen==0)
  765. {
  766. showApn=1;//没有字段,则设置为显示菜单
  767. printf("No 'APNSHOW'\r\n");
  768. }else{
  769. showApn=atoi(name);
  770. }
  771. printf("APNSHOW:%d\r\n",showApn);
  772. tempLen=GetParaFromStr(tempData, "APNAUTHTYPE", name);
  773. if(tempLen==0)
  774. { //默认 NONE
  775. sutProductPara.ApnAuthType=0;
  776. printf("No 'APNAUTHTYPE'\r\n");
  777. }else{
  778. sutProductPara.ApnAuthType=atoi(name);
  779. }
  780. printf("APNAUTHTYPE:%d\r\n", sutProductPara.ApnAuthType);
  781. READ_EXIT:
  782. //读取APN参数到table
  783. if(ApnFileIndex==-1 || HgsApnLen==0)
  784. {//资源文件错误,则只有一个默认APN
  785. goto SET_ONLY_ONE;
  786. }else{
  787. //读出数据
  788. for(i=0;i<APN_NUM;i++)
  789. {
  790. if(0==GetApnFromSrc(tempData, i, name,pass))
  791. {//获取APN失败,恢复默认
  792. goto SET_ONLY_ONE;
  793. }else{
  794. strcpy(&showApnTable[2*i][0], name);
  795. strcpy(&showApnTable[2*i+1][0],pass);
  796. }
  797. }
  798. if(sutProductPara.APNIndex>3) {
  799. while(1){
  800. SlwTrace(INF,"APNIndex error",1);
  801. }
  802. }
  803. //如果所选的APN与资源文件的APN 不同则修改
  804. if(0!=strcmp(showApnTable[sutProductPara.APNIndex*2],sutProductPara.APNName)){
  805. strcpy(sutProductPara.APNName,showApnTable[sutProductPara.APNIndex*2]);
  806. strcpy(sutProductPara.APNPass,showApnTable[sutProductPara.APNIndex*2+1]);
  807. SaveProductParaToFlash("Apn Res Set");
  808. }
  809. validApnNum=APN_NUM;
  810. return;
  811. }
  812. SET_ONLY_ONE:
  813. strcpy(showApnTable[0],APN_NAME);
  814. strcpy(showApnTable[1],APN_PASSWORD);
  815. validApnNum=1;
  816. }
  817. void SetLanguageShow(int update)
  818. {
  819. static unsigned short susCt=0;
  820. //static char cnt=0;
  821. char buf[10];
  822. unsigned char len=0;
  823. char buf2[20];
  824. int x=12;//4
  825. if(update==1){
  826. GuiClearAll();
  827. if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("语种设置",1);
  828. else ShowCaption("Languages Set",1);
  829. GuiDrawHLine(0,159,20,1);
  830. if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(x,56," 语种选择: ",1);
  831. else GuiShowStr(x,56," Choice: ",1);
  832. if(0==strcmp(sutProductPara.Language,"cn")){
  833. snprintf(buf, sizeof(buf),"%s","中文");
  834. }else{
  835. snprintf(buf, sizeof(buf),"%s","English");
  836. }
  837. len=strlen(buf);
  838. GuiShowStr(x+(16*5),56,buf,1);
  839. GuiReverseRect(x+(16*5),56,8*len,14);//5
  840. GuiDrawHLine(0,159,104,1);
  841. susCt=0;
  842. }else if(update == 2){
  843. memset(buf,0,sizeof(buf));
  844. //cnt++;
  845. //Languagecnt++;
  846. if(0==strcmp(sutProductPara.Language,"cn")){
  847. if(0!=Languagecnt%2){
  848. snprintf(buf, sizeof(buf),"%s","English");
  849. }else {
  850. snprintf(buf, sizeof(buf),"%s","中文");
  851. }
  852. }else
  853. {
  854. if(0!=Languagecnt%2) snprintf(buf, sizeof(buf),"%s","中文");
  855. else snprintf(buf, sizeof(buf),"%s","English");
  856. }
  857. len=strlen(buf);
  858. GuiClearRect(x+(16*5),56,160,56+16);
  859. GuiShowStr(x+(16*5),56,buf,1);
  860. GuiReverseRect(x+(16*5),56,8*len,16);//5 //14
  861. GuiDrawHLine(0,159,104,1);
  862. }
  863. if(susCt==0){
  864. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
  865. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  866. }else if(susCt==200){
  867. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[M]保存 [EXIT]退出",0x01);
  868. else GuiShowStr(0,110,"[SAVE] [EXIT]",0x01);
  869. }
  870. if(++susCt>=400)susCt=0;
  871. }
  872. void SetLanguageResponse(void)
  873. {
  874. //static char cnt=0;
  875. char Tempbuf[60];
  876. switch(g_ulKeyValue){
  877. case KEY_PANEL_UP:
  878. //cnt++;
  879. Languagecnt++;
  880. SetLanguageShow(2);//0
  881. break;
  882. case KEY_PANEL_DOWN:
  883. //cnt++;
  884. Languagecnt++;
  885. SetLanguageShow(2);//0
  886. break;
  887. case KEY_PANEL_MENU:
  888. if(0==Languagecnt%2){
  889. UISetNextStatus(UIS_MENU_SYS_SET);
  890. }else{
  891. Languagecnt=0;
  892. if(0==strcmp(sutProductPara.Language,"cn")){
  893. strcpy(sutProductPara.Language,"en");
  894. if(sutProductPara.Netmode>2){
  895. sutProductPara.Netmode=0;
  896. GetMododexWithCard();
  897. }
  898. }else strcpy(sutProductPara.Language,"cn");
  899. }
  900. SaveProductParaToFlash("MENU_SWGPS");
  901. fanhui=1;
  902. UISetNextStatus(UIS_MENU_SYS_SET);
  903. if(0==strcmp(sutProductPara.Language,"cn")){
  904. strncpy(Tempbuf,"AT+POC=512&0\r\n",sizeof(Tempbuf));
  905. }else{
  906. strncpy(Tempbuf,"AT+POC=512&1\r\n",sizeof(Tempbuf));
  907. }
  908. SlwTrace(INF,Tempbuf,1);
  909. ModemSendAT(Tempbuf);
  910. break;
  911. case KEY_PANEL_EXIT:
  912. Languagecnt=0;
  913. UISetNextStatus(UIS_MENU_SYS_SET);
  914. break;
  915. }
  916. }
  917. void SetKeySoundShow(int update)
  918. {
  919. static unsigned short susCt=0;
  920. static char cnt=0;
  921. char buf[10];
  922. unsigned char len=0;
  923. char buf2[20];
  924. int x=12;//4
  925. if(update==1){
  926. GuiClearAll();
  927. if(0==strcmp(sutProductPara.Language,"cn"))ShowCaption("按键音设置",1);
  928. else ShowCaption("KeySound Set",1);
  929. GuiDrawHLine(0,159,20,1);
  930. if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(x,56," 键音开关: ",1);
  931. else GuiShowStr(x,56," Switch: ",1);
  932. snprintf(buf, sizeof(buf),"%s",sutProductPara.Keysound);
  933. len=strlen(buf);
  934. GuiShowStr(x+(16*5),56,buf,1);
  935. GuiReverseRect(x+(16*5),56,8*len,14);//5
  936. GuiDrawHLine(0,159,104,1);
  937. susCt=0;
  938. }else if(update == 2){
  939. memset(buf,0,sizeof(buf));
  940. cnt++;
  941. if(0==strcmp(sutProductPara.Keysound,"open")){
  942. if(0!=cnt%2){
  943. snprintf(buf, sizeof(buf),"%s","close");
  944. }else {
  945. snprintf(buf, sizeof(buf),"%s","open");
  946. }
  947. }else
  948. {
  949. if(0!=cnt%2) snprintf(buf, sizeof(buf),"%s","open");
  950. else snprintf(buf, sizeof(buf),"%s","close");
  951. }
  952. len=strlen(buf);
  953. GuiClearArea(x+(16*5),56,160,14); ////////////////////////
  954. GuiShowStr(x+(16*5),56,buf,1);
  955. GuiReverseRect(x+(16*5),56,8*len,14);//5
  956. GuiDrawHLine(0,159,104,1);
  957. }
  958. if(susCt==0){
  959. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
  960. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  961. }else if(susCt==200){
  962. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[M]保存 [EXIT]退出",0x01);
  963. else GuiShowStr(0,110,"[SAVE] [EXIT]",0x01);
  964. }
  965. if(++susCt>=400)susCt=0;
  966. }
  967. void SetKeysoundResponse(void)
  968. {
  969. static char cnt=0;
  970. switch(g_ulKeyValue){
  971. case KEY_PANEL_UP:
  972. cnt++;
  973. SetKeySoundShow(2);//0
  974. break;
  975. case KEY_PANEL_DOWN:
  976. cnt++;
  977. SetKeySoundShow(2);//0
  978. break;
  979. case KEY_PANEL_MENU:
  980. if(0==cnt%2){
  981. UISetNextStatus(UIS_MENU_SYS_SET);
  982. }else{
  983. if(0==strcmp(sutProductPara.Keysound,"open")){
  984. strcpy(sutProductPara.Keysound,"close");
  985. }else strcpy(sutProductPara.Keysound,"open");
  986. }
  987. printf("start set--------------------\r\n");
  988. SaveProductParaToFlash("MENU_SWGPS");
  989. fanhui=1;
  990. UISetNextStatus(UIS_MENU_SYS_SET);
  991. break;
  992. case KEY_PANEL_EXIT:
  993. UISetNextStatus(UIS_MENU_SYS_SET);
  994. break;
  995. }
  996. }
  997. void SetStartInfoShow(int update)
  998. {
  999. if(update){
  1000. GuiClearAll();
  1001. GuiShowBmp(0,0,"update.bmp");
  1002. }
  1003. }
  1004. //void MessageBoxShow(int update)
  1005. //{
  1006. // if(update){
  1007. // GuiClearArea(0,19,160,90);
  1008. // ShowMessageBox("请先解锁!");
  1009. // os_dly_wait(10);
  1010. // UISetNextStatus(UIS_STANDBY);
  1011. // }
  1012. //}
  1013. void SetFastInterfaceModeShow(int update) //快捷界面设置
  1014. {
  1015. int i;
  1016. char**p=NULL;
  1017. char GroupsFeatures[2];
  1018. static const char *accIconFileName[]={
  1019. "APN.bmp",
  1020. "APN1.bmp",
  1021. ""
  1022. };
  1023. static const char*ModeName[]={
  1024. "群组选择",
  1025. "成员选择",
  1026. //"语音记录",
  1027. ""
  1028. };
  1029. static const char *apcModeName[]={
  1030. "Group Option",
  1031. "Member Option",
  1032. // "Voice record",
  1033. ""
  1034. };
  1035. if(0==strcmp(sutProductPara.Language,"cn"))
  1036. {
  1037. p=ModeName;
  1038. }else{
  1039. p=apcModeName;
  1040. }
  1041. memset(GroupsFeatures,0,sizeof(GroupsFeatures));
  1042. if(update){
  1043. GuiClearAll();
  1044. if(0==strcmp(sutProductPara.Language,"cn"))ShowCaption("快捷界面设置",2);//
  1045. else ShowCaption("FastInterface",2);//
  1046. GuiDrawHLine(0,159,20,1);
  1047. //设置Features 将决定选择图标
  1048. GroupsFeatures[sutProductPara.FastInterface]=1;
  1049. ListBoxInit(&sutListBox,p,0,accIconFileName,GroupsFeatures);
  1050. //----------------------------
  1051. GuiDrawHLine(0,159,104,1);
  1052. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]退出",0x01);
  1053. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  1054. }
  1055. }
  1056. void SetFastInterfaceModeResponse(void)
  1057. {
  1058. unsigned long key;
  1059. key=ListBoxResponse(&sutListBox);
  1060. if(KEY_PANEL_MENU==key)
  1061. {
  1062. if(sutProductPara.FastInterface!=sutListBox.handle){
  1063. sutProductPara.FastInterface=sutListBox.handle;
  1064. SaveProductParaToFlash("SetFastInter");
  1065. os_dly_wait(1);
  1066. }
  1067. fanhui=1;
  1068. UISetNextStatus(UIS_MENU_SYS_SET);
  1069. }
  1070. else if(KEY_PANEL_EXIT==key)UISetNextStatus(UIS_MENU_SYS_SET);
  1071. }
  1072. /****************************2G 3G 4G****************************************/
  1073. void SetNetModeShow(int update) //
  1074. {
  1075. int i;
  1076. char**p=NULL;
  1077. char GroupsFeatures[4];
  1078. static const char *accIconFileName[]={
  1079. "APN.bmp",
  1080. "APN1.bmp",
  1081. ""
  1082. };
  1083. static const char*ModeName[]={
  1084. "Auto",
  1085. "4G",
  1086. "3G",
  1087. "2G",
  1088. ""
  1089. };
  1090. static const char*apcModeName[]={
  1091. "Auto",
  1092. "4G",
  1093. "3G",
  1094. ""
  1095. };
  1096. if(0==strcmp(sutProductPara.Language,"cn"))
  1097. {
  1098. p=ModeName;
  1099. }else{
  1100. p=apcModeName;
  1101. }
  1102. memset(GroupsFeatures,0,sizeof(GroupsFeatures));
  1103. if(update){
  1104. GuiClearAll();
  1105. if(0==strcmp(sutProductPara.Language,"cn"))ShowCaption("网络设置",2);//
  1106. else ShowCaption("NetMode Set",2);//
  1107. GuiDrawHLine(0,159,20,1);
  1108. //设置Features 将决定选择图标
  1109. GroupsFeatures[sutProductPara.Netmode]=1;
  1110. ListBoxInit(&sutListBox,p,0,accIconFileName,GroupsFeatures);
  1111. //----------------------------
  1112. GuiDrawHLine(0,159,104,1);
  1113. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]退出",0x01);
  1114. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  1115. }
  1116. }
  1117. void SetNetModeResponse(void)
  1118. {
  1119. unsigned char i=0;
  1120. unsigned long key;
  1121. key=ListBoxResponse(&sutListBox);
  1122. if(KEY_PANEL_MENU==key)
  1123. {
  1124. if(sutProductPara.LowConsumption==1)
  1125. {
  1126. if(0==strcmp(sutProductPara.Language,"cn"))ShowMessageBox("低功耗中无法设置");
  1127. else ShowMessageBox("Unable to set");
  1128. i=50;
  1129. while(i--)
  1130. OsDelayTime(1);
  1131. fanhui=1;
  1132. UISetNextStatus(UIS_MENU_SYS_SET);
  1133. return;
  1134. }
  1135. sutProductPara.Netmode=sutListBox.handle;
  1136. SaveProductParaToFlash("MENU_SetVolume");
  1137. os_dly_wait(1);
  1138. switch(sutProductPara.Netmode)
  1139. {
  1140. case 0:
  1141. //ModemSendAT("at+zsnt=0,0,0\r\n"); //AUTO
  1142. GetMododexWithCard();
  1143. break;
  1144. case 1:
  1145. //ModemSendAT("at+zsnt=6,0,0\r\n"); //4g
  1146. GetMododexWithCard();
  1147. break;
  1148. case 2:
  1149. //ModemSendAT("at+zsnt=9,0,0\r\n");//3
  1150. GetMododexWithCard();
  1151. break;
  1152. case 3:
  1153. //ModemSendAT("at+zsnt=4,0,0\r\n");//2
  1154. GetMododexWithCard();
  1155. break;
  1156. }
  1157. fanhui=1;
  1158. UISetNextStatus(UIS_MENU_SYS_SET);
  1159. }
  1160. else if(KEY_PANEL_EXIT==key)UISetNextStatus(UIS_MENU_SYS_SET);
  1161. }
  1162. /**********************功放*********************************/
  1163. void SetAwModeShow(int update) //
  1164. {
  1165. int i;
  1166. char**p=NULL;
  1167. char GroupsFeatures[2];
  1168. static const char *accIconFileName[]={
  1169. "APN.bmp",
  1170. "APN1.bmp",
  1171. ""
  1172. };
  1173. static const char*ModeName[]={
  1174. "K类",
  1175. "免提",
  1176. ""
  1177. };
  1178. static const char *apcModeName[]={
  1179. "K Class",
  1180. "HandsFree",
  1181. ""
  1182. };
  1183. if(0==strcmp(sutProductPara.Language,"cn"))
  1184. {
  1185. p=ModeName;
  1186. }else{
  1187. p=apcModeName;
  1188. }
  1189. memset(GroupsFeatures,0,sizeof(GroupsFeatures));
  1190. if(update){
  1191. GuiClearAll();
  1192. if(0==strcmp(sutProductPara.Language,"cn"))ShowCaption("功放设置",2);//
  1193. else ShowCaption("AwMode Set",2);//
  1194. GuiDrawHLine(0,159,20,1);
  1195. //设置Features 将决定选择图标
  1196. GroupsFeatures[sutProductPara.Aw8735]=1;
  1197. ListBoxInit(&sutListBox,p,0,accIconFileName,GroupsFeatures);
  1198. //----------------------------
  1199. GuiDrawHLine(0,159,104,1);
  1200. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]退出",0x01);
  1201. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  1202. }
  1203. }
  1204. void SetAwModeResponse(void)
  1205. {
  1206. unsigned long key;
  1207. key=ListBoxResponse(&sutListBox);
  1208. if(KEY_PANEL_MENU==key)
  1209. {
  1210. if(sutProductPara.Aw8735!=sutListBox.handle){
  1211. sutProductPara.Aw8735=sutListBox.handle;
  1212. SaveProductParaToFlash("MENU_SetVolume");
  1213. os_dly_wait(1);
  1214. }
  1215. fanhui=1;
  1216. UISetNextStatus(UIS_MENU_SYS_SET);
  1217. }
  1218. else if(KEY_PANEL_EXIT==key)UISetNextStatus(UIS_MENU_SYS_SET);
  1219. }
  1220. /**********************低功耗********************************/
  1221. void SetLowConsumptionModeShow(int update) //
  1222. {
  1223. int i;
  1224. char**p=NULL;
  1225. char GroupsFeatures[2];
  1226. static const char *accIconFileName[]={
  1227. "APN.bmp",
  1228. "APN1.bmp",
  1229. ""
  1230. };
  1231. static const char*ModeName[]={
  1232. "关",
  1233. "开",
  1234. ""
  1235. };
  1236. static const char *apcModeName[]={
  1237. "close",
  1238. "open",
  1239. ""
  1240. };
  1241. if(0==strcmp(sutProductPara.Language,"cn"))
  1242. {
  1243. p=ModeName;
  1244. }else{
  1245. p=apcModeName;
  1246. }
  1247. memset(GroupsFeatures,0,sizeof(GroupsFeatures));
  1248. if(update){
  1249. GuiClearAll();
  1250. if(0==strcmp(sutProductPara.Language,"cn"))ShowCaption("低功耗设置",2);//
  1251. else ShowCaption("LowConsumption",2);//
  1252. GuiDrawHLine(0,159,20,1);
  1253. //设置Features 将决定选择图标
  1254. GroupsFeatures[sutProductPara.LowConsumption]=1;
  1255. ListBoxInit(&sutListBox,p,0,accIconFileName,GroupsFeatures);
  1256. //----------------------------
  1257. GuiDrawHLine(0,159,104,1);
  1258. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]退出",0x01);
  1259. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  1260. }
  1261. }
  1262. void SetLowConsumptionResponse(void)
  1263. {
  1264. unsigned long key;
  1265. key=ListBoxResponse(&sutListBox);
  1266. if(KEY_PANEL_MENU==key)
  1267. {
  1268. if(sutProductPara.LowConsumption!=sutListBox.handle){
  1269. sutProductPara.LowConsumption=sutListBox.handle;
  1270. if(sutProductPara.LowConsumption==0)
  1271. { switch(sutProductPara.Netmode)
  1272. {
  1273. case 0:
  1274. GetMododexWithCard();
  1275. break;
  1276. case 1:
  1277. GetMododexWithCard();//4g
  1278. break;
  1279. case 2:
  1280. GetMododexWithCard();//3
  1281. break;
  1282. }
  1283. os_dly_wait(30);
  1284. ModemSendAT("AT+POC=558&0\r\n");
  1285. }else { //4g
  1286. sutProductPara.Netmode=1;
  1287. GetMododexWithCard();
  1288. os_dly_wait(30);
  1289. ModemSendAT("AT+POC=558&1\r\n");
  1290. }
  1291. SaveProductParaToFlash("MENU_SetVolume");
  1292. os_dly_wait(1);
  1293. }
  1294. fanhui=1;
  1295. UISetNextStatus(UIS_MENU_SYS_SET);
  1296. }
  1297. else if(KEY_PANEL_EXIT==key)UISetNextStatus(UIS_MENU_SYS_SET);
  1298. }
  1299. //unsigned char MododrxTable[4][4]={{7,6,5,4},{7,6,6,1},{7,6,2,1},{7,6,2,1}}; //电信 移动 联通 国外
  1300. unsigned char MododrxTable[4]={0,4,3,2}; //电信 移动 联通 国外
  1301. void GetMododexWithCard(void)
  1302. {
  1303. char buf[30];
  1304. //根据CardType和ModeSetup转换为Mododex值的一个表
  1305. //static const unsigned char MododrxTable[3][3]={{11,24,5},{2,8,5},{17,21,5}};
  1306. //if(thisYunYingShang>3) return;
  1307. snprintf(buf,sizeof(buf),"at+zsnte=%d\r\n",MododrxTable[sutProductPara.Netmode]);
  1308. //"at+zsnt=0,0,0\r\n"
  1309. ModemSendAT(buf);
  1310. }
  1311. void WaitOneCallShow(int update)
  1312. {
  1313. char buf[50];
  1314. if(update){
  1315. GuiClearAll();
  1316. if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf,sizeof(buf),"呼叫:%s",sutPocStatus.Callname);
  1317. else snprintf(buf,sizeof(buf),"Call:%s",sutPocStatus.Callname);
  1318. ShowMessageBox(buf);
  1319. // UISetNextStatus(UIS_STANDBY);
  1320. if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(0,110," 挂断",0x01);//GuiShowStrM20(135,113,"挂断",1,COLOR_WHITE,OrangeColorId);
  1321. else GuiShowStr(0,110," HangUp",0x01);//GuiShowStrM20(105,111,"HangUp",1,COLOR_WHITE,OrangeColorId);//113
  1322. }
  1323. }
  1324. void WaitOneCallResponse()
  1325. {
  1326. unsigned long key;
  1327. char buf[40];
  1328. key=g_ulKeyValue;
  1329. if(KEY_PANEL_EXIT==key){
  1330. //UISetNextStatus(UIS_MENU_MAIN);
  1331. snprintf(buf,sizeof(buf),"AT+POC=540&2&%d\r\n",sutPocStatus.CallID);
  1332. ModemSendAT(buf);
  1333. }
  1334. }
  1335. void SetFactory_KeyShow(int update)
  1336. {
  1337. static unsigned short susCt=0;
  1338. char buf[10];
  1339. char buf1[6];
  1340. int x=64;//4
  1341. int i;
  1342. if(update==1){
  1343. GuiClearAll();
  1344. ShowCaption("按键测试",1);//0
  1345. GuiDrawHLine(0,159,20,1);
  1346. GuiShowStr(x,56,"按键",1);
  1347. GuiShowStr(x,56+18,"无",1);
  1348. }
  1349. }
  1350. void Factory_KeyResponse()
  1351. {
  1352. int FileIndex;
  1353. static unsigned long Lastkey=-1;
  1354. char Buf[10];
  1355. int x=64;//4
  1356. Lastkey=KeyScanPort();
  1357. if(Lastkey!=((KEY_ALL_PORTB<<16)| KEY_ALL_PORTC))
  1358. {
  1359. switch(Lastkey)
  1360. {
  1361. case KEY_PPT:
  1362. GuiClearArea(x,56+18,80,18);
  1363. GuiShowStr(x,56+18,"左一",1); //二
  1364. break;
  1365. case KEY_SOS_OK:
  1366. GuiClearArea(x,56+18,80,18);
  1367. GuiShowStr(x,56+18,"上一",1);
  1368. break;
  1369. case KEY_INFO:
  1370. GuiClearArea(x,56+18,80,18);
  1371. GuiShowStr(x,56+18,"左一",1);
  1372. break;
  1373. case KEY_FUNC_P2:
  1374. GuiClearArea(x,56+18,80,18);
  1375. GuiShowStr(x,56+18,"左二",1); //三
  1376. break;
  1377. case KEY_FUNC_P3:
  1378. GuiClearArea(x,56+18,80,18);
  1379. GuiShowStr(x,56+18,"左三",1);
  1380. break;
  1381. case KEY_PANEL_MENU:
  1382. GuiClearArea(x,56+18,80,18);
  1383. GuiShowStr(x,56+18,"正一",1);
  1384. break;
  1385. case KEY_PANEL_UP:
  1386. GuiClearArea(x,56+18,80,18);
  1387. GuiShowStr(x,56+18,"正二",1);
  1388. break;
  1389. case KEY_PANEL_DOWN:
  1390. GuiClearArea(x,56+18,80,18);
  1391. GuiShowStr(x,56+18,"正三",1);
  1392. break;
  1393. case KEY_PANEL_EXIT:
  1394. GuiClearArea(x,56+18,80,18);
  1395. GuiShowStr(x,56+18,"正四",1);
  1396. os_dly_wait(100);
  1397. UISetNextStatus(UIS_FACTORY_MENU);
  1398. break;
  1399. }
  1400. }
  1401. else
  1402. {
  1403. GuiClearArea(x,56+18,80,18);
  1404. GuiShowStr(x,56+18,"无",1);
  1405. }
  1406. }
  1407. void SetFactory_LCDShow(int update)
  1408. {
  1409. if(update){
  1410. GuiClearAll();
  1411. }
  1412. }
  1413. void Factory_LcdResponse()
  1414. {
  1415. static unsigned char KeyCnt=0;
  1416. if(KEY_PANEL_UP==g_ulKeyValue||KEY_PANEL_DOWN==g_ulKeyValue){
  1417. if(++KeyCnt>3)KeyCnt=0;
  1418. if(KeyCnt==1)GuiClearAllM20Test(RedColorId);
  1419. else if(KeyCnt==2)GuiClearAllM20Test(GreenColorId);
  1420. else if(KeyCnt==3)GuiClearAllM20Test(BlueColorId);
  1421. else if(KeyCnt==0)GuiClearAll();
  1422. }else if(KEY_PANEL_EXIT==g_ulKeyValue){
  1423. KeyCnt=0;
  1424. UISetNextStatus(UIS_FACTORY_MENU);
  1425. }
  1426. }
  1427. void SetFactory_LEDShow(int update)
  1428. {
  1429. unsigned char x=64;
  1430. if(update==1){
  1431. GuiClearAll();
  1432. ShowCaption("LED测试",1);//0
  1433. GuiDrawHLine(0,159,20,1);
  1434. // GuiShowStr(x,56,"红灯--按UP",1);
  1435. ShowCaptionArea("红灯--按UP",0,160,56);
  1436. // GuiShowStr(x,56+18,"绿灯--按DOWN",1);
  1437. ShowCaptionArea("绿灯--按DOWN",0,160,56+18);
  1438. }
  1439. }
  1440. /*
  1441. NotBright=0, //均不亮
  1442. RedBright, //红灯常亮
  1443. RedFastFlash, //红灯快闪
  1444. RedSlowFlash, //红灯慢闪
  1445. BlueBright, //蓝灯常亮
  1446. BlueFastFlash, //蓝灯快闪
  1447. BlueSlowFlash, //蓝灯慢闪
  1448. RedBlueBright, //红蓝常亮
  1449. RedBlueFastFlash, //红蓝快闪
  1450. RedBlueSlowFlash //红蓝慢闪
  1451. */
  1452. void Factory_LEDResponse()
  1453. {
  1454. static unsigned char KeyCnt=0;
  1455. if(KEY_PANEL_UP==g_ulKeyValue){
  1456. if(!KeyCnt){
  1457. SetLedStatus(RedBright);
  1458. }else{
  1459. SetLedStatus(NotBright);
  1460. }
  1461. KeyCnt=!KeyCnt;
  1462. }else if(KEY_PANEL_DOWN==g_ulKeyValue){
  1463. if(!KeyCnt){
  1464. SetLedStatus(BlueBright);
  1465. }else{
  1466. SetLedStatus(NotBright);
  1467. }
  1468. KeyCnt=!KeyCnt;
  1469. }else if(KEY_PANEL_EXIT==g_ulKeyValue){
  1470. KeyCnt=0;
  1471. SetLedStatus(NotBright);
  1472. UISetNextStatus(UIS_FACTORY_MENU);
  1473. }
  1474. }
  1475. void SetFactory_VBATShow(int update)
  1476. {
  1477. unsigned char x=64;
  1478. unsigned char buf[20];
  1479. static unsigned int susCt=0;
  1480. static unsigned int lastVbat=0;
  1481. if(update==1){
  1482. GuiClearAll();
  1483. ShowCaption("电压值",1);//0
  1484. GuiDrawHLine(0,159,20,1);
  1485. if(Mcu_Type==MCU_ST){
  1486. GuiShowStr(18,38,"ST",1);
  1487. }else if(Mcu_Type==MCU_HK){
  1488. GuiShowStr(18,38,"HK",1);
  1489. }else{
  1490. GuiShowStr(18,38,"未知",1);
  1491. }
  1492. snprintf(buf,sizeof(buf),"%d",g_iVbat);
  1493. GuiShowStr(x,38,buf,1);
  1494. if(sutProductPara.VbatCalibration>0)snprintf(buf,sizeof(buf),"校准值:%03d",sutProductPara.VbatCalibration);
  1495. else snprintf(buf,sizeof(buf),"校准值:%03d",sutProductPara.VbatCalibration);
  1496. GuiShowStr(18,56,buf,1);
  1497. }
  1498. if(susCt==200||susCt==0){
  1499. if(lastVbat!=g_iVbat){
  1500. lastVbat=g_iVbat;
  1501. snprintf(buf,sizeof(buf),"%d",lastVbat);
  1502. GuiShowStr(x,38,buf,1);
  1503. }
  1504. if(lastVbat>432){ // 或者IC判饱
  1505. snprintf(buf,sizeof(buf),"合格");
  1506. GuiShowStr(x,56+18+18,buf,1);
  1507. }else GuiClearRect(x,56+18+18,160,56+18+18+18);
  1508. }
  1509. if(++susCt>=400)susCt=0;
  1510. }
  1511. void Factory_VBATResponse()
  1512. {
  1513. char buf[20];
  1514. if(KEY_PANEL_EXIT==g_ulKeyValue){
  1515. UISetNextStatus(UIS_FACTORY_MENU);
  1516. }else if(KEY_PANEL_UP==g_ulKeyValue){
  1517. if(++sutProductPara.VbatCalibration>20)sutProductPara.VbatCalibration=-15;
  1518. snprintf(buf,sizeof(buf),"校准值:%03d",sutProductPara.VbatCalibration);
  1519. GuiShowStr(18,56,buf,1);
  1520. }else if(KEY_PANEL_DOWN==g_ulKeyValue)
  1521. {
  1522. if(--sutProductPara.VbatCalibration<-20)sutProductPara.VbatCalibration=15;
  1523. snprintf(buf,sizeof(buf),"校准值:%03d",sutProductPara.VbatCalibration);
  1524. GuiShowStr(18,56,buf,1);
  1525. }else if(KEY_PANEL_MENU==g_ulKeyValue)
  1526. {
  1527. ShowMessageBox("正在保存");
  1528. SaveProductParaToFlash("SAVE VBATCAL");
  1529. UISetNextStatus(UIS_FACTORY_MENU);
  1530. }
  1531. }
  1532. /**********************PTT 按键音*********************************/
  1533. void SetPttToneModeShow(int update) //
  1534. {
  1535. int i;
  1536. char**p=NULL;
  1537. char TempStatue=0;
  1538. char GroupsFeatures[4];
  1539. static short susCt=0;
  1540. static const char *accIconFileName[]={
  1541. "APN.bmp",
  1542. "APN1.bmp",
  1543. ""
  1544. };
  1545. static const char*ModeName[]={
  1546. "全关", //0x00
  1547. "仅发送提示", //0x01
  1548. "仅接收提示", //0x10
  1549. "全开", //0x11
  1550. ""
  1551. };
  1552. static const char *apcModeName[]={
  1553. "Full Close",
  1554. "Only Send",
  1555. "Only Recv",
  1556. "Full Open",
  1557. ""
  1558. };
  1559. if(0==strcmp(sutProductPara.Language,"cn"))
  1560. {
  1561. p=ModeName;
  1562. }else{
  1563. p=apcModeName;
  1564. }
  1565. memset(GroupsFeatures,0,sizeof(GroupsFeatures));
  1566. if(update){
  1567. susCt=0;
  1568. GuiClearAll();
  1569. if(0==strcmp(sutProductPara.Language,"cn"))ShowCaption("PTT提示音设置",2);//
  1570. else ShowCaption("PttTone Set",2);//
  1571. GuiDrawHLine(0,159,20,1);
  1572. //设置Features 将决定选择图标
  1573. TempStatue=(sutProductPara.SendToneEnadble)|(sutProductPara.RecvToneEnadble<<1);
  1574. GroupsFeatures[TempStatue]=1;
  1575. ListBoxInit(&sutListBox,p,0,accIconFileName,GroupsFeatures);
  1576. //----------------------------
  1577. GuiDrawHLine(0,159,104,1);
  1578. }
  1579. if(susCt==0){
  1580. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
  1581. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  1582. }else if(susCt==200){
  1583. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[M]保存 [EXIT]退出",0x01);
  1584. else GuiShowStr(0,110,"[SAVE] [EXIT]",0x01);
  1585. }
  1586. if(++susCt>=400)susCt=0;
  1587. }
  1588. void SetPttToneResponse(void)
  1589. {
  1590. unsigned long key;
  1591. char TempStatue=0;
  1592. char buf[25];
  1593. key=ListBoxResponse(&sutListBox);
  1594. if(KEY_PANEL_MENU==key)
  1595. {
  1596. TempStatue=(sutProductPara.SendToneEnadble)|(sutProductPara.RecvToneEnadble<<1);
  1597. if(TempStatue!=sutListBox.handle){
  1598. memset(buf,0,sizeof(buf));
  1599. TempStatue=sutListBox.handle;
  1600. sutProductPara.SendToneEnadble=TempStatue&0x01;
  1601. sutProductPara.RecvToneEnadble=TempStatue>>1;
  1602. SaveProductParaToFlash("MENU_SetPttTone");
  1603. snprintf(buf,sizeof(buf),"AT+POC=511&%d&%d&1\r\n",sutProductPara.SendToneEnadble,sutProductPara.RecvToneEnadble);
  1604. ModemSendAT(buf);
  1605. os_dly_wait(1);
  1606. }
  1607. fanhui=1;
  1608. UISetNextStatus(UIS_MENU_SYS_SET);
  1609. }
  1610. else if(KEY_PANEL_EXIT==key)UISetNextStatus(UIS_MENU_SYS_SET);
  1611. }
  1612. void SetADBDebugShow(int update) //
  1613. {
  1614. int i;
  1615. char**p=NULL;
  1616. char GroupsFeatures[2];
  1617. static short susCt=0;
  1618. static const char *accIconFileName[]={
  1619. "APN.bmp",
  1620. "APN1.bmp",
  1621. ""
  1622. };
  1623. static const char*ModeName[]={
  1624. "关闭", //0x00
  1625. "打开", //0x01
  1626. ""
  1627. };
  1628. static const char *apcModeName[]={
  1629. "close",
  1630. "open",
  1631. ""
  1632. };
  1633. if(0==strcmp(sutProductPara.Language,"cn"))
  1634. {
  1635. p=ModeName;
  1636. }else{
  1637. p=apcModeName;
  1638. }
  1639. memset(GroupsFeatures,0,sizeof(GroupsFeatures));
  1640. if(update){
  1641. susCt=0;
  1642. GuiClearAll();
  1643. if(0==strcmp(sutProductPara.Language,"cn"))ShowCaption("USB调试",2);//
  1644. else ShowCaption("USB debug",2);//
  1645. GuiDrawHLine(0,159,20,1);
  1646. //设置Features 将决定选择图标
  1647. GroupsFeatures[AdbDebug]=1;
  1648. ListBoxInit(&sutListBox,p,0,accIconFileName,GroupsFeatures);
  1649. //----------------------------
  1650. GuiDrawHLine(0,159,104,1);
  1651. }
  1652. if(susCt==0){
  1653. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
  1654. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  1655. }else if(susCt==200){
  1656. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[M]保存 [EXIT]退出",0x01);
  1657. else GuiShowStr(0,110,"[SAVE] [EXIT]",0x01);
  1658. }
  1659. if(++susCt>=400)susCt=0;
  1660. }
  1661. void SetAdbDebugResponse(void)
  1662. {
  1663. unsigned long key;
  1664. char buf[25];
  1665. key=ListBoxResponse(&sutListBox);
  1666. if(KEY_PANEL_MENU==key)
  1667. {
  1668. if(AdbDebug!=sutListBox.handle){
  1669. memset(buf,0,sizeof(buf));
  1670. AdbDebug=sutListBox.handle;
  1671. if(AdbDebug){
  1672. snprintf(buf,sizeof(buf),"at+zadset=d\r\n");
  1673. ModemSendAT(buf);
  1674. SlwTrace(INF,buf,1);
  1675. os_dly_wait(1);
  1676. fanhui=1;
  1677. UISetNextStatus(UIS_MENU_SYS_SET);
  1678. }
  1679. else{
  1680. //重启模块
  1681. ShowMessageBox("reboot...");
  1682. while(1);
  1683. // sutPocStatus.modemRstFlag=1;
  1684. // os_dly_wait(100);
  1685. // UISetNextStatus(UIS_STANDBY);
  1686. return;
  1687. }
  1688. }
  1689. }
  1690. else if(KEY_PANEL_EXIT==key)UISetNextStatus(UIS_MENU_SYS_SET);
  1691. }
  1692. void SetBOOTDebugShow(int update) //
  1693. {
  1694. int i;
  1695. char**p=NULL;
  1696. char GroupsFeatures[2];
  1697. static short susCt=0;
  1698. static const char *accIconFileName[]={
  1699. "APN.bmp",
  1700. "APN1.bmp",
  1701. ""
  1702. };
  1703. static const char*ModeName[]={
  1704. "普通模式", //0x00
  1705. "升级模式", //0x01
  1706. ""
  1707. };
  1708. static const char *apcModeName[]={
  1709. "close",
  1710. "open",
  1711. ""
  1712. };
  1713. if(0==strcmp(sutProductPara.Language,"cn"))
  1714. {
  1715. p=ModeName;
  1716. }else{
  1717. p=apcModeName;
  1718. }
  1719. memset(GroupsFeatures,0,sizeof(GroupsFeatures));
  1720. if(update){
  1721. susCt=0;
  1722. GuiClearAll();
  1723. if(0==strcmp(sutProductPara.Language,"cn"))ShowCaption("固件升级",2);//
  1724. else ShowCaption("BOOT updata",2);//
  1725. GuiDrawHLine(0,159,20,1);
  1726. //设置Features 将决定选择图标
  1727. GroupsFeatures[BOOTDebug]=1;
  1728. ListBoxInit(&sutListBox,p,0,accIconFileName,GroupsFeatures);
  1729. //----------------------------
  1730. GuiDrawHLine(0,159,104,1);
  1731. }
  1732. if(susCt==0){
  1733. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
  1734. else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
  1735. }else if(susCt==200){
  1736. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[M]保存 [EXIT]退出",0x01);
  1737. else GuiShowStr(0,110,"[SAVE] [EXIT]",0x01);
  1738. }
  1739. if(++susCt>=400)susCt=0;
  1740. }
  1741. void SetBOOTDebugResponse(void)
  1742. {
  1743. unsigned long key;
  1744. char buf[25];
  1745. key=ListBoxResponse(&sutListBox);
  1746. if(KEY_PANEL_MENU==key)
  1747. {
  1748. if(BOOTDebug!=sutListBox.handle){
  1749. memset(buf,0,sizeof(buf));
  1750. BOOTDebug=sutListBox.handle;
  1751. if(BOOTDebug){
  1752. ShowMessageBox("reboot...");
  1753. MODEN_BOOT_EN_HIGH;
  1754. os_dly_wait(100);
  1755. MODEM_RESET_HIGH;
  1756. os_dly_wait(100);
  1757. MODEM_RESET_LOW;
  1758. CHARGE_IC_HIGH;//断掉充电IC
  1759. }else{
  1760. ShowMessageBox("normal...");
  1761. MODEN_BOOT_EN_LOW;
  1762. os_dly_wait(50);
  1763. sutPocStatus.modemRstFlag=1;
  1764. }
  1765. //UIS_BOOTUPATE_SHOW
  1766. //UISetNextStatus(UIS_STANDBY);
  1767. UISetNextStatus(UIS_BOOTUPATE_SHOW);
  1768. }
  1769. }
  1770. else if(KEY_PANEL_EXIT==key)UISetNextStatus(UIS_MENU_SYS_SET);
  1771. }
  1772. void PowerOffShow(int update) //
  1773. {
  1774. int i;
  1775. if(update){
  1776. GuiClearAll();
  1777. GuiDrawHLine(0,159,20,1);
  1778. if(0==strcmp(sutProductPara.Language,"cn"))ShowCaption("关机提示",2);//
  1779. else ShowCaption("PowerOff",2);//
  1780. if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("确定关机?",48);
  1781. else ShowCaption("PowerOff?",48);
  1782. //----------------------------
  1783. GuiDrawHLine(0,159,104,1);
  1784. }
  1785. if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"确定 退出",0x01);
  1786. else GuiShowStr(0,110,"[MENU] [EXIT]",0x01);
  1787. }
  1788. void SetPowerOffResponse(void)
  1789. {
  1790. unsigned long key;
  1791. char buf[25];
  1792. if(KEY_PANEL_MENU==g_ulKeyValue)
  1793. {
  1794. SlwTrace(INF, "PwrOffOk",1);
  1795. ShowMessageBox("正在关机...");
  1796. MODEN_POWER_EN_HIGH;
  1797. IWDG_ReloadCounter();
  1798. os_dly_wait(100);
  1799. MODEN_POWER_EN_LOW;
  1800. IWDG_ReloadCounter();
  1801. os_dly_wait(220);
  1802. PWR_EN_LOW;
  1803. while(1);
  1804. }
  1805. else if(KEY_PANEL_EXIT==g_ulKeyValue){
  1806. if(!g_uGtFactory)UISetNextStatus(UIS_STANDBY);
  1807. else UISetNextStatus(UIS_FACTORY_MENU);
  1808. }
  1809. }
  1810. void BootUptating(int update)
  1811. {
  1812. if(update)
  1813. {
  1814. GuiClearAll();
  1815. ShowCaption("升级模式",64);
  1816. }
  1817. }