#include "includes.h" /****************************状态栏显示部分开始***********************************/ #ifndef USE_HPOC_POC static char GUListBoxInited=0; unsigned char AscToHex(unsigned char aHex) { if((aHex>=0)&&(aHex<=9)) aHex += 0x30; else if((aHex>=10)&&(aHex<=15))//A-F //aHex += 0x37; aHex += 0x57; else aHex = 0xff; return aHex; } void AscStrTurnHexStr(char *AscStr, char *HexStr) { char *pAscStr=AscStr; unsigned char d,h,l; while(0!=(d=(unsigned char)*pAscStr++)){ l=d&0x0f; h=d>>4; *HexStr++=AscToHex(h); *HexStr++=AscToHex(l); } *HexStr=0; } #endif //显示信号强度 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<5 || CSQ==99){ guiClearRect(x,y+1,x+10,y+9,COLOR_STATUS_BAR); }else if(CSQ<11){ guiDrawVLine(x+2,y+8,x,y,guiGetBackColor()); guiClearRect(x+2,y+1,x+10,y+9,COLOR_STATUS_BAR); }else if(CSQ<18){ 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()); } } unsigned char netshowvalue=0xff; unsigned char ctecCurrentSet=0; //显示网络制式 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){ if(sutApp.account.tnet==5)guiShowStr(NET_ICON_X, y+1,"5G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR); else 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 ShowCardType(char card){ unsigned short x= CARD_ICON_X; unsigned short y=3; if(card==0) guiShowBmp(x, y, "SIM1.bmp"); else if(card==1) guiShowBmp(x, y, "SIM2.bmp"); } //显示电量 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 } sutApp.lowPwrWarn=0; } //显示时间 static void ShowTime(char flash,unsigned int exeInterval){ static unsigned short nextExe=0; static unsigned char flag=0; MY_CLOCK myclock={0}; char buf[30]; //if(sutApp.bndPocDone==0)return; if(sutPocStatus.logined==0)return; 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; } //MSG_INFO(1,buf); guiShowStr(TIME_ICON_X, 1,buf, FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR); } if(++nextExe>=(1000/exeInterval)) nextExe=0;//1000 } //显示耳机接入状态 static void ShowEarStatus(char flash){ static unsigned char lastStatus=0; if(lastStatus==sutApp.earLev && flash==0) return; if(sutApp.earLev!=0) guiShowBmp(EAR_ICON_X, 1, "ear.bmp"); else guiClearRect(EAR_ICON_X, 1, EAR_ICON_X+14,1+12, COLOR_STATUS_BAR); lastStatus=sutApp.earLev; } //显示键盘锁状态 static void ShowKeyLocStatus(char flash){ static unsigned char lastStatus=0; if(lastStatus==sutApp.keyLock && flash==0) return; if(sutApp.keyLock!=0) guiShowBmp(LOCK_ICON_X, 1, "lock.bmp"); else guiClearRect(LOCK_ICON_X, 1, LOCK_ICON_X+LOCK_ICON_WX,12, COLOR_STATUS_BAR); lastStatus=sutApp.keyLock; } //显示状态栏 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; static char cardType=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); } //显示卡选项 if(tempFlash || cardType != sutApp.simSel){ cardType=sutApp.simSel; ShowCardType(cardType); } //显示2G/3G/4G if(tempFlash || s_netshowvalue!=netshowvalue){ s_netshowvalue=netshowvalue; Show_Net(s_netshowvalue); } //显示GPS是否正常及鉴权情况 //gpsInfo.gpsLocated=1; //gpsInfo.bbAuth=1; //gpsInfo.gpsF=1; 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); } //文本消息显示 //sutSms.haveUnRead=1; ShowMessageFlag(0); //GPS显示 //时间显示 ShowTime(tempFlash,exeInterval); //显示耳机状态 ShowEarStatus(tempFlash); //显示键盘锁状态 ShowKeyLocStatus(tempFlash); } /****************************状态栏显示部分结束***********************************/ /****************************待机界面显示部分开始***********************************/ 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); static void uiShowCallUserName(void); static void uiShowOffLineMessage(void); static void uiShowCopsInfo(void){ char info[50]; switch(sutApp.copstype){ case 0:case 2:case 4:case 7://中国移动 snprintf(info, sizeof(info), "中国移动"); break; case 1:case 6:case 9://中移联通 snprintf(info, sizeof(info), "中国联通"); break; case 3:case 8:case 11://中国电信 snprintf(info, sizeof(info), "中国电信"); break; default:snprintf(info, sizeof(info), "公网集群对讲系统");break; } guiFillRect(0, UI_STATUS_ITEM_Y, GLCD_WIDTH-1, UI_CONTENT_SHOW_Y-1, guiGetForeColor());//清除第二区 guiShowCaption(0,info, UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); } 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[20]; static char firstRun=0; static unsigned short dly=0; char tmpStatus=status; static int copsStatus; #if 0 /*延时一下1秒后才显示后面的,如果直接登录了,就跳出延时*/ if(firstRun==0){ if((++dly>=(1*1000/exeInterval)) || sutPocStatus.logined!=0){ firstRun=1; tmpStatus=1; sutApp.enableKey=1;//延时按键操作完成 }else return; } #endif /*逻辑处理开始*/ if(tmpStatus){ guiClearAll(guiGetBackColor()); #ifdef AUTH_SKIP guiShowStr(1, UI_BOTTOM_SHOW_Y-12,"软件测试版本", FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR, guiGetBackColor()); #else if(!newPara.newold_plam)guiShowStr(1, UI_BOTTOM_SHOW_Y,"菜单", FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR, guiGetBackColor()); #endif danhu=sutPocStatus.danHuStatus; uiShowGuaDuan(danhu); lastFlag=-1; siCt=0; GUListBoxInited=0; //return; } if(copsStatus != sutApp.copstype || tmpStatus){ copsStatus=sutApp.copstype; uiShowCopsInfo(); } //更新单呼显示与否 if(sutPocStatus.danHuStatus != danhu){ danhu=sutPocStatus.danHuStatus; if(!newPara.newold_plam)uiShowGuaDuan(danhu); } //提示解锁 if(sutApp.lockShow!=0){ backLightReset(); guiShowMessageBox("请先解锁!"); LSAPI_OSI_ThreadSleep(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("空闲"); 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("本机在讲话"); } 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); else uiShowGUName(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(sutApp.weather[0]!=0&&newPara.WeatherEnable==0)guiLefItem(0,UI_BOTTOM_SHOW_Y,COLOR_STATUS_BAR, guiGetBackColor(),FONT_MODE_12X12,sutApp.weather); 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+2,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); } } 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){ guiShowStr(2, UI_GROUP_SHOW_Y+2,"群组:", FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); guiClearRect(2+30, UI_GROUP_SHOW_Y, GLCD_WIDTH-1, UI_GROUP_SHOW_Y+16, guiGetBackColor()); #ifdef USE_12X12_FONT_ONLY guiShowStr(2+30, UI_GROUP_SHOW_Y+2,info, FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #else guiShowStr(2+30, UI_GROUP_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #endif } static void uiShowUser(const char* info){ guiShowStr(2, UI_USER_SHOW_Y+2,"成员:", FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); guiClearRect(2+30, UI_USER_SHOW_Y, GLCD_WIDTH-1, UI_USER_SHOW_Y+16, guiGetBackColor()); #ifdef USE_12X12_FONT_ONLY guiShowStr(2+30, UI_USER_SHOW_Y+2,info, FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #else guiShowStr(2+30, UI_USER_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #endif } static void uiShowHuaQuan(const char* info){ guiShowStr(2, UI_VOICE_SHOW_Y+2,"话权:", FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); guiClearRect(2+30, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16, guiGetBackColor()); #ifdef USE_12X12_FONT_ONLY guiShowStr(2+30, UI_VOICE_SHOW_Y+2,info, FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #else guiShowStr(2+30, UI_VOICE_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #endif } 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); } } 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()); } } /****************************待机界面显示部分结束***********************************/ /****************************主菜单显示部分开始*************************************/ #include "Palace.h" SUT_PALACE sutPalace; void uiShowMenuMain(char update){ static const char *apcMenuMain[]={ "群组选择", "成员选择", "文本信息", "系统设置", "定位设置", "终端信息", "" }; 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: uISetNextStatus(UIS_MENU_GROUP_SEL); break; case 1: uISetNextStatus(UIS_MENU_USER_SEL); break; case 2: uISetNextStatus(UIS_MENU_MAIL_SEL); break; case 3: uISetNextStatus(UIS_MENU_SYS_SEL); break; case 4: uISetNextStatus(UIS_MENU_LOCATION_SEL); break; case 5: uISetNextStatus(UIS_MENU_INFO_SEL); break; } uiPushStack(sutPalace.Index); } else if(MKEY_VALUE_ESC==key){ uISetNextStatus(UIS_STANDBY); } } /****************************主菜单显示部分结束*************************************/ /*****************************群组选择/成员选择部分开始*********************************/ static void ReFlashItemGU(char type); static void UserAssistAdd(void); void numGUFlash(int index, int total){ char info[10]; int x; snprintf(info, sizeof(info), "%d", total); x=GLCD_WIDTH-strlen(info)*8; guiClearRect(GLCD_WIDTH/2, UI_STATUS_ITEM_Y, GLCD_WIDTH-1, UI_STATUS_ITEM_Y+12, guiGetForeColor()); guiShowStr(x, UI_STATUS_ITEM_Y+1, info, FONT_MODE_12X12, REVERSED_NO, guiGetBackColor(), guiGetForeColor()); } static char SelMachine=0; bool setHandleToZero=true; 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; setHandleToZero=true; } break; case 1: if(uTimerExpired(&timer)){ uISetNextStatus(UIS_STANDBY); } break; case 2: temp=getAssistResult(); if(temp){ guiClearAll(guiGetBackColor()); if(type==0){ guiShowCaption(20,"群组选择",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //0 uiMenuShowBottomIndacitor("确定", "返回"); }else{ guiShowCaption(20,"用户选择",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(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)){ setHandleToZero=true; 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; #ifndef USE_BND_POC 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); #else broad_joingroup(sutPocStatus.AllGroups[sutListBox.handle].ID); #endif 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)){ setHandleToZero=true; 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; broad_calluser(sutPocStatus.AllUsers[sutListBox.handle].ID, cb_callmember); MSG_INFO(1,"AllUsers[sutListBox.handle].ID===%d",sutPocStatus.AllUsers[sutListBox.handle].ID); uISetNextStatus(UIS_STANDBY); SelMachine=0; } break; } } static void UserAssistAdd(void){ switch(SelMachine){ case 1: if(getAssistResult()){ if(sutUIstatus.Status==UIS_MENU_GROUP_SEL)ReFlashItemGU(0); else ReFlashItemGU(1); SelMachine=0; } break; case 2: if(getAssistResult()){ if(sutUIstatus.Status==UIS_MENU_GROUP_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", "Group3.bmp", "people1.bmp", "people2.bmp", "people3.bmp", "" }; static char *icons[4]; int i; unsigned short timeout; static const char *NullGU=""; static char *GUName[POC_ALL_GROUPS_NUM+1]; //5 static char GUFeatures[POC_ALL_GROUPS_NUM+1];//5 unsigned int showHandle; if(type==0){ icons[0]=accIconFileName[0]; icons[1]=accIconFileName[1]; icons[2]=accIconFileName[2]; }else{ icons[0]=accIconFileName[3]; icons[1]=accIconFileName[4]; icons[2]=accIconFileName[5]; } icons[3]=accIconFileName[6]; for(i=0;i<=POC_ALL_GROUPS_NUM;i++){ GUName[i]=NullGU; 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; static char *p=0; unsigned char Exseat=0; static char yunyingshang=0; QR_OUT testma; x=2,y=UI_CONTENT_SHOW_Y+3; guiClearRect(0,y,GLCD_WIDTH-1,GLCD_HEIGHT,guiGetBackColor()); if(sysInfoType==0){ switch(sutApp.copstype){ case 0:case 2:case 4:case 7://中国移动 yunyingshang=1; break; case 1:case 6:case 9://中移联通 yunyingshang=2; break; case 3:case 8:case 11://中国电信 yunyingshang=3; break; default: yunyingshang=0; break; } if(newPara.newold_plam==1){ p=ohpocGetIMEI(); // guiShowStr(NET_ICON_X, y+1,"4G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR); //guiShowCaption(0,"IMEI",UI_NOTE_LOCATION_Y,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); }else{ Exseat=0; p=ohpocGetICCID(); if(yunyingshang!=1){ p[19]=0; } //guiShowCaption(0,"ICCID",UI_NOTE_LOCATION_Y,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); } if(p!=NULL){ EncodeData(p,&testma); guiDrawQRimage(36,y+1,4,testma.data,testma.size);//32 }else{ guiShowMessageBox("获取失败"); } MSG_INFO(1,"copstype==%d,yunyingshang==%d",sutApp.copstype,yunyingshang); } else if(sysInfoType==1){ snprintf(buf, sizeof(buf),"ICCID:"); guiShowStr(0,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); if(LSAPI_SIM_GetICCID(buf)==0&&yunyingshang!=0){ strcpy(sutApp.ICCID, buf); if(yunyingshang!=1){ sutApp.ICCID[19]=0; } snprintf(buf, sizeof(buf),"%s",sutApp.ICCID); MSG_INFO(1,"CCID========%s",sutApp.ICCID); len=strlen(buf); if(len>14){ y+=LineSpace; Exseat+=LineSpace; guiShowStr(0,y,buf+14,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); buf[14]=0; y-=LineSpace; } guiShowStr(48,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); } else{ snprintf(buf, sizeof(buf),"未知"); guiShowStr(48,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); } y+=Exseat;//返回指向原始位置 y+=LineSpace; Exseat=0; //IMEI snprintf(buf, sizeof(buf),"IMEI:"); guiShowStr(0,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); memset(buf,0,sizeof(buf)); if(LSAPI_SIM_GetIMEI(buf)==0){ len=strlen(buf); if(len>15){ y+=LineSpace; Exseat+=LineSpace; guiShowStr(0,y,buf+15,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); buf[15]=0; y-=LineSpace; } guiShowStr(40,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); }else{ guiShowStr(40,y,"未知",FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); } y+=Exseat;//返回指向原始位置 y+=LineSpace; //终端编码 snprintf(buf,sizeof(buf),"PSN:%lu", sutApp.account.psn); len=strlen(buf); if(len>17){ y+=LineSpace; guiShowStr(x+32,y,buf+17,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); buf[17]=0; y-=LineSpace; } guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); }else if(sysInfoType==2){ //对讲平台 //snprintf(buf, sizeof(buf),"对讲平台:%s", OHPOC_POC_PLATFORM); if(newPara.newold_plam==0)snprintf(buf, sizeof(buf),"对讲平台:BND"); else snprintf(buf, sizeof(buf),"对讲平台:芯平台"); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace; //对讲版本号 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()); 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()); } } 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) { if(sutApp.platfrom_err){ sutApp.platfrom_err=0; uISetNextStatus(UIS_STANDBY); } uISetNextStatus(sutUIstatus.LastStatus); } else if(MKEY_VALUE_DOWN==key || MKEY_VALUE_UP==key){ if(sysInfoType==0) sysInfoType=1; else if(sysInfoType==1)sysInfoType=2; else sysInfoType=0; sysInfoFlash(); }else if(MKEY_VALUE_CB_IP==key){ sysInfoType=2; sysInfoFlash(); } } /*****************************终端信息结束**********************************/ 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 netMode){ char buf[30]; snprintf(buf, sizeof(buf), "AT+CTEC=%d,%d\r\n",ctecCurrentSet, netMode); 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*2 != newPara.netMode){ newPara.netMode=sutListBox.handle*2; 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;iFastUiChange)uISetNextStatus(UIS_STANDBY); else uISetNextStatus(UIS_MENU_SYS_SEL); }else if(MKEY_VALUE_MENU==key){ getStackStruct()->ok_back=1; if(sutListBox.handle != sutApp.simSel){ snprintf(buf, sizeof(buf), "AT+SIMCROSS=%d\r\n",sutListBox.handle); msgAtSend(buf); guiShowMessageBox("请重启设备"); msgAtSend("AT+TRB\r\n"); LSAPI_OSI_ThreadSleep(1000); for(;;){ MSG_INFO(1, "card changed, wait user reboot"); CTL_POWER_HOLD(0); LSAPI_OSI_ThreadSleep(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_PLAT); else{ guiShowMessageBox("密码错误"); LSAPI_OSI_ThreadSleep(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,0); } } 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"); LSAPI_OSI_ThreadSleep(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){ #ifdef USE_12X12_FONT_ONLY int len=guiGetStrXLen((char *)msg,FONT_MODE_12X12); #else int len=guiGetStrXLen((char *)msg,FONT_MODE_16X16); #endif guiClearRect(0, 60, GLCD_WIDTH-1, 60+16,guiGetBackColor()); #ifdef USE_12X12_FONT_ONLY guiShowStr((GLCD_WIDTH-len)/2,60+2, msg,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); #else guiShowStr((GLCD_WIDTH-len)/2,60, msg,FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); #endif } char loadMsg=0; void showLoading(void){ loadMsg=1; } void uiShowVersionSel(char StatusUpdate){ char buf[50]; 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; loadMsg=0; fotaMsgShow("正在检测版本"); uiMenuShowBottomLine(); uiMenuShowBottomIndacitor("确定", "返回"); uTimerStart(&fotaTick, 5000); } switch(fotaStep){ case 0: if(uTimerExpired(&fotaTick)){ fotaMsgShow("检测超时"); fotaStep=4; } break; case 1://等待用户确定 break; case 2://用户确定后等待结果 if(uTimerExpired(&fotaTick)){ fotaMsgShow("超时退出"); fotaStep=4; } if(loadMsg!=0){ fotaMsgShow("正在下载"); loadMsg=0; } break; case 3://升级成功,等待重启 msgAtSend("AT+POC=050000\r\n");//停止POC后复位 MSG_INFO(1, "Stop poc"); LSAPI_OSI_ThreadSleep(2000); msgAtSend("AT+TRB\r\n"); MSG_INFO(1, "Reset system!!!"); while(1){LSAPI_OSI_ThreadSleep(1000);} break; case 4://延时显示2秒后退出 uTimerStart(&fotaTick, 2000); fotaStep=5; break; case 5://退出升级流程 if(uTimerExpired(&fotaTick)) uISetNextStatus(UIS_MENU_SYS_SEL); break; case 6://无更新版本 fotaMsgShow("无更新版本"); fotaStep=4; break; case 7://升级失败 fotaMsgShow("升级失败"); fotaStep=4; break; case 8://下载成功 fotaMsgShow("下载成功,重启更新"); fotaStep=3; break; case 9:// snprintf(buf, sizeof(buf), "是否更新到:%s",sutApp.fotaVersion); fotaMsgShow(buf); fotaStep=1; 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, 1000); } } } /*****************************版本设置结束**********************************/ /*****************************提示音设置开始********************************/ 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(); } } /*****************************提示音设置结束********************************/ /*****************************BND 新旧平台选择**********************************/ void uiShowPingTaiSel(char StatusUpdate){ static const char *simMode[2+1]={ "博纳德", "芯平台", "" }; char Features[2]; unsigned char i; if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"平台选择",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); for(i=0;i<2;i++){ if(i==newPara.newold_plam) Features[i]=1; else Features[i]=0; } ListBoxInit(&sutListBox,simMode,0,commonIcon2,Features,newPara.newold_plam); uiMenuShowBottomIndacitor("保存", "返回"); } } void uiShowPingTaiSelResponse(void){ char buf[30]; unsigned short key=ListBoxResponse(&sutListBox); if(MKEY_VALUE_ESC==key){ if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY); else uISetNextStatus(UIS_MENU_SYS_SEL); }else if(MKEY_VALUE_MENU==key){ getStackStruct()->ok_back=1; if(sutListBox.handle != newPara.newold_plam){ newPara.newold_plam=sutListBox.handle; if(sutListBox.handle==0){ broad_write_custom(CHANGE_PLATFORM_CONTEXT,"std"); }else broad_write_custom(CHANGE_PLATFORM_CONTEXT,"xin"); sysIniSave(); guiShowMessageBox("请重启设备"); msgAtSend("AT+TRB\r\n"); LSAPI_OSI_ThreadSleep(1000); for(;;){ MSG_INFO(1, "平台正在切换,等待用户重启"); CTL_POWER_HOLD(0); LSAPI_OSI_ThreadSleep(1000); } } uISetNextStatus(UIS_MENU_SYS_SEL); } } /*****************************BND 新旧平台选择结束**********************************/ /*****************************关机界面提示结束**********************************/ void uiShowShutDown(char update){ if(update){ lcdBackLightApi(1); guiClearAll(guiGetBackColor()); guiShowCaption(0,"关机",UI_STATUS_BAR_HEIGH,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); guiShowMessageBox("确定关机?"); uiMenuShowBottomLine(); uiMenuShowBottomIndacitor("确定", "取消"); } } void uiShowShutDownResponse(void){ unsigned short key=getKeyValue(); if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_STANDBY); else if(MKEY_VALUE_MENU==key){ MSG_INFO(1, "Power is off!"); appSleepCtl(ASLEEP_PWR, 1); } } /*****************************关机界面提示结束**********************************/ /*****************************基站定位**********************************/ void uiShowLBS_MAP(char update){ static char zoom;//Z8 static int cnt; static char calc; static signed char lastLbsMapZoom=-1; if(update){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"基站定位",UI_STATUS_BAR_HEIGH,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //正在获取 guiShowMessageBox("正在获取"); Lbs_Sendto_bnd(); calc=0; cnt=0; sutPocStatus.GetLbsOnce=0; lastLbsMapZoom=-1; } if(++cnt<1000/APP_SUB_DIV_TIME) return; cnt=0; backLightReset(); if(sutPocStatus.GetLbsOnce){ sutPocStatus.GetLbsOnce=2; if(lastLbsMapZoom!=newPara.LbsMapZoom){ switch(newPara.LbsMapZoom){ case 0: guishow_png(0,UI_CONTENT_SHOW_Y,"z8.png"); break; case 1: guishow_png(0,UI_CONTENT_SHOW_Y,"z12.png"); break; case 2: guishow_png(0,UI_CONTENT_SHOW_Y,"z16.png"); break; } calc=0; lastLbsMapZoom=newPara.LbsMapZoom; } }else{ if(calc++<30){ //获取失败 if(calc==20)guiShowMessageBox("获取失败!"); else if(calc==22)uISetNextStatus(UIS_MENU_MAIN); // } if(calc<20)Lbs_Sendto_bnd(); } } void uiShowLBS_MAPResponse(void){ unsigned short key=getKeyValue(); if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_MAIN); else if(MKEY_VALUE_UP==key){ if(newPara.LbsMapZoom>0){ newPara.LbsMapZoom--; } }else if(MKEY_VALUE_DOWN==key){ if(newPara.LbsMapZoom<2)newPara.LbsMapZoom++; } } /*****************************关机界面提示结束**********************************/ /*****************************天气显示**********************************/ void uiShowWeatherSel(char StatusUpdate){ static const char *EnableMode[2+1]={ "打开", "关闭", "" }; char Features[2]; unsigned char i; if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"天气显示",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); for(i=0;i<2;i++){ if(i==newPara.WeatherEnable) Features[i]=1; else Features[i]=0; } ListBoxInit(&sutListBox,EnableMode,0,commonIcon2,Features,newPara.WeatherEnable); uiMenuShowBottomIndacitor("保存", "返回"); } } void uiShowWeatherSelResponse(void){ unsigned short key=ListBoxResponse(&sutListBox); if(MKEY_VALUE_ESC==key){ if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY); else uISetNextStatus(UIS_MENU_SYS_SEL); }else if(MKEY_VALUE_MENU==key){ getStackStruct()->ok_back=1; if(sutListBox.handle != newPara.WeatherEnable){ newPara.WeatherEnable=sutListBox.handle; sysIniSave(); } uISetNextStatus(UIS_MENU_SYS_SEL); } } /*****************************天气显示**********************************/