#include "includes.h" /****************************状态栏显示部分开始***********************************/ //#ifndef USE_HPOC_POC // //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<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; 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.UserInfo.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 gpsF:1; }TMP_GPS_DEF; static TMP_GPS_DEF tmpGps; unsigned short x=GPS_ICON_X,y=0; if(tmpGps.located==sutGpsInfo.isGpsValid && tmpGps.gpsF==sutGpsInfo.isGpsWork && flash==0) return; guiClearRect(x,y,x+GPS_ICON_WX,y+11,COLOR_STATUS_BAR); if(sutGpsInfo.isGpsWork==0){//GPS未打开时 guiClearRect(x,y,x+GPS_ICON_WX,y+11,COLOR_STATUS_BAR); }else{//GPS已打开 guiShowBmp(x,y,"GPSA.bmp"); if(sutGpsInfo.isGpsValid==1) guiShowBmp(x+10,y,"GPS2.bmp");//已定位 } tmpGps.located=sutGpsInfo.isGpsValid; tmpGps.gpsF=sutGpsInfo.isGpsWork; } 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; char buf[30]; //if(sutApp.bndPocDone==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; } guiShowStr(TIME_ICON_X, 1,buf, FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR); } if(++nextExe>=(1000/exeInterval)) nextExe=0; } //显示耳机接入状态 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; // static bnd_time_t tempDate={0}; // char info[30]; 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是否正常及鉴权情况 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,char type); static void uiShowCallUserName(void); static void uiShowOffLineMessage(void); static void uiShowCopsInfo(void){ char info[50]; switch(sutApp.copstype){ case 46000: case 46002: case 46007: snprintf(info, sizeof(info), "中国移动"); break; case 46001: case 46006: snprintf(info, sizeof(info), "中国联通"); break; case 46003: case 46005: case 46008: case 46009: case 46010: case 46011: 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); } #ifdef USE_LEFT_MOVING /* param[in] dlyInterval 间隔 param[in] reset 重刷 param[in] now 使能刷 param[in] voice 话权 */ void movingShowNames(unsigned int dlyInterval,unsigned char reset, unsigned char now,unsigned char voice){ const char *idleptr="空闲"; const char *voiceptr="本机在讲话"; const char *danhuptr="单呼模式"; char *gname=danhuptr; char *voicePri=idleptr; char *uname=NULL; static unsigned int interval=0xffffff; if(sutPocStatus.logined==0) return; //if(sutPocStatus.statusChaned!=0){ // sutPocStatus.statusChaned=0; // reset=1; //} if(++interval<500/dlyInterval && reset==0 && now==0) return;//0.5秒刷新一次 interval=0; if(sutPocStatus.danHuStatus==0){ if(sutPocStatus.LocalGroup.name[0]==0) gname=NULL; else gname=sutPocStatus.LocalGroup.name; } if(voice==0) voicePri=idleptr; else if(voice==1) voicePri=voiceptr; else voicePri=sutPocStatus.CallName; if(sutPocStatus.LocalUser.name[0]!=0) uname=sutPocStatus.LocalUser.name; mainScreenShowMoving(UI_GROUP_SHOW_Y, reset,gname,uname,voicePri,voice); } #endif 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; unsigned char reset=0; unsigned char moveFlash=0; static unsigned char voice=0; static MY_CLOCK tempDate; /*逻辑处理开始*/ if(tmpStatus){ guiClearAll(guiGetBackColor()); #ifdef AUTH_SKIP guiShowStr(1, UI_BOTTOM_SHOW_Y,"测试样机", FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR, guiGetBackColor()); #else //guiShowStr(1, UI_BOTTOM_SHOW_Y,"菜单", FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR, guiGetBackColor()); //now_time. #endif danhu=sutPocStatus.danHuStatus; uiShowGuaDuan(danhu); lastFlag=-1; siCt=0; //return; } if(copsStatus != sutApp.copstype || tmpStatus){ copsStatus=sutApp.copstype; uiShowCopsInfo(); } //更新单呼显示与否 if(sutPocStatus.danHuStatus != danhu){ danhu=sutPocStatus.danHuStatus; 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()); #ifdef USE_LEFT_MOVING voice=0; moveFlash=1; #else uiShowHuaQuan("空闲",0); #endif 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()); #ifdef USE_LEFT_MOVING voice=1; moveFlash=1; #else uiShowHuaQuan("本机在讲话",1); #endif } 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;//保证要刷新名字 #ifdef USE_LEFT_MOVING voice=2; moveFlash=1; #endif } #ifndef USE_LEFT_MOVING uiShowCallUserName(); #endif break; } if(Flag>0){//已登录 if(Flag != lastFlag && (lastFlag==-1 || ME_NO_LOGIN==lastFlag)) { #ifdef USE_LEFT_MOVING reset=1; #else uiShowGUName(1); #endif } #ifndef USE_LEFT_MOVING else uiShowGUName(0); #endif }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(); } #ifdef USE_LEFT_MOVING movingShowNames(APP_SUB_DIV_TIME,reset,moveFlash,voice); #endif 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){ unsigned int color=COLOR_BLACK; if(sutPocStatus.danHuStatus==0) guiShowBmp(2, UI_GROUP_SHOW_Y, "Group2.bmp"); else{ guiShowBmp(2, UI_GROUP_SHOW_Y, "Onecall.bmp"); color=COLOR_RED; } //guiShowStr(2, UI_GROUP_SHOW_Y+2,"群组:", FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); guiClearRect(2+16+2, UI_GROUP_SHOW_Y, GLCD_WIDTH-1, UI_GROUP_SHOW_Y+16, guiGetBackColor()); #ifdef USE_12X12_FONT_ONLY guiShowStr(2+16+2, UI_GROUP_SHOW_Y+2,info, FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #else guiShowStr(2+16+2, UI_GROUP_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #endif } static void uiShowUser(const char* info){ guiClearRect(1, UI_USER_SHOW_Y, GLCD_WIDTH-1, UI_USER_SHOW_Y+16, guiGetBackColor());//2+18 guiShowBmp(2, UI_USER_SHOW_Y, "people2.bmp"); //guiShowStr(2, UI_USER_SHOW_Y+2,"成员:", FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #ifdef USE_12X12_FONT_ONLY guiShowStr(2+18, UI_USER_SHOW_Y+2,info, FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #else guiShowStr(2+18, UI_USER_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #endif } static void uiShowHuaQuan(const char* info,char type){ unsigned int color=COLOR_BLACK; 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; } //guiShowStr(2, UI_VOICE_SHOW_Y+2,"话权:", FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); guiClearRect(2+18, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16, guiGetBackColor()); #ifdef USE_12X12_FONT_ONLY guiShowStr(2+18, UI_VOICE_SHOW_Y+2,info, FONT_MODE_12X12, REVERSED_NO,COLOR_BLACK,guiGetBackColor()); #else guiShowStr(2+18, UI_VOICE_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,color,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,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;//WJL y=UI_USER_SHOW_Y; 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); sutApp.MenuToStandby=1; } } /****************************主菜单显示部分结束*************************************/ /*****************************群组选择/成员选择部分开始*********************************/ static char GUListBoxInited=0; static char SelMachine=0; 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)*12; guiClearRect(78, 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 unsigned int thisShowNum; bool setHandleToZero=true; void uiShowGUSel(char StatusUpdate,unsigned int exeInterval,char type){ static unsigned int timer; char info[50]; if(StatusUpdate){ if(sutPocStatus.logined==0){ guiShowMessageBox("请先登录"); uTimerStart(&timer, 1000); SelMachine=0; }else SelMachine=1; } switch(SelMachine){ case 0://延时后退出 if(uTimerExpired(&timer)){ uISetNextStatus(UIS_STANDBY); } break; case 1://显示 guiClearAll(guiGetBackColor()); guiShowMessageBox("请稍候"); sutPocStatus.ListDetailValid=0; if(type==0){ guiShowCaption(0,"群组选择",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //0 uiMenuShowBottomIndacitor("确定", "返回"); msgAtSend("AT+POC=0D0000\r\n"); }else{ guiShowCaption(0,"用户选择",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //0 uiMenuShowBottomIndacitor("单呼", "返回"); snprintf(info, sizeof(info),"AT+POC=0E0000%08x\r\n",sutPocStatus.LocalGroup.ID); msgAtSend(info); } thisShowNum=0; SelMachine=3; uTimerStart(&timer, 5000); uiMenuShowBottomLine(); break; case 3: if(uTimerExpired(&timer)){ guiShowMessageBox("成员获取失败"); SelMachine=0; uTimerStart(&timer, 1000); } if(sutPocStatus.ListDetailValid!=0){ SelMachine=2; thisShowNum=sutPocStatus.ListCurOnlineNum; guiClearRect(0,GLCD_HEIGHT/2-20,GLCD_WIDTH-1,GLCD_HEIGHT/2+20,guiGetBackColor());//刷掉"请稍候"的残留 ReFlashItemGU(type); } break; } } void GroupSelResponse(){ unsigned int key; char buf[50]; switch(SelMachine){ case 2: key=ListBoxResponse(&sutListBox); if(MKEY_VALUE_ESC==key){ uISetNextStatus(UIS_MENU_MAIN); }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; switch(SelMachine){ case 2: key=ListBoxResponse(&sutListBox); if(MKEY_VALUE_ESC==key){ uISetNextStatus(UIS_MENU_MAIN); }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_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", "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 if(type==0){ icons[0]=accIconFileName[0]; icons[1]=accIconFileName[1]; icons[2]=accIconFileName[5]; }else{ icons[0]=accIconFileName[2]; icons[1]=accIconFileName[3]; icons[2]=accIconFileName[4]; } icons[3]=accIconFileName[5]; 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(1,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), "纬度 %c:%d.%05d",sutGpsInfo.NSFlag,sutGpsInfo.latitue/1000000,sutGpsInfo.latitue%1000000); guiShowStr(1,y, buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); y+=12+5; snprintf(buf, sizeof(buf), "经度 %c:%d.%06d",sutGpsInfo.EWFlag,sutGpsInfo.longitue/1000000,sutGpsInfo.longitue%1000000); guiShowStr(1,y, buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); } /*****************************定位设置部分结束*********************************/ /*******************************终端信息开始**********************************/ unsigned char sysInfoType; static void sysInfoFlash(void){ unsigned short x,y,ext; char buf[50]; unsigned char LineSpace=12+4; int len; char yunyingshang=0; x=2,y=UI_CONTENT_SHOW_Y+5; guiClearRect(0,y,GLCD_WIDTH-1,GLCD_HEIGHT,guiGetBackColor()); QR_OUT testma; if(sysInfoType==0){ if(LSAPI_SIM_GetIMEI(buf)==0){ //guiShowCaption(0,"IMEI二维码",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); EncodeData(buf,&testma); guiDrawQRimage(20,40,4,testma.data,testma.size); }else{ guiShowMessageBox("获取失败"); } } else if(sysInfoType==1){ memset(buf,0,sizeof(buf)); snprintf(buf, sizeof(buf),"ICCID:"); guiShowStr(0,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace; memset(buf,0,sizeof(buf)); switch(sutApp.copstype){ case 46000: case 46002: case 46007: yunyingshang=1; break; case 46001: case 46006: yunyingshang=2; break; case 46003: case 46005: case 46008: case 46009: case 46010: case 46011: yunyingshang=3; break; default: yunyingshang=0; break; } 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); guiShowStr(0,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); len=strlen(buf); if(len>16){ y+=LineSpace; guiShowStr(x,y,buf+16,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); } }else{ snprintf(buf, sizeof(buf),"未知"); guiShowStr(0,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); } y+=LineSpace; memset(buf,0,sizeof(buf)); snprintf(buf, sizeof(buf),"IMEI:"); guiShowStr(0,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); //IMEI y+=LineSpace; memset(buf,0,sizeof(buf)); if(LSAPI_SIM_GetIMEI(buf)==0){ guiShowStr(0,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); }else{ guiShowStr(0,y,"未知",FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); } }else if(sysInfoType==2){ //对讲平台 snprintf(buf, sizeof(buf),"对讲平台:%s", OHPOC_POC_PLATFORM); guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace; ext=0; memset(buf,sizeof(buf),0); snprintf(buf,sizeof(buf),"POC:%s", sutApp.pocVersion); len=strlen(buf); if(len>16){ y+=LineSpace; guiShowStr(x+32,y,buf+15,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); buf[20]=0; y-=LineSpace; ext=LineSpace; } guiShowStr(x,y,buf,FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK,guiGetBackColor()); y+=LineSpace+ext; //模块 memset(buf,sizeof(buf),0); snprintf(buf,sizeof(buf),"模块:%s", sutApp.modemVer); len=strlen(buf); if(len>16){ y+=LineSpace; guiShowStr(x+32,y,buf+15,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),"PSN:%s",sutApp.UserInfo.OtherId); guiShowStr(0,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 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+80, 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){ if(sutListBox.handle)temp=0; else temp=1; snprintf(buf, sizeof(buf), "AT+SIMCROSS=%d\r\n",temp); msgToModem(buf); MSG_INFO(1, buf); guiShowMessageBox("请重启设备"); msgToModem("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_HIGH, PMODE_INTELLECTUAL, PMODE_LOW_PWR }PWR_ENUMDEF; void pwrModeSetCmd(unsigned char pwrMode){ unsigned char seg1; char buf[30]; if(pwrMode==PMODE_HIGH){ seg1=0; }else if(pwrMode==PMODE_INTELLECTUAL){ seg1=1; }else if(pwrMode==PMODE_LOW_PWR){ seg1=2; }else return; snprintf(buf, sizeof(buf), "AT+POC=7A0000%02X\r\n",seg1); msgAtSend(buf); } void pwrModeAckHandler(unsigned char seg1, unsigned char seg2){ if(seg1==PMODE_HIGH && newPara.pwrMode != PMODE_HIGH){ newPara.pwrMode=seg1; goto SAVE_PWR_MODE; }else if(seg1==PMODE_INTELLECTUAL && newPara.pwrMode != PMODE_INTELLECTUAL){ newPara.pwrMode=seg1; goto SAVE_PWR_MODE; }else if(seg1==PMODE_LOW_PWR && newPara.pwrMode != PMODE_LOW_PWR){ newPara.pwrMode=seg1; 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("密码错误"); 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){ #if 1 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()); #if 1 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); fotaStep=10;//0 loadMsg=0; fotaMsgShow("正在检测版本"); uiMenuShowBottomLine(); uiMenuShowBottomIndacitor("确定", "返回"); uTimerStart(&fotaTick, 5000); tupParaSet(&tupsendPara, AUTH_FOTA_PORT, authFotaRecv_cb,AUTH_UDP_THREAD_STACK); if(1==netWork.netReady)tryConnectTup(domainInfo.address,TUP_UDP,&tupsendPara); } switch(fotaStep){ case 0: if(uTimerExpired(&fotaTick)){ fotaMsgShow("检测超时"); // if(1==netWork.netReady){ // infoPacketAndSend(BND_PSN,ohpocGetIMEI(),OHPOC_VERSION,OHPOC_MODLE,UDP_HEART_TICK_NON_4G,UDP_HEART_TICK__4G); // } fotaStep=4; } break; case 1://等待用户确定 break; case 2://用户确定后等待结果 if(uTimerExpired(&fotaTick)){ fotaMsgShow("超时退出"); fotaStep=4; } if(loadMsg!=0){ fotaMsgShow("正在下载"); loadMsg=0; } break; case 3://升级成功,等待重启 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; AppFotaInfo.fota_statue=DISENABLE; break; case 8://下载成功 fotaMsgShow("下载成功,重启更新"); fotaStep=3; break; case 9:// snprintf(buf, sizeof(buf), "是否更新到:%s",targetVersion); fotaMsgShow(buf); fotaStep=1; break; case 10: if(uTimerExpired(&fotaTick)){ fotaStep=0; if(1==netWork.netReady){ infoPacketAndSend(BND_PSN,ohpocGetIMEI(),OHPOC_VERSION,OHPOC_MODLE,UDP_HEART_TICK_NON_4G,UDP_HEART_TICK__4G); } uTimerStart(&fotaTick, 2000); } 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; uTimerStart(&fotaTick, 10000);//1 AppFotaInfo.fota_statue=ENABLE; } } } /*****************************版本设置结束**********************************/ /*****************************提示音设置开始********************************/ 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(); } } /*****************************提示音设置结束********************************/ /*****************************MIC增益**********************************/ unsigned char MictempIndex; static void MICcugainFlash(char type){ char buf[50]; unsigned short x=4,y=56,value; if(sutUIstatus.Status==UIS_MENU_SYS_MICCU)value=7; else if(sutUIstatus.Status==UIS_MENU_SYS_MICXI)value=16; if(type==0) guiShowStr(x+25, y, "设置:", FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); else if(type==1){ if(++MictempIndex>value) MictempIndex=0; }else if(type==2){ if(MictempIndex>0) MictempIndex--; else MictempIndex=value; } snprintf(buf, sizeof(buf), "%02d", MictempIndex); guiShowStr(x+80, y, buf, FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); } void uiShowMiccugainUISel(char StatusUpdate){ if(StatusUpdate){ guiClearAll(guiGetBackColor()); if(sutUIstatus.Status==UIS_MENU_SYS_MICCU){ guiShowCaption(0,"MIC增益粗调",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); MictempIndex =newPara.VolMicLvCu; } else{ guiShowCaption(0,"MIC增益微调",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); MictempIndex=newPara.VolMicLvXi; } uiMenuShowBottomLine(); //MictempIndex=newPara.MicCulv; MICcugainFlash(0); uiMenuShowBottomIndacitor("保存", "返回"); } } void uiShowMicCuSelResponse(void){ char buf[30]; unsigned short key=getKeyValue(); if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL); else if(MKEY_VALUE_DOWN==key)MICcugainFlash(1); else if(MKEY_VALUE_UP==key) MICcugainFlash(2); else if(MKEY_VALUE_MENU==key){ getStackStruct()->ok_back=1; if(sutUIstatus.Status==UIS_MENU_SYS_MICCU){ if(MictempIndex != newPara.VolMicLvCu){ newPara.VolMicLvCu=MictempIndex; snprintf(buf, sizeof(buf),"AT+CACCP=0,0,0,\"%02x00%02x00\"\r\n",newPara.VolMicLvCu,newPara.VolMicLvXi); msgAtSend(buf); MSG_INFO(0,buf); sysIniSave(); } }else if(sutUIstatus.Status==UIS_MENU_SYS_MICXI){ if(MictempIndex != newPara.VolMicLvXi){ newPara.VolMicLvXi=MictempIndex; snprintf(buf, sizeof(buf),"AT+CACCP=0,0,0,\"%02x00%02x00\"\r\n",newPara.VolMicLvCu,newPara.VolMicLvXi); msgAtSend(buf); MSG_INFO(0,buf); sysIniSave(); } } uISetNextStatus(UIS_MENU_SYS_SEL); } } /*****************************BND 新旧平台选择**********************************/ void uiShowPingTaiSel(char StatusUpdate){ static const char *PTMode[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,PTMode,0,commonIcon2,Features,newPara.newold_plam); uiMenuShowBottomIndacitor("保存", "返回"); } } void uiShowPingTaiSelResponse(void){ } /*****************************BND 新旧平台选择结束**********************************/ /*****************************音质设置开始**********************************/ unsigned char voiceSetTmp; static void switchVolceFlash(void){ char info[30]; unsigned short x,y,len; if(voiceSetTmp==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 uiShowVoiceSel(char StatusUpdate){ if(StatusUpdate){ guiClearAll(guiGetBackColor()); guiShowCaption(0,"音质设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); uiMenuShowBottomLine(); voiceSetTmp=newPara.voiceSel; switchVolceFlash(); uiMenuShowBottomIndacitor("保存", "返回"); } } void uiShowVoiceSelResponse(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.voiceSel != voiceSetTmp){ newPara.voiceSel=voiceSetTmp; voiceModeSet(newPara.voiceSel); sysIniSave(); } uISetNextStatus(UIS_MENU_SYS_SEL); }else if(MKEY_VALUE_DOWN || MKEY_VALUE_UP){ if(voiceSetTmp==0) voiceSetTmp=1; else voiceSetTmp=0; switchVolceFlash(); } } /*****************************音质设置结束**********************************/ #ifdef USE_LEFT_MOVING /***************************主界面滚动显示**********************************/ #define MOVING_ITME_NUM 3 //显示三条项目 #define MAX_ROW_BYTE (20+1+2) //最多显示20个字节,10个中文 #define MAX_SHOW_BYTE 12 //最多一次性显示10个字节 void leftMoveStr(char *name, unsigned short len){ char temp[3]; unsigned char move=1; unsigned short i; if(name[0] > 0x80) move=2; for(i=0;i0x80){ if(i+2>cpsize){//装不下了,停止 break; } des[i]=src[i]; des[i+1]=src[i+1]; i++; }else des[i]=src[i]; } des[i]=0; } void showbufdata(char type, unsigned char *data, int len){ char info[100],buf[3]; int i; sprintf(info, "D[%d]%c:",len,type); for(i=0;iMAX_SHOW_BYTE) needMove=1; else needMove=0; if(memcmp(ptempMd5, tempMd5, 16)|| reset){//内容发生了变化 guiClearRect(0, showY, GLCD_WIDTH-1, showY+16,guiGetBackColor()); //guiShowStr(showX, showY+2, &indicators[i][0], FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); guiShowBmp(2,showY+2 , Picon[i]); // 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; // } // if(sutPocStatus.danHuStatus==0) guiShowBmp(2, UI_GROUP_SHOW_Y, "Group2.bmp"); // else{ // guiShowBmp(2, UI_GROUP_SHOW_Y, "Onecall.bmp"); // color=COLOR_RED; } showX += 20; if(needMove==0){ //if(*sum!=tsum|| reset){//内容发生了变化 if(memcmp(ptempMd5, tempMd5, 16)|| reset){//内容发生了变化 //只显示一次即可 snprintf(showPtr, MAX_ROW_BYTE, "%s", ptr); guiClearRect(showX, showY, GLCD_WIDTH-1, showY+16,guiGetBackColor()); if(i==2){ if(voicetype==0)guiShowStr(showX,showY, showMax, FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); else if(voicetype==1)guiShowStr(showX,showY, showMax, FONT_MODE_16X16, REVERSED_NO, COLOR_RED, guiGetBackColor()); else if(voicetype==2)guiShowStr(showX,showY, showMax, FONT_MODE_16X16, REVERSED_NO, COLOR_BLUE, guiGetBackColor()); }else guiShowStr(showX,showY, showMax, FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); } }else{//做移动处理 //if(*sum!=tsum) memcpy(showPtr, ptr, MAX_ROW_BYTE); if(memcmp(ptempMd5, tempMd5, 16)) memcpy(showPtr, ptr, MAX_ROW_BYTE); else leftMoveStr(showPtr, strlen(showPtr)); getRealShow(showMax, showPtr,MAX_SHOW_BYTE); guiClearRect(showX, showY, GLCD_WIDTH-1, showY+16,guiGetBackColor()); if(i==2){ if(voicetype==0)guiShowStr(showX,showY, showMax, FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); else if(voicetype==1)guiShowStr(showX,showY, showMax, FONT_MODE_16X16, REVERSED_NO, COLOR_RED, guiGetBackColor()); else if(voicetype==2)guiShowStr(showX,showY, showMax, FONT_MODE_16X16, REVERSED_NO, COLOR_BLUE, guiGetBackColor()); }else guiShowStr(showX,showY, showMax, FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); } memcpy( ptempMd5,tempMd5, 16); } } #endif