1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426 |
- #include "includes.h"
- typedef enum{
- PMODE_DEFAULT_LOW,
- PMODE_SUPER_LOW,
- PMODE_NORMAL
- }PWR_ENUMDEF;
- unsigned short LcdOnTimeCt;
- unsigned int g_uiGpsStat = 1;
- SUT_MENU sutMenuSysSetup;
- unsigned char Net_temp_flag;
- //超长功耗
- #define MODE_LONG_LOW_PWR_NONE_4G 5
- #define MODE_LONG_LOW_PWR_IS_4G 55
- //默认为低功耗模式
- #define MODE_LOW_PWR_NONE_4G 5
- #define MODE_LOW_PWR_IS_4G 25
- //使用常规非低功耗模式
- #define MODE_NORMAL__NONE_4G 5
- #define MODE_NORMAL__IS_4G 5
- //终端放弃设置模式,由服务器决定使用什么情况
- #define MODE_AUTO____NONE_4G 0
- #define MODE_AUTO____IS_4G 0
- static const char*g_ausNetOut[]={"Auto"," 2G "," 3G "," 4G "};
- void ModemSetPwrMode(unsigned char mode)
- {
- char info[30];
- unsigned char seg1,seg2;
- switch(mode){
- case PMODE_DEFAULT_LOW: seg1=MODE_LOW_PWR_NONE_4G;seg2=MODE_LOW_PWR_IS_4G;break;//默认为低功耗模式
- case PMODE_SUPER_LOW: seg1=MODE_LONG_LOW_PWR_NONE_4G;seg2=MODE_LONG_LOW_PWR_IS_4G;break;//超长功耗
- case PMODE_NORMAL: seg1=MODE_NORMAL__NONE_4G;seg2=MODE_NORMAL__IS_4G;break;//使用常规非低功耗模式
- default:return;
- }
- snprintf(info, sizeof(info), "AT+UDP=%d,%d\r\n",seg1,seg2);
- ModemSendAt(info);
- SlwTrace(INF, info,0);
- }
- void GetPwrMode(char *msg)
- {//0,5,30
- //1,30,30
- int seg1,seg2;
- short i;
- char buf[15];
- //if(msg[0]=='0') return;
- for(i=2;i<strlen(msg);i++){
- if(msg[i]==','){
- seg1=atoi(msg+2);
- seg2=atoi(msg+i+1);
- if(seg1==MODE_LOW_PWR_NONE_4G && seg2==MODE_LOW_PWR_IS_4G && newPara.pwrMode != PMODE_DEFAULT_LOW){
- goto SAVE_PWR_MODE;
- }else if(seg1==MODE_LONG_LOW_PWR_NONE_4G && seg2==MODE_LONG_LOW_PWR_IS_4G && newPara.pwrMode != PMODE_SUPER_LOW){
- goto SAVE_PWR_MODE;
- }else if(seg1==MODE_NORMAL__NONE_4G && seg2==MODE_NORMAL__IS_4G && newPara.pwrMode != PMODE_NORMAL){
- goto SAVE_PWR_MODE;
- }else if(seg2!=MODE_LOW_PWR_IS_4G&&seg2!=MODE_LONG_LOW_PWR_IS_4G&& seg2!=MODE_NORMAL__IS_4G){
- //Seg2 3个模式都不满足切换为常规模式
- seg1=MODE_NORMAL__NONE_4G;
- seg2=MODE_NORMAL__IS_4G;
- newPara.pwrMode = PMODE_NORMAL;
- goto SAVE_PWR_MODE;
- }
- }
- }
- return;
- SAVE_PWR_MODE:
- // snprintf(buf, sizeof(buf), "AT+UDP=%d,%d\r\n",seg1,seg2);
- // ModemSendAt(buf);
- // SlwTrace(INF,buf,1);
- ModemSetPwrMode(newPara.pwrMode);
- ModifyConfigureFile(0);
- }
- /*****************************************************
- 深圳北纬22.33 东经114.07
- 经过试验数据比较准确,但是东西南北不知道
- ******************************************************/
- void GetCoordinates(unsigned char type)
- {
- //type 0 UI时调用
- // 1 上传时调用
- char buf[30];
- char buf1[8];
- char buf2[4]={0};
- char temp[3];
- char temp1[3];
- char temp2[5];
- char temp3[5];
- int i,num,num1,w,j;
-
- double Jnum1,Jnum2,Jnum3;//有小数位 8位有效
- double Wnum1,Wnum2,Wnum3;//有小数位 8位有效
- unsigned char laTemp[4],loTemp[4];
- laTemp[0] = (sutGpsInfo.latitue>>24);
- laTemp[1] = (sutGpsInfo.latitue>>16);
- laTemp[2] = (sutGpsInfo.latitue>>8);
- laTemp[3] = (sutGpsInfo.latitue);
-
- loTemp[0] = (sutGpsInfo.longitue>>24);
- loTemp[1] = (sutGpsInfo.longitue>>16);
- loTemp[2] = (sutGpsInfo.longitue>>8);
- loTemp[3] = (sutGpsInfo.longitue);
-
- AscStrTurnHexStr((char *)loTemp,buf1);
- memset(temp, 0, sizeof(temp));
- for(i=0;i<3;i++) temp[i]=buf1[i];
- j=atoi(temp);
-
- memset(temp2, 0, sizeof(temp2));
- for(i=0;i<6;i++) temp2[i]=buf1[i+3];
- num=atoi(temp2);
-
- Jnum1=num/1000;
- Jnum1 /=60;
- Jnum2 = (num%1000)*60;
- Jnum2 /=3600000;
- Jnum3=Jnum1+Jnum2;
- sutGpsInfo.testJD = j*1000000+Jnum3*1000000;//上传时使用
- AscStrTurnHexStr((char *)laTemp,buf2);
- for(i=0;i<3;i++) temp1[i]=buf2[i];
- w=atoi(temp1);
- for(i=0;i<6;i++) temp3[i]=buf2[i+3];
- num1=atoi(temp3);
- Wnum1=num1/1000;
- Wnum1 /=60;
- Wnum2 = (num1%1000)*60;
- Wnum2 /=3600000;
- Wnum3=Wnum1+Wnum2;
- sutGpsInfo.testWD = w*1000000+Wnum3*1000000;
- if(type == 0){//UI时要显示
- snprintf(buf, sizeof(buf)," 纬度 %s: %.3d.%05d","S",w,(unsigned int)(Wnum3*100000));
- GuiShowStr(0,STATUS_ITEM_HEIGH,buf,0x01,0);
- snprintf(buf, sizeof(buf)," 经度 %s: %d.%05d","W",j,(unsigned int)(Jnum3*100000));
- GuiShowStr(0,STATUS_ITEM_HEIGH+16,buf,0x01,0);
- }
- }
-
-
- unsigned char validApnNum;
-
- char *APNNAME[APN_NUM+1]=
- {
- "APN1",
- "APN2",
- "APN3",
- "APN4",
- ""
- };
- static const char *accIconFileNameAPN[]={
- "APN.bmp",
- "APN1.bmp",
- ""
- };
- void SetAPNShow(int update)
- {
- int i;
- static char GroupsFeatures[APN_NUM];
- if(update){
- if(showApn!=1)
- {
- ShowMessageBox("禁止修改");
- uTimerHardDly(200);
- UISetNextStatus(UIS_MENU_SYS_SET);
- return;
- }
- if(validApnNum==1)
- {
- ShowMessageBox("配置文件无APN");
- uTimerHardDly(200);
- UISetNextStatus(UIS_MENU_SYS_SET);
- return;
- }
- memset(GroupsFeatures,0,sizeof(GroupsFeatures));
- GuiClearAll();
- ShowCaption("设置APN",2);//
- //GuiDrawHLine(0,159,20,1);
- //设置Features 将决定选择图标
- GroupsFeatures[newPara.apnList.defaultuse]=1;
- ListBoxInit(&sutListBox,APNNAME,0,accIconFileNameAPN,GroupsFeatures);
- //----------------------------
- GuiDrawHLine(0,159,110,1);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[OK]切换 [S]详情",0x01,0);
- }
- }
-
-
- char *LCDNAME[LCD_NUM+1]=
- {
- "5",
- "4",
- "3",
- "2",
- "1",
- ""
- };
- void SetLcdBrightShow(int update)
- {
- static char GroupsFeatures[LCD_NUM];
- if(update){
- GuiClearAll();
- ShowCaption("背光调节",2);
- //设置Features 将决定选择图标
- memset(GroupsFeatures,0,sizeof(GroupsFeatures));
- GroupsFeatures[newPara.LcdPulse]=1;
- ListBoxInit(&sutListBox,LCDNAME,0,accIconFileNameAPN,GroupsFeatures);
- //----------------------------
- GuiDrawHLine(0,159,110,1);
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]切换",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- //sutUIstatus.ItemRefresh=0;
- }
- }
-
- void SetLcdBrightResponse(void)
- {
- unsigned long key;
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_MENU==key){
- if(sutListBox.handle != newPara.LcdPulse){
-
- // if(sutListBox.handle==0)Test_EnableSpk=0;
- // else Test_EnableSpk=1;
- newPara.LcdPulse=sutListBox.handle;
- ModifyConfigureFile(1);
- }
- //sutUIstatus.ItemRefresh=1;
- UI_Stack.OK_back=1;
- UISetNextStatus(UIS_MENU_SYS_SET);
- }else if(KEY_PANEL_OK==key){
- UISetNextStatus(UIS_MENU_SYS_SET);
- }
- }
-
- void SetSYSResponse(void)
- {
- unsigned long key;
- key=MenuResponse(&sutMenuSysSetup);
- if(KEY_PANEL_MENU==key){
- switch(sutMenuSysSetup.handle){
- case 0:
- UISetNextStatus(UIS_SET_LCD);
- break;
- case 1:
- UISetNextStatus(UIS_SET_LCDBRIGHT);
- break;
- case 2:
- UISetNextStatus(UIS_SET_SIMCARD);
- break;
-
- case 3:
- UISetNextStatus(UIS_SET_USBTTL);
- break;
- case 4:
- UISetNextStatus(UIS_SET_PWRMODE);
- break;
- case 5:
- UISetNextStatus(UIS_SET_SERVER_PASS);
- break;
- case 6:
- UISetNextStatus(UIS_SET_POC_FOTA);
- break;
- }
- PushUiStack(&UI_Stack,sutMenuSysSetup.handle);
- }
- else if(KEY_PANEL_OK==key){
- UISetNextStatus(UIS_MENU_MAIN); //UIS_MENU_SYS_SET
- }
- }
-
- char showIndex;
- void ShowAPNMessage(char index)
- {
- char buf[40];
- char temp[40];
- unsigned char len;
- unsigned char i,y,maxLen;
- i=0;
- y=STATUS_ITEM_HEIGH;
- maxLen=14;
- GuiClearRect(0, y, LCD_WIDTH-1,LCD_HEIGHT-25);
- snprintf(buf, sizeof(buf), "%s:",APNNAME[showIndex]);
- GuiShowStr(1,y+16*i++,buf,0x01,0);
- len=strlen(newPara.apnList.apnList[showIndex].account);
- memcpy(temp, newPara.apnList.apnList[showIndex].account, maxLen);
- temp[maxLen]=0;
- snprintf(buf, sizeof(buf), "Name:%s",temp);
- GuiShowStr(1,y+16*i++,buf,0x01,0);
- if(len > maxLen)
- {
- // memcpy(temp, newPara.apnList.apnList[showIndex].account, maxLen);temp[maxLen]=0;
- // snprintf(buf, sizeof(buf), "%s",temp);
- // buf[len-maxLen]=0;
- strcpy(buf,&(newPara.apnList.apnList[showIndex].account[maxLen]));
- GuiShowStr(1,y+16*i++,buf,0x01,0);
- }
- len=strlen(newPara.apnList.apnList[showIndex].pass);
- memcpy(temp, newPara.apnList.apnList[showIndex].pass, maxLen);
- temp[maxLen]=0;
- snprintf(buf, sizeof(buf), "Pass:%s",temp);
- GuiShowStr(1,y+16*i++,buf,0x01,0);
- if(len > maxLen)
- {
- // memcpy(temp, newPara.apnList.apnList[showIndex].pass, maxLen);temp[maxLen]=0;
- // snprintf(buf, sizeof(buf), "%s",temp);
- // buf[len-maxLen]=0;
- strcpy(buf,&(newPara.apnList.apnList[showIndex].pass[maxLen]));
- GuiShowStr(1,y+16*i++,buf,0x01,0);
- }
- }
-
- void SetApnDetailShow(int update)
- {
- char buf[40];
- if(update)
- {
- GuiClearAll();
- ShowCaption("APN详情",2);//
- //GuiDrawHLine(0,159,20,1);
- showIndex=0;
- ShowAPNMessage(showIndex);
- //----------------------------
- GuiDrawHLine(0,159,110,1);
- GuiShowStr(0,SUBSCRIPT_LOCATION," [EXIT]返回",0x01,0);
- }
- }
-
-
- //居中显示信息
- void FunShowMsg(char *info)
- {
- int x,y;
- SlwTrace(INF, info,1);
- x=(LCD_WIDTH-strlen(info)*8)/2;
- y=LCD_HEIGHT/2;
- GuiClearArea(0,y,LCD_WIDTH, 16);
- GuiShowStr(x,y,info,1,0);
- }
- //配置编码器菜单
- unsigned char tempCodetype;
- void CodeTypeUpdateShow(void)
- {
- char info[20];
-
- switch(tempCodetype){
- case 0:sprintf(info, "EVRC_HALF");break;
- case 1:sprintf(info, "EVRC_FULL");break;
- case 2:sprintf(info, "AMRNB-122");break;
-
- default:return;
- }
-
- FunShowMsg(info);
- }
- void SetCodeTypeShow(int update)
- {
- static unsigned short susCt=0;
- int x=4;//4
- int i;
- if(update==1){
- susCt=0;
- GuiClearAll();
- ShowCaption("编码器设置",1);//0
- //GuiDrawHLine(0,159,20,1);
- GuiDrawHLine(0,159,110,1);
- if(modemInitReady==0){
- ShowMessageBox("模块暂未启动");
- uTimerHardDly(50);
- UISetNextStatus(UIS_MENU_SYS_SET);
- }else{
- tempCodetype=sutPocStatus.codeType;
- CodeTypeUpdateShow();
- }
- }
- if(susCt==0){
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择 [下]选择",0x01,0);
- }else if(susCt==200){
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[M]保存[EXIT]退出",0x01,0);
- }
-
- if(++susCt>=400)susCt=0;
- }
- void SetCodeTypeResponse(void)
- {
- char info[30];
- switch(g_ulKeyValue){
- case KEY_PANEL_UP:
- if(tempCodetype==0) tempCodetype=1;
- else tempCodetype--;
-
- CodeTypeUpdateShow();
- break;
- case KEY_PANEL_DOWN:
- if(tempCodetype==1) tempCodetype=0;
- else tempCodetype++;
- CodeTypeUpdateShow();
- break;
- case KEY_PANEL_MENU:
- if(tempCodetype != sutPocStatus.codeType){
- sutPocStatus.codeType=tempCodetype;
- sprintf(info, "AT+POC=40000001%02x\r\n", tempCodetype);
- ModemSendAt(info);
- SlwTrace(INF, "Update codetype",1);
- }
- UISetNextStatus(UIS_STANDBY);
- break;
- case KEY_PANEL_EXIT:
- UISetNextStatus(UIS_MENU_SYS_SET);
- break;
- }
- }
- void SetGPSTimeShowDetail(unsigned char timeIndex)
- {
- unsigned short tempTime;
- char buf[10];
- tempTime = GPS_TimeTable[timeIndex];
-
- GuiClearRect(100,STATUS_ITEM_HEIGH+16+16,LCD_WIDTH-1, STATUS_ITEM_HEIGH+16+16+16);
- if(tempTime==0)
- {
- GuiShowStr(100,STATUS_ITEM_HEIGH+16+16," 关闭 ",0x01,0);//130
- //GuiReverseRect(108,56,16*2,16);
- }else
- {
- snprintf(buf, sizeof(buf)," %02d 秒",tempTime);
- GuiShowStr(100,STATUS_ITEM_HEIGH+16+16,buf,0x01,0);//130
- // if(tempTime > 99) GuiReverseRect(108,56,24,16);
- // else GuiReverseRect(108,56,16,16);
- }
- }
-
- /*********************************************************/
- void SetGPSShow(int update)
- {
- static unsigned short susCt=0;
- if(update){
- GuiClearAll();
- ShowCaption("定位设置",1);//
- GuiShowStr(0,STATUS_ITEM_HEIGH+16+16,"定位上传设置: 秒",0x01,0); //sutGpsInfo.SendTime
- //GuiDrawHLine(0,159,20,1);
- GetCoordinates(0);
- sutGpsInfo.GPS_TimeIndexBackup = newPara.gpsTimeIndex;
- SetGPSTimeShowDetail(sutGpsInfo.GPS_TimeIndexBackup);
- GuiDrawHLine(0,159,110,1);
- susCt=0;
- }
- if(susCt==0){
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择 [下]选择",0x01,0);
- }else if(susCt==200){
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[M]保存[EXIT]退出",0x01,0);
- }
- if(++susCt>=400)susCt=0;
- }
-
- void SetGPSResponse(void)
- {
- switch(g_ulKeyValue)
- {
- case KEY_PANEL_UP:
- case KEY_PANEL_DOWN:
-
- if(hgs_poc_type!=POC_OWN)break;
- if(g_ulKeyValue==KEY_PANEL_UP)
- {
- if(sutGpsInfo.GPS_TimeIndexBackup<(GPS_TABLE_NUM-1))
- sutGpsInfo.GPS_TimeIndexBackup++;
- else
- sutGpsInfo.GPS_TimeIndexBackup=0;
- }else{
- if(sutGpsInfo.GPS_TimeIndexBackup==0)
- sutGpsInfo.GPS_TimeIndexBackup=GPS_TABLE_NUM-1;
- else
- sutGpsInfo.GPS_TimeIndexBackup--;
- }
- SetGPSTimeShowDetail(sutGpsInfo.GPS_TimeIndexBackup);
- break;
- case KEY_PANEL_OK:
- if(hgs_poc_type!=POC_OWN)break;
- if(sutGpsInfo.GPS_TimeIndexBackup != newPara.gpsTimeIndex)
- {//changed
- newPara.gpsTimeIndex = sutGpsInfo.GPS_TimeIndexBackup;
- GpsTimeUpdate();
- //save sys
- ModifyConfigureFile(1);
- }
- UI_Stack.OK_back=1;
- UISetNextStatus(UIS_MENU_MAIN);
- break;
- case KEY_PANEL_MENU: UISetNextStatus(UIS_MENU_MAIN);break;
- //case KEY_PANEL_MENU: UISetNextStatus(UIS_MENU_MAIN);break;
- }
- }
-
- /***************************提示音设置******************************/
- unsigned char tempKeySound;
- char *KeySoundNAME[5]=
- {
- "关闭提示音",
- "按键+收发音",
- "仅收发音",
- ""
- };
- void SetKeySoundShow(int update)
- {
- static unsigned short susCt=0;
- static char GroupsFeatures[4];
- if(update){
- GuiClearAll();
- ShowCaption("提示音设置",1);
- //设置Features 将决定选择图标
- memset(GroupsFeatures,0,sizeof(GroupsFeatures));
- GroupsFeatures[newPara.KeySound]=1;
- ListBoxInit(&sutListBox,KeySoundNAME,0,accIconFileNameAPN,GroupsFeatures);
- //----------------------------
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- GuiDrawHLine(0,159,110,1);
- }
- if(susCt==20){
- // GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择[下]选择",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- }else if(susCt==200){
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]保存",0x01,0);
- }
- if(++susCt>=400)susCt=0;
- }
- void SetKeysoundResponse(void)
- {
- unsigned long key;
- char buf[20];
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_MENU==key){
- if(sutListBox.handle != newPara.KeySound){
- //AT+TONES=1
- //ModemSendAt
- newPara.KeySound=sutListBox.handle;
- if(newPara.KeySound){
- if(hgs_poc_type==POC_OWN)ModemSendAt("AT+TONES=1\r\n");
- else if(hgs_poc_type==POC_BND){
- snprintf(buf,sizeof(buf),"AT+POC=tonevol=%d\r\n",newPara.VolumLv);
- ModemSendAt(buf);
-
- }
- }else{
- //AT+POC=ttsvol=6
- if(hgs_poc_type==POC_OWN)ModemSendAt("AT+TONES=0\r\n");
- else ModemSendAt("AT+POC=tonevol=0\r\n");
- }
- ModifyConfigureFile(1);
- }
- //sutUIstatus.ItemRefresh=1;
- UI_Stack.OK_back=1;
- UISetNextStatus(UIS_MENU_MAIN);
- }else if(KEY_PANEL_OK==key){
- UISetNextStatus(UIS_MENU_MAIN);
- }
-
- }
- // char CardUseShow[3][11];
- char *CardUseShow[3]=
- {
- "卡1",
- "卡2",
- ""
- };
- void SetCardShow(int update)
- {
- static unsigned short susCt=0;
- char i=0;
- char GroupsFeatures[2];
- if(update){
- GuiClearAll();
- ShowCaption("SIM卡选择",1);
- //设置Features 将决定选择图标
- memset(GroupsFeatures,0,sizeof(GroupsFeatures));
- //CardStatue
- GroupsFeatures[SIMSelect]=1;
- ListBoxInit(&sutListBox,CardUseShow,0,accIconFileNameAPN,GroupsFeatures);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- //----------------------------
- GuiDrawHLine(0,127,110,1);
- }
- if(susCt==20){
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择 [下]选择",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
-
- }else if(susCt==200){
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]保存",0x01,0);
- }
- if(++susCt>=400)susCt=0;
- }
- void SetCardResponse(void)
- {
- unsigned long key;
- char buf[20];
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_MENU==key){
- snprintf(buf,sizeof(buf),"AT+SIMCROSS=%d\r\n",sutListBox.handle);
- ModemSendAt(buf);
- SIMSelect=sutListBox.handle;
- //sutUIstatus.ItemRefresh=1;
- sutPocStatus.modemRstFlag=1;
- UISetNextStatus(UIS_STANDBY);
- }else if(KEY_PANEL_OK==key){
- if(UI_Stack.FastUiChange==1){
- UI_Stack.FastUiChange=0;
- UISetNextStatus(UIS_STANDBY);
- }else UISetNextStatus(UIS_MENU_SYS_SET);
- }
-
- }
- unsigned char SetTimeIndex;
- void SetLCDShow(int update)
- {
- static unsigned short susCt=0;
- char buf[10];
- char buf1[6];
- int x=4;//4
- int i;
-
- if(update==1){
- SetTimeIndex=newPara.lcdParaDefaultIndex;
- GuiClearAll();
- ShowCaption("LCD设置",1);//0
- //GuiDrawHLine(0,159,20,1);
- GuiShowStr(x,56," 背光时间: ",1,0);
- if(SetTimeIndex==4) snprintf(buf, sizeof(buf),"常亮 ");
- else snprintf(buf, sizeof(buf),"%3d 秒",newPara.lcdParaList[SetTimeIndex]);
- GuiShowStr(x+(12*5),56,buf,1,0);
- //GuiReverseRect(x+(16*5),56,32,16);
- snprintf(buf1, sizeof(buf1),"%3d",SetTimeIndex);
- SlwTrace(INF,buf1,1);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- GuiDrawHLine(0,LCD_WIDTH-1,110,1);
- susCt=0;
- //return;
- }else if(update == 2){
- GuiClearRect(x+(12*5),56,LCD_WIDTH,16);
- if(SetTimeIndex==4) snprintf(buf, sizeof(buf),"常亮 ");
- else snprintf(buf, sizeof(buf),"%3d 秒",newPara.lcdParaList[SetTimeIndex]);
- GuiShowStr(x+(12*5),56,buf,1,0);
- //GuiReverseRect(x+(16*5),56,32,16);
- GuiDrawHLine(0,LCD_WIDTH-1,110,1);
-
- }
-
- if(susCt==0){
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择 [下]选择",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- }else if(susCt==200){
- // GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]保存",0x01,0);
- }
- if(++susCt>=400)susCt=0;
- }
-
-
- void SetLCDResponse(void)
- {
- int FileIndex;
- unsigned long key;
- char Buf[10];
- int x=4;//4
- //TimeOut[]
- // key=ListBoxResponse(&sutListBox);
-
- switch(g_ulKeyValue){
-
- case KEY_PANEL_UP:
- if(++SetTimeIndex>=5)SetTimeIndex=0;
- SetLCDShow(2);//0
- break;
- case KEY_PANEL_DOWN:
- if(SetTimeIndex>0)SetTimeIndex--;
- else SetTimeIndex=4;
- SetLCDShow(2);//0
- break;
- case KEY_PANEL_MENU:
- if(SetTimeIndex != newPara.lcdParaDefaultIndex){
- newPara.lcdParaDefaultIndex=SetTimeIndex;
- //save sys
- ModifyConfigureFile(1);
- }
-
- UI_Stack.OK_back=1;
- UISetNextStatus(UIS_MENU_SYS_SET);
- break;
- case KEY_PANEL_OK:
- UISetNextStatus(UIS_MENU_SYS_SET);
- break;
- }
- }
-
- void GetMododexWithCard(void)
- {
- char buf[30];
- //根据CardType和ModeSetup转换为Mododex值的一个表
- //static const unsigned char MododrxTable[3][3]={{11,24,5},{2,8,5},{17,21,5}};
- static const unsigned char MododrxTable[3][4]={{11,15,10,5},{2,25,7,5},{17,25,1,5}};
- snprintf(buf,sizeof(buf),"AT+MODODREX=%d\r\n",MododrxTable[thisYunYingShang][newPara.netMode]);
- ModemSendAt(buf);
- }
- void SetNetShow(int update)
- {
- static unsigned short susCt=0;
- static const char *Netmode[NET_NUM+1]=
- {
- "AUTO",
- "2G",
- "4G",
- ""
- };
- //static
- char NetsFeatures[NET_NUM]={0};
- if(update){
- GuiClearAll();
- ShowCaption("网络设置",2);//
- NetsFeatures[newPara.netMode/2]=1;
- ListBoxInit(&sutListBox,Netmode,0,accIconFileNameAPN,NetsFeatures);
- //----------------------------
- GuiDrawHLine(0,LCD_WIDTH-1,110,1);
- }
- if(susCt==0){
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择 [下]选择",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- }else if(susCt==200){
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]保存",0x01,0);
- }
- if(++susCt>=400)susCt=0;
- }
- void SetNetResponse(void)
- {
- unsigned long key;
- unsigned char buf[15];
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_MENU==key){
- if(sutListBox.handle*2 != newPara.netMode){
- newPara.netMode=sutListBox.handle*2;
- snprintf(buf,sizeof(buf),"AT+CTEC=%d,%d\r\n",netshowvalue,newPara.netMode);
- ModemSendAt(buf);
- ModifyConfigureFile(1);
- }
- UI_Stack.OK_back=1;
- UISetNextStatus(UIS_MENU_MAIN);
- }else if(KEY_PANEL_OK==key){
- UISetNextStatus(UIS_MENU_MAIN);
- }
- }
- unsigned char USBSeletCt=0;
- void SetUSBorTTLShow(int update)
- {
- static unsigned short susCt=0;
- static const char *Netmode[3+1]=
- {
- "TTL",
- "USB",
- "升级模式",
- ""
- };
- //static
- char NetsFeatures[3]={0};
- if(update){
- GuiClearAll();
- ShowCaption("串口切换",2);//
- NetsFeatures[USBSeletCt]=1;
- ListBoxInit(&sutListBox,Netmode,0,accIconFileNameAPN,NetsFeatures);
- //----------------------------
- GuiDrawHLine(0,159,110,1);
- }
- if(susCt==0){
- // GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择 [下]选择",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- }else if(susCt==200){
- // GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]保存",0x01,0);
- }
- if(++susCt>=400)susCt=0;
- }
- void SetUSBorTTLResponse(void)
- {
- unsigned long key;
- unsigned char buf[15];
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_MENU==key){
- if(sutListBox.handle != USBSeletCt){
- USBSeletCt=sutListBox.handle;
- switch(USBSeletCt)
- {
- case 0://TTL
- MODEM_UPDATE_LOW;
- break;
- case 1://USB
- // ModemSendAt("AT+ROUTE=0,1\r\n");//打开POClog
- MODEM_UPDATE_LOW;
- break;
- case 2://MODEMUPDATE
- MODEM_UPDATE_HIGH;
- sutPocStatus.modemRstFlag=1;
- break;
- }
- }
- UI_Stack.OK_back=1;
- UISetNextStatus(UIS_MENU_SYS_SET);
- }else if(KEY_PANEL_OK==key){
- UISetNextStatus(UIS_MENU_SYS_SET);
- }
- }
- void SetPowerModeShow(int update)
- {
- int i;
- static const char *ModeName[]={//这里数量变了记得修改 PWR_MODE_NUM
- "低功耗模式",
- "超长待机模式",
- "常规模式",
- ""
- };
-
- char GroupsFeatures[PWR_MODE_NUM];
- memset(GroupsFeatures,0,sizeof(GroupsFeatures));
-
- if(update){
- GuiClearAll();
- ShowCaption("模式设置",2);//
- //GuiDrawHLine(0,159,20,1);
- //设置Features 将决定选择图标
- GroupsFeatures[newPara.pwrMode]=1;
-
- ListBoxInit(&sutListBox,ModeName,0,accIconFileNameAPN,GroupsFeatures);
- //----------------------------
- GuiDrawHLine(0,LCD_WIDTH-1,110,1);
- // GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]切换",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- }
- }
- /***************************场景模式设置******************************/
- void SetSoundModeShow(int update)
- {
- int i;
- static const char *ModeName[]={
- "室内模式",
- "室外模式",
- ""
- };
-
- char GroupsFeatures[2];
- memset(GroupsFeatures,0,sizeof(GroupsFeatures));
-
- if(update){
- GuiClearAll();
- ShowCaption("场景模式",2);//
- //GuiDrawHLine(0,159,20,1);
- //设置Features 将决定选择图标
- memset(GroupsFeatures,0,sizeof(GroupsFeatures));
- GroupsFeatures[newPara.SoundMode]=1;
-
- ListBoxInit(&sutListBox,ModeName,0,accIconFileNameAPN,GroupsFeatures);
- //----------------------------
- GuiDrawHLine(0,LCD_WIDTH-1,110,1);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[OK]切换 [EXIT]退出",0x01,0);
- //sutUIstatus.ItemRefresh=0;
- }
- }
- void SetSoundModeResponse(void)
- {
- unsigned long key;
- key=ListBoxResponse(&sutListBox);
-
- if(KEY_PANEL_MENU==key)
- {
-
- if(newPara.SoundMode!=sutListBox.handle){
- newPara.SoundMode=sutListBox.handle;
- if(newPara.SoundMode==1)ModemSendAt("at+syscmd=start_pcm volume 7 7\r\n");
- else ModemSendAt("at+syscmd=start_pcm volume 7 5\r\n");
- ModifyConfigureFile(1);
- //sutUIstatus.ItemRefresh=1;
- }
-
- UI_Stack.OK_back=1;
- UISetNextStatus(UIS_MENU_SYS_SET);
- }
- else if(KEY_PANEL_EXIT==key)UISetNextStatus(UIS_MENU_SYS_SET);
-
- }
- //对讲版本空中升级API
- int getNewVersion;
- unsigned char fotaPocStatus;
- unsigned int fotaTick;
- void SetUpIntercomVerShow(int update)
- {
- char info[40];
- if(update){
- GuiClearAll();
- ShowCaption("升级对讲版本",1);//
- //GuiDrawHLine(0,159,20,1);
- FunShowMsg("正在检测版本");
- GuiDrawHLine(0,127,110,1);
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[M]升级 [EXIT]退出",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- getNewVersion=-1;
- fotaPocStatus=0;
- ModemSendAt("AT+FOTA?\r\n");//对应用在模块接收消息中添加获取版本代码
- uTimerStart(&fotaTick,400);//200
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[M]确定 [EXIT]退出",0x01,0);
- }
- switch(fotaPocStatus){
- case 0://获取版本信息
- if(uTimerExpired(&fotaTick)){
- if(getNewVersion ==0){//没有更新版本
- fotaPocStatus=1;
- FunShowMsg("没有可更新版本");
- uTimerStart(&fotaTick,150);
- }else if(getNewVersion>0){//有可更新版本
- //询问是否更新
- sprintf(info, "更新到V%d ?",getNewVersion);
- FunShowMsg(info);
- fotaPocStatus=2;
- }else{//超时未检测到查询版本响应
- fotaPocStatus=1;
- FunShowMsg("检测超时");
- uTimerStart(&fotaTick,150);
- }
- }
- break;
- case 1:
- if(uTimerExpired(&fotaTick)){//退出显示信息完毕
- UISetNextStatus(UIS_STANDBY);
- }
- break;
- }
- }
- void SetUpIntercomVerResponse(void)
- {
- switch(fotaPocStatus){
- case 2://等待用户确定
- if(KEY_PANEL_MENU==g_ulKeyValue){
- //确定
- fotaPocStatus=3;
- ModemSendAt("AT+FOTA=1\r\n");
- }else if(KEY_PANEL_OK==g_ulKeyValue){
- UISetNextStatus(UIS_MENU_SYS_SET);
- }
- break;
- }
- }
- /*
- 针对cat1
- AT+FOTA? 查询FOTA状态
- +FOTA:1,0 无版本可以升级/当前版本最新
- +FOTA:1,2012 有最新的版本可以升级 2012版本
- AT+FOTA=1 有版本升级的情况下发,表示启动升级
- +FOTA:0 表示升级失败/停止
- +FOTA:1 表示正在升级
- +FOTA:2 表示升级成功即将重启
- */
- void FotaStatusProcess(char *pMsg)
- {
- char info[30];
- switch(pMsg[0]){
-
- case '1'://1,0 1,19070702 表示查询POC版本响应
- if(strlen(pMsg)>2){
- getNewVersion=atoi(pMsg+2);//获取版本结果
- }else{
- FunShowMsg("正在升级...");
- }
- break;
- case '2'://表示安装完成,正在重启模块
- FunShowMsg("正在重启...");
- sutPocStatus.modemRstFlag=1;
- fotaPocStatus=1;
- uTimerStart(&fotaTick,150);
- break;
- case '0'://退出FOTA升级,原因可能是因为网络不稳定或者文件获取失败
- FunShowMsg("失败退出");
- fotaPocStatus=1;
- uTimerStart(&fotaTick,150);
- break;
- }
- }
- void UIShowInformation(int update)
- {
- u16 x,y;
- char temp[11];
- char buf[50];
- static unsigned char flag=0;
- unsigned char LineSpace;//行宽
- LineSpace=18;
- if(update)
- {
- flag=0;
- GuiClearAll();
- ShowCaption("终端信息",1); //0
- //GuiDrawHLine(0,159,20,1);
- }
- x=2,y=STATUS_ITEM_HEIGH+5;//
- if(
- KEY_PANEL_DOWN==g_ulKeyValue ||
- update)
- {
- g_ulKeyValue = 0;
- g_uslockCnt=0;
- if(flag==0 || flag==2)
- {//显示PSN
- GuiClearRect(0,y,LCD_WIDTH-1,LCD_HEIGHT-1);
- //终端型号
- // snprintf(buf, sizeof(buf),"终端型号:%s",sutProductPara.ProductName);
- // GuiShowStr(x,y,buf,0x01,0);
- // y+=LineSpace;
- //终端编码
- snprintf(buf, sizeof(buf),"PSN:%lu",sutProductPara.PSN);
- GuiShowStr(x,y,buf,0x01,0);
- y+=LineSpace;
- //应用版本号
- snprintf(buf, sizeof(buf),"应用版本:V%d",sutProductPara.ProductVersion);
- GuiShowStr(x,y,buf,0x01,0);
- y+=LineSpace;
- //内部版本号
- snprintf(buf, sizeof(buf),"内部版本:%d",CUSTOMER_CODE);
- GuiShowStr(x,y,buf,0x01,0);
- // y+=LineSpace;
- // //模块版本号
- // snprintf(buf, sizeof(buf),"模块版本:L%d",g_iModemVer);
- // GuiShowStr(x,y,buf,0x01,0);
- flag=1;
- }else if(flag==1)
- {
- g_ulKeyValue = 0;
- g_uslockCnt=0;
- GuiClearRect(0,y,LCD_WIDTH-1,LCD_HEIGHT-1);
- //对讲版本号
- //snprintf(buf, sizeof(buf),"对讲版本:V%d",g_iPocVer);
-
- if(hgs_poc_type==POC_NULL)snprintf(buf, sizeof(buf),"平台:未知");
- else if(hgs_poc_type==POC_OWN)snprintf(buf, sizeof(buf),"平台:HGS");
- else if(hgs_poc_type==POC_BND)snprintf(buf, sizeof(buf),"平台:BND");
- GuiShowStr(x,y,buf,0x01,0);
- y+=LineSpace;
- //校验码
- // GetCheckCodeByPsnMEID(temp,sutProductPara.PSN,DEV_HARDID);
- // snprintf(buf, sizeof(buf),"校验码:%s",temp);
- snprintf(buf, sizeof(buf),"PocVer:%s",g_iPocVer);
- GuiShowStr(x,y,buf,0x01,0);
- y+=LineSpace;
- temp[0]=0;
- //显示MCU主频率
- snprintf(buf, sizeof(buf),"MCU主频:%d.%d Mhz",USER_MAIN_SYSCLK/1000000,USER_MAIN_SYSCLK%1000000/100000);
- GuiShowStr(x,y,buf,0x01,0);
- y+=LineSpace;
- //
- memset(buf,sizeof(buf),0);
- snprintf(buf,sizeof(buf),"模块:%s",ModemVer);
- GuiShowStr(x,y,buf,0x01,0);
- flag=2;
- }
- }else if(KEY_UP_DOWN_IP == g_ulKeyValue)
- {
- g_ulKeyValue=0;
- if(flag==1 || flag==2)
- {
- //显示IP
- GuiClearRect(0,y,LCD_WIDTH-1,LCD_HEIGHT-1);
- //交换IP
- GuiShowStr(x,y,"交换服务器:",0x01,0);
- y+= LineSpace;
- snprintf(buf, sizeof(buf),"%s",showPIP);
- GuiShowStr(x,y,buf,0x01,0);
- y+=LineSpace;
- //GPS IP
- GuiShowStr(x,y,"定位服务器:",0x01,0);
- y+= LineSpace;
- snprintf(buf, sizeof(buf),"%s",showGIP);
- GuiShowStr(x,y,buf,0x01,0);
- y+=LineSpace;
- snprintf(buf, sizeof(buf),"PORT:%d",newPara.gpsPort);
- GuiShowStr(x,y,buf,1,0);
- flag=0;
- }
- }
- }
- void UIShowPOCSerPass(int update){
- if(update){
- GuiClearAll();//clear
- ShowCaption("密码验证",1); //0
- //GuiDrawHLine(0,LCD_WIDTH,20,1);
- NumEditInit(&sutNumEdit,(LCD_WIDTH-6*8)/2,(LCD_HEIGHT-16)/2,"000000");
- NumEditShow(&sutNumEdit);
- GuiDrawHLine(0,LCD_WIDTH,104,1);
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]加值 [OK]移动",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<加值 确定 下翻>",0x01,0);
- }
- }
- void POCSetSerPassResponse(void){
- unsigned long key;
-
- NumEditResponse(&sutNumEdit);
- if(KEY_PANEL_MENU==g_ulKeyValue){
- if(memcmp(sutNumEdit.buffer, menu_key, 6)==0) UISetNextStatus(UIS_SET_SERVER);
- else{
- ShowMessageBox("密码错误");
- uTimerHardDly(50);
- UI_Stack.OK_back=1;
- UISetNextStatus(UIS_MENU_SYS_SET);
- }
- }
- //if(KEY_PANEL_OK==g_ulKeyValue) UISetNextStatus(UIS_MENU_SYS_SET);
- }
- void UIShowPOCSer(int update){
- int i;
- unsigned char tempSer;
- static const char *accIconFileName[]={
- "Ser.bmp",
- "Sersel.bmp",
- ""
- };
- static const char *NameAddr[]={
- "杭州服务器",
- "山东服务器",
- "IP分发服务器",
- "集群服务器",
- "自定义服务器",
- ""
- };
- static char *tempAddr[5];
- static char ItemFeatures[4+1];
-
- if(update){
- GuiClearAll();
- ShowCaption("服务器列表",2); //0
- //GuiDrawHLine(0,159,20,1);
- GuiDrawHLine(0,159,110,1);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]确定",0x01,0);
-
- tempSer=newPara.serList.defaultuse;
- if(hgs_poc_type != POC_OWN){
- if(tempSer >= 2) tempSer -= 2;
- }
- for(i=0;i<=SER_US;i++){
-
- if(i==tempSer) ItemFeatures[i]=1;
- else ItemFeatures[i]=0;
-
- }
- //初始化ListBox控件
- if(hgs_poc_type == POC_OWN)
- ListBoxInit(&sutListBox,NameAddr,0,accIconFileName,ItemFeatures);
- else{
- for(i=0;i<2;i++) tempAddr[i]=(char *)NameAddr[i];
- tempAddr[i++]=(char *)NameAddr[4];
- tempAddr[i++]=(char *)NameAddr[5];
- ListBoxInit(&sutListBox,tempAddr,0,accIconFileName,ItemFeatures);
- }
- return;
- }
- }
- void POCSetSerResponse(void)
- {
- char buf[50],buf1[100];
- unsigned long key;
- char *pip,*domain=NULL;
- unsigned char tempSer;
-
- key=ListBoxResponse(&sutListBox);
-
- if(KEY_PANEL_OK==key) UISetNextStatus(UIS_MENU_SYS_SET);
- else if(KEY_PANEL_MENU==key){
- tempSer=sutListBox.handle;
- if(hgs_poc_type != POC_OWN){
- if(tempSer >= 2) tempSer += 2;//西安POC没有集群跟IP分发
- }
-
- if(tempSer != newPara.serList.defaultuse){
- newPara.serList.defaultuse=tempSer;
- ShowMessageBox("配置完成");
- //sys save
- ModifyConfigureFile(0);
- getGIPAddr();//更新GPS参数
- pip=getPIPAddr();
- domain=getDOMAINAddr();
- //西安的POC不支持单段设置,且必须同时配置id与ip,最好不配置domain
- if(hgs_poc_type==POC_OWN)snprintf(buf, sizeof(buf),"ip=%s;domain=%s;", pip, domain);
- else snprintf(buf, sizeof(buf),"id=%ld;ip=%s;", sutProductPara.PSN,pip);
- AscStrToHexStr(buf,buf1);
- ModemSendAt("AT+POC=010000");
- ModemSendAt(buf1);
- ModemSendAt("\r\n");
- IWDG_ReloadCounter();
- uTimerHardDly(20);
- //os_dly_wait(20);
- ModemSendAt("AT+POC=040000\r\n");
- //OsDelayTime(100);
- }
- UISetNextStatus(UIS_STANDBY );
- }
- }
- void SetAPNResponse(void)
- {
- unsigned long key;
- key=ListBoxResponse(&sutListBox);
-
- if(KEY_PANEL_OK==key)
- {
- ShowMessageBox("即将重启更新...");
- if(newPara.apnList.defaultuse != sutListBox.handle){
- newPara.apnList.defaultuse = sutListBox.handle;
- //save sys
- ModifyConfigureFile(0);
- //uTimerHardDly(200);
- //modemPwrOffNow=1;
- sutPocStatus.modemRstFlag=1;
- UISetNextStatus(UIS_STANDBY);
- }else UISetNextStatus(UIS_MENU_SYS_SET);
- }else if(KEY_OPTION==key) UISetNextStatus(UIS_APN_DETAIL);
- else if(KEY_PANEL_MENU==key)UISetNextStatus(UIS_MENU_SYS_SET);
- }
-
- void SetApnDetailResponse(void)
- {
- if(KEY_PANEL_DOWN==g_ulKeyValue)
- {
- showIndex++;
- if(showIndex >= validApnNum) showIndex=0;
- ShowAPNMessage(showIndex);
- }else if(KEY_PANEL_UP==g_ulKeyValue)
- {
- if(showIndex==0) showIndex=validApnNum;
- if(showIndex > 0) showIndex--;
- ShowAPNMessage(showIndex);
- }
- else if(KEY_PANEL_OK==g_ulKeyValue) UISetNextStatus(UIS_SET_APN);
- }
-
- void SetPowerModeResponse()
- {
- unsigned long key;
-
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_MENU==key){
- if(sutListBox.handle != newPara.pwrMode){
- newPara.pwrMode=sutListBox.handle;
- ModifyConfigureFile(1);
- }
- UI_Stack.OK_back=1;
- UISetNextStatus(UIS_MENU_SYS_SET);
- }else if(KEY_PANEL_OK==key){
- UISetNextStatus(UIS_MENU_SYS_SET);
- }
- }
- unsigned char TempMicLv=0x6c;
- //SUT_MENU sutMenuMain;
- /*********************************************************/
- void SetMicLvSelectShow(int update)
- {
- static unsigned short susCt=0;
- char buf[4];
- if(update==1){
- susCt=0;
- GuiClearAll();
- ShowCaption("麦克风增益",1);//
- GuiDrawHLine(0,159,110,1);
- if(modemInitReady==0){
- ShowMessageBox("模块暂未启动");
- uTimerHardDly(50);
- UISetNextStatus(UIS_MENU_SYS_SET);
- }else{
- TempMicLv=newPara.Miclv;
- snprintf(buf,sizeof(buf),"%03d",TempMicLv);
- FunShowMsg(buf);
-
- }
- }
- if(susCt==0){
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择 [下]选择",0x01,0);
- }else if(susCt==200){
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[M]保存 [EXIT]退出",0x01,0);
- }
-
- if(++susCt>=400)susCt=0;
-
- }
-
- void SetMicLvSelectResponse()
- {
- char info[30];
- switch(g_ulKeyValue){
- case KEY_PANEL_UP:
- if(TempMicLv==0x6E) TempMicLv=100;
- else TempMicLv++;
- snprintf(info,sizeof(info),"%03d",TempMicLv);
- FunShowMsg(info);
- break;
- case KEY_PANEL_DOWN:
- if(TempMicLv==100) TempMicLv=0x6E;
- else TempMicLv--;
- snprintf(info,sizeof(info),"%03d",TempMicLv);
- FunShowMsg(info);
- break;
- case KEY_PANEL_MENU:
- uTimerHardDly(50);
- newPara.Miclv=TempMicLv;
- sprintf(info, "AT+CACCP=2,1,6,\"%02x00%02x00\"\r\n", TempMicLv/16,TempMicLv%16);
- ModemSendAt(info);
- printf("%s---%02x----%02x",info,TempMicLv/16,TempMicLv%16);
- ModifyConfigureFile(0);
- break;
- case KEY_PANEL_EXIT:
- UISetNextStatus(UIS_MENU_SYS_SET);
- break;
- }
- }
- void PoweroffWaitShow(int update)
- {
- if(update==1){
- GuiClearAll();
- ShowMessageBox("确认关机?");
- GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]确认",0x01,0);
- }
-
- }
- void PoweroffWaitResponse()
- {
- switch(g_ulKeyValue){
- case KEY_PANEL_MENU:
- GuiShowBmp(0,0,"BYEBYE.bmp");
- uTimerHardDly(50);
- MODEM_PWREN_LOW;
- PWR_EN_LOW;
- MODEM_LED1_LOW;
- while(1);
- break;
- case KEY_PANEL_EXIT:
- UISetNextStatus(UIS_STANDBY);
- break;
- }
- }
|