123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533 |
- #include "includes.h"
- /****************************状态栏显示部分开始***********************************/
- #define MIN_PWR_LEVEL 315 //低于此电压后不工作
- #define WARN_PWR_LEVEL 325 //提示请充电电压
- static const char *NullPtr="";
- //显示信号强度
- static void ShowSingle(int CSQ){
- unsigned short x=SIGNAL_ICON_X;
- unsigned short y=2;
- if(sutApp.pocPpp == 0) guiShowBmp(x,y,"Single.bmp");
- else guiShowBmp(x,y,"SingleOK.bmp");
- //11 3格
- x += 7;
- if(CSQ<1 || CSQ==99){
- guiClearRect(x,y+1,x+10,y+9,COLOR_STATUS_BAR);
- }else if(CSQ<8){
- guiDrawVLine(x+2,y+8,x,y,guiGetBackColor());
- guiClearRect(x+2,y+1,x+10,y+9,COLOR_STATUS_BAR);
- }else if(CSQ<16){
- guiDrawVLine(x+2,y+8,x,y,guiGetBackColor());
- guiDrawVLine(x,y+8,x+3,y,guiGetBackColor());
- guiClearRect(x+6,y+1,x+10,y+9,COLOR_STATUS_BAR);
- }else if(CSQ<22){
- guiDrawVLine(x+2,y+8,x,y,guiGetBackColor());
- guiDrawVLine(x,y+8,x+3,y,guiGetBackColor());
- guiDrawVLine(x-2,y+8,x+6,y,guiGetBackColor());
- guiClearRect(x+9,y+1,x+10,y+9,COLOR_STATUS_BAR);
- }else{
- guiDrawVLine(x+2,y+8,x,y,guiGetBackColor());
- guiDrawVLine(x,y+8,x+3,y,guiGetBackColor());
- guiDrawVLine(x-2,y+8,x+6,y,guiGetBackColor());
- guiDrawVLine(x-4,y+8,x+9,y,guiGetBackColor());
- }
- #if 0
- if(CSQ<1 || CSQ==99){
- guiClearRect(7,3,21,11,COLOR_STATUS_BAR);
- }else if(CSQ<8){
- guiDrawVLine(9,10,7,2,guiGetBackColor());
- guiClearRect(9,3,21,11,COLOR_STATUS_BAR);
- }else if(CSQ<16){
- guiDrawVLine(9,10,7,2,guiGetBackColor());
- guiDrawVLine(7,10,10,2,guiGetBackColor());
- guiClearRect(13,3,21,11,COLOR_STATUS_BAR);
- }else if(CSQ<22){
- guiDrawVLine(9,10,7,2,guiGetBackColor());
- guiDrawVLine(7,10,10,2,guiGetBackColor());
- guiDrawVLine(5,10,13,2,guiGetBackColor());
- guiClearRect(16,3,21,11,COLOR_STATUS_BAR);
- }else{
- guiDrawVLine(9,10,7,2,guiGetBackColor());
- guiDrawVLine(7,10,10,2,guiGetBackColor());
- guiDrawVLine(5,10,13,2,guiGetBackColor());
- guiDrawVLine(3,10,16,2,guiGetBackColor());
- }
- #endif
- }
- unsigned char netshowvalue=0xff;
- //显示网络制式
- static void Show_Net(unsigned char s_netshowvalue){
- unsigned short y=0;
- if(s_netshowvalue==0){
- guiShowStr(NET_ICON_X, y+1,"2G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR);
- }else if(s_netshowvalue==4){
- guiShowStr(NET_ICON_X, y+1,"4G", FONT_MODE_12X12, REVERSED_NO,guiGetBackColor(),COLOR_STATUS_BAR);
- }else guiClearRect(NET_ICON_X,y,NET_ICON_X+NET_ICON_WX,y+11,COLOR_STATUS_BAR);
- }
- static void gpsIconShow(char flash){
- typedef struct{
- unsigned char located:1;
- unsigned char auth:1;
- unsigned char gpsF:1;
- }TMP_GPS_DEF;
- static TMP_GPS_DEF tmpGps;
- unsigned short x=GPS_ICON_X,y=0;
-
- if(tmpGps.located==gpsInfo.gpsLocated && tmpGps.auth==gpsInfo.bbAuth && tmpGps.gpsF==gpsInfo.gpsF && flash==0) return;
- guiClearRect(x,y,x+GPS_ICON_WX,y+11,COLOR_STATUS_BAR);
- if(gpsInfo.gpsF==0){//GPS未打开时
- if(gpsInfo.bbAuth==1) guiShowBmp(x,y,"GPS3.bmp");//已鉴权
- }else{//GPS已打开
- if(gpsInfo.bbAuth==1) guiShowBmp(x,y,"GPS1.bmp");//已鉴权
- else if(gpsInfo.bbAuth==1) guiShowBmp(x,y,"GPSA.bmp");//未鉴权
- if(gpsInfo.gpsLocated==1) guiShowBmp(x+10,y,"GPS2.bmp");//已定位
- }
- tmpGps.located=gpsInfo.gpsLocated;
- tmpGps.auth=gpsInfo.bbAuth;
- tmpGps.gpsF=gpsInfo.gpsF;
- }
- //显示电量
- static void ShowBatttery(int bat,unsigned int exeInterval){
- static unsigned int flashCnt=0;
- static unsigned char flag=0;
- static unsigned short cnt=0;
- unsigned short x=BAT_ICON_X,y=2,h=y+2;
- if(bat<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);
- guiShowStr(1, UI_BOTTOM_SHOW_Y,"菜单", FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR, guiGetBackColor());
- danhu=sutPocStatus.danHuStatus;
- uiShowGuaDuan(danhu);
- lastFlag=-1;
- siCt=0;
- return;
- }
-
- //更新单呼显示与否
- if(sutPocStatus.danHuStatus != danhu){
- danhu=sutPocStatus.danHuStatus;
- uiShowGuaDuan(danhu);
- }
-
- //提示解锁
- if(sutApp.lockShow!=0){
- guiShowMessageBox("请先解锁!");
- nwy_sleep(500);
- guiClearRect(0,GLCD_HEIGHT/2-20,GLCD_WIDTH-1,GLCD_HEIGHT/2+20,guiGetBackColor());
- lastFlag=-1;//让以下刷新一下
- sutApp.lockShow=0;
- }
- //以下持续调用,以便动态更新信息
- if(0==sutPocStatus.logined) Flag=ME_NO_LOGIN;//未登录
- else if(0==sutPocStatus.spk && 0==sutPocStatus.mic){//已登录,无人说话
- Flag=ME_NOBODY_SPEAK;
- }else if(0!=sutPocStatus.mic) Flag=ME_IAM_SPEAK;//已登录,本机说话
- else if(0!=sutPocStatus.spk) Flag=ME_SOMEBODY_SPEAK;//有人说话
- switch(Flag){
- case ME_NO_LOGIN://未登录
- if(Flag != lastFlag){
- guiFillRect(0, UI_CONTENT_SHOW_Y, GLCD_WIDTH-1, UI_BOTTOM_SHOW_Y-1,guiGetBackColor());
- guiShowBmp(0,UI_CONTENT_SHOW_Y, "logo.bmp");
- }
- break;
- case ME_NOBODY_SPEAK://已登录,无人说话
- if(Flag != lastFlag){
- if(ME_NO_LOGIN==lastFlag) guiFillRect(0, UI_CONTENT_SHOW_Y, GLCD_WIDTH-1, UI_CONTENT_SHOW_Y+16,guiGetBackColor());//从未登录到登录,'正在登录'那行也刷掉
- guiFillRect(0, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16,guiGetBackColor());
- uiShowHuaQuan("空闲",0);
- sutPocStatus.statusChaned = 1;
- }
- break;
- case ME_IAM_SPEAK://已登录,本机说话
- if(Flag != lastFlag){
- guiFillRect(0, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16,guiGetBackColor());
- uiShowHuaQuan("本机在讲话",1);
- }
- break;
- case ME_SOMEBODY_SPEAK://已登录,有人说话
- if(Flag != lastFlag){
- guiFillRect(0, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16,guiGetBackColor());
- sutPocStatus.statusChaned=1;//保证要刷新名字
- }
- uiShowCallUserName();
- break;
- }
- if(Flag>0){//已登录
- if(Flag != lastFlag && (lastFlag==-1 || ME_NO_LOGIN==lastFlag)){
- uiShowGUName(1);
- uiShowLearnGroup(1);
- }else{
- uiShowGUName(0);
- uiShowLearnGroup(0);
- }
- }else{//未登录
- snprintf(info, sizeof(info),"请等待网络连接.");
- switch(siCt){//not finished yet
- case 0:
- strcat(info, " ");
- guiShowStr(1, UI_CONTENT_SHOW_Y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
- break;
- case (1000/APP_SUB_DIV_TIME):
- strcat(info, ". ");
- guiShowStr(1, UI_CONTENT_SHOW_Y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
- break;
- case (2000/APP_SUB_DIV_TIME):
- strcat(info, "..");
- guiShowStr(1, UI_CONTENT_SHOW_Y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
- break;
- }
- //显示登录状态
- uiShowOffLineMessage();
- }
- if(++siCt>=(3000/APP_SUB_DIV_TIME)) siCt=0;
- if(Flag != lastFlag) lastFlag=Flag;
- }
- static void uiShowGUName(int update){
- static char scNameUser[POC_GROUP_USER_NAME_LEN];
- static char scNameGroup[POC_GROUP_USER_NAME_LEN];
- char name[POC_GROUP_USER_NAME_LEN];
- unsigned short len;
- unsigned char danHuanBuffer[9]={0xB5,0xA5,0xBA,0xF4,0xC4,0xA3,0xCA,0xBD,0};
- char GroupShowUpdate=0;
- char UserShowUpdate=0;
- if(sutPocStatus.danHuStatus==0){
- if(0!=strcmp(sutPocStatus.LocalGroup.name,scNameGroup) || update!=0){
- memset(scNameGroup,0,sizeof(scNameGroup));
- memcpy(scNameGroup,sutPocStatus.LocalGroup.name,sizeof(scNameGroup));
- GroupShowUpdate=1;
- }
- }else{
- if(0!=strcmp((char *)danHuanBuffer,scNameGroup) || update!=0){
- memset(scNameGroup,0,sizeof(scNameGroup));
- memcpy(scNameGroup, danHuanBuffer,sizeof(danHuanBuffer));
- GroupShowUpdate=1;
- }
- }
-
- if(0!=strcmp(sutPocStatus.LocalUser.name,scNameUser) || update!=0){
- memset(scNameUser,0,sizeof(scNameUser));
- memcpy(scNameUser,sutPocStatus.LocalUser.name,sizeof(scNameUser));
- UserShowUpdate=1;
- }
- if(GroupShowUpdate){
- guiClearRect(0,UI_GROUP_SHOW_Y,GLCD_WIDTH-1,UI_GROUP_SHOW_Y+16,guiGetBackColor());//18
- //刷新群组栏
- if(sutPocStatus.danHuStatus==0) StrIntercept(name, scNameGroup, sizeof(name));
- else snprintf(name, sizeof(name), "单呼模式");
- uiShowGroup(name);
- sutPocStatus.statusChaned=1;
- }
- if(UserShowUpdate){
- guiClearRect(0,UI_USER_SHOW_Y,GLCD_WIDTH-1,UI_GROUP_SHOW_Y+16,guiGetBackColor());//18
- //刷新成员栏
- StrIntercept(name, scNameUser, sizeof(name));
- uiShowUser(name);
- }
- }
- void uiShowLearnGName(const char *name){
- guiShowBmp(2, UI_LEARN_SHOW_Y, "Group2.bmp");
- guiClearRect(2+16, UI_LEARN_SHOW_Y, GLCD_WIDTH-1, UI_LEARN_SHOW_Y+16, guiGetBackColor());
- guiShowStr(2+16, UI_LEARN_SHOW_Y, "学习组:", FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor());
- guiShowStr(2+16+56, UI_LEARN_SHOW_Y,name, FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor());
- }
- static void uiShowGuaDuan(unsigned char danhu){
- if(danhu==0) guiClearArea(GLCD_WIDTH-32, UI_BOTTOM_SHOW_Y, 32, 14, guiGetBackColor());
- else guiShowStr(GLCD_WIDTH-32, UI_BOTTOM_SHOW_Y, "挂断", FONT_MODE_12X12, REVERSED_NO, COLOR_STATUS_BAR,guiGetBackColor());
- }
- static void uiShowGroup(const char* info){
- unsigned int color=guiGetForeColor();
- if(sutPocStatus.danHuStatus==0) guiShowBmp(2, UI_GROUP_SHOW_Y, "Group2.bmp");
- else{
- guiShowBmp(2, UI_GROUP_SHOW_Y, "Onecall.bmp");
- color=COLOR_RED;
- }
- guiClearRect(2+16, UI_GROUP_SHOW_Y, GLCD_WIDTH-1, UI_GROUP_SHOW_Y+16, guiGetBackColor());
- guiShowStr(2+16, UI_GROUP_SHOW_Y, "对讲组:", FONT_MODE_16X16, REVERSED_NO,color,guiGetBackColor());
- guiShowStr(2+16+56, UI_GROUP_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,color,guiGetBackColor());
- }
- static void uiShowUser(const char* info){
- guiShowBmp(2, UI_USER_SHOW_Y, "people2.bmp");
- guiClearRect(2+16, UI_USER_SHOW_Y, GLCD_WIDTH-1, UI_USER_SHOW_Y+16, guiGetBackColor());
- guiShowStr(2+16, UI_USER_SHOW_Y,"昵称:", FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor());
- guiShowStr(2+16+40, UI_USER_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,guiGetForeColor(),guiGetBackColor());
- }
- static void uiShowHuaQuan(const char* info,char type){
- unsigned int color=guiGetForeColor();
- if(type==0) guiShowBmp(2, UI_VOICE_SHOW_Y, "Phone.bmp");
- else if(type==1){
- color=COLOR_RED;
- guiShowBmp(2, UI_VOICE_SHOW_Y, "Csend.bmp");
- }else if(type==2){
- guiShowBmp(2, UI_VOICE_SHOW_Y, "Creceive.bmp");
- color=COLOR_DEEP_GREEN;
- }
- guiClearRect(2+16, UI_VOICE_SHOW_Y, GLCD_WIDTH-1, UI_VOICE_SHOW_Y+16, guiGetBackColor());
- guiShowStr(2+16, UI_VOICE_SHOW_Y,info, FONT_MODE_16X16, REVERSED_NO,color,guiGetBackColor());
- }
- static void uiShowCallUserName(void){
- static char scName[POC_GROUP_USER_NAME_LEN];
- char name[POC_GROUP_USER_NAME_LEN];
- if(0 != strncmp(scName, sutPocStatus.CallName, POC_GROUP_USER_NAME_LEN) ||
- sutPocStatus.statusChaned){
- //当名字变更或UI切换了,刷新显示
- sutPocStatus.statusChaned=0;
- memcpy(scName, sutPocStatus.CallName, POC_GROUP_USER_NAME_LEN);
- uiShowHuaQuan(scName,2);
- }
- }
- static void uiShowOffLineMessage(void){
- static unsigned char laReason;
- char info[50],update=0;
- unsigned short y;
-
- if(sutUIstatus.Status != UIS_STANDBY) return;
- if(sutPocStatus.PocLineOffReason==laReason && sutUIstatus.ItemRefresh==0) return;
- sutUIstatus.ItemRefresh=0;
- laReason=sutPocStatus.PocLineOffReason;
- if(sutApp.cardStatus==0){
- snprintf(info, sizeof(info), "请插卡");
- update=1;
- }else{
- switch(sutPocStatus.PocLineOffReason){
- case 1:snprintf(info, sizeof(info), "无网络连接");break;
- case 2:snprintf(info, sizeof(info), "无法连接");break;
- case 3:snprintf(info, sizeof(info), "没有服务");break;
- case 4:snprintf(info, sizeof(info), "账号信息错误");break;
- }
- if(sutPocStatus.PocLineOffReason!=0) update=1;
- }
- if(update!=0){
- y=UI_CONTENT_SHOW_Y+2+12;
- guiClearRect(1,y, GLCD_WIDTH-1, y +12, guiGetBackColor());
- guiShowStr(1, y,info, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
- }
- }
- /****************************待机界面显示部分结束***********************************/
- #ifdef MAKE_IT_COMMON_VERSION
- #define LEARN_TASK_SEG "消息列表"
- #define LEARN_RANK_SEG "考勤信息"
- #define LEARN_GROUP_SEG "群组选择"
- #define LEARN_USER_SEG "成员选择"
- #else
- #define LEARN_TASK_SEG "学习任务"
- #define LEARN_RANK_SEG "学习排名"
- #define LEARN_GROUP_SEG "班级选择"
- #define LEARN_USER_SEG "同学选择"
- #endif
- /****************************主菜单显示部分开始*************************************/
- #include "Palace.h"
- SUT_PALACE sutPalace;
- void uiShowMenuMain(char update){
- static const char *apcMenuMain[]={
- #ifdef MAKE_IT_COMMON_VERSION
- "消息列表",
- "考勤信息",
- "群组选择",
- "成员选择",
- "定位设置",
- #else
- "学习任务",
- "学习排名",
- "班级选择",
- "同学选择",
- "消息通知",
- #endif
- "系统信息",
- ""
- };
- if(update) PalaceInit(&sutPalace,apcMenuMain,"Palace","主菜单");
- }
- void MenuMainResponse(void){
- unsigned short key;
- key=PalaceResponse(&sutPalace);
- if(MKEY_VALUE_MENU==key){
- switch(sutPalace.Index){
- case 0:
- #ifndef MAKE_IT_COMMON_VERSION
- uISetNextStatus(UIS_MENU_TASK_SEL);
- #endif
- break;
- case 1:
- #ifndef MAKE_IT_COMMON_VERSION
- uISetNextStatus(UIS_MENU_RANK_SEL);
- #endif
- break;
- case 2:
- uISetNextStatus(UIS_MENU_CLASS_SEL);
- break;
- case 3:
- uISetNextStatus(UIS_MENU_STUDENT_SEL);
- break;
- case 4:
- uISetNextStatus(UIS_MENU_LOCATION_SEL);
- break;
- case 5:
- uISetNextStatus(UIS_MENU_SYS_SEL);
- break;
- }
- uiPushStack(sutPalace.Index);
- }
- else if(MKEY_VALUE_ESC==key){
- uISetNextStatus(UIS_STANDBY);
- }
- }
- /****************************主菜单显示部分结束*************************************/
- /*****************************群组选择/成员选择部分开始*********************************/
- static char GUListBoxInited=0;
- static char SelMachine=0;
- static void ReFlashItemGU(char type);
- static void UserAssistAdd(void);
- void uiShowGUSel(char StatusUpdate,unsigned int exeInterval,char type){
- static char machine;
- static unsigned int timer;
- unsigned short timeout;
- char temp;
- if(StatusUpdate) machine=0;
- switch(machine){
- case 0:
- if(sutPocStatus.logined == 0){//not login
- guiShowMessageBox(" 请先登录 ");
- uTimerStart(&timer, 1000);
- machine=1;
- }else{
- if(type==0) appSleepCtl(ASLEEP_GGROUP, 1);//要获取群组信息,不让休眠,记得超时或获取成功或获取失败后需要释放
- else appSleepCtl(ASLEEP_GUSER, 1);
- UiassistStart(0);
- machine=2;
- }
- break;
- case 1:
- if(uTimerExpired(&timer)){
- uISetNextStatus(UIS_STANDBY);
- }
- break;
- case 2:
- temp=getAssistResult();
- if(temp){//??è?íê3é
- guiClearAll(guiGetBackColor());
- if(type==0){
- guiShowCaption(0,LEARN_GROUP_SEG,UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //0
- uiMenuShowBottomIndacitor("确定", "返回");
- }else{
- guiShowCaption(0,LEARN_USER_SEG,UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12); //0
- uiMenuShowBottomIndacitor("单呼", "返回");
- }
- ReFlashItemGU(type);
- uiMenuShowBottomLine();
- machine=3;
- //获取成功后退出释放休眠
- if(type==0) appSleepCtl(ASLEEP_GGROUP, 0);
- else appSleepCtl(ASLEEP_GUSER, 0);
- }
- break;
- }
- if(machine != 3) return;
-
- UserAssistAdd();
- }
- void GroupSelResponse(){
- unsigned int key;
- char buf[50];
- int i;
- key=getKeyValue();
- switch(SelMachine){
- case 0:
- if(sutListBox.handle==0 && MKEY_VALUE_UP==key){
- UiassistStart(1);
- SelMachine=1;
- }else if(((sutListBox.handle+1) == sutListBox.itemnum) && (MKEY_VALUE_DOWN==key)){
- UiassistStart(2);
- SelMachine=2;
- }
- key=ListBoxResponse(&sutListBox);
- if(MKEY_VALUE_ESC==key){
- uiAssist.status=0;
- if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY);
- else uISetNextStatus(UIS_MENU_MAIN);
- appSleepCtl(ASLEEP_GGROUP, 0);//按键退出后释放休眠
- GUListBoxInited=0;
- }else if(MKEY_VALUE_MENU==key){
- if(0 == sutPocStatus.ListCurOnlineNum) break;
- ///////////////////////////////////////
- UiassistEnd(1);
- sutApp.groupTTSEnable=1;
- snprintf(buf, sizeof(buf),"AT+POC=090000%08x\r\n",sutPocStatus.AllGroups[sutListBox.handle].ID);
- msgAtSend(buf);
- MSG_INFO(1,buf);
- snprintf(buf, sizeof(buf),"进入:%s",sutPocStatus.AllGroups[sutListBox.handle].name);
- MSG_INFO(1,buf);
- uISetNextStatus(UIS_STANDBY);
- SelMachine=0;
- }
- break;
- }
- }
- void UserSelResponse(){
- char buf[50];
- unsigned int key;
-
- key=getKeyValue();
- switch(SelMachine){
- case 0:
- if(GUListBoxInited==0) break;//还未初始化listbox时,不执行按键响应
- if(sutListBox.handle==0 && MKEY_VALUE_UP==key){
- UiassistStart(1);
- SelMachine=1;
- }else if((sutListBox.handle+1) == sutListBox.itemnum && (MKEY_VALUE_DOWN==key)){
- UiassistStart(2);
- SelMachine=2;
- }
- key=ListBoxResponse(&sutListBox);
- if(MKEY_VALUE_ESC==key){
- uiAssist.status=0;
- if(getStackStruct()->FastUiChange)uISetNextStatus(UIS_STANDBY);
- else uISetNextStatus(UIS_MENU_MAIN);
- appSleepCtl(ASLEEP_GUSER, 0);//按键退出后释放休眠
- GUListBoxInited=0;
- }else if(MKEY_VALUE_MENU==key){
- if(0 == sutPocStatus.ListCurOnlineNum) break;
- snprintf(buf, sizeof(buf),"AT+POC=0A0000%08x\r\n",sutPocStatus.AllUsers[sutListBox.handle].ID);
- msgAtSend(buf);
- MSG_INFO(1, buf);
- snprintf(buf, sizeof(buf),"呼叫:%s",sutPocStatus.AllUsers[sutListBox.handle].name);
- MSG_INFO(1, buf);
- uISetNextStatus(UIS_STANDBY);
- SelMachine=0;
- }
- break;
- }
- }
- static void UserAssistAdd(void){
- switch(SelMachine){
- case 1:
- if(getAssistResult()){
- if(sutUIstatus.Status==UIS_MENU_CLASS_SEL)ReFlashItemGU(0);
- else ReFlashItemGU(1);
- SelMachine=0;
- }
- break;
- case 2:
- if(getAssistResult()){
- if(sutUIstatus.Status==UIS_MENU_CLASS_SEL)ReFlashItemGU(0);
- else ReFlashItemGU(1);
- SelMachine=0;
- }
- break;
- }
- }
- static void ReFlashItemGU(char type){
- static unsigned short susCt=0;
- static const char *accIconFileName[]={
- "Group1.bmp",
- "Group2.bmp",
- "people1.bmp",
- "people2.bmp",
- ""
- };
- static char *icons[3];
- int i;
- unsigned short timeout;
- static char *GUName[POC_ALL_GROUPS_NUM+1]; //5
- static char GUFeatures[POC_ALL_GROUPS_NUM+1];//5
-
- if(type==0){
- icons[0]=accIconFileName[0];
- icons[1]=accIconFileName[1];
- }else{
- icons[0]=accIconFileName[2];
- icons[1]=accIconFileName[3];
- }
- icons[2]=accIconFileName[4];
- for(i=0;i<=POC_ALL_GROUPS_NUM;i++){
- GUName[i]=NullPtr;
- GUFeatures[i]=0;
- }
- for(i=0;i<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,SIM选择",
- "4,功耗模式设置",
- "5,服务器设置",
- "6,版本升级",
- "7,提示音设置",
- "8,终端信息",
- "9,SD卡检测",
- "10,留音记录",
- ""
- };
- 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_NET);
- break;
- case 2://SIM选择
- uISetNextStatus(UIS_MENU_SYS_SIM);
- break;
- case 3://功耗模式设置
- uISetNextStatus(UIS_MENU_SYS_PWR);
- break;
- case 4://服务器设置
- uISetNextStatus(UIS_MENU_SYS_SERVERPASS);
- break;
- case 5://版本升级
- uISetNextStatus(UIS_MENU_SYS_VERSION);
- break;
- case 6://提示音设置
- uISetNextStatus(UIS_MENU_SYS_NOTE);
- break;
- case 7://终端信息
- uISetNextStatus(UIS_MENU_SYS_INFO);
- break;
- case 8://SD卡检测
- uISetNextStatus(UIS_MENU_SYS_SD);
- break;
- case 9://留音记录设置
- uISetNextStatus(UIS_MENU_SYS_VOICE);
- break;
- }
- if(sutMenuSysSetup.handle<=9) 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 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("请重启设备");
- msgAtSend("AT+TRB=1\r\n");
- nwy_sleep(100);
- for(;;){
- MSG_INFO(1, "card changed, wait user reboot");
- CTL_POWER_HOLD(0);
- nwy_sleep(1000);
- }
- }
- uISetNextStatus(UIS_MENU_SYS_SEL);
- }
- }
- /*****************************卡选择设置结束**********************************/
- /*****************************功耗设置开始**********************************/
- typedef enum{
- PMODE_DEFAULT_LOW,
- PMODE_SUPER_LOW,
- PMODE_NORMAL
- }PWR_ENUMDEF;
- //低功耗模式
- #define MODE_LOW_PWR_NONE_4G 5
- #define MODE_LOW_PWR_IS_4G 25
- //超长待机模式
- #define MODE_LONG_LOW_PWR_NONE_4G 5
- #define MODE_LONG_LOW_PWR_IS_4G 55
- //常规模式
- #define MODE_NORMAL__NONE_4G 5
- #define MODE_NORMAL__IS_4G 5
- //终端放弃设置模式,由服务器决定使用什么
- #define MODE_AUTO____NONE_4G 0
- #define MODE_AUTO____IS_4G 0
- //默认功耗模式
- #define MODE_PWR_DEFAULT_NONE_4G MODE_LOW_PWR_NONE_4G
- #define MODE_PWR_DEFAULT_IS_4G MODE_LOW_PWR_IS_4G
- static void pwrModeSetCmd(unsigned char pwrMode){
- unsigned char seg1,seg2;
- char buf[30];
-
- if(pwrMode==PMODE_DEFAULT_LOW){
- seg1=MODE_PWR_DEFAULT_NONE_4G;
- seg2=MODE_PWR_DEFAULT_IS_4G;
- }else if(pwrMode==PMODE_SUPER_LOW){
- seg1=MODE_LONG_LOW_PWR_NONE_4G;
- seg2=MODE_LONG_LOW_PWR_IS_4G;
- }else if(pwrMode==PMODE_NORMAL){
- seg1=MODE_NORMAL__NONE_4G;
- seg2=MODE_NORMAL__IS_4G;
- }else return;
- snprintf(buf, sizeof(buf), "AT+UDP=%d,%d\r\n",seg1,seg2);
- msgAtSend(buf);
- }
- void pwrModeAckHandler(unsigned char seg1, unsigned char seg2){
- if(seg1==MODE_PWR_DEFAULT_NONE_4G && seg2==MODE_PWR_DEFAULT_IS_4G && newPara.pwrMode != PMODE_DEFAULT_LOW){
- goto SAVE_PWR_MODE;
- }else if(seg1==MODE_LONG_LOW_PWR_NONE_4G && seg2==MODE_LONG_LOW_PWR_IS_4G && newPara.pwrMode != PMODE_SUPER_LOW){
- goto SAVE_PWR_MODE;
- }else if(seg1==MODE_NORMAL__NONE_4G && seg2==MODE_NORMAL__IS_4G && newPara.pwrMode != PMODE_NORMAL){
- goto SAVE_PWR_MODE;
- }else if(seg2!=MODE_LOW_PWR_IS_4G&&seg2!=MODE_LONG_LOW_PWR_IS_4G&& seg2!=MODE_NORMAL__IS_4G){
- //Seg2 3个模式都不满足则切换为默认模式
- newPara.pwrMode = PMODE_DEFAULT_LOW;
- goto SAVE_PWR_MODE;
- }
- return;
- SAVE_PWR_MODE:
- sysIniSave();
- pwrModeSetCmd(newPara.pwrMode);
- }
- #define PWR_MODE_NUM 3
- void uiShowPwrSel(char StatusUpdate){
- static const char *pwrMode[PWR_MODE_NUM+1]={
- "低功耗模式",
- "超长待机模式",
- "常规模式",
- "",
- };
- char Features[PWR_MODE_NUM];
- unsigned char i;
- if(StatusUpdate){
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"功耗设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- uiMenuShowBottomLine();
- for(i=0;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 fotaStepSet(unsigned char newStep){
- fotaStep=newStep;
- }
- void fotaMsgShow(char *msg){
- int len=guiGetStrXLen((char *)msg,FONT_MODE_16X16);
- guiClearRect(0, 60, GLCD_WIDTH-1, 60+16,guiGetBackColor());
- guiShowStr((GLCD_WIDTH-len)/2,60, msg,FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
- }
- void uiShowVersionSel(char StatusUpdate){
- if(StatusUpdate){
- sutApp.fotaVersion[0]=0;
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"版本更新",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- msgAtSend("AT+FOTA?\r\n");
- fotaStep=0;
- fotaMsgShow("正在检测版本");
- uiMenuShowBottomLine();
- uiMenuShowBottomIndacitor("确定", "返回");
- uTimerStart(&fotaTick, 500);
- }
- switch(fotaStep){
- case 0:
- if(uTimerExpired(&fotaTick)){
- fotaMsgShow("检测超时");
- fotaStep=4;
- }
- break;
- case 1://等待用户确定
- break;
- case 2://用户确定后等待结果
- if(uTimerExpired(&fotaTick)){
- fotaMsgShow("超时退出");
- fotaStep=4;
- }
- break;
- case 3://升级成功,等待重启
- msgAtSend("AT+POC=050000\r\n");//停止POC后复位
- MSG_INFO(1, "Stop poc");
- nwy_sleep(2000);
- msgAtSend("AT+TRB=2\r\n");
- MSG_INFO(1, "Reset system!!!");
- while(1){nwy_sleep(1000);}
- break;
- case 4://延时显示2秒后退出
- uTimerStart(&fotaTick, 2000);
- fotaStep=5;
- break;
- case 5://退出升级流程
- if(uTimerExpired(&fotaTick)) uISetNextStatus(UIS_MENU_SYS_SEL);
- break;
- }
- }
- void uiShowVersionSelResponse(void){
- unsigned char key=getKeyValue();
-
- if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
- else if(MKEY_VALUE_MENU==key){
- if(fotaStep==1){
- fotaMsgShow("请勿断电!");
- fotaStep=2;
- msgAtSend("AT+FOTA=1\r\n");
- uTimerStart(&fotaTick, 10000);
- }
- }
- }
- /*****************************版本设置结束**********************************/
- /*****************************提示音设置开始********************************/
- unsigned char noteSetTmp;
- static void switchFlash(void){
- char info[30];
- unsigned short x,y,len;
-
- if(noteSetTmp==0) snprintf(info, sizeof(info), "关闭");
- else snprintf(info, sizeof(info), "打开");
-
- len=guiGetStrXLen((char *)info, FONT_MODE_12X12);
- x=(GLCD_WIDTH-len)/2;
- y=UI_CONTENT_SHOW_Y+(GLCD_HEIGHT-UI_CONTENT_SHOW_Y)/2-12;
- guiShowStr(x,y,info, FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
- }
- void uiShowNoteSel(char StatusUpdate){
- if(StatusUpdate){
- guiClearAll(guiGetBackColor());
- guiShowCaption(0,"提示音设置",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
- uiMenuShowBottomLine();
- noteSetTmp=newPara.KeySound;
- switchFlash();
- uiMenuShowBottomIndacitor("保存", "返回");
- }
- }
- void uiShowNoteSelResponse(void){
- unsigned short key=getKeyValue();
- if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
- else if(MKEY_VALUE_MENU==key){
- getStackStruct()->ok_back=1;
- if(newPara.KeySound != noteSetTmp){
- newPara.KeySound=noteSetTmp;
- #ifndef ENABLE_PWM_BEEP
- if(noteSetTmp==0) msgAtSend("AT+TONES=0\r\n");
- else msgAtSend("AT+TONES=1\r\n");
- #endif
- sysIniSave();
- }
- uISetNextStatus(UIS_MENU_SYS_SEL);
- }else if(MKEY_VALUE_DOWN || MKEY_VALUE_UP){
- if(noteSetTmp==0) noteSetTmp=1;
- else noteSetTmp=0;
- switchFlash();
- }
- }
- /*****************************提示音设置结束********************************/
|