#include "includes.h" /****************************状态栏显示部分开始***********************************/ #define MIN_PWR_LEVEL 315 //低于此电压后不工作 #define WARN_PWR_LEVEL 325 //提示请充电电压 static const char *NullPtr=""; //显示信号强度 static void ShowSingle(int CSQ){ unsigned short x=SIGNAL_ICON_X; unsigned short y=2; if(sutApp.pocPpp == 0) guiShowBmp(x,y,"Single.bmp"); else guiShowBmp(x,y,"SingleOK.bmp"); //11 3格 x += 7; if(CSQ<1 || CSQ==99){ guiClearRect(x,y+1,x+10,y+9,COLOR_STATUS_BAR); }else if(CSQ<8){ guiDrawVLine(x+2,y+8,x,y,guiGetBackColor()); guiClearRect(x+2,y+1,x+10,y+9,COLOR_STATUS_BAR); }else if(CSQ<16){ guiDrawVLine(x+2,y+8,x,y,guiGetBackColor()); guiDrawVLine(x,y+8,x+3,y,guiGetBackColor()); guiClearRect(x+6,y+1,x+10,y+9,COLOR_STATUS_BAR); }else if(CSQ<22){ guiDrawVLine(x+2,y+8,x,y,guiGetBackColor()); guiDrawVLine(x,y+8,x+3,y,guiGetBackColor()); guiDrawVLine(x-2,y+8,x+6,y,guiGetBackColor()); guiClearRect(x+9,y+1,x+10,y+9,COLOR_STATUS_BAR); }else{ guiDrawVLine(x+2,y+8,x,y,guiGetBackColor()); guiDrawVLine(x,y+8,x+3,y,guiGetBackColor()); guiDrawVLine(x-2,y+8,x+6,y,guiGetBackColor()); guiDrawVLine(x-4,y+8,x+9,y,guiGetBackColor()); } #if 0 if(CSQ<1 || CSQ==99){ guiClearRect(7,3,21,11,COLOR_STATUS_BAR); }else if(CSQ<8){ guiDrawVLine(9,10,7,2,guiGetBackColor()); guiClearRect(9,3,21,11,COLOR_STATUS_BAR); }else if(CSQ<16){ guiDrawVLine(9,10,7,2,guiGetBackColor()); guiDrawVLine(7,10,10,2,guiGetBackColor()); guiClearRect(13,3,21,11,COLOR_STATUS_BAR); }else if(CSQ<22){ guiDrawVLine(9,10,7,2,guiGetBackColor()); guiDrawVLine(7,10,10,2,guiGetBackColor()); guiDrawVLine(5,10,13,2,guiGetBackColor()); guiClearRect(16,3,21,11,COLOR_STATUS_BAR); }else{ guiDrawVLine(9,10,7,2,guiGetBackColor()); guiDrawVLine(7,10,10,2,guiGetBackColor()); guiDrawVLine(5,10,13,2,guiGetBackColor()); guiDrawVLine(3,10,16,2,guiGetBackColor()); } #endif } unsigned char netshowvalue=0xff; //显示网络制式 static void Show_Net(unsigned char s_netshowvalue){ unsigned short y=0; if(s_netshowvalue==0){ guiShowStr(NET_ICON_X, y+1,"2G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR); }else if(s_netshowvalue==4){ guiShowStr(NET_ICON_X, y+1,"4G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR); }else guiClearRect(NET_ICON_X,y,NET_ICON_X+NET_ICON_WX,y+11,COLOR_STATUS_BAR); } static void gpsIconShow(char flash){ typedef struct{ unsigned char located:1; unsigned char auth:1; unsigned char gpsF:1; }TMP_GPS_DEF; static TMP_GPS_DEF tmpGps; unsigned short x=GPS_ICON_X,y=0; if(tmpGps.located==gpsInfo.gpsLocated && tmpGps.auth==gpsInfo.bbAuth && tmpGps.gpsF==gpsInfo.gpsF && flash==0) return; guiClearRect(x,y,x+GPS_ICON_WX,y+11,COLOR_STATUS_BAR); if(gpsInfo.gpsF==0){//GPS未打开时 if(gpsInfo.bbAuth==1) guiShowBmp(x,y,"GPS3.bmp");//已鉴权 }else{//GPS已打开 if(gpsInfo.bbAuth==1) guiShowBmp(x,y,"GPS1.bmp");//已鉴权 else if(gpsInfo.bbAuth==1) guiShowBmp(x,y,"GPSA.bmp");//未鉴权 if(gpsInfo.gpsLocated==1) guiShowBmp(x+10,y,"GPS2.bmp");//已定位 } tmpGps.located=gpsInfo.gpsLocated; tmpGps.auth=gpsInfo.bbAuth; tmpGps.gpsF=gpsInfo.gpsF; } //显示电量 static void ShowBatttery(int bat,unsigned int exeInterval){ static unsigned int flashCnt=0; static unsigned char flag=0; static unsigned short cnt=0; unsigned short x=BAT_ICON_X,y=2,h=y+2; if(bat=400 4格 guiShowBmp(x,y,"VBAT1.bmp"); guiDrawVLine(h,h+5,x+4,y+1,guiGetBackColor()); guiDrawVLine(h,h+5,x+8,y+1,guiGetBackColor()); guiDrawVLine(h,h+5,x+12,y+1,guiGetBackColor()); guiDrawVLine(h,h+5,x+16,y+1,guiGetBackColor());//5.12 } } //显示时间 static void ShowTime(char flash,unsigned int exeInterval){ static unsigned short nextExe=0; static unsigned char flag=0; MY_CLOCK myclock; char buf[30]; if(nextExe==0 || flash){ ohpocGetClock(&myclock); if(flag){ snprintf(buf, sizeof(buf), "%02d:%02d",myclock.hour, myclock. min); flag=0; }else{ snprintf(buf, sizeof(buf), "%02d %02d",myclock.hour, myclock. min); flag=1; } guiShowStr(TIME_ICON_X, 1,buf, FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR); } if(++nextExe>=(1000/exeInterval)) nextExe=0; } //显示状态栏 void uiShowStatusBar(char flash,unsigned int exeInterval){ static unsigned char s_netshowvalue=0xff; static unsigned char lastPPPStatus; static int siCSQ; static int siVbat; static unsigned short batFirstShow=0; static char lastEnable=0; char tempFlash=flash; if(sutApp.enableKey==0) return; if(lastEnable==0){ lastEnable=1; tempFlash=1; guiFillRect(0, 0, GLCD_WIDTH-1, UI_STATUS_BAR_HEIGH-1,COLOR_STATUS_BAR);//清除第一区 } //显示信号 if(tempFlash || siCSQ!=sutApp.g_iCSQ || lastPPPStatus != sutApp.pocPpp){ lastPPPStatus=sutApp.pocPpp; siCSQ=sutApp.g_iCSQ; ShowSingle(sutApp.g_iCSQ); } //显示2G/3G/4G if(tempFlash || s_netshowvalue!=netshowvalue){ s_netshowvalue=netshowvalue; Show_Net(s_netshowvalue); } //显示GPS是否正常及鉴权情况 gpsIconShow(tempFlash); //电量显示 if(batFirstShow < (1000/exeInterval)) {//开机前1秒显示一半电量 sutApp.g_iBAT=360; batFirstShow++; }else if(tempFlash || siVbat!=sutApp.g_iBAT || sutApp.g_iBAT < WARN_PWR_LEVEL){ siVbat=sutApp.g_iBAT; ShowBatttery(sutApp.g_iBAT,exeInterval); //MSG_INFO(1, "----%d", sutApp.g_iBAT); } //文本消息显示 ShowMessageFlag(0); //GPS显示 //时间显示 ShowTime(tempFlash,exeInterval); //显示锁,UI状态变化时更新 if(tempFlash && sutUIstatus.Status==UIS_STANDBY){ if(sutApp.keyLock==0) guiClearRect(72,110,72+17,110+17,guiGetBackColor()); else guiShowBmp(72,110, "lock.bmp"); } } /****************************状态栏显示部分结束***********************************/ /****************************待机界面显示部分开始***********************************/ typedef enum{ ME_NO_LOGIN, ME_NOBODY_SPEAK, ME_IAM_SPEAK, ME_SOMEBODY_SPEAK }ME_ENUM; static void uiShowGUName(int update); static void uiShowGuaDuan(unsigned char danhu); static void uiShowGroup(const char* info); static void uiShowUser(const char* info); static void uiShowHuaQuan(const char* info,char type); static void uiShowCallUserName(void); static void uiShowOffLineMessage(void); void uiShowMainInterface(char status,unsigned int exeInterval){ short Flag=ME_NO_LOGIN;//ME_ENUM static unsigned char danhu=0; static short lastFlag=-1; static unsigned short siCt=0; char info[40]; static char firstRun=0; static unsigned short dly=0; char tmpStatus=status; /*延时一下1秒后才显示后面的,如果直接登录了,就跳出延时*/ if(firstRun==0){ if((++dly>=(3*1000/exeInterval)) || sutPocStatus.logined!=0){ firstRun=1; tmpStatus=1; sutApp.enableKey=1;//延时按键操作完成 }else return; } /*逻辑处理开始*/ if(tmpStatus){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"加速度语音系统", UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); guiShowStr(1, UI_BOTTOM_SHOW_Y,"菜单", FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR, guiGetBackColor()); danhu=sutPocStatus.danHuStatus; uiShowGuaDuan(danhu); lastFlag=-1; siCt=0; return; } //更新单呼显示与否 if(sutPocStatus.danHuStatus != danhu){ danhu=sutPocStatus.danHuStatus; uiShowGuaDuan(danhu); } //提示解锁 if(sutApp.lockShow!=0){ guiShowMessageBox("请先解锁!"); nwy_sleep(500); guiClearRect(0,GLCD_HEIGHT/2-20,GLCD_WIDTH-1,GLCD_HEIGHT/2+20,guiGetBackColor()); lastFlag=-1;//让以下刷新一下 sutApp.lockShow=0; } //以下持续调用,以便动态更新信息 if(0==sutPocStatus.logined) Flag=ME_NO_LOGIN;//未登录 else if(0==sutPocStatus.spk && 0==sutPocStatus.mic){//已登录,无人说话 Flag=ME_NOBODY_SPEAK; }else if(0!=sutPocStatus.mic) Flag=ME_IAM_SPEAK;//已登录,本机说话 else if(0!=sutPocStatus.spk) Flag=ME_SOMEBODY_SPEAK;//有人说话 switch(Flag){ case ME_NO_LOGIN://未登录 if(Flag != lastFlag){ guiFillRect(0, UI_CONTENT_SHOW_Y, GLCD_WIDTH-1, UI_BOTTOM_SHOW_Y-1,guiGetBackColor()); guiShowBmp(0,UI_CONTENT_SHOW_Y, "logo.bmp"); } break; case ME_NOBODY_SPEAK://已登录,无人说话 if(Flag != lastFlag){ if(ME_NO_LOGIN==lastFlag) guiFillRect(0, UI_CONTENT_SHOW_Y, GLCD_WIDTH-1, UI_CONTENT_SHOW_Y+16,guiGetBackColor());//从未登录到登录,'正在登录'那行也刷掉 guiFillRect(0, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16,guiGetBackColor()); uiShowHuaQuan("空闲",0); sutPocStatus.statusChaned = 1; } break; case ME_IAM_SPEAK://已登录,本机说话 if(Flag != lastFlag){ guiFillRect(0, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16,guiGetBackColor()); uiShowHuaQuan("本机在讲话",1); } break; case ME_SOMEBODY_SPEAK://已登录,有人说话 if(Flag != lastFlag){ guiFillRect(0, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16,guiGetBackColor()); sutPocStatus.statusChaned=1;//保证要刷新名字 } uiShowCallUserName(); break; } if(Flag>0){//已登录 if(Flag != lastFlag && (lastFlag==-1 || ME_NO_LOGIN==lastFlag)){ uiShowGUName(1); uiShowLearnGroup(1); }else{ uiShowGUName(0); uiShowLearnGroup(0); } }else{//未登录 snprintf(info, sizeof(info),"请等待网络连接."); switch(siCt){//not finished yet case 0: strcat(info, " "); guiShowStr(1, UI_CONTENT_SHOW_Y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor()); break; case (1000/APP_SUB_DIV_TIME): strcat(info, ". "); guiShowStr(1, UI_CONTENT_SHOW_Y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor()); break; case (2000/APP_SUB_DIV_TIME): strcat(info, ".."); guiShowStr(1, UI_CONTENT_SHOW_Y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor()); break; } //显示登录状态 uiShowOffLineMessage(); } if(++siCt>=(3000/APP_SUB_DIV_TIME)) siCt=0; if(Flag != lastFlag) lastFlag=Flag; } static void uiShowGUName(int update){ static char scNameUser[POC_GROUP_USER_NAME_LEN]; static char scNameGroup[POC_GROUP_USER_NAME_LEN]; char name[POC_GROUP_USER_NAME_LEN]; unsigned short len; unsigned char danHuanBuffer[9]={0xB5,0xA5,0xBA,0xF4,0xC4,0xA3,0xCA,0xBD,0}; char GroupShowUpdate=0; char UserShowUpdate=0; if(sutPocStatus.danHuStatus==0){ if(0!=strcmp(sutPocStatus.LocalGroup.name,scNameGroup) || update!=0){ memset(scNameGroup,0,sizeof(scNameGroup)); memcpy(scNameGroup,sutPocStatus.LocalGroup.name,sizeof(scNameGroup)); GroupShowUpdate=1; } }else{ if(0!=strcmp((char *)danHuanBuffer,scNameGroup) || update!=0){ memset(scNameGroup,0,sizeof(scNameGroup)); memcpy(scNameGroup, danHuanBuffer,sizeof(danHuanBuffer)); GroupShowUpdate=1; } } if(0!=strcmp(sutPocStatus.LocalUser.name,scNameUser) || update!=0){ memset(scNameUser,0,sizeof(scNameUser)); memcpy(scNameUser,sutPocStatus.LocalUser.name,sizeof(scNameUser)); UserShowUpdate=1; } if(GroupShowUpdate){ guiClearRect(0,UI_GROUP_SHOW_Y,GLCD_WIDTH-1,UI_GROUP_SHOW_Y+16,guiGetBackColor());//18 //刷新群组栏 if(sutPocStatus.danHuStatus==0) StrIntercept(name, scNameGroup, sizeof(name)); else snprintf(name, sizeof(name), "单呼模式"); uiShowGroup(name); sutPocStatus.statusChaned=1; } if(UserShowUpdate){ guiClearRect(0,UI_USER_SHOW_Y,GLCD_WIDTH-1,UI_GROUP_SHOW_Y+16,guiGetBackColor());//18 //刷新成员栏 StrIntercept(name, scNameUser, sizeof(name)); uiShowUser(name); } } void uiShowLearnGName(const char *name){ guiShowBmp(2, UI_LEARN_SHOW_Y, "Group2.bmp"); guiClearRect(2+16, UI_LEARN_SHOW_Y, GLCD_WIDTH-1, UI_LEARN_SHOW_Y+16, guiGetBackColor()); guiShowStr(2+16, UI_LEARN_SHOW_Y, "学习组:", FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor()); guiShowStr(2+16+56, UI_LEARN_SHOW_Y,name, FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor()); } static void uiShowGuaDuan(unsigned char danhu){ if(danhu==0) guiClearArea(GLCD_WIDTH-32, UI_BOTTOM_SHOW_Y, 32, 14, guiGetBackColor()); else guiShowStr(GLCD_WIDTH-32, UI_BOTTOM_SHOW_Y, "挂断", FONT_MODE_12X12, REVERSED_NO, COLOR_STATUS_BAR,guiGetBackColor()); } static void uiShowGroup(const char* info){ unsigned int color=guiGetForeColor(); if(sutPocStatus.danHuStatus==0) guiShowBmp(2, UI_GROUP_SHOW_Y, "Group2.bmp"); else{ guiShowBmp(2, UI_GROUP_SHOW_Y, "Onecall.bmp"); color=COLOR_RED; } guiClearRect(2+16, UI_GROUP_SHOW_Y, GLCD_WIDTH-1, UI_GROUP_SHOW_Y+16, guiGetBackColor()); guiShowStr(2+16, UI_GROUP_SHOW_Y, "对讲组:", FONT_MODE_16X16, REVERSED_NO,color,guiGetBackColor()); guiShowStr(2+16+56, UI_GROUP_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,color,guiGetBackColor()); } static void uiShowUser(const char* info){ guiShowBmp(2, UI_USER_SHOW_Y, "people2.bmp"); guiClearRect(2+16, UI_USER_SHOW_Y, GLCD_WIDTH-1, UI_USER_SHOW_Y+16, guiGetBackColor()); guiShowStr(2+16, UI_USER_SHOW_Y,"昵称:", FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor()); guiShowStr(2+16+40, UI_USER_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor()); } static void uiShowHuaQuan(const char* info,char type){ unsigned int color=guiGetForeColor(); if(type==0) guiShowBmp(2, UI_VOICE_SHOW_Y, "Phone.bmp"); else if(type==1){ color=COLOR_RED; guiShowBmp(2, UI_VOICE_SHOW_Y, "Csend.bmp"); }else if(type==2){ guiShowBmp(2, UI_VOICE_SHOW_Y, "Creceive.bmp"); color=COLOR_DEEP_GREEN; } guiClearRect(2+16, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16, guiGetBackColor()); guiShowStr(2+16, UI_VOICE_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,color,guiGetBackColor()); } static void uiShowCallUserName(void){ static char scName[POC_GROUP_USER_NAME_LEN]; char name[POC_GROUP_USER_NAME_LEN]; if(0 != strncmp(scName, sutPocStatus.CallName, POC_GROUP_USER_NAME_LEN) || sutPocStatus.statusChaned){ //当名字变更或UI切换了,刷新显示 sutPocStatus.statusChaned=0; memcpy(scName, sutPocStatus.CallName, POC_GROUP_USER_NAME_LEN); uiShowHuaQuan(scName,2); } } static void uiShowOffLineMessage(void){ static unsigned char laReason; char info[50],update=0; unsigned short y; if(sutUIstatus.Status != UIS_STANDBY) return; if(sutPocStatus.PocLineOffReason==laReason && sutUIstatus.ItemRefresh==0) return; sutUIstatus.ItemRefresh=0; laReason=sutPocStatus.PocLineOffReason; if(sutApp.cardStatus==0){ snprintf(info, sizeof(info), "请插卡"); update=1; }else{ switch(sutPocStatus.PocLineOffReason){ case 1:snprintf(info, sizeof(info), "无网络连接");break; case 2:snprintf(info, sizeof(info), "无法连接");break; case 3:snprintf(info, sizeof(info), "没有服务");break; case 4:snprintf(info, sizeof(info), "账号信息错误");break; } if(sutPocStatus.PocLineOffReason!=0) update=1; } if(update!=0){ y=UI_CONTENT_SHOW_Y+2+12; guiClearRect(1,y, GLCD_WIDTH-1, y +12, guiGetBackColor()); guiShowStr(1, y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor()); } } /****************************待机界面显示部分结束***********************************/ #ifdef MAKE_IT_COMMON_VERSION #define LEARN_TASK_SEG "消息列表" #define LEARN_RANK_SEG "考勤信息" #define LEARN_GROUP_SEG "群组选择" #define LEARN_USER_SEG "成员选择" #else #define LEARN_TASK_SEG "学习任务" #define LEARN_RANK_SEG "学习排名" #define LEARN_GROUP_SEG "班级选择" #define LEARN_USER_SEG "同学选择" #endif /****************************主菜单显示部分开始*************************************/ #include "Palace.h" SUT_PALACE sutPalace; void uiShowMenuMain(char update){ static const char *apcMenuMain[]={ #ifdef MAKE_IT_COMMON_VERSION "消息列表", "考勤信息", "群组选择", "成员选择", "定位设置", #else "学习任务", "学习排名", "班级选择", "同学选择", "消息通知", #endif "系统信息", "" }; if(update) PalaceInit(&sutPalace,apcMenuMain,"Palace","主菜单"); } void MenuMainResponse(void){ unsigned short key; key=PalaceResponse(&sutPalace); if(MKEY_VALUE_MENU==key){ switch(sutPalace.Index){ case 0: #ifndef MAKE_IT_COMMON_VERSION uISetNextStatus(UIS_MENU_TASK_SEL); #endif break; case 1: #ifndef MAKE_IT_COMMON_VERSION uISetNextStatus(UIS_MENU_RANK_SEL); #endif break; case 2: uISetNextStatus(UIS_MENU_CLASS_SEL); break; case 3: uISetNextStatus(UIS_MENU_STUDENT_SEL); break; case 4: uISetNextStatus(UIS_MENU_LOCATION_SEL); break; case 5: uISetNextStatus(UIS_MENU_SYS_SEL); break; } uiPushStack(sutPalace.Index); } else if(MKEY_VALUE_ESC==key){ uISetNextStatus(UIS_STANDBY); } } /****************************主菜单显示部分结束*************************************/ /*****************************群组选择/成员选择部分开始*********************************/ static char GUListBoxInited=0; static char SelMachine=0; static void ReFlashItemGU(char type); static void UserAssistAdd(void); void uiShowGUSel(char StatusUpdate,unsigned int exeInterval,char type){ static char machine; static unsigned int timer; unsigned short timeout; char temp; if(StatusUpdate) machine=0; switch(machine){ case 0: if(sutPocStatus.logined == 0){//not login guiShowMessageBox(" 请先登录 "); uTimerStart(&timer, 1000); machine=1; }else{ if(type==0) appSleepCtl(ASLEEP_GGROUP, 1);//要获取群组信息,不让休眠,记得超时或获取成功或获取失败后需要释放 else appSleepCtl(ASLEEP_GUSER, 1); UiassistStart(0); machine=2; } break; case 1: if(uTimerExpired(&timer)){ uISetNextStatus(UIS_STANDBY); } break; case 2: temp=getAssistResult(); if(temp){//??è?íê3é guiClearAll(guiGetBackColor()); if(type==0){ guiShowCaption(0,LEARN_GROUP_SEG,UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //0 uiMenuShowBottomIndacitor("确定", "返回"); }else{ guiShowCaption(0,LEARN_USER_SEG,UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //0 uiMenuShowBottomIndacitor("单呼", "返回"); } ReFlashItemGU(type); uiMenuShowBottomLine(); machine=3; //获取成功后退出释放休眠 if(type==0) appSleepCtl(ASLEEP_GGROUP, 0); else appSleepCtl(ASLEEP_GUSER, 0); } break; } if(machine != 3) return; UserAssistAdd(); } void GroupSelResponse(){ unsigned int key; char buf[50]; int i; key=getKeyValue(); switch(SelMachine){ case 0: if(sutListBox.handle==0 && MKEY_VALUE_UP==key){ UiassistStart(1); SelMachine=1; }else if(((sutListBox.handle+1) == sutListBox.itemnum) && (MKEY_VALUE_DOWN==key)){ UiassistStart(2); SelMachine=2; } key=ListBoxResponse(&sutListBox); if(MKEY_VALUE_ESC==key){ uiAssist.status=0; if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY); else uISetNextStatus(UIS_MENU_MAIN); appSleepCtl(ASLEEP_GGROUP, 0);//按键退出后释放休眠 GUListBoxInited=0; }else if(MKEY_VALUE_MENU==key){ if(0 == sutPocStatus.ListCurOnlineNum) break; /////////////////////////////////////// UiassistEnd(1); sutApp.groupTTSEnable=1; snprintf(buf, sizeof(buf),"AT+POC=090000%08x\r\n",sutPocStatus.AllGroups[sutListBox.handle].ID); msgAtSend(buf); MSG_INFO(1,buf); snprintf(buf, sizeof(buf),"进入:%s",sutPocStatus.AllGroups[sutListBox.handle].name); MSG_INFO(1,buf); uISetNextStatus(UIS_STANDBY); SelMachine=0; } break; } } void UserSelResponse(){ char buf[50]; unsigned int key; key=getKeyValue(); switch(SelMachine){ case 0: if(GUListBoxInited==0) break;//还未初始化listbox时,不执行按键响应 if(sutListBox.handle==0 && MKEY_VALUE_UP==key){ UiassistStart(1); SelMachine=1; }else if((sutListBox.handle+1) == sutListBox.itemnum && (MKEY_VALUE_DOWN==key)){ UiassistStart(2); SelMachine=2; } key=ListBoxResponse(&sutListBox); if(MKEY_VALUE_ESC==key){ uiAssist.status=0; if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY); else uISetNextStatus(UIS_MENU_MAIN); appSleepCtl(ASLEEP_GUSER, 0);//按键退出后释放休眠 GUListBoxInited=0; }else if(MKEY_VALUE_MENU==key){ if(0 == sutPocStatus.ListCurOnlineNum) break; snprintf(buf, sizeof(buf),"AT+POC=0A0000%08x\r\n",sutPocStatus.AllUsers[sutListBox.handle].ID); msgAtSend(buf); MSG_INFO(1, buf); snprintf(buf, sizeof(buf),"呼叫:%s",sutPocStatus.AllUsers[sutListBox.handle].name); MSG_INFO(1, buf); uISetNextStatus(UIS_STANDBY); SelMachine=0; } break; } } static void UserAssistAdd(void){ switch(SelMachine){ case 1: if(getAssistResult()){ if(sutUIstatus.Status==UIS_MENU_CLASS_SEL)ReFlashItemGU(0); else ReFlashItemGU(1); SelMachine=0; } break; case 2: if(getAssistResult()){ if(sutUIstatus.Status==UIS_MENU_CLASS_SEL)ReFlashItemGU(0); else ReFlashItemGU(1); SelMachine=0; } break; } } static void ReFlashItemGU(char type){ static unsigned short susCt=0; static const char *accIconFileName[]={ "Group1.bmp", "Group2.bmp", "people1.bmp", "people2.bmp", "" }; static char *icons[3]; int i; unsigned short timeout; static char *GUName[POC_ALL_GROUPS_NUM+1]; //5 static char GUFeatures[POC_ALL_GROUPS_NUM+1];//5 if(type==0){ icons[0]=accIconFileName[0]; icons[1]=accIconFileName[1]; }else{ icons[0]=accIconFileName[2]; icons[1]=accIconFileName[3]; } icons[2]=accIconFileName[4]; for(i=0;i<=POC_ALL_GROUPS_NUM;i++){ GUName[i]=NullPtr; GUFeatures[i]=0; } for(i=0;i=GPS_TABLE_NUM) tempGpsIndex=0; }else if(type==2){ if(tempGpsIndex>0) tempGpsIndex--; else tempGpsIndex=GPS_TABLE_NUM-1; }else return; gpsTimeValue=getGPSTimeValue(tempGpsIndex); if(gpsTimeValue==0) snprintf(buf, sizeof(buf), "定位上传设置:关闭"); else snprintf(buf, sizeof(buf), "定位上传设置:%d秒",gpsTimeValue); guiClearRect(0,y,GLCD_WIDTH-1, y+12,guiGetBackColor()); guiShowStr(30,y, buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); } static locationXYFlash(char flash){ char buf[50]; unsigned short y=UI_CONTENT_SHOW_Y+2; if(gpsInfo.update==0 && flash==0) return; gpsInfo.update=0; guiClearRect(0, y,GLCD_WIDTH-1, y+12+5+12,guiGetBackColor()); snprintf(buf, sizeof(buf), "纬度 S:%d.%05d",gpsInfo.Lat/1000000,gpsInfo.Lat%1000000); guiShowStr(30,y, buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); y+=12+5; snprintf(buf, sizeof(buf), "经度 W:%d.%05d",gpsInfo.Long/1000000,gpsInfo.Long%1000000); guiShowStr(30,y, buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); } /*****************************定位设置部分结束*********************************/ /*******************************终端信息开始**********************************/ unsigned char sysInfoType; static void sysInfoFlash(void){ unsigned short x,y; char buf[50]; unsigned char LineSpace=12+4; int len; x=2,y=UI_CONTENT_SHOW_Y+5; guiClearRect(0,y,GLCD_WIDTH-1,UI_BOTTOM_LINE_Y-1,guiGetBackColor()); if(sysInfoType==0){ //终端型号 snprintf(buf, sizeof(buf),"终端型号:%s",OHPOC_APP_NAME); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace; //终端编码 snprintf(buf, sizeof(buf),"终端编码:%lu",sutApp.account.psn); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace; //应用版本 snprintf(buf, sizeof(buf),"应用版本:%s",OHPOC_VERSION); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace; //内部版本 snprintf(buf, sizeof(buf),"内部版本:%d",CUSTOMER_CODE); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); }else if(sysInfoType==1){ //对讲版本号 snprintf(buf, sizeof(buf),"对讲版本:%s",sutApp.pocVersion); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace; //模块 memset(buf,sizeof(buf),0); snprintf(buf,sizeof(buf),"模块:%s", sutApp.modemVer); len=strlen(buf); if(len>20){ y+=LineSpace; guiShowStr(x+32,y,buf+20,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); buf[20]=0; y-=LineSpace; } guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); }else if(sysInfoType==2){ //显示服务器 //对讲IP //getPIPAddr();getGIPAddr(); guiShowStr(x,y,"交换服务器:",FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+= LineSpace; snprintf(buf, sizeof(buf),"%s",showPIP); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace; //GPS IP guiShowStr(x,y,"定位服务器:",FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+= LineSpace; snprintf(buf, sizeof(buf),"%s",showGIP); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace; snprintf(buf, sizeof(buf),"端口:%d",newPara.gpsPort); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); } } void uiShowInformation(char update){ if(update){ sysInfoType=0; guiClearAll(guiGetBackColor()); guiShowCaption(0,"终端信息",UI_STATUS_BAR_HEIGH,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); uiMenuShowBottomIndacitor(NULL, "返回"); sysInfoFlash(); } } void uiShowInformationResponse(void){ unsigned short key=getKeyValue(); if(MKEY_VALUE_ESC==key) uISetNextStatus(sutUIstatus.LastStatus); else if(MKEY_VALUE_DOWN==key || MKEY_VALUE_UP==key){ if(sysInfoType==0) sysInfoType=1; else sysInfoType=0; sysInfoFlash(); }else if(MKEY_VALUE_CB_IP==key){ sysInfoType=2; sysInfoFlash(); } } /*****************************终端信息结束**********************************/ /*******************************留音记录开始**********************************/ void uiShowVoiceInfo(char update){ static unsigned int timer; static char *showInfo[3+1]; static char empty; int i; if(update){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"留音记录",UI_STATUS_BAR_HEIGH,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); uiMenuShowBottomIndacitor("播放", "返回"); sutApp.voiceInfo.update=0; sutApp.voiceInfo.aNum=0; sutApp.voiceInfo.vNum=0; sutApp.voiceInfo.voiceValidNum=0; sutApp.voiceInfo.voiceStatus=1; empty=0; msgAtSend("AT+VINFO?\r\n"); guiShowMessageBox("请稍后"); uTimerStart(&timer, 2000); } switch(sutApp.voiceInfo.voiceStatus){ case 1: if(sutApp.voiceInfo.update!=0){ sutApp.voiceInfo.voiceStatus=2; break; } if(uTimerExpired(&timer)){ showInfo[0]="空"; sutApp.voiceInfo.voiceStatus=2; empty=1; //MSG_INFO(1, "==>Empty"); } break; case 2: if(empty==0) for(i=0;iok_back=1; uISetNextStatus(sutUIstatus.LastStatus); } } /*****************************SD卡检测结束***********************************/ static const char *commonIcon2[]={ "APN.bmp", "APN1.bmp", "" }; /*****************************LCD设置开始**********************************/ unsigned char lcdTmpIndex; static void lcdTimeFlash(char type){ char buf[50]; unsigned short x=4,y=56,value; if(type==0) guiShowStr(x+25, y, "背光时间:", FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); else if(type==1){ if(++lcdTmpIndex>=5) lcdTmpIndex=0; }else if(type==2){ if(lcdTmpIndex>0) lcdTmpIndex--; else lcdTmpIndex=4; } value=newPara.lcdParaList[lcdTmpIndex]; if(value==0) snprintf(buf, sizeof(buf), " 常亮 "); else snprintf(buf, sizeof(buf), "%3d 秒", value); guiShowStr(x+85, y, buf, FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); } void uiShowLcdSel(char StatusUpdate){ if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"LCD设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); lcdTmpIndex=newPara.lcdParaDefaultIndex; lcdTimeFlash(0); uiMenuShowBottomIndacitor("保存", "返回"); } } void uiShowLcdSelResponse(void){ unsigned short key=getKeyValue(); if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL); else if(MKEY_VALUE_DOWN==key)lcdTimeFlash(1); else if(MKEY_VALUE_UP==key) lcdTimeFlash(2); else if(MKEY_VALUE_MENU==key){ getStackStruct()->ok_back=1; if(lcdTmpIndex != newPara.lcdParaDefaultIndex){ newPara.lcdParaDefaultIndex=lcdTmpIndex; MSG_INFO(1, "LCD TimeUpdate"); backLightReset(); sysIniSave(); } uISetNextStatus(UIS_MENU_SYS_SEL); } } /*****************************LCD设置结束**********************************/ /*****************************网络设置开始**********************************/ const unsigned char netModeSetTable[3]={1,2,4};//设置制式:AUTH,2G,4G /*输入制式源始值,返回索引值对应值*/ unsigned char getNetModeIndex(unsigned char netModeValue){ unsigned char i; for(i=0;i=sizeof(netModeSetTable)) return 0xff; else return netModeSetTable[netModeIndex]; } /*输入制式索引值,发送对应该命令给模块*/ void netModeSetCmd(unsigned char netModeIndex){ char buf[30]; unsigned char netModeValue=getNetModeValue(netModeIndex); if(netModeValue==0xff){ MSG_ERR(1,"netMode index invalid:%d",netModeIndex); return; } snprintf(buf, sizeof(buf), "AT$MYSYSINFO=%d\r\n",netModeValue); msgAtSend(buf); } #define NET_MODE_NUM 3 void uiShowNetSel(char StatusUpdate){ static const char *netMode[NET_MODE_NUM+1]={ "AUTO", "2G", "4G", "" }; char Features[NET_MODE_NUM]; unsigned char i; if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"网络设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); for(i=0;iok_back=1; if(sutListBox.handle != newPara.netMode){ newPara.netMode=sutListBox.handle; MSG_INFO(1, "netMode update:%d", newPara.netMode); sysIniSave(); netModeSetCmd(newPara.netMode); } uISetNextStatus(UIS_MENU_SYS_SEL); } } /*****************************网络设置结束**********************************/ /*****************************卡选择设置开始**********************************/ #define SIM_MODE_NUM 2 void uiShowSimSel(char StatusUpdate){ static const char *simMode[SIM_MODE_NUM+1]={ "卡1", "卡2", "" }; char Features[SIM_MODE_NUM]; unsigned char i; if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"SIM设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); for(i=0;iok_back=1; if(sutListBox.handle != sutApp.simSel){ snprintf(buf, sizeof(buf), "AT+SSIM=%d\r\n",sutListBox.handle+1); msgAtSend(buf); guiShowMessageBox("请重启设备"); msgAtSend("AT+TRB=1\r\n"); nwy_sleep(100); for(;;){ MSG_INFO(1, "card changed, wait user reboot"); CTL_POWER_HOLD(0); nwy_sleep(1000); } } uISetNextStatus(UIS_MENU_SYS_SEL); } } /*****************************卡选择设置结束**********************************/ /*****************************功耗设置开始**********************************/ typedef enum{ PMODE_DEFAULT_LOW, PMODE_SUPER_LOW, PMODE_NORMAL }PWR_ENUMDEF; //低功耗模式 #define MODE_LOW_PWR_NONE_4G 5 #define MODE_LOW_PWR_IS_4G 25 //超长待机模式 #define MODE_LONG_LOW_PWR_NONE_4G 5 #define MODE_LONG_LOW_PWR_IS_4G 55 //常规模式 #define MODE_NORMAL__NONE_4G 5 #define MODE_NORMAL__IS_4G 5 //终端放弃设置模式,由服务器决定使用什么 #define MODE_AUTO____NONE_4G 0 #define MODE_AUTO____IS_4G 0 //默认功耗模式 #define MODE_PWR_DEFAULT_NONE_4G MODE_LOW_PWR_NONE_4G #define MODE_PWR_DEFAULT_IS_4G MODE_LOW_PWR_IS_4G static void pwrModeSetCmd(unsigned char pwrMode){ unsigned char seg1,seg2; char buf[30]; if(pwrMode==PMODE_DEFAULT_LOW){ seg1=MODE_PWR_DEFAULT_NONE_4G; seg2=MODE_PWR_DEFAULT_IS_4G; }else if(pwrMode==PMODE_SUPER_LOW){ seg1=MODE_LONG_LOW_PWR_NONE_4G; seg2=MODE_LONG_LOW_PWR_IS_4G; }else if(pwrMode==PMODE_NORMAL){ seg1=MODE_NORMAL__NONE_4G; seg2=MODE_NORMAL__IS_4G; }else return; snprintf(buf, sizeof(buf), "AT+UDP=%d,%d\r\n",seg1,seg2); msgAtSend(buf); } void pwrModeAckHandler(unsigned char seg1, unsigned char seg2){ if(seg1==MODE_PWR_DEFAULT_NONE_4G && seg2==MODE_PWR_DEFAULT_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个模式都不满足则切换为默认模式 newPara.pwrMode = PMODE_DEFAULT_LOW; goto SAVE_PWR_MODE; } return; SAVE_PWR_MODE: sysIniSave(); pwrModeSetCmd(newPara.pwrMode); } #define PWR_MODE_NUM 3 void uiShowPwrSel(char StatusUpdate){ static const char *pwrMode[PWR_MODE_NUM+1]={ "低功耗模式", "超长待机模式", "常规模式", "", }; char Features[PWR_MODE_NUM]; unsigned char i; if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"功耗设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); for(i=0;iok_back=1; if(sutListBox.handle != newPara.pwrMode){ newPara.pwrMode=sutListBox.handle; MSG_INFO(1, "pwrMode update:%d", newPara.pwrMode); sysIniSave(); pwrModeSetCmd(newPara.pwrMode); } uISetNextStatus(UIS_MENU_SYS_SEL); } } /*****************************功耗设置结束**********************************/ /*****************************服务器设置输入密码开始**********************************/ void uiShowServerPassSel(char StatusUpdate){ if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"密码验证",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); NumEditInit(&sutNumEdit,(GLCD_WIDTH-6*8)/2,(GLCD_HEIGHT-16)/2,"000000"); NumEditShow(&sutNumEdit); uiMenuShowBottomIndacitor("[上]加值", "[下]移动"); } } void uiShowServerSelPassResponse(void){ unsigned short key=getKeyValue(); NumEditResponse(&sutNumEdit); if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL); else if(MKEY_VALUE_MENU==key){ if(memcmp(sutNumEdit.buffer, getMenuKey(), 6)==0) uISetNextStatus(UIS_MENU_SYS_SERVER); else{ guiShowMessageBox("密码错误"); nwy_sleep(1000); getStackStruct()->ok_back=1; uISetNextStatus(UIS_MENU_SYS_SEL); } } } /*****************************服务器设置输入密码结束**********************************/ /*****************************服务器设置开始**********************************/ void uiShowServerSel(char StatusUpdate){ static const char *serIcons[]={ "Ser.bmp", "Sersel.bmp", "" }; static const char *serName[]={ "杭州服务器", "山东服务器", "IP分发服务器", "集群服务器", "自定义服务器", "", }; char Features[5]; unsigned char tempSer,i; if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"服务器列表",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); uiMenuShowBottomIndacitor("确认", "返回"); tempSer=newPara.serList.defaultuse; for(i=0;i<=SERVER_UR;i++){ if(i==tempSer) Features[i]=1; else Features[i]=0; } ListBoxInit(&sutListBox,serName,0,serIcons,Features); } } void uiShowServerSelResponse(void){ unsigned char tempSer; char buf[50],buf1[100]; unsigned short key=ListBoxResponse(&sutListBox); if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL); else if(MKEY_VALUE_MENU==key){ tempSer=sutListBox.handle; if(tempSer != newPara.serList.defaultuse){ newPara.serList.defaultuse=tempSer; sysIniSave(); getGIPAddr(); snprintf(buf, sizeof(buf), "ip=%s;domain=%s;",getPIPAddr(),getDOMAINAddr()); AscStrTurnHexStr(buf,buf1); msgAtSend("AT+POC=010000"); msgAtSend(buf1); msgAtSend("\r\n"); nwy_sleep(100); msgAtSend("AT+POC=040000\r\n"); } uISetNextStatus(UIS_STANDBY ); } } /*****************************服务器设置结束**********************************/ /*****************************版本设置开始**********************************/ unsigned char fotaStep; unsigned int fotaTick; void fotaStepSet(unsigned char newStep){ fotaStep=newStep; } void fotaMsgShow(char *msg){ int len=guiGetStrXLen((char *)msg,FONT_MODE_16X16); guiClearRect(0, 60, GLCD_WIDTH-1, 60+16,guiGetBackColor()); guiShowStr((GLCD_WIDTH-len)/2,60, msg,FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); } void uiShowVersionSel(char StatusUpdate){ if(StatusUpdate){ sutApp.fotaVersion[0]=0; guiClearAll(guiGetBackColor()); guiShowCaption(0,"版本更新",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); msgAtSend("AT+FOTA?\r\n"); fotaStep=0; fotaMsgShow("正在检测版本"); uiMenuShowBottomLine(); uiMenuShowBottomIndacitor("确定", "返回"); uTimerStart(&fotaTick, 500); } switch(fotaStep){ case 0: if(uTimerExpired(&fotaTick)){ fotaMsgShow("检测超时"); fotaStep=4; } break; case 1://等待用户确定 break; case 2://用户确定后等待结果 if(uTimerExpired(&fotaTick)){ fotaMsgShow("超时退出"); fotaStep=4; } break; case 3://升级成功,等待重启 msgAtSend("AT+POC=050000\r\n");//停止POC后复位 MSG_INFO(1, "Stop poc"); nwy_sleep(2000); msgAtSend("AT+TRB=2\r\n"); MSG_INFO(1, "Reset system!!!"); while(1){nwy_sleep(1000);} break; case 4://延时显示2秒后退出 uTimerStart(&fotaTick, 2000); fotaStep=5; break; case 5://退出升级流程 if(uTimerExpired(&fotaTick)) uISetNextStatus(UIS_MENU_SYS_SEL); break; } } void uiShowVersionSelResponse(void){ unsigned char key=getKeyValue(); if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL); else if(MKEY_VALUE_MENU==key){ if(fotaStep==1){ fotaMsgShow("请勿断电!"); fotaStep=2; msgAtSend("AT+FOTA=1\r\n"); uTimerStart(&fotaTick, 10000); } } } /*****************************版本设置结束**********************************/ /*****************************提示音设置开始********************************/ unsigned char noteSetTmp; static void switchFlash(void){ char info[30]; unsigned short x,y,len; if(noteSetTmp==0) snprintf(info, sizeof(info), "关闭"); else snprintf(info, sizeof(info), "打开"); len=guiGetStrXLen((char *)info, FONT_MODE_12X12); x=(GLCD_WIDTH-len)/2; y=UI_CONTENT_SHOW_Y+(GLCD_HEIGHT-UI_CONTENT_SHOW_Y)/2-12; guiShowStr(x,y,info, FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); } void uiShowNoteSel(char StatusUpdate){ if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"提示音设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); noteSetTmp=newPara.KeySound; switchFlash(); uiMenuShowBottomIndacitor("保存", "返回"); } } void uiShowNoteSelResponse(void){ unsigned short key=getKeyValue(); if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL); else if(MKEY_VALUE_MENU==key){ getStackStruct()->ok_back=1; if(newPara.KeySound != noteSetTmp){ newPara.KeySound=noteSetTmp; #ifndef ENABLE_PWM_BEEP if(noteSetTmp==0) msgAtSend("AT+TONES=0\r\n"); else msgAtSend("AT+TONES=1\r\n"); #endif sysIniSave(); } uISetNextStatus(UIS_MENU_SYS_SEL); }else if(MKEY_VALUE_DOWN || MKEY_VALUE_UP){ if(noteSetTmp==0) noteSetTmp=1; else noteSetTmp=0; switchFlash(); } } /*****************************提示音设置结束********************************/