12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709 |
- #include "includes.h"
- /****************************状态栏显示部分开始***********************************/
- 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<WARN_PWR_LEVEL){//请充电
- if(++cnt<(800/exeInterval)) return;
- cnt=0;
- if(flag==0){
- guiShowBmp(x,y,"VBAT1.bmp");
- flag=1;
- }else{
- flag=0;
- guiClearRect(x,y-2,x+21,y-2+1+11,COLOR_STATUS_BAR);
- }
- }else if(bat<355){//340<x<=355 1格
- guiShowBmp(x,y,"VBAT1.bmp");//3
- guiDrawVLine(h,h+5,x+16,y+1,guiGetBackColor());
- }
- else if(bat<375){//355<x<=375 2格
- guiShowBmp(x,y,"VBAT1.bmp");
- guiDrawVLine(h,h+5,x+12,y+1,guiGetBackColor());
- guiDrawVLine(h,h+5,x+16,y+1,guiGetBackColor());//5.12
- }
- else if(bat<400){//375<x<=400 3格
- guiShowBmp(x,y,"VBAT1.bmp");
- 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
- }
- else{//>=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);
- #ifdef DEVELOP_MODE
- guiShowStr(1, UI_BOTTOM_SHOW_Y,"研发版本", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR);
- #else
- 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;
- 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){
- guiClearRect(2, UI_LEARN_SHOW_Y, GLCD_WIDTH-1, UI_LEARN_SHOW_Y+16, guiGetBackColor());
- guiShowBmp(2, UI_LEARN_SHOW_Y, "Group2.bmp");
- 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();
- guiClearRect(2, UI_GROUP_SHOW_Y, GLCD_WIDTH-1, UI_GROUP_SHOW_Y+16, guiGetBackColor());
- 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+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){
- guiClearRect(2, UI_USER_SHOW_Y, GLCD_WIDTH-1, UI_USER_SHOW_Y+16, guiGetBackColor());
- guiShowBmp(2, UI_USER_SHOW_Y, "people2.bmp");
- 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();
- guiClearRect(2, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16, guiGetBackColor());
- 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+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);
- }
- }
- /****************************主菜单显示部分结束*************************************/
- /*****************************群组选择/成员选择部分开始*********************************/
- bool uiSwitchLock=false;
- bool isUiSwitchReady(void){return uiSwitchLock;}
- 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{
- uiSwitchLock=true;
- 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);
- uiSwitchLock=false;
- }
- break;
- }
- if(machine != 3) return;
-
- UserAssistAdd();
- }
- void GUBackToStandby(void){
- if(isUiSwitchReady()==false) return;
- uISetNextStatus(UIS_STANDBY);
- }
- 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<sutPocStatus.ListFillIndex;i++){
- GUFeatures[i]=1;
- if(type==0){
- if(sutPocStatus.AllGroups[i].ID==sutPocStatus.LocalGroup.ID) GUFeatures[i]=0;
- GUName[i]=sutPocStatus.AllGroups[i].name;
- }else{
- if(sutPocStatus.AllUsers[i].ID==sutPocStatus.LocalUser.ID) GUFeatures[i]=0;
- GUName[i]=sutPocStatus.AllUsers[i].name;
- }
- }
-
- if(sutPocStatus.ListCurOnlineNum==0 || sutPocStatus.ListDetailValid==0){//没有成员总数或没有获取到明细
- GUName[0]="空";
- GUFeatures[i]=0;
- }
-
- //初始化ListBox控件
- ListBoxInit(&sutListBox,GUName,0,icons,GUFeatures);
- GUListBoxInited=1;
- }
- /*****************************群组选择/成员选择部分结束*********************************/
- /*****************************系统设置部分开始*********************************/
- void uiShowMenuSysSetup(char flash){
- static const char *apcPtr[]={
- "1,LCD设置",
- "2,本机密码",
- "3,功耗模式设置",
- "4,服务器设置",
- "5,版本升级",
- "6,提示音设置",
- "7,终端信息",
- "8,SD卡检测",
- "9,天线调试",
- "10,功放模式",
- #ifdef MENU_TEST
- "10,测试",
- #endif
- ""
- };
- if(flash){
- msgAtSend("AT+RSIM\r\n");//进此菜单前查询一下卡用于后面显示
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"系统设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- uiMenuShowBottomLine();
- uiMenuShowBottomIndacitor("确认", "返回");
- uiMenuInit(&sutMenuSysSetup,apcPtr,FONT_MODE_12X12,true);
- }
- }
- void sysTemSetResponse(void){
- unsigned short key;
-
- key=uiMenuResponse(&sutMenuSysSetup);
- if(MKEY_VALUE_MENU==key){
- switch(sutMenuSysSetup.handle){
- case 0://LCD设置
- uISetNextStatus(UIS_MENU_SYS_LCD);
- break;
- case 1://本机密码
- uISetNextStatus(UIS_MENU_SYS_PASS);
- break;
- case 2://功耗模式设置
- uISetNextStatus(UIS_MENU_SYS_PWR);
- break;
- case 3://服务器设置
- uISetNextStatus(UIS_MENU_SYS_SERVERPASS);
- break;
- case 4://版本升级
- uISetNextStatus(UIS_MENU_SYS_VERSION);
- break;
- case 5://提示音设置
- uISetNextStatus(UIS_MENU_SYS_NOTE);
- break;
- case 6://终端信息
- uISetNextStatus(UIS_MENU_SYS_INFO);
- break;
- case 7://SD卡检测
- uISetNextStatus(UIS_MENU_SYS_SD);
- break;
- case 8://天线调试
- uISetNextStatus(UIS_MENU_SYS_ANT);
- break;
- case 9://功放模式
- uISetNextStatus(UIS_MENU_SYS_PA);
- break;
- #ifdef MENU_TEST
- case 9://测试
- uISetNextStatus(UIS_MENU_SYS_TEST);
- break;
- }
- if(sutMenuSysSetup.handle<=9)
- #else
- }
- if(sutMenuSysSetup.handle<=9)
- #endif
- uiPushStack(sutMenuSysSetup.handle);
- }else if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_MAIN);
- }
- /*****************************系统设置部分结束*********************************/
- /*****************************定位设置部分开始*********************************/
- unsigned char tempGpsIndex;
- static locationTimeFlash(char type);
- static locationXYFlash(char flash);
- void uiShowMenuLocationSel(char flash){
- #ifdef MAKE_IT_COMMON_VERSION
- if(flash){
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"定位设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- uiMenuShowBottomLine();
- if(newPara.gpsEnable==0){
- uiMenuShowBottomIndacitor(NULL, "返回");
- guiShowMessageBox("版本不支持");
- nwy_sleep(1000);
- uISetNextStatus(UIS_MENU_MAIN);
- return;
- }
- uiMenuShowBottomIndacitor("保存", "返回");
- locationTimeFlash(0);
- }
- if(newPara.gpsEnable!=0) locationXYFlash(flash);
- #else
- static const char *apcPtr[]={
- "1,课程表",
- "2,通知简报",
- ""
- };
- if(flash){
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"消息通知",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- uiMenuShowBottomLine();
- uiMenuShowBottomIndacitor("确认", "返回");
- uiMenuInit(&sutMenuSysSetup,apcPtr,FONT_MODE_12X12,true);
- }
- #endif
- }
- void loationSetResponse(void){
- #ifdef MAKE_IT_COMMON_VERSION
- unsigned short key;
-
- key=getKeyValue();
- if(MKEY_VALUE_UP==key) locationTimeFlash(1);
- else if(MKEY_VALUE_DOWN==key) locationTimeFlash(2);
- else if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_MAIN);
- else if(MKEY_VALUE_MENU==key){
- if(tempGpsIndex != newPara.gpsTimeIndex){
- MSG_INFO(1, "GPS timeIndex update:%d",getGPSTimeValue(tempGpsIndex));
- newPara.gpsTimeIndex=tempGpsIndex;
- sysIniSave();
- gpsCheckInfo();//检测一下
- }
- uISetNextStatus(UIS_MENU_MAIN);
- }
- #else
- unsigned short key;
-
- key=uiMenuResponse(&sutMenuSysSetup);
- if(MKEY_VALUE_MENU==key){
- switch(sutMenuSysSetup.handle){
- case 0://课程表
- uISetNextStatus(UIS_MENU_LOCATION_CLASS);
- break;
- case 1://消息通知
- uISetNextStatus(UIS_MENU_LOCATION_NOTICE);
- break;
- }
- if(sutMenuSysSetup.handle<=1) uiPushStack(sutMenuSysSetup.handle);
- }else if(MKEY_VALUE_ESC==key){
- sdUnmount();
- uISetNextStatus(UIS_MENU_MAIN);
- }
- #endif
- }
- static locationTimeFlash(char type){
- unsigned short gpsTimeValue;
- char buf[50];
- unsigned short y=70;
- if(type==0){
- tempGpsIndex=newPara.gpsTimeIndex;
- }else if(type==1){
- if(++tempGpsIndex>=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 uiShowANT(char update){
- if(update){
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"天线调试",UI_STATUS_BAR_HEIGH,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- guiShowMessageBox("确定进入?");
- uiMenuShowBottomLine();
- uiMenuShowBottomIndacitor("确定", "返回");
- }
- }
- void uiShowANTResponse(void){
- unsigned short key=getKeyValue();
- if(MKEY_VALUE_ESC==key) uISetNextStatus(sutUIstatus.LastStatus);
- else if(MKEY_VALUE_MENU==key){
- sutApp.antMode=1;
- guiShowMessageBox("天线模式");
- }
- }
- /*****************************天线调试****************************************/
- /*******************************留音记录开始**********************************/
- 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;i<sutApp.voiceInfo.voiceValidNum;i++) showInfo[i]=sutApp.voiceInfo.info[i].info;
- else i=1;
- showInfo[i]=NullPtr;
- guiFillRect(0,UI_CONTENT_SHOW_Y,GLCD_WIDTH-1,UI_BOTTOM_SHOW_Y-1,guiGetBackColor());
- uiMenuInit(&sutMenuSysSetup,showInfo,FONT_MODE_12X12,false);
- sutApp.voiceInfo.voiceStatus=3;
- break;
- }
- }
- void uiShowVoiceInfoResponse(void){
- char cmd[30];
- unsigned short key;
-
- if(sutApp.voiceInfo.voiceStatus!=3) return;
- key=uiMenuResponse(&sutMenuSysSetup);
- if(MKEY_VALUE_ESC==key) uISetNextStatus(sutUIstatus.LastStatus);
- else if(MKEY_VALUE_MENU==key){
- if(sutApp.voiceInfo.voiceValidNum!=0){
- snprintf(cmd, sizeof(cmd), "AT+VPLAY=%c\r\n", sutApp.voiceInfo.info[sutMenuSysSetup.handle].index);
- msgAtSend(cmd);
- }
- }
- }
- /*****************************留音记录结束**********************************/
- /*****************************SD卡检测***************************************/
- void uiShowSD(char update){
- static unsigned int timer;
- if(update){
- sysInfoType=0;
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"SD卡检测",UI_STATUS_BAR_HEIGH,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- guiShowMessageBox("正在检测");
- uiMenuShowBottomLine();
- if(true==sdCardTest()) guiShowMessageBox("SD卡正常");
- else guiShowMessageBox("SD卡异常");
- uTimerStart(&timer, 2000);
- }
- if(uTimerExpired(&timer)){
- getStackStruct()->ok_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);i++){
- if(netModeValue==netModeSetTable[i]) return i;
- }
- return 0xff;//无对应值
- }
- /*输入制式索引值,返回制式源始值*/
- unsigned char getNetModeValue(unsigned char netModeIndex){
- if(netModeIndex>=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;i<NET_MODE_NUM;i++){
- if(i==newPara.netMode) Features[i]=1;
- else Features[i]=0;
- }
- ListBoxInit(&sutListBox,netMode,0,commonIcon2,Features);
- uiMenuShowBottomIndacitor("保存", "返回");
- }
- }
- void uiShowNetSelResponse(void){
- unsigned short key=ListBoxResponse(&sutListBox);
- if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
- else if(MKEY_VALUE_MENU==key){
- getStackStruct()->ok_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;i<SIM_MODE_NUM;i++){
- if(i==sutApp.simSel) Features[i]=1;
- else Features[i]=0;
- }
- ListBoxInit(&sutListBox,simMode,0,commonIcon2,Features);
- uiMenuShowBottomIndacitor("保存", "返回");
- }
- }
- void uiShowSimSelResponse(void){
- char buf[30];
- unsigned short key=ListBoxResponse(&sutListBox);
- if(MKEY_VALUE_ESC==key) 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+SSIM=%d\r\n",sutListBox.handle+1);
- msgAtSend(buf);
- guiShowMessageBox("请重启设备");
- shutSysNow();
- }
- 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;i<PWR_MODE_NUM;i++){
- if(i==newPara.pwrMode) Features[i]=1;
- else Features[i]=0;
- }
- ListBoxInit(&sutListBox,pwrMode,0,commonIcon2,Features);
- uiMenuShowBottomIndacitor("保存", "返回");
- }
- }
- void uiShowPwrSelResponse(void){
- unsigned short key=ListBoxResponse(&sutListBox);
- if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
- else if(MKEY_VALUE_MENU==key){
- getStackStruct()->ok_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 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 fotaMsgShow2(char *msg1, char *msg2){
- guiClearRect(0, 45, GLCD_WIDTH-1, 45+16+2+16,guiGetBackColor());
- int len=guiGetStrXLen((char *)msg1,FONT_MODE_16X16);
- guiShowStr((GLCD_WIDTH-len)/2,45, msg1,FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
- len=guiGetStrXLen((char *)msg2,FONT_MODE_16X16);
- guiShowStr((GLCD_WIDTH-len)/2,45+16+2, msg2,FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
- }
- 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;
- sutApp.fotaStatus=0;
- fotaMsgShow("正在检测版本");
- uiMenuShowBottomLine();
- uiMenuShowBottomIndacitor("确定", "返回");
- uTimerStart(&fotaTick, 500);
- }
- switch(fotaStep){
- case 0:
- if(sutApp.fotaStatus==1){
- fotaMsgShow("无更新版本");
- fotaStep=4;
- break;
- }else if(sutApp.fotaStatus==2){
- snprintf(buf, sizeof(buf), "是否更新到:%s",sutApp.fotaVersion);
- fotaMsgShow(buf);
- fotaStep=1;
- break;
- }
- if(uTimerExpired(&fotaTick)){
- fotaMsgShow("检测超时");
- fotaStep=4;
- }
- break;
- case 1://等待用户确定
- break;
- case 2://用户确定后等待结果
- if(sutApp.fotaStatus==3){
- fotaMsgShow("升级失败");
- fotaStep=4;
- break;
- }else if(sutApp.fotaStatus==4){
- sutApp.fotaStatus=0;//否则会一直刷新本消息
- fotaMsgShow("正在下载");
- break;
- }else if(sutApp.fotaStatus==5){
- fotaMsgShow("下载成功");
- fotaStep=3;
- break;
- }
- if(uTimerExpired(&fotaTick)){
- fotaMsgShow("超时退出");
- fotaStep=4;
- }
- break;
- case 3://下载成功
- nwy_sleep(1000);
- fotaStep=6;
- fotaMsgShow2("确定将关机,需长按开","机键直至开机(约60秒)");
- break;
- case 4://延时显示2秒后退出
- uTimerStart(&fotaTick, 2000);
- fotaStep=5;
- break;
- case 5://退出升级流程
- if(uTimerExpired(&fotaTick)) uISetNextStatus(UIS_MENU_SYS_SEL);
- break;
- case 6:
- break;
- }
- }
- void uiShowVersionSelResponse(void){
- unsigned char key=getKeyValue();
- if(fotaStep!=1 && fotaStep!=6) return;
- 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);
- }else if(fotaStep==6){
- paControl(false);//防止一直滴音
- if(nwy_version_update(true)<0){
- MSG_ERR(1, "nwy_version_update failed");
- guiShowMessageBox("文件不正确");
- fotaStep=5;
- nwy_sleep(1000);
- }
- MSG_INFO(1, "Reset system!!!");
- shutSysNow();
- }
- }
- }
- /*****************************版本设置结束**********************************/
- /*****************************提示音设置开始********************************/
- 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();
- }
- }
- /*****************************提示音设置结束********************************/
- /*****************************功放模式开始********************************/
- static void paFlash(void){
- char info[30];
- unsigned short x,y,len;
-
- if(noteSetTmp==2) snprintf(info, sizeof(info), "FM模式");
- 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;
- guiClearRect(0, y, GLCD_WIDTH-1, y+12, guiGetBackColor());
- guiShowStr(x,y,info, FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
- }
- void uiShowPA(char StatusUpdate){
- if(StatusUpdate){
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"功放模式设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- uiMenuShowBottomLine();
- noteSetTmp=newPara.paCnt;
- paFlash();
- uiMenuShowBottomIndacitor("保存", "返回");
- }
- }
- void uiShowPAResponse(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.paCnt != noteSetTmp){
- newPara.paCnt=noteSetTmp;
- if(newPara.paCnt==2) MSG_INFO(1,"FM Mode:%d", newPara.paCnt);
- else MSG_INFO(1,"MIAN TI MODE:%d", newPara.paCnt);
- sysIniSave();
- }
- uISetNextStatus(UIS_MENU_SYS_SEL);
- }else if(MKEY_VALUE_DOWN || MKEY_VALUE_UP){
- if(noteSetTmp==2) noteSetTmp=4;
- else noteSetTmp=2;
- paFlash();
- }
- }
- /*****************************功放模式结束********************************/
- void uiShowPassword(char StatusUpdate){
- int len,x,y=GLCD_HEIGHT/2;
- char info[60];
- if(StatusUpdate){
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"本机密码",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- uiMenuShowBottomLine();
- snprintf(info, sizeof(info), "%s",sutApp.account.password);
- len=guiGetStrXLen(info,FONT_MODE_12X12);
- x=(GLCD_WIDTH-len)/2;
- guiShowStr(x,y-8,info,FONT_MODE_12X12,REVERSED_NO,COLOR_BLACK,guiGetBackColor());
- uiMenuShowBottomIndacitor(NULL, "返回");
- }
- }
- void uiShowPasswordResponse(void){
- unsigned short key=getKeyValue();
- if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
- }
- #ifdef MENU_TEST
- ///////////////////////////////////测试
- #define INFO1 "2021/05/17 16:16"
- #define INFO2 "*我们都是中华人民共和国的子民。全球最大的中文搜索引擎、致力于让网民更便捷地获取信息,找到所求。百度超过千亿的中文网页数据库,可以瞬间找到相关的搜索结果,测试一二三四五六七八九十ABCDEFGHIJKLMNOPQRSTUVWXYZtest测试1234567890 abcdefghijklmnopqrstuvwxyz!"
- #define INFO3 "end"
- #include "newMessage.h"
- int tflag=0;
- void uiTest(char StatusUpdate){
- char ret;
- if(StatusUpdate){
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"测试",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- uiMenuShowBottomLine();
- uiMenuShowBottomIndacitor(NULL, "返回");
- switch(tflag){
- case 0:ret=newMessageInit(FONT_MODE_12X12, NULL, NULL, INFO3);break;
- case 1:ret=newMessageInit(FONT_MODE_12X12, NULL, INFO2, NULL);break;
- case 2:ret=newMessageInit(FONT_MODE_12X12, NULL, INFO2, INFO3);break;
- case 3:ret=newMessageInit(FONT_MODE_12X12, INFO1, NULL, NULL);break;
- case 4:ret=newMessageInit(FONT_MODE_12X12, INFO1, NULL, INFO3);break;
- case 5:ret=newMessageInit(FONT_MODE_12X12, INFO1, INFO2, NULL);break;
- case 6:ret=newMessageInit(FONT_MODE_12X12, INFO1, INFO2, INFO3);break;
- }
- if(0!=ret){
- guiShowMessageBox("异常");
- uISetNextStatus(UIS_MENU_SYS_SEL);
- }else{
- if(++tflag>6) tflag=0;
- }
- }
- }
- void uiTestResponse(void){
- unsigned short key=getKeyValue();
- if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
- else if(MKEY_VALUE_DOWN==key) newMessageShow(SHOW_DOWN);
- else if(MKEY_VALUE_UP==key) newMessageShow(SHOW_UP);
- }
- #endif
|