123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025 |
- /********************************************************************************
- * File Name: UI.c
- * Function Describe:user interface module
- * Relate Module:
- * Explain: 用户界面,注意,为避免操作系统中多任务调用而导致资源访问冲突,只允许在同一个任务中调用。目前设定在MainTask任务中调用!
- * Writer: ShiLiangWen
- * Date: 2016.1.28
- *******************************************************************************/
- #include "includes.h"
- #include "LCD.h"
- unsigned char lastOption;//向下
- //LASTOPTION lastoption;
- SUT_UI_STATUS sutUIstatus;
- void UISetNextStatus(unsigned char status);
- void ShowStatusBar(int Update);//显示状态栏
- void ShowButton(u16 x,u16 y,const char *str);//显示一个按钮
- void ShowMessageBox(char *msg);
- int siCt1=-1;
- signed char ChangeIng=0;//-1
- char ChangeIngCt=0;
- SUT_LIST_BOX sutListBox;//ListBox控件,因为内部用到了features[]数据比较大,为节省内存控件,建议整个项目共用一个list
- UI_STACK UI_Stack;
- /******************************************************
- 在同一个位置交替显示本机用户名和本机当前群组名
- 参数:x,y 显示位置左上角的坐标
- update ==0 时根据内部静态群组名比较决定是否刷屏显示
- update !=0 时强制刷屏显示
- ******************************************************/
- void ShowGroupAndUserName(u16 x,u16 y,int update)
- {
- #if POC_USER_NAME_LEN>POC_GROUP_NAME_LEN
- static char scName[POC_USER_NAME_LEN];
- char name[POC_USER_NAME_LEN];
- #else
- static char scName[POC_GROUP_NAME_LEN];
- char name[POC_GROUP_NAME_LEN];
- #endif
- static char scCt=0;//0~2--显示群组名 3~5--显示用户名
- u16 len;
- unsigned char danHuanBuffer[9]={0xB5,0xA5,0xBA,0xF4,0xC4,0xA3,0xCA,0xBD,0};
- char GroupShowUpdate=0;
- if(++scCt>=6 || update!=0)scCt=0;
- if(scCt<3){
- if(sutPocStatus.danHunStatus==0){
- if(0!=strcmp(sutPocStatus.LocalGroup.name,scName) || update!=0){
- memcpy(scName,sutPocStatus.LocalGroup.name,sizeof(scName));
- GroupShowUpdate=1;
-
- }
- }else{
- if(0!=strcmp((char *)danHuanBuffer,scName) || update!=0){
- memcpy(scName, danHuanBuffer,sizeof(danHuanBuffer));
-
- GroupShowUpdate=1;
- }
- }
- if(GroupShowUpdate){
- GuiClearRect(x,y,160,y+18);//16
- StrIntercept(name,scName,sizeof(name));
- GuiShowStr(x,y+4,name,0x01);
- GuiReverseRect(x,y,160,18);//测试
- sutPocStatus.statusChaned=1;
- }
- }else{
- if(0!=strcmp(sutPocStatus.LocalUser.name,scName) || update!=0){
- memcpy(scName,sutPocStatus.LocalUser.name,sizeof(scName));
- GuiClearRect(x,y,160,y+18);//16
- StrIntercept(name,scName,sizeof(name));;
- GuiShowStr(x,y+4,name,0x01);
- GuiReverseRect(x,y,160,18);//测试
- sutPocStatus.statusChaned=1;
- }
- }
- }
- void ShowGroupAndUserNameM20(u16 x,u16 y,int update)
- {
- #if POC_USER_NAME_LEN>POC_GROUP_NAME_LEN
- static char scNameUser[POC_GROUP_NAME_LEN];
- static char scNameGroup[POC_GROUP_NAME_LEN];
- char name[POC_GROUP_NAME_LEN];
- #else
- static char scNameUser[POC_GROUP_NAME_LEN];
- static char scNameGroup[POC_GROUP_NAME_LEN];
- char name[POC_GROUP_NAME_LEN];
- #endif
- unsigned char danHuanBuffer[]={0xB5,0xA5,0xBA,0xF4,0};//0xB5,0xA5,0xBA,0xF4,0xC4,0xA3,0xCA,0xBD,
- unsigned char endanHuanBuffer[]="Separate Call";
- unsigned char SosBuffer[]="SOS";
- char GroupShowUpdate=0;
-
- if(sutPocStatus.SOS_Flag==1){ //SOS
- if(0!=strcmp(SosBuffer,scNameGroup)|| update!=0){
- memcpy(scNameGroup,SosBuffer,sizeof(SosBuffer));
- GroupShowUpdate=1;
- }
- }else if(sutPocStatus.danHunStatus>0){
- if(0==strcmp(sutProductPara.Language,"cn")){
- if(0!=strcmp(danHuanBuffer,scNameGroup)|| update!=0){
- memcpy(scNameGroup,danHuanBuffer,sizeof(danHuanBuffer));
- GroupShowUpdate=1;
- }
-
- }else {
- if(0!=strcmp(endanHuanBuffer,scNameGroup)|| update!=0){
- memcpy(scNameGroup,endanHuanBuffer,sizeof(endanHuanBuffer));
- GroupShowUpdate=1;
- }
- }
- }else if(0!=strcmp(sutPocStatus.LocalGroup.name,scNameGroup) || update!=0){
- memcpy(scNameGroup,sutPocStatus.LocalGroup.name,sizeof(scNameGroup));
- GroupShowUpdate=1;
-
- }
-
- if(0!=strcmp(sutPocStatus.LocalUser.name,scNameUser) || update!=0){
- memcpy(scNameUser,sutPocStatus.LocalUser.name,sizeof(scNameUser));
- GroupShowUpdate=1;
- }
-
- if(GroupShowUpdate){
- GuiClearRect(x,y,160,y+19);//18
- GuiClearRect(x,y+18,160,y+19);//18
-
- if(sutPocStatus.danHunStatus==0&&sutPocStatus.SOS_Flag==0)
- {
- GuiShowBmp(x+5,y+4,"Group2.bmp");
-
- }else if(sutPocStatus.SOS_Flag==1) GuiShowBmp(x+5,y+4,"SOS.bmp");//GuiShowStr(x,y+4,"模式:",0x01);
- else{
- GuiShowBmp(x+5,y+4,"Onecall.bmp");
- }
-
- GuiShowBmp(x+5,y+4+18,"people2.bmp");
-
- StrIntercept(name,scNameGroup,sizeof(name));
-
- /**************英文 位置不同*********************************/
- if(0==strcmp(sutProductPara.Language,"en")){
- if(sutPocStatus.SOS_Flag==1){
- GuiShowStr(x+30,y+4,name,0x11);//48
- }
- }
- if(sutPocStatus.danHunStatus==0)GuiShowStr(x+30,y+4,name,0x11);//0x01
- else {
- memset(name,0,sizeof( name));
- strcpy(name,sutPocStatus.Callname); //
- GuiShowStr(x+30,y+4,name,0x11);///
- }
- SlwTrace(INF,name,1);
- StrIntercept(name,scNameUser,sizeof(name));
- //GuiShowStr(x+30,y+4+18,name,0x01);
- GuiShowStr(x+30,y+4+18,name,0x11);
- if(sutPocStatus.danHunStatus==2){
- if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStrM20(127,111,"挂断",0x11,COLOR_WHITE,OrangeColorId);//135 113
- else GuiShowStrM20(105,111,"HangUp",0x11,COLOR_WHITE,OrangeColorId);//113
- }else if(sutPocStatus.danHunStatus==0){
- GuiClearAreaFixColor(100,111,60,18,OrangeColorId);
- }
- //sutPocStatus.statusChaned=1;
- }
- GroupShowUpdate=0;
- //sutPocStatus.statusChaned=1;
- }
- void ShowCallUserName(u16 x,u16 y)
- {
- static char scName[POC_USER_NAME_LEN];
- char name[POC_USER_NAME_LEN];
- uint8_t thisName;
-
- static uint8_t siCt=0;
-
- if(siCt==0||siCt==20||siCt==40 || siCt==60||siCt==80||siCt==100)
- {
- if(strncmp(scName, sutPocStatus.Callname,sizeof(scName)) != 0 ||
- strncmp(scName, sutPocStatus.Callname,sizeof(sutPocStatus.Callname))!=0 ||
- sutPocStatus.statusChaned)
- {//当名字变更后,刷新
- //GuiClearRect(x+30,y,159,y+18);
- GuiClearArea(x+30,y,124,18);
- memcpy(scName,sutPocStatus.Callname,sizeof(sutPocStatus.Callname));
- sutPocStatus.statusChaned=0;
- // SlwTrace(INF,"------------------\r\n",1);
- // printf("-------------suct=%d\r\n",siCt);
- }
- StrIntercept(name,scName,sizeof(name));
- GuiShowStrM20(x+30,y,sutPocStatus.Callname,0x11,BlueColorId,COLOR_WHITE);
- }
- if(++siCt>100) siCt=0;
- }
- /**********************************************************
- 显示主界面
- ************************************************************/
- void UIShowMainInterface(int StatusUpdate)
- {
- int Flag;//主界面状态:0--未登录 1--无人说话 2--本机说话 3--对方说话
- static int siLastFlag=-1;//上一个Flag状态值
- static int siCt=0;
- char info[20];
- static unsigned char lastLoginResult=0xff;
-
- if(StatusUpdate){
- GuiClearAllM20();
- siLastFlag=-1;
- siCt=0;
- ShowStatusBar(StatusUpdate);
- if(0==strcmp(sutProductPara.Language,"cn"))
- {
- GuiShowStr(0,111,"菜单 ",0x11);//113
- GuiReverseRect(0,110,160,18);//测试
- }else{
- GuiShowStr(1,111,"Menu ",0x11);///test
- GuiReverseRect(0,110,160,18);//测试
- }
- if(1==sutPocStatus.Logined) ShowGroupAndUserNameM20(0,19,1);
- return;
- }
- if(Ui_LockFlag==1){
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("请先解锁!");
- else ShowMessageBox("Please unlock");
- os_dly_wait(50);
- GuiClearRect(0,LCD_HEIGHT/2-20,159,LCD_HEIGHT/2+20);
- if(1==sutPocStatus.Logined) ShowGroupAndUserNameM20(0,19,1);
- }
- //======以下持续调用,以便动态更新信息==========
- //----顶部显示状态栏-----------
- ShowStatusBar(StatusUpdate);
-
- //-----登陆状态标志更新--------
- if(0==sutPocStatus.Logined){//未登录时,显示LOGO
- Flag=0;
- }else if(sutPocStatus.Speaker==0 && sutPocStatus.PPTpress==0){//对方未说话,本机未说话
- Flag=1;
- siCt1=0;
- }else if(sutPocStatus.Speaker==0 && sutPocStatus.PPTpress==1){//对方未说话,本机说话
- Flag=2;
- }else if(sutPocStatus.Speaker>0){//对方说话了
- Flag=3;
- }
-
- //-------中间图片显示-------
- switch(Flag){
- case 0://未登录
- if(Flag!=siLastFlag||Ui_LockFlag==1){
- GuiClearRect(0,19,159,19+59);
- GuiShowBmp(30,19,"logo.bmp"); //38
- Ui_LockFlag=0;
- }
- break;
- case 1://已登录,但无人说话
- if(Flag!=siLastFlag||Ui_LockFlag==1){
- GuiClearRect(36,60,159,60+18); //38+59
-
- if(0==strcmp(sutProductPara.Language,"cn")) {
- GuiShowBmp(5,60,"Phone.bmp");
- GuiShowStr(30,60,"空闲",0x11);
- }else {
- GuiShowBmp(5,60,"Phone.bmp");
- GuiShowStr(30,60,"Free",0x11);
- }
- // sutPocStatus.statusChaned = 1;
- Ui_LockFlag=0;
-
- }
- break;
- case 2://已登录,本机说话
- if(Flag!=siLastFlag||Ui_LockFlag==1){
- //GuiClearRect(36,60,159,60+18);//38+59
- GuiClearRect(0,60,159,60+18);//38+59
- if(0==strcmp(sutProductPara.Language,"cn")){
- //GuiShowBmp(5,60,"Phone.bmp");
- GuiShowBmp(5,60,"Csend.bmp");
- if(sutPocStatus.SOS_Flag==0) GuiShowStrM20(30,60,"本机在讲话",0x11,RedColorId,COLOR_WHITE);
- else GuiShowStrM20(30,60,"按PTT退出SOS",0x11,RedColorId,COLOR_WHITE);
- }else{
- //GuiShowBmp(5,60,"Phone.bmp");
- GuiShowBmp(5,60,"Csend.bmp");
- if(sutPocStatus.SOS_Flag==0)GuiShowStrM20(30,60,"Native",0x11,RedColorId,COLOR_WHITE);
- else GuiShowStrM20(30,60,"Press PTT Exit",0x11,RedColorId,COLOR_WHITE);
- }
-
- sutPocStatus.statusChaned = 1;
- Ui_LockFlag=0;
- }
-
- break;
- case 3://已登录,对方说话
- if(Flag!=siLastFlag||Ui_LockFlag==1){
- //GuiShowBmp(5,60,"Phone.bmp");
- GuiShowBmp(5,60,"Creceive.bmp");
- sutPocStatus.statusChaned = 1;
- Ui_LockFlag=0;
- }
- // //显示对方名字
- ShowCallUserName(0,60); //18
- break;
- }
-
- //------群组、用户显示--------
- if(Flag>0){//已登陆
- // if(siCt==0 || siCt==100 || siCt==200){//每秒刷一次,以便及时更新。刷太快也影响
- if(Flag!=siLastFlag && siLastFlag==0)
- {
- ShowGroupAndUserNameM20(0,19,1);
- }else
- {
- ShowGroupAndUserNameM20(0,19,0);
- }
- }else{//未登陆
-
- if(lastLoginResult != sutPocStatus.loginResult || siLastFlag==-1)
- {
- lastLoginResult=sutPocStatus.loginResult;
- if(lastLoginResult==1) snprintf(info, sizeof(info), "账号信息错误");
- else if(lastLoginResult==2) snprintf(info, sizeof(info), "无网络连接 ");
- else if(lastLoginResult==4){
- if(0==strcmp(sutProductPara.Language,"cn")) snprintf(info, sizeof(info), "请插卡 ");
- else {
- snprintf(info, sizeof(info), "No Card");
- }
- }
- else if(lastLoginResult==5) snprintf(info, sizeof(info), "无法连接");
- else if(lastLoginResult==6) snprintf(info, sizeof(info), "没有服务");
- else goto NEXT_STEP;
- GuiShowStr(0,38,info,0x11);
- }
-
- if(0==strcmp(sutProductPara.Language,"cn")) {
- memset(info, ' ',sizeof(info));
- memcpy(info, "正在登陆.", 9);
- if(0==siCt)
- {
- GuiShowStr(0,19,info,0x11);
- }
- else if(100==siCt)
- {
- info[9]='.';
- GuiShowStr(0,19,info,0x11);
- }
- else if(200==siCt)
- {
- info[9]='.';info[10]='.';
- GuiShowStr(0,19,info,0x11);
- }
- }else{
- memset(info, ' ',sizeof(info));
- memcpy(info, "Loging.", 7);
- if(0==siCt)
- {
- GuiShowStr(0,19,info,0x11);
- }
- else if(100==siCt)
- {
- info[7]='.';
- GuiShowStr(0,19,info,0x11);
- }
- else if(200==siCt)
- {
- info[7]='.';info[8]='.';
- GuiShowStr(0,19,info,0x11);
- }
- }
-
-
- }
- NEXT_STEP:
-
- if(++siCt>=300)siCt=0;
- if(Flag!=siLastFlag){//状态变化 才更新 分页
- siLastFlag=Flag;
- siCt=0;
- }
- }
-
- void UI_Init(void)
- {
- memset(&sutUIstatus,0,sizeof(SUT_UI_STATUS));
- UISetNextStatus(UIS_STANDBY);
- }
- /******************************************************
- UIShowMenuMain
- 显示主菜单
- *******************************************************/
- SUT_MENU sutMenuMain;
- void UIShowMenuMain(int update)
- {
- char**p=NULL;
-
- static const char *apcMenuMain[]={
- "群组选择",
- "成员选择",
- "LCD设置",
- //"语音记录",
- "系统设置",
- "终端信息",
- //"固件升级",
- ""
- };
-
- static const char *apcMenuMainEn[]={
- "Group Option",
- "Member Option",
- //"Voice record",
- "System Set",
- "Device Info",
- //"HARD UPDATE ",
- ""
- };
-
-
-
- if(0==strcmp(sutProductPara.Language,"cn"))
- {
- p=apcMenuMain;
-
- }else{
- p=apcMenuMainEn;
- }
-
- if(update){
- GuiClearAll();
- if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("主菜单",3); //0的话有点靠顶
- else ShowCaption("Menu",3);
- GuiDrawHLine(0,159,20,1);
- MenuInit(&sutMenuMain,p);
- return;
- }
- //如果有需要持续调用,则在以下添加代码
-
- }
- /******************************************************
- 工厂菜单
- *******************************************************/
- void UIShowFactoryMenu(int update)
- {
- char**p=NULL;
-
- static const char *apcMenuMain[]={
- "GPS测试",
- "按键测试",
- "LCD测试",
- "LED测试",
- "电压值",
- "综测",
- ""
- };
- p=apcMenuMain;
-
- if(update){
- GuiClearAll();
- ShowCaption("工厂模式",3); //0的话有点靠顶
- GuiDrawHLine(0,159,20,1);
- MenuInit(&sutMenuMain,p);
- return;
- }
- //如果有需要持续调用,则在以下添加代码
-
- }
- /******************************************************
- UIShowMenuSysSetup
- 系统设置菜单
- *******************************************************/
- //SUT_MENU sutMenuSysSetup;
- void UIShowMenuSysSetup(int update)
- {
- char **p=NULL;
- static const char *apcMenuSysSetup[]={
- //"语种选择",
- //"APN设置",
- //"北斗设置",
- //"LCD设置",
- //"网络设置",
- //"低功耗设置",
- "按键音设置",
- "PTT提示音",
- //"功放模式设置",
- //"快捷界面设置",
- "对讲版本升级",
- "USB调试",
- "固件升级",
- ""
- };
-
- static const char *apcMenuSysSetupEn[]={
- //"Languages Set",
- //"APN设置",
- //"GPS Set",
- //"LCD Set",
- //"NET Set",
- //"LowConsumption",
- "KeySound Set",
- "PttTone Set",
- //"AWMode Set",
- "Fast Interface",
- "System Update",
- "USB debug",
- "HARD Update",
- ""
- };
-
-
- if(0==strcmp(sutProductPara.Language,"cn")) p=apcMenuSysSetup;
- else p=apcMenuSysSetupEn;
-
- if(update){
- GuiClearAll();
- if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("系统设置",3); //0
- else ShowCaption("System Set",3);
- GuiDrawHLine(0,159,20,1);
- MenuInit(&sutMenuSysSetup,p);
- return;
- }
- }
- void UIShowGroupSel(int update)
- {
- static unsigned short susCt=0;
- unsigned short timeout;
-
- if(update){
- if(sutPocStatus.Logined == 0)//not login
- {
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox(" 请先登录... ");
- else ShowMessageBox("Please login first... ");
- timeout=50;
- while(timeout--)OsDelayTime(1);
- UISetNextStatus(UIS_STANDBY);
- return;
- }else if(sutPocStatus.danHunStatus==2){
-
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("单呼禁止操作!");
- else ShowMessageBox("Can't do that");
- timeout=50;
- while(timeout--)
- OsDelayTime(1);
- UISetNextStatus(UIS_STANDBY);
- return;
- }
- SimpleGroupInfoScan(1, 1);
- susCt=0;
- GuiClearAll();
-
- if(0==strcmp(sutProductPara.Language,"cn")){
- if(sutPocStatus.recordflag==1)ShowCaption("群组语音",3); //0
- else ShowCaption("群组选择",3);
- }
- else{
- if(sutPocStatus.recordflag==1)ShowCaption("Group Voice",3); //0
- else ShowCaption("Group Selection",3); //0
- }
- GuiDrawHLine(0,159,20,1);
- ReFlashItem2();
- GuiDrawHLine(0,159,104,1);
- return;
- }
-
- //按键提示
- if(susCt==0){
- if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
- else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
- }else if(susCt==200){
- if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(0,110,"[M]确定 [EXIT]退出",0x01);
- else GuiShowStr(0,110,"[M]OK [EXIT]",0x01);
- }
- if(++susCt>=400)susCt=0;
-
- }
- void ReFlashItem(void)
- {
- //char buf[100];
- static unsigned short susCt=0;
- static const char *accIconFileName[]={
- "people2.bmp",
- "people2.bmp",
- "people1.bmp",
- ""
- };
- int i;
- unsigned short timeout;
- static char NullUser=0;
- static char *UsersName[POC_ALL_USERS_NUM+1]; //5
- static char UserFeatures[POC_ALL_USERS_NUM+1];//5
- //----------------------------
- for(i=0;i<=POC_ALL_USERS_NUM;i++){
- UsersName[i]=&NullUser;
- UserFeatures[i]=0;
- }
- for(i=0;i<sutPocStatus.FillUserIndex;i++)
- {
- if(strcmp(sutPocStatus.LocalUser.name,sutPocStatus.AllUsers[i].name)==0){
- UserFeatures[i]=1;
-
- }else UserFeatures[i]=2;//sutPocStatus.AllUsers[i].status-1;
-
- UsersName[i]=sutPocStatus.AllUsers[i].name;
- }
- if(sutPocStatus.UserOnLineNum==0)
- {
- UsersName[0]="空";
- UserFeatures[i]=0;
- }
- //初始化ListBox控件
- ListBoxInit(&sutListBox,UsersName,0,accIconFileName,UserFeatures);
-
- }
- void ReFlashItem2(void)
- {
- //char buf[100];
- static unsigned short susCt=0;
- static const char *accIconFileName[]={
- "Group2.bmp",
- "Group2.bmp",
- "Group1.bmp",
- ""
- };
- int i;
- unsigned short timeout;
- static char NullUser=0;
- static char *GroupsName[POC_ALL_GROUPS_NUM+1]; //5
- static char GroupFeatures[POC_ALL_GROUPS_NUM+1];//5
- //----------------------------
- for(i=0;i<=POC_ALL_GROUPS_NUM;i++){
- GroupsName[i]=&NullUser;
- GroupFeatures[i]=0;
- }
- for(i=0;i<sutPocStatus.FillGroupIndex;i++)
- {
- if(strcmp(sutPocStatus.LocalGroup.name,sutPocStatus.AllGroups[i].name)==0) {
- GroupFeatures[i]=1;
- }else GroupFeatures[i]=2;
-
- GroupsName[i]=sutPocStatus.AllGroups[i].name;
- }
- if(sutPocStatus.GroupOnLineNum==0)
- {
- GroupsName[0]="空";
- GroupFeatures[i]=0;
- }
- //初始化ListBox控件
- ListBoxInit(&sutListBox,GroupsName,0,accIconFileName,GroupFeatures);
- }
- void ReFlashItemVoice(void)
- {
- static unsigned short susCt=0;
- static const char *accIconFileNameM20[]={
- "voice1.bmp",
- "voice2.bmp",
- "voice2.bmp",
- ""
- };
- int i;
- unsigned short timeout;
- static char NullVoice=0;
- static char *VoicesName[POC_ALL_VOICES_NUM+1]; //5
- static char VoiceFeatures[POC_ALL_VOICES_NUM+1];//5
- static char Voicetime[POC_ALL_VOICES_NUM+1];
- //----------------------------
- for(i=0;i<=POC_ALL_VOICES_NUM;i++){
- VoicesName[i]=&NullVoice;
- VoiceFeatures[i]=0;
- //Voicetime[i]=0;
-
- }
- for(i=0;i<sutPocStatus.FillVoiceIndex;i++)
- {
- VoiceFeatures[i]= !sutPocStatus.AllVoices[sutPocStatus.FillVoiceIndex-i-1].type;
- VoicesName[i]=sutPocStatus.AllVoices[sutPocStatus.FillVoiceIndex-i-1].name;
- Voicetime[i]=sutPocStatus.AllVoices[sutPocStatus.FillVoiceIndex-i-1].time;
- }
-
- if(sutPocStatus.VoiceOnLineNum==0)
- {
- VoicesName[0]="空";
- VoiceFeatures[i]=0;
- Voicetime[i]=0;
- }
-
- if(sutPocStatus.VoiceOnLineNum==0)sutListBox.handle=0;
- else sutListBox.handle=sutPocStatus.FillVoiceIndex-1;
-
- if(lastOption){
- sutListBox.handle=0;
- lastOption=0;
- }
- //初始化ListBox控件
- ListBoxInitM20(&sutListBox,VoicesName,0,accIconFileNameM20,VoiceFeatures,Voicetime);
- }
- /******************************************************
- UIShowUserSel
- 用户选择
- *******************************************************/
- void UIShowUserSel(int update)
- {
- static unsigned short susCt=0;
- unsigned short timeout;
-
- if(update){
- if(sutPocStatus.Logined == 0)//not login
- {
-
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox(" 请先登录... ");
- else ShowMessageBox(" Please login first...");
- timeout=50;
- while(timeout--)
- OsDelayTime(1);
- UISetNextStatus(UIS_STANDBY);
- return;
- }else if(sutPocStatus.danHunStatus==2||sutPocStatus.Speaker!=0){
-
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("禁止操作!");
- else ShowMessageBox("Can't do that");
- timeout=50;
- while(timeout--)
- OsDelayTime(1);
- UISetNextStatus(UIS_MENU_MAIN);
- return;
- }
- SimpleUserInfoScan(1, 1);
- susCt=0;
- GuiClearAll();
- if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("用户选择",3); //0
- else ShowCaption("User Selection",3);
- GuiDrawHLine(0,159,20,1);
- ReFlashItem();
- GuiDrawHLine(0,159,104,1);
- return;
- }
- //按键提示
- if(susCt==0&& sutPocStatus.danHunStatus!=1){
- if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
- else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
-
- }else if(susCt==200 && sutPocStatus.danHunStatus!=1){
-
- if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(0,110,"[M]单呼 [EXIT]退出",0x01);
- else GuiShowStr(0,110,"[M]Call [EXIT]",0x01);
- }
- if(++susCt>=400)susCt=0;
- }
- /******************************************************
- 语音记录
- *******************************************************/
- void UIShowVoiceShow(int update)
- {
- static unsigned short susCt=0;
- unsigned short timeout;
-
- if(update){
- if(sutPocStatus.Logined == 0)//not login
- {
-
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox(" 请先登录... ");
- else ShowMessageBox(" Please login first...");
- timeout=50;
- while(timeout--)
- OsDelayTime(1);
- UISetNextStatus(UIS_STANDBY);
- return;
- }else if(sutPocStatus.danHunStatus==2||sutPocStatus.Speaker!=0){
-
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("禁止操作!");
- else ShowMessageBox("Can't do that");
- timeout=50;
- while(timeout--)
- OsDelayTime(1);
- UISetNextStatus(UIS_MENU_MAIN);
- return;
- }
- SimpleVoiceInfoScan(1,1);
- susCt=0;
- GuiClearAll();
- if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("语音记录",3); //0
- else ShowCaption("voice record",3);
- GuiDrawHLine(0,159,20,1);
- ReFlashItemVoice();
- GuiDrawHLine(0,159,104,1);
- return;
- }
-
- //按键提示
- if(susCt==0){
- if(0==strcmp(sutProductPara.Language,"cn")) GuiShowStr(0,110,"[上]选择 [下]选择",0x01);
- else GuiShowStr(0,110,"[UP] [DOWN]",0x01);
-
- }else if(susCt==200){
-
- if(0==strcmp(sutProductPara.Language,"cn"))GuiShowStr(0,110,"[M]播放 [EXIT]退出",0x01);
- else GuiShowStr(0,110,"[M]PLAY [EXIT]",0x01);
- }
- if(++susCt>=400)susCt=0;
- }
- /******************************************************
- UIShowInformation
- 用户选择
- *******************************************************/
- void UIShowInformation(int update)
- {
- u16 x,y;
- char temp[20];
- char buf[50];
- static unsigned char flag=0;
- if(update)
- {
- flag=0;
- GuiClearAll();
- if(0==strcmp(sutProductPara.Language,"cn")) ShowCaption("终端信息",3); //0
- else ShowCaption("Device Info",3); //0
- GuiDrawHLine(0,159,20,1);
- }
- x=2,y=22;
- if(update||KEY_PANEL_UP == g_ulKeyValue &&flag==0)
- {
- g_ulKeyValue = 0;
- // if(flag==0 || flag==2)
- // {
- //显示PSN
- GuiClearRect(0,y,LCD_WIDTH-1,LCD_HEIGHT-1);
- //终端型号
- if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"终端型号:%s",sutProductPara.ProductName);
- else snprintf(buf, sizeof(buf),"Device Name:%s",sutProductPara.ProductName);
- GuiShowStr(x,y,buf,0x01);
- y+=20;
- //终端编码
- if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"ID:%s",sutProductPara.IMEI);
- else snprintf(buf, sizeof(buf),"ID:%s",sutProductPara.IMEI);
- GuiShowStr(x,y,buf,0x01);
- y+=20;
- //应用版本号
- if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"应用版本:V%d.%d",sutProductPara.ProductVersion,INTER_VER);
- else snprintf(buf, sizeof(buf),"MCU Ver:V%d.%d",sutProductPara.ProductVersion,INTER_VER);
- GuiShowStr(x,y,buf,0x01);
- y+=20;
- //对讲版本号
- if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"对讲版本:%s",g_iPocVer);
- else snprintf(buf, sizeof(buf),"POC Ver:%s",g_iPocVer);
- GuiShowStr(x,y,buf,0x01);
- y+=20;
- memset(buf,sizeof(buf),0);
- if(Modem_type==Un_KnownModem){
- if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf,sizeof(buf),"模块类型:未知");
- else snprintf(buf,sizeof(buf),"Module:Unknown");
- }
- else if(Modem_type==USA_Modem)
- {
- if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf,sizeof(buf),"模块类型:美版");
- else snprintf(buf,sizeof(buf),"Module:US");
-
- }
- else if(Modem_type==Europe_Modem) {
-
- if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf,sizeof(buf),"模块类型:欧版");
- else snprintf(buf,sizeof(buf),"Module:EU");
-
- }
- //snprintf(buf, sizeof(buf),"模块类型:%s",buf);
- GuiShowStr(x,y,buf,0x01);
- flag=2;
- }else if(KEY_PANEL_DOWN == g_ulKeyValue && flag==2)
- {
- g_ulKeyValue=0;
- GuiClearRect(0,y,LCD_WIDTH-1,LCD_HEIGHT-1);
- // HardRevision
- if(0==strcmp(sutProductPara.Language,"cn")) snprintf(buf, sizeof(buf),"固件版本:");
- else snprintf(buf, sizeof(buf),"HardRevision:");
- GuiShowStr(x,y,buf,0x01);
- y+=20;
- strncpy(temp,HardRevision,sizeof(temp));
- GuiShowStr(x,y,temp,0x01);
- snprintf(buf, sizeof(buf),"%s",&HardRevision[19]);
- y+=20;
- GuiShowStr(x,y,buf,0x01);
- flag=0;
- // g_ulKeyValue=0;
- // if(flag==1 || flag==2)
- // {
- // //显示IP
- // GuiClearRect(0,y,LCD_WIDTH-1,LCD_HEIGHT-1);
- // //交换IP
- // GuiShowStr(x,y,"交换服务器:",0x01);
- // y+= 20;
- // snprintf(buf, sizeof(buf),"%s",sutProductPara.PIP);
- // GuiShowStr(x,y,buf,0x01);
- // y+=20;
- // //GPS IP
- // GuiShowStr(x,y,"北斗服务器:",0x01);
- // y+= 20;
- // snprintf(buf, sizeof(buf),"%s",sutProductPara.GIP);
- // GuiShowStr(x,y,buf,0x01);
- // y+=20;
- // snprintf(buf, sizeof(buf),"PORT:%d",sutProductPara.GpsPort);
- // GuiShowStr(x,y,buf,1);
- // flag=0;
- // }
- }
- }
- /******************************************************
- UI_Loop
- UI循环调用,需要在MainTask的主循环中持续调用,及时处理状态发生变化时的UI显示
- 此处按下OK键显示里面内容
- *******************************************************/
- void UI_Loop(void)
- {
-
- int StatusUpdate;
- if(fota_update.NewPocFlag==1)
- {//显示正在升级;
- UISetNextStatus(UIS_UPDATA_SHOW);
- }
- if(sutUIstatus.Status!=sutUIstatus.NextStatus){//状态发生变更
- sutUIstatus.LastStatus=sutUIstatus.Status;
- sutUIstatus.Status=sutUIstatus.NextStatus;
- StatusUpdate=1;
- }else{//状态没有发生变更
- StatusUpdate=0;
- }
-
- switch(sutUIstatus.Status){
- case UIS_STANDBY:
- Init_stack(&UI_Stack);//UI 返回栈
- UIShowMainInterface(StatusUpdate);
- sutUIstatus.LastHandle=0;
- sutUIstatus.LastPage=0;
- break;
- case UIS_MENU_MAIN:
- UIShowMenuMain(StatusUpdate);
- break;
- case UIS_MENU_USER_SEL:
- UIShowUserSel(StatusUpdate);
- break;
- case UIS_MENU_GROUP_SEL:
- UIShowGroupSel(StatusUpdate);
- break;
- case UIS_MAIL_BOX:
- UIShowMailBox(StatusUpdate);
- break;
-
- case UIS_MENU_SYS_SET:
- UIShowMenuSysSetup(StatusUpdate);
- break;
-
- case UIS_MENU_INFO:
- UIShowInformation(StatusUpdate);
- break;
-
- case UIS_MESSAGE_OPTION:
- MessageOptionShow(StatusUpdate);
- break;
-
- case UIS_MESSAGE_READ:
- MessageReadShow(StatusUpdate);
- break;
-
- case UIS_MESSAGE_DELE:
- MessageDeletShow(StatusUpdate);
- break;
-
- case UIS_MESSAGE_FORMAT:
- MessageFormatShow(StatusUpdate);
- break;
-
- case UIS_SET_APN:
- SetAPNShow(StatusUpdate);
- break;
- case UIS_APN_DETAIL:
- SetApnDetailShow(StatusUpdate);
- break;
- case UIS_SET_GPS:
- SetGPSShow(StatusUpdate);
- break;
- case UIS_SET_LCD:
- SetLCDShow(StatusUpdate);
- break;
- ////////////////////////////
- case UIS_SET_NET:
- SetNetModeShow(StatusUpdate);
- break;
- ///////////////////////////
- case UIS_UP_APPRICATION_VER:
- SetUpAppricationVerShow(StatusUpdate);
- break;
- case UIS_UP_APP_PENDING:
- SetUpAppricationVerPending();
- break;
-
- case UIS_UP_INTERCOM_VER:
- SetUpIntercomVerShow(StatusUpdate);
- break;
- case UIS_UPDATA_SHOW:
- Fota_Update_Show(StatusUpdate);
- break;
- case UIS_SET_LANGUAGE:
- SetLanguageShow(StatusUpdate);
- break;
-
- case UIS_Voice_Record:
- UIShowVoiceShow(StatusUpdate);
- break;
-
- case UIS_SET_KEYSound:
- SetKeySoundShow(StatusUpdate);
- break;
-
- case UIS_START_INFOSET:
- SetStartInfoShow(StatusUpdate);
- break;
- case UIS_FASTINTERFACE:
- SetFastInterfaceModeShow(StatusUpdate);
- break;
- case UIS_AWMODESET:
- SetAwModeShow(StatusUpdate);
- break;
- case UIS_LOW_CONSUMPTION:
- SetLowConsumptionModeShow(StatusUpdate);
- break;
- case UIS_FACTORY_MENU:
- UIShowFactoryMenu(StatusUpdate);
- break;
- case UIS_WAIT_ONECALL:
- WaitOneCallShow(StatusUpdate);
- break;
- case UIS_FACTORY_KEY:
- SetFactory_KeyShow(StatusUpdate);
- break;
- case UIS_FACTORY_LCD:
- SetFactory_LCDShow(StatusUpdate);
- break;
- case UIS_FACTORY_LED:
- SetFactory_LEDShow(StatusUpdate);
- break;
- case UIS_FACTORY_VBAT:
- SetFactory_VBATShow(StatusUpdate);
- break;
-
- case UIS_SET_PTTTONE:
-
- SetPttToneModeShow(StatusUpdate);
- break;
- case UIS_SET_ADB:
- SetADBDebugShow(StatusUpdate);
- break;
-
- case UIS_SET_BOOT:
- SetBOOTDebugShow(StatusUpdate);
- break;
-
- case UIS_POWEROFF:
- PowerOffShow(StatusUpdate);
- break;
-
- case UIS_BOOTUPATE_SHOW:
- BootUptating(StatusUpdate);
- break;
- }
- }
- /******************************************************
- UI_Key
- 按键处理
- *******************************************************/
- void UI_Key(void)
- {
- char buf[100];
- unsigned long key;
- int i,temp;
-
- if(LcdSleepFlag==1){
- LcdSleepFlag=0;
- return;
- }
- switch(sutUIstatus.Status){
-
- case UIS_STANDBY://----待机界面---
-
- switch(g_ulKeyValue){
- // case KEY_PANEL_MENU:
- // if(g_uslockflag==1)return;
- // UISetNextStatus(UIS_MENU_MAIN);
- // break;
- case KEY_PANEL_EXIT:
- if(g_uslockflag==1)return;
- if(sutPocStatus.danHunStatus==2){
- snprintf(buf,sizeof(buf),"AT+POC=540&2&%d\r\n",sutPocStatus.CallID);
- ModemSendAT(buf);
- }else {
- // if(LastLcdSleepFlag==0){
- // LCDTimeOut(1);
- // sutLcdParam.OnTimeCt=g_ausTimeOut[sutProductPara.LCDSetIndex];
- // }
- // else {
- // LCDTimeOut(0);
- // sutLcdParam.OnTimeCt=0;
- // }
- }
- break;
-
- case KEY_PANEL_UP:
- sutUIstatus.ShortCut=1;
- UISetNextStatus(UIS_MENU_GROUP_SEL);
- break;
- case KEY_PANEL_DOWN:
- sutUIstatus.ShortCut=1;
- UISetNextStatus(UIS_MENU_USER_SEL);
- break;
- }
-
- break;
- case UIS_MENU_MAIN://----主菜单----
-
- key=MenuResponse(&sutMenuMain);
-
- if(KEY_PANEL_MENU==key){
- switch(sutMenuMain.handle){
- case 0://群组选择
- UISetNextStatus(UIS_MENU_GROUP_SEL);
- break;
- case 1://成员选择
- UISetNextStatus(UIS_MENU_USER_SEL);
-
- break;
- // case 2://语音记录
- // sutPocStatus.recordflag=1; //语音记录先进群组
- // UISetNextStatus(UIS_MENU_GROUP_SEL);
- break;
-
- case 2:
- UISetNextStatus(UIS_SET_LCD);
- break;
-
-
- case 3://系统设置
- UISetNextStatus(UIS_MENU_SYS_SET);
- break;
-
- case 4://终端信息
- UISetNextStatus(UIS_MENU_INFO);
- break;
- // case 4://固件升级
- // UISetNextStatus(UIS_SET_BOOT);
- // break;
- }
-
- PushUiStack(&UI_Stack,sutMenuMain.handle);
- }
- else if(KEY_PANEL_EXIT==key){
- UISetNextStatus(UIS_STANDBY);
- }
- break;
-
- case UIS_FACTORY_MENU:
-
- key=MenuResponse(&sutMenuMain);
-
- if(KEY_PANEL_MENU==key){
- switch(sutMenuMain.handle){
- case 0:
- UISetNextStatus(UIS_SET_GPS);
- GPS_PWREN_HIGH;
- break;
- case 1:
- UISetNextStatus(UIS_FACTORY_KEY);
- break;
- case 2:
- UISetNextStatus(UIS_FACTORY_LCD);
- break;
-
- case 3:
- UISetNextStatus(UIS_FACTORY_LED);
- break;
- case 4:
- UISetNextStatus(UIS_FACTORY_VBAT);
- break;
- }
-
- PushUiStack(&UI_Stack,sutMenuMain.handle);
- }
-
- break;
-
- case UIS_MENU_GROUP_SEL://-----群组选择-----
-
- if(sutListBox.handle==0 &&(KEY_PANEL_UP==g_ulKeyValue) )
- {
- sutPocStatus.Page_Up=4;
-
- if(sutPocStatus.handleIndex>0 && sutPocStatus.handleIndex<6){
- sutPocStatus.handleIndex=0;
- sutPocStatus.Page_Up=4;
- }else if(sutPocStatus.handleIndex==0){
- if(sutPocStatus.GroupOnLineNum%5==0){
- sutPocStatus.handleIndex=sutPocStatus.GroupOnLineNum-5;
- sutPocStatus.Page_Up=4;
- }else {
- sutPocStatus.handleIndex=sutPocStatus.GroupOnLineNum-sutPocStatus.GroupOnLineNum%5;
- sutPocStatus.Page_Up=sutPocStatus.GroupOnLineNum%5-1;
- }
- }else{
- sutPocStatus.handleIndex -=5;
- sutPocStatus.Page_Up=4;
- }
- printf("sutPocStatus.handleIndex==%d\r\n",sutPocStatus.handleIndex);
- SimpleGroupInfoScan(0,0);
- ReFlashItem2();//指针会被重置到0位置
- break;
- }else if((sutListBox.handle+1) == sutListBox.itemnum && (KEY_PANEL_DOWN==g_ulKeyValue))
- {
- sutPocStatus.Page_Up=0;
-
- if(sutPocStatus.GroupOnLineNum%5==0)sutPocStatus.Top_Index=5;
- else sutPocStatus.Top_Index=sutPocStatus.GroupOnLineNum%5;
- //最后一页
- if(sutPocStatus.handleIndex==sutPocStatus.GroupOnLineNum-sutPocStatus.Top_Index){
- sutPocStatus.handleIndex=0;
- //sutPocStatus.Page_Up=sutPocStatus.handleIndex%5;
- }else{
- sutPocStatus.handleIndex+=5;
- }
- printf("sutPocStatus.handleIndex==%d\r\n",sutPocStatus.handleIndex);
- if(sutPocStatus.handleIndex>sutPocStatus.GroupOnLineNum) sutPocStatus.handleIndex=0;
- sutPocStatus.Page_Up=0;
- SimpleGroupInfoScan(0,1);
- ReFlashItem2();//指针会被重置到0位置
-
- //reload down
- break;
- }
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_EXIT==g_ulKeyValue)
- {
- //lastOption=0;
- sutPocStatus.Page_Up=0;
- sutPocStatus.recordflag=0;
- if(sutUIstatus.ShortCut==1){
- sutUIstatus.ShortCut=0;
- UISetNextStatus(UIS_STANDBY);
- }else UISetNextStatus(UIS_MENU_MAIN);
- }
- else if(KEY_PANEL_MENU==key){
- sutPocStatus.Page_Up=0;
- g_cMenuBack=1;
- //群组选择
- ///////////////////////////////////////
- if(0 == sutPocStatus.GroupOnLineNum)
- {
- break;
- }
- ///////////////////////////////////////
- if(sutPocStatus.recordflag==1){
- sutPocStatus.recordflag=0;
- sutPocStatus.recordID=sutPocStatus.AllGroups[sutListBox.handle].ID;
- UISetNextStatus(UIS_Voice_Record);
- }else{
-
- if(sutPocStatus.LocalGroup.ID==sutPocStatus.AllGroups[sutListBox.handle].ID)
- {
- if(0==strcmp(sutProductPara.Language,"cn"))sprintf(buf, "已经在此群组");
- else sprintf(buf, "Already");
- ShowMessageBox(buf);
- OsDelayTime(100);
- UISetNextStatus(sutUIstatus.LastStatus);
- //UISetNextStatus(UIS_STANDBY);
- break;
- }
- snprintf(buf, sizeof(buf),"AT+POC=529&%d\r\n",sutPocStatus.AllGroups[sutListBox.handle].ID);
- ModemSendAT(buf);
- SlwTrace(INF,buf,1);
- if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf, sizeof(buf),"进入:%s",sutPocStatus.AllGroups[sutListBox.handle].name);
- else snprintf(buf, sizeof(buf),"Enter:%s",sutPocStatus.AllGroups[sutListBox.handle].name);
-
- ShowMessageBox(buf);
- OsDelayTime(100);
- UISetNextStatus(UIS_STANDBY);
- }
- }
-
- break;
- case UIS_MENU_USER_SEL://-----成员选择-----
- if(sutListBox.handle==0 && KEY_PANEL_UP==g_ulKeyValue)
- {
- sutPocStatus.Page_Up=4;
-
- if(sutPocStatus.handleIndex>0 && sutPocStatus.handleIndex<6){
- sutPocStatus.handleIndex=0;
- sutPocStatus.Page_Up=4;
- }else if(sutPocStatus.handleIndex==0){
- if(sutPocStatus.UserOnLineNum%5==0){
- sutPocStatus.handleIndex=sutPocStatus.UserOnLineNum-5;
- sutPocStatus.Page_Up=4;
- }else {
- sutPocStatus.handleIndex=sutPocStatus.UserOnLineNum-sutPocStatus.UserOnLineNum%5;
- sutPocStatus.Page_Up=sutPocStatus.UserOnLineNum%5-1;
- }
- }else{
- sutPocStatus.handleIndex -=5;
- sutPocStatus.Page_Up=4;
- }
-
- printf("sutPocStatus.handleIndex==%d\r\n",sutPocStatus.handleIndex);
-
- SimpleUserInfoScan(0,0);
- ReFlashItem();//指针会被重置到0位置
- //lastOption=1;
- //reload up
- break;
- }else if((sutListBox.handle+1) == sutListBox.itemnum && (KEY_PANEL_DOWN==g_ulKeyValue))
- {
- sutPocStatus.Page_Up=0;
- //sutPocStatus.handleIndex += sutListBox.itemnum-1; ///
-
- if(sutPocStatus.UserOnLineNum%5==0)sutPocStatus.Top_Index=5;
- else sutPocStatus.Top_Index=sutPocStatus.UserOnLineNum%5;
- //最后一页
- if(sutPocStatus.handleIndex==sutPocStatus.UserOnLineNum-sutPocStatus.Top_Index){
- sutPocStatus.handleIndex=0;
- //sutPocStatus.Page_Up=sutPocStatus.handleIndex%5;
- }else{
- sutPocStatus.handleIndex+=5;
- }
- printf("sutPocStatus.handleIndex==%d\r\n",sutPocStatus.handleIndex);
- if(sutPocStatus.handleIndex>sutPocStatus.UserOnLineNum) sutPocStatus.handleIndex=0;
- SimpleUserInfoScan(0,1);
- sutPocStatus.Page_Up=0;
- ReFlashItem();//指针会被重置到0位置
- break;
- }
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_EXIT==g_ulKeyValue)
- {
- if(sutUIstatus.ShortCut==1){
- sutUIstatus.ShortCut=0;
- UISetNextStatus(UIS_STANDBY);
- }else UISetNextStatus(UIS_MENU_MAIN);
- sutPocStatus.Page_Up=0;
- }
- else if(KEY_PANEL_MENU==key){
- sutPocStatus.Page_Up=0;
- g_cMenuBack=1;
- //单呼成员
- ///////////////////////////////////////
- if(0 == sutPocStatus.UserOnLineNum)
- {
- // sprintf(buf, "无法呼叫自己");
- // ShowMessageBox(buf);
- // OsDelayTime(200);
- //// UISetNextStatus(sutUIstatus.LastStatus);
- // UISetNextStatus(UIS_STANDBY);
- // return;
- break;
- }
- if(sutPocStatus.LocalUser.ID==sutPocStatus.AllUsers[sutListBox.handle].ID)
- {
- if(0==strcmp(sutProductPara.Language,"cn"))sprintf(buf, "无法呼叫自己");
- else sprintf(buf, "Can't call");
- ShowMessageBox(buf);
- OsDelayTime(200);
- UISetNextStatus(sutUIstatus.LastStatus);
- //UISetNextStatus(UIS_STANDBY);
- break;
- }
- snprintf(buf, sizeof(buf),"AT+POC=540&1&%d\r\n",sutPocStatus.AllUsers[sutListBox.handle].ID);
- if(sutPocStatus.LocalUser.ID==sutPocStatus.AllUsers[sutListBox.handle].ID)
- sutPocStatus.CallID=sutPocStatus.AllUsers[sutListBox.handle].ID;//主呼ID
- ModemSendAT(buf);
- if(0==strcmp(sutProductPara.Language,"cn"))snprintf(buf, sizeof(buf),"呼叫:%s",sutPocStatus.AllUsers[sutListBox.handle].name);
- else snprintf(buf, sizeof(buf),"Call:%s",sutPocStatus.AllUsers[sutListBox.handle].name);
- strcpy(sutPocStatus.Callname,sutPocStatus.AllUsers[sutListBox.handle].name);
-
- // ShowMessageBox(buf);
- // OsDelayTime(200);
- // UISetNextStatus(UIS_STANDBY);
- UISetNextStatus(UIS_WAIT_ONECALL);
- }
- break;
-
-
- case UIS_Voice_Record://-----语音记录-----
- if(sutListBox.handle==0 && KEY_PANEL_UP==g_ulKeyValue)
- {
- if(sutPocStatus.voicehandleIndex >=5) {
- /***提示已经到顶部**/
- //sutPocStatus.handleIndex -=5;
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("没有更多记录");
- else ShowMessageBox("Record the top!");
- os_dly_wait(1);
- lastOption=1;
- }
- else if(sutPocStatus.voicehandleIndex==0){
-
- // if(sutPocStatus.VoiceOnLineNum==5){
- // sutPocStatus.voicehandleIndex=0;
- // if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("没有更多记录");
- // else ShowMessageBox("Record the top!");
- // os_dly_wait(1);
- // }else
- if(sutPocStatus.VoiceOnLineNum>5){
- sutPocStatus.voicehandleIndex=5;
-
- }else{
- sutPocStatus.voicehandleIndex=0;
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("没有更多记录");
- else ShowMessageBox("Record the top!");
- os_dly_wait(1);
- lastOption=1;
- }
-
- }
- SimpleVoiceInfoScan(0,0);
- ReFlashItemVoice();//指针会被重置到0位置
- //reload up
- break;
- }else if((sutListBox.handle+1) == sutListBox.itemnum && KEY_PANEL_DOWN==g_ulKeyValue)
- {
-
- if(sutPocStatus.voicehandleIndex >=5) {
- sutPocStatus.voicehandleIndex -=5;
-
- lastOption=1;
-
- }else if(sutPocStatus.voicehandleIndex==0){
-
- if(0==strcmp(sutProductPara.Language,"cn")) ShowMessageBox("已经是最新一条!");
- else ShowMessageBox("The latest record!");
- os_dly_wait(1);
-
- }
- printf("sutPocStatus.recordID1111===%d\r\n",sutPocStatus.recordID);
-
- SimpleVoiceInfoScan(1,1); //0.1
- ReFlashItemVoice();//指针会被重置到0位置
-
- printf("sutPocStatus.recordID222222===%d\r\n",sutPocStatus.recordID);
- //reload down
- break;
- }
- key=ListBoxResponseM20(&sutListBox);
- if(KEY_PANEL_EXIT==g_ulKeyValue)
- {
- lastOption=0;
- UISetNextStatus(sutUIstatus.LastStatus);
- sutPocStatus.recordflag=1;
-
- }
- // else if(KEY_PANEL_MENU==g_ulKeyValue)
- // {
- // lastOption=0;
- // UISetNextStatus(UIS_MENU_MAIN);
- // }
- else if(KEY_PANEL_MENU==key){
- if(sutPocStatus.VoiceOnLineNum!=0){
- snprintf(buf, sizeof(buf),"AT+POC=552&%d&%d\r\n",sutPocStatus.recordID,sutPocStatus.AllVoices[sutPocStatus.FillVoiceIndex-sutListBox.handle-1].ID);///*****
- ModemSendAT(buf);
- SlwTrace(INF,buf,1);
- }
- }
- break;
-
- case UIS_MAIL_BOX://-----短信查阅-----
- MessageResponse();
- break;
-
- case UIS_MENU_SYS_SET://-----系统设置-----
- SetSYSResponse(); //名字没取好,实际上是系统
- break;
- case UIS_MENU_INFO://-----终端信息-----
- if(KEY_PANEL_EXIT==g_ulKeyValue){
- UISetNextStatus(sutUIstatus.LastStatus);//UIS_STANDBY
- }
- //else if(KEY_PANEL_MENU==g_ulKeyValue)UISetNextStatus(UIS_MENU_MAIN);
- break;
- case UIS_MESSAGE_OPTION:
- MessageOptionResponse();
- break;
- case UIS_MESSAGE_READ:
- MessageReadResponse();
- break;
- case UIS_MESSAGE_FORMAT:
- MessageFormatResponse();
- break;
-
- case UIS_MESSAGE_DELE:
- MessageDeletResponse();
- break;
- case UIS_SET_APN: //-----系统设置-------
- SetAPNResponse();
- break;
- case UIS_APN_DETAIL:
- SetApnDetailResponse();
- break;
- case UIS_SET_GPS:
- SetGPSResponse();
- break;
- case UIS_SET_LCD:
- SetLCDResponse();
- break;
- ////////////////////////////////////
- case UIS_SET_NET:
- SetNetModeResponse();
- break;
- //////////////////////////////////
- case UIS_UP_APPRICATION_VER:
- SetUpAppricationVerResponse();
- break;
- case UIS_UP_INTERCOM_VER:
- SetUpIntercomVerResponse();
- break;
-
- case UIS_SET_LANGUAGE:
- SetLanguageResponse();
- break;
- case UIS_SET_KEYSound:
- SetKeysoundResponse();
- break;
-
- case UIS_FASTINTERFACE:
- SetFastInterfaceModeResponse();
- break;
- case UIS_AWMODESET:
- SetAwModeResponse();
- break;
-
- case UIS_LOW_CONSUMPTION:
- SetLowConsumptionResponse();
- break;
- case UIS_WAIT_ONECALL:
- WaitOneCallResponse();
- break;
- case UIS_FACTORY_KEY:
- Factory_KeyResponse();
- break;
- case UIS_FACTORY_LCD:
- Factory_LcdResponse();
- break;
- case UIS_FACTORY_LED:
- Factory_LEDResponse();
- break;
-
- case UIS_FACTORY_VBAT:
- Factory_VBATResponse();
- break;
-
-
- case UIS_SET_PTTTONE:
- SetPttToneResponse();
- break;
-
- case UIS_SET_ADB:
- SetAdbDebugResponse();
- break;
-
- case UIS_SET_BOOT:
- SetBOOTDebugResponse();
- break;
-
- case UIS_POWEROFF:
- SetPowerOffResponse();
- break;
-
- default:
- break;
-
- }
-
- }
- /******************************************************
- UISetNextStatus
- 设置下一个UI状态
- *******************************************************/
- void UISetNextStatus(unsigned char status)
- {
- if(status==sutUIstatus.Status) return;
- sutUIstatus.LastStatus=sutUIstatus.NextStatus;
- sutUIstatus.NextStatus=status;
- }
- /******************************************************
- 显示开机动画
- 完整图片 尺寸
- logo.bmp 100*59
- 子图片 与主图片坐标偏移
- logo-down 2,42
- logo-g 38,25
- logo-h 4,10
- logo-i 29,19
- logo-o 59,25
- logo-s 77,25
- logo-up 2,0
- *******************************************************/
- void ShowBootAnimation(void)
- {
- int i;
- int x,y;
- int w,h;
- x=30;y=34;//最终整张logo图片的位置
- w=100;h=59;//整张图片的尺寸
- LCD_BL_HIGH; //改正用户体验
- KEY_LED(0);
- GuiClearAll();
- GuiShowBmp(0,0,"welcome.bmp");
- for(i=0;i<5000;i++)//4000000
- {
- if(i%100==0) IWDG_ReloadCounter();
- }
- }
- /***********************************
- 显示信号状态
- **********************************/
- void ShowSingle(int CSQ)
- {
-
- GuiShowBmp(0,0+2,"SingleOK.bmp");
-
- if(CSQ<1 || CSQ==99){
- GuiClearRectM20(7,4,21,14);
- }else if(CSQ<8){
- GuiDrawVLine(12,14,7,2,COLOR_DEFAULT_BLUE);
- GuiClearRectM20(11,4,21,14);
- }else if(CSQ<16){
- GuiDrawVLine(12,14,7,2,COLOR_DEFAULT_BLUE);
- GuiDrawVLine(9,14,11,2,COLOR_DEFAULT_BLUE);
- GuiClearRectM20(15,4,21,14);
- }else if(CSQ<22){
- GuiDrawVLine(12,14,7,2,COLOR_DEFAULT_BLUE);
- GuiDrawVLine(9,14,11,2,COLOR_DEFAULT_BLUE);
- GuiDrawVLine(7,14,15,2,COLOR_DEFAULT_BLUE);
- GuiClearRectM20(19,4,21,14);
- }else{
- GuiDrawVLine(12,14,7,2,COLOR_DEFAULT_BLUE);
- GuiDrawVLine(9,14,11,2,COLOR_DEFAULT_BLUE);
- GuiDrawVLine(7,14,15,2,COLOR_DEFAULT_BLUE);
- GuiDrawVLine(4,14,19,2,COLOR_DEFAULT_BLUE);
- }
-
-
- }
- /************************************************************************
- 显示电量
- *************************************************************************/
- void ShowBatttery(int bat,char Update)
- {
- static unsigned int flashCnt=0;
- static unsigned char flag=0;
- static signed char VbatStatue=-1;
- static signed char LastVbatStatue=-1;
- static unsigned short temp=0;
- static unsigned short BatCnt=0;
-
- int x=90; //46
- unsigned char Color;
-
- if(ChangeIng){
- Color=COLOR_CHARGE_BLUE;
- if((bat>422)||(GPIO_ReadInputDataBit(CHARGE_STATUE_PORT,CHARGE_STATUE_PIN)==RESET)){
- if(ChangeIngCt==0 && ReCharge==0){
- GuiShowBmp(x+41,3,"CHARGEBAT.bmp");
- CHARGE_LED_HIGH;
- return;
- }
- CHARGE_LED_LOW;
- }
- temp=420;
- }else{
- CHARGE_LED_LOW;
- Color=COLOR_DEFAULT_BLUE;
- temp=407;
- }
- if(bat<WARN_PWR_LEVEL){//请充电 340
- if(os_time_get()< flashCnt) return;
- flashCnt=os_time_get()+80;
- if(flag==0)
- {
- LastVbatStatue=0;
- flag=1;
- }else{
- flag=0;
- LastVbatStatue=1;
- }
- } else if(bat<362)LastVbatStatue=2;
- else if(bat<385)LastVbatStatue=3;
- else if(bat<temp)LastVbatStatue=4;
- else LastVbatStatue=5;
-
- if(VbatStatue!=LastVbatStatue||Update){
- if(bat<WARN_PWR_LEVEL){//请充电 340
- // if(flag==0)
- // {
- // GuiShowBmp(x+41,3,"VBAT1.bmp");
- // flag=1;
- // }else{
- // flag=0;
- if(ChangeIng)GuiShowBmp(x+41,3,"VBAT3.bmp");
- else GuiShowBmp(x+41,3,"VBAT2.bmp");
- // }
- }
- else if(bat<362){//340<x<=355 1格
- GuiShowBmp(x+41,3,"VBAT1.bmp");
- GuiDrawVLine(5,12,62+x,4,Color);
- }
- else if(bat<385){//355<x<=375 2格
- GuiShowBmp(x+41,3,"VBAT1.bmp");
- GuiDrawVLine(5,12,57+x,4,Color);
- GuiDrawVLine(5,12,62+x,4,Color);
- }
- else if(bat<temp){//375<x<=425 3格
- GuiShowBmp(x+41,3,"VBAT1.bmp");
- GuiDrawVLine(5,12,52+x,4,Color);
- GuiDrawVLine(5,12,57+x,4,Color);
- GuiDrawVLine(5,12,62+x,4,Color);
- }
- else{//>=425 4格
- GuiShowBmp(x+41,3,"VBAT1.bmp");
- GuiDrawVLine(5,12,47+x,4,Color);
- GuiDrawVLine(5,12,52+x,4,Color);
- GuiDrawVLine(5,12,57+x,4,Color);
- GuiDrawVLine(5,12,62+x,4,Color);
- }
- VbatStatue=LastVbatStatue;
- }
- }
- void ShowTime(char Update)
- {
- static int lastS=-1;
- int s;
- USER_RTC_DEF Temptime;
- char buf[30];
- //if(sutPocStatus.FirstLogined==0) return; //M20
- RTC_UserGetTime(&Temptime);
- s=Temptime.min;
- if(lastS!=s||Update){
- lastS=s;
- snprintf(buf, sizeof(buf),"%02d:%02d",Temptime.hour,Temptime.min);//-02d"g_usModeMTime,g_usModeSTime
- GuiShowStrM20(67,5,buf,0x01,COLOR_WHITE,COLOR_BLACK); //75
- }
- }
- void ShowGPSICon(char y)
- {
- GuiClearRectM20(45,y,50,18);//18<->20
- if(0== sutGpsInfo.isGpsWork) GuiClearRectM20(45,y,67,18);//未工作或未检测到 //75
-
- else
- {
-
- //GPS已工作
- if(0 == sutGpsInfo.isGpsValid)
- {//未定位
- if(sutGpsInfo.isGpsAuthOk==0)//未鉴权
- {
- GuiShowBmp(45,y,"GPS1.bmp");
- }else//已鉴权
- {
- GuiShowBmp(45,y,"GPSA.bmp");//已鉴权
- }
- }else
- {//已定位
- if(sutGpsInfo.isGpsAuthOk==0)//未鉴权
- {
- GuiShowBmp(45,y,"GPS1.bmp");
- }else//已鉴权
- {
- GuiShowBmp(45,y,"GPSA.bmp");//已鉴权
- }
- GuiShowBmp(45+10-2,y+2,"GPS2.bmp");//定位辐射放最后
- }
- }
- }
- /************************************************************************
- ShowStatusBar
- 显示状态栏
- *************************************************************************/
- void ShowStatusBar(int Update)
- {
- static char batFirstShow=0;
- static uint8_t siHNS;
- static int siCSQ;
- static int siVbat;
- unsigned short usGps;
- static unsigned short susGps;
- static STATUE lastPPPStatus;
- static signed int s_netshowvalue=-1;
- static signed char EarFlag= -1;//
- static unsigned char VbatStatue=0;
- char buf[20];
-
- if(Update){
- GuiClearRectM20(0,0,160,18);
- siCSQ=g_iCSQ;
- ShowSingle(g_iCSQ);
- siVbat=g_iVbat;
- ShowGPSICon(0);
- ShowBatttery(g_iVbat,Update);
- //ShowMessageFlag(1);
- ShowTime(1);
- s_netshowvalue=netshowvalue;
- Show_Net(s_netshowvalue);
- if(!Earcheck){
- GuiClearRectM20(110,3,110+16,16);
- }
- else GuiShowBmp(110,3,"Ear.bmp");
- EarFlag=Earcheck;
- return;
- }
- //2G-4G显示
- if(s_netshowvalue!=netshowvalue){
- s_netshowvalue=netshowvalue;
- Show_Net(s_netshowvalue);
- }
-
- //信号显示
- if(siCSQ!=g_iCSQ || lastPPPStatus != sutGpsStatus.PPPStatus){
- lastPPPStatus=sutGpsStatus.PPPStatus;
- siCSQ=g_iCSQ;
- ShowSingle(g_iCSQ);
- }
- //消息显示
- // ShowMessageFlag(0);
- //GPS显示
- usGps=((unsigned short)sutGpsInfo.isGpsWork<<8) | ((unsigned short)sutGpsInfo.isGpsValid) | ((unsigned short)sutGpsInfo.isGpsAuthOk<<2);
- if(susGps!=usGps ){
- susGps =usGps;
- ShowGPSICon(0);
- }
- //时间显示
- ShowTime(0);
-
- //锁和耳机标志
- if(g_uslockflag==1){
- GuiShowBmp(72,110,"lock.bmp");
- }
-
- if(Earcheck!=EarFlag)
- {
- if(!Earcheck){
- GuiClearRectM20(110,3,110+16,16);
- }else GuiShowBmp(110,3,"Ear.bmp");
- EarFlag=Earcheck;
- }
-
- if(ChangeIng!=GPIO_ReadInputDataBit(CHARGEChek_PORT,CHARGEChek_PIN)){
- ChangeIngCt=5;
- MODEM_VBUS_EN_LOW;
- os_dly_wait(100);
- MODEM_VBUS_EN_HIGH;
- LCDTimeOut(0); //插USB亮屏
- ChangeIng=GPIO_ReadInputDataBit(CHARGEChek_PORT,CHARGEChek_PIN);
- VbatStatue=1;
- }
-
- //电量显示
- if(!sutPocStatus.Speaker &&!sutPocStatus.PPTpress)//防止对讲时候拉低低压,显示不准
- {
- if(siVbat!=g_iVbat || g_iVbat < WARN_PWR_LEVEL||VbatStatue){
- siVbat=g_iVbat;
- ShowBatttery(g_iVbat,VbatStatue);
- VbatStatue=0;
- }
- }
-
- }
- void ShowMessageBox(char *msg)
- {
- char buf[70];
- u16 len,x,y;
- y=LCD_HEIGHT/2;
- GuiClearRect(0,y-20,159,y+20);
- GuiDrawRect(2,y-18,157,y+18,1);
- StrIntercept(buf,msg,18);//18
- len=GetStrXLen(buf);
- x=(LCD_WIDTH-len)/2;
- GuiShowStr(x,y-8,buf,0x01);
- }
- void ShowNumBox(unsigned short msg)
- {
- char buf[10];
- u16 len,x,y;
-
- y=LCD_HEIGHT/2; //中间
- GuiClearRect(0,y-20,159,y+20);
- //GuiDrawRect(2,y-6,157,y+16,1); //上面显示要修改的号码 下面显示文字
- GuiDrawRect(2,y-6,130,y+16,1);
- // StrIntercept(buf,(char *)msg,18);
- snprintf(buf, sizeof(buf),"%u",msg);
- len=GetStrXLen(buf);
- //x=(LCD_WIDTH-len)/2;
- GuiShowStr(4,y,buf,0x01);
- }
- /************************************************************************
- ShowButton
- 显示一个按钮
- *************************************************************************/
- void ShowButton(u16 x,u16 y,const char *str)
- {
- int len;
- len=GetStrXLen((char *)str);
- GuiClearRect(x,y,x+len+8,y+20);
- GuiShowStr(x+4,y+2,str,0x01);
- GuiReverseRect(x,y,(x+len+8),(y+16+4));
- }
- void ShowButton2(u16 x,u16 y,const char *str)
- {
- int len;
- len=GetStrXLen((char *)str);
- GuiClearRect(x,y,x+len+8,y+20);
- GuiShowStr(x+4,y+2,str,0x01);
- GuiReverseRect(x,y,(x+len+8),(y+16+4));
- }
- void Show_Net(unsigned int s_netshowvalue)
- {
- if(s_netshowvalue==0||s_netshowvalue==2){
- GuiShowStrM20(28,4,"2G",1,COLOR_WHITE,COLOR_BLACK);
-
- }else if(s_netshowvalue==4){
- GuiShowStrM20(28,4,"4G",1,COLOR_WHITE,COLOR_BLACK);
- }else {
- GuiClearRectM20(28,4,45,18);
- }
- }
- //stack init
- void Init_stack(struct UI_STACK* s)
- {
- memset(s->sta,0,sizeof(s->sta));
- s->top=-1;
- }
- //push stack
- int PushUiStack(struct UI_STACK *s,int data)
- {
- if(s->top==4){
- printf("stack full\r\n");
- return 1;
- }
-
- (s->top)++;
- s->sta[s->top]=data;
- return 0;
- }
- //pull stack
- int PullUiStack(struct UI_STACK *s)
- {
- int tmp;
- if(s->top<0){
- printf("stack is empty\r\n");
- return -1;
- }else {
- tmp=(s->sta)[s->top];
- (s->top)--;
- return tmp;
- }
-
- }
|