123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188 |
- #include "includes.h"
- char showPIP[40];
- char showGIP[40];
- signed char netshowvalue=-1;
- signed char tempnetshowvalue=-1;
- //unsigned char Nonloop=0; //第一次按菜单不压栈
- SUT_UI_STATUS sutUIstatus;
- UI_STACK UI_Stack;
- SUT_LIST_BOX sutListBox;
- SUT_PALACE sutPalace;
- static void UserAssistAdd(void);
- static void UI_Loop(void);
- PT_THREAD (ptUITask(struct pt *pt)){
- static timer_t ptTimer;
- PT_BEGIN(pt);
- while(1){
- if(uTimerExpired(&bootMapCnt))UI_Loop();
- UI_Key();
- PTTimerStart(&pt_timerPool, &ptTimer, 1);//1
- PT_WAIT_UNTIL(pt, PTTimerIsExpired(&ptTimer));
- }
- PT_END(pt);
- }
- /******************************************************
- UISetNextStatus
- 设置下一个UI状态
- *******************************************************/
- void UISetNextStatus(unsigned char status)
- {
- sutUIstatus.LastStatus=sutUIstatus.NextStatus;
- sutUIstatus.NextStatus=status;
- }
- void UI_Init(void)
- {
- memset(&sutUIstatus,0,sizeof(SUT_UI_STATUS));
- UISetNextStatus(UIS_STANDBY);
- }
- void ShowSingle(int CSQ);
- static void ShowGPSICon(void);
- static void ShowBatttery(int bat);
- static void ShowTime(char update);
- static void Show_Net(unsigned int s_netshowvalue);
- /************************************************************************
- ShowStatusBar
- 显示状态栏
- *************************************************************************/
- void ShowStatusBar(char Update,char change)
- {
- 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 char s_netshowvalue=-1;
- //static signed char danhu=-1;
- static signed char ItemShow=-1;
- static signed char LastSimSelect=-1;
- static signed char LastthisYunYingShang=-1;
- static signed char lastcharge=1;
-
- if(ItemShow==-1){
- GuiFillRect(0,0,159,STATUS_BAR_HEIGH-1,COLOR_DEFAULT_BLUE);
- GuiFillRect(0,STATUS_BAR_HEIGH,159,STATUS_ITEM_HEIGH-1,COLOR_WARN_RED);
- ItemShow=1;
- }
- if(LastthisYunYingShang!=thisYunYingShang && sutUIstatus.Status==UIS_STANDBY){
- GuiFillRect(0,STATUS_BAR_HEIGH,159,STATUS_ITEM_HEIGH-1,COLOR_WARN_RED);
- switch(thisYunYingShang){
- case CHINA_TELECOM:
- ShowCaption("中国电信",STATUS_BAR_HEIGH);
- break;
- case CHINA_MOBILE:
- ShowCaption("中国移动",STATUS_BAR_HEIGH);
- break;
- case CHINA_UNICOM:
- ShowCaption("中国联通",STATUS_BAR_HEIGH);
- break;
- case CHINA_NONE:
- ShowCaption("公网集群对讲系统",STATUS_BAR_HEIGH);
- break;
- }
- LastthisYunYingShang=thisYunYingShang;
- }
-
-
- //2G-4G显示
- if(s_netshowvalue!=netshowvalue){
- s_netshowvalue=netshowvalue;
- Show_Net(s_netshowvalue);
- }
-
- //卡在位
- if(sutPocStatus.CardStatus&&SIMSelect!=LastSimSelect){
- if(SIMSelect==0)GuiShowBmp(20,3,"SIM1.bmp");
- else GuiShowBmp(20,3,"SIM2.bmp");
- LastSimSelect=SIMSelect;
- }
-
- //信号显示
- if(siCSQ!=g_iCSQ || lastPPPStatus != netPPP){
- lastPPPStatus=netPPP;
- siCSQ=g_iCSQ;
- ShowSingle(g_iCSQ);
- }
-
- if(batFirstShow < 100)
- {//开机大概前1秒显示50%电量,之后根据实际显示
- g_iVbat=360;
- batFirstShow++;
- }
- //电量显示
- //if(lastcharge==1)return;
- if(siVbat!=g_iVbat || g_iVbat < WARN_PWR_LEVEL||lastcharge!=Chargeing){
- siVbat=g_iVbat;
- lastcharge=Chargeing;
-
- if(lastcharge==0) GuiShowBmp(106,1,"CHARGEBAT.bmp");//GuiShowBmp(106,1,"CHARGEBAT.bmp");
- else ShowBatttery(g_iVbat);
-
- }
- //消息显示
- //ShowMessageFlag(0);
-
- //GPS显示
- // usGps=((unsigned short)sutGpsInfo.isGpsWork<<8) | ((unsigned short)sutGpsInfo.isGpsValid) | ((unsigned short)sutGpsInfo.isGpsAuthOk<<2);
- //
- // if(susGps!=usGps ){
- // susGps =usGps;
- // ShowGPSICon();
- // }
- //
- //时间显示
- ShowTime(Update);
-
- if(g_uslockflag==1){
- GuiShowBmp(92,0,"lock.bmp");
- }
-
-
- }
- static void ShowCallUserName(u16 x,u16 y);
- static void ShowGroupAndUserName(u16 x,u16 y,int update);
- static void UIShowGroupSel(int update);
- static void UIShowUserSel(int update);
- static void ReFlashItem(void);
- static void UIShowMenuMain(int update);
- SUT_MENU sutMenuMain;
- int siCt1=-1;
- void UIShowMainInterface(char StatusUpdate)
- {
- int Flag;//主界面状态:0--未登录 1--无人说话 2--本机说话 3--对方说话
- static int siLastFlag=-1;//上一个Flag状态值
- static int siCt=0;
- char info[20];
- static unsigned char lastLoginResult=0xff;
- static signed char danhu=-1;
- char Ylseek=4;//Y轴偏移 8
-
- if(StatusUpdate){
-
- GuiClearAll();
- switch(thisYunYingShang){
- case CHINA_TELECOM:
- ShowCaption("中国电信",STATUS_BAR_HEIGH);
- break;
- case CHINA_MOBILE:
- ShowCaption("中国移动",STATUS_BAR_HEIGH);
- break;
- case CHINA_UNICOM:
- ShowCaption("中国联通",STATUS_BAR_HEIGH);
- break;
- case CHINA_NONE:
- ShowCaption("公网集群对讲系统",STATUS_BAR_HEIGH);
- break;
- }
- danhu=sutPocStatus.danHunStatus;
- if(danhu==0) GuiClearArea(100,110,30,14);//GuiClearRect(120,110,160,14);//136
- else GuiShowStr(100,110,"挂断",0x01,0);
- siLastFlag=-1;
- siCt=0;
- return;
- }
-
- if(danhu!=sutPocStatus.danHunStatus)
- {
- danhu=sutPocStatus.danHunStatus;
- if(danhu==0) GuiClearArea(100,110,30,14);//GuiClearRect(120,110,160,14);//136
- else GuiShowStr(100,110,"挂断",0x01,0);
- }
- if(Ui_LockFlag==1){
- ShowMessageBox("请先解锁!");
- uTimerHardDly(50);
- }
-
-
- //======以下持续调用,以便动态更新信息==========
- //----顶部显示状态栏-----------
- //-----登陆状态标志更新--------
- if(0==sutPocStatus.Logined){//未登录时,显示LOGO
- Flag=0;
- }else if(sutPocStatus.Speaker==0 && sutPocStatus.Mic==0){//对方未说话,本机未说话
- Flag=1;
- siCt1=0;
- }else if(sutPocStatus.Mic>0 ){//对方未说话,本机说话
- Flag=2;
- }else if(sutPocStatus.Speaker>0){//对方说话了
- Flag=3;
- }
- //-------中间图片显示-------
- switch(Flag){
- case 0://未登录
- if(Flag!=siLastFlag||Ui_LockFlag){
- GuiClearRect(0,STATUS_ITEM_HEIGH,LCD_WIDTH,44+64);
- GuiShowBmp(0,44,"logo.bmp");
- }
- break;
- case 1://已登录,但无人说话
- if(Flag!=siLastFlag||Ui_LockFlag){
- GuiClearRect(0,STATUS_ITEM_HEIGH,LCD_WIDTH-1,STATUS_ITEM_HEIGH+7);
- GuiClearRect(0,STATUS_ITEM_HEIGH+20+20+8,127,STATUS_ITEM_HEIGH+20+20+20+12);
- GuiShowBmp(0,STATUS_ITEM_HEIGH+20+20+8+8,"Phone.bmp");
- GuiShowStr(16,STATUS_ITEM_HEIGH+20+20+8+8,"空闲",0x10,0);
- sutPocStatus.statusChaned = 1;
- }
- break;
- case 2://已登录,本机说话
- if(Flag!=siLastFlag||Ui_LockFlag){
- GuiClearRect(0,STATUS_ITEM_HEIGH+20+20+8,LCD_WIDTH-1,STATUS_ITEM_HEIGH+20+20+8+20);
- }
- GuiShowBmp(0,STATUS_ITEM_HEIGH+20+20+8+8,"Csend.bmp");
- GuiShowStr(16,STATUS_ITEM_HEIGH+20+20+8+8,"本机在讲话",0x10,0);
- break;
-
- case 3://已登录,对方说话
- if(Flag!=siLastFlag||Ui_LockFlag)
- {
- GuiShowBmp(0,STATUS_ITEM_HEIGH+20+20+8+8,"Creceive.bmp");
- GuiClearRect(16,STATUS_ITEM_HEIGH+20+20+8+8,127,STATUS_ITEM_HEIGH+20+20+20+8+8);
- }
- //显示对方名字
- ShowCallUserName(16,STATUS_ITEM_HEIGH+20+20+8+8);
- break;
- }
-
- //------群组、用户显示--------
- if(Flag>0){//已登陆
-
- if((Flag!=siLastFlag&&(siLastFlag==0||siLastFlag==-1))||Ui_LockFlag)
- {
- ShowGroupAndUserName(0,STATUS_ITEM_HEIGH+8,1);//当前群组和用户名显示 18
- }else {
- ShowGroupAndUserName(0,STATUS_ITEM_HEIGH+8,0);//当前群组和用户名显示 18
- }
-
- }else{//未登陆
- memset(info, ' ',sizeof(info));
- memcpy(info, "正在登陆.", 9);
- if(0==siCt)
- {
- GuiShowStr(0,STATUS_ITEM_HEIGH,info,1,0);
- }
- else if(100==siCt)
- {
- info[9]='.';
- GuiShowStr(0,STATUS_ITEM_HEIGH,info,1,0);
- }
- else if(200==siCt)
- {
- info[9]='.';info[10]='.';
- GuiShowStr(0,STATUS_ITEM_HEIGH,info,1,0);
- }
-
- if(lastLoginResult != sutPocStatus.loginResult || siLastFlag==-1)
- {
-
- if(sutPocStatus.loginResult==1) snprintf(info, sizeof(info), "账号信息错误");
- else if(sutPocStatus.loginResult==2) snprintf(info, sizeof(info), "无网络连接 ");
- else if(sutPocStatus.loginResult==4) snprintf(info, sizeof(info), "请插卡 ");
- else if(sutPocStatus.loginResult==5&&lastLoginResult!=1) snprintf(info, sizeof(info), "无法连接");
- else if(sutPocStatus.loginResult==6) snprintf(info, sizeof(info), "没有服务");
- else {
- lastLoginResult=sutPocStatus.loginResult;
- goto NEXT_STEP;
- }
- lastLoginResult=sutPocStatus.loginResult;
- GuiShowStr(0,STATUS_ITEM_HEIGH+16,info,1,0);
- }
- }
- Ui_LockFlag=0;
- NEXT_STEP:
- //-------
- if(++siCt>=300)siCt=0;
-
- if(Flag!=siLastFlag){//状态变化 才更新 分页
- siLastFlag=Flag;
- siCt=0;
- }
- }
- /******************************************************
- UIShowMenuSysSetup
- 系统设置菜单
- *******************************************************/
- //SUT_MENU sutMenuSysSetup;
- void UIShowMenuSysSetup(int update)
- {
-
- static const char *apcMenuSysSetup[]={
- "1.LCD时长设置",
- "2.亮度调节",
- // "3.网络设置",
- // "4.提示音设置",
- "3.SIM选择",
- // "6.麦克风增益",
- "4.串口功能切换",
- "5.功耗模式设置",
- "6.服务器设置",
- "7.对讲版本升级",//此项放最后
- ""
- ////"6.场景模式",
- //"6.编码器设置",
- };
-
- static char *staticMenum[11];
- char i;
- char numb=0;
- while(*apcMenuSysSetup[numb++]);
- numb--;
- if(update){
- GuiClearAll();
- ShowCaption("系统设置",STATUS_BAR_HEIGH); //1
- if(hgs_poc_type != POC_OWN){
- for(i=0;i<4;i++) staticMenum[i]=(char *)apcMenuSysSetup[i];
- staticMenum[i]=(char *)apcMenuSysSetup[numb];
- MenuInit(&sutMenuSysSetup,staticMenum);
- }else MenuInit(&sutMenuSysSetup,apcMenuSysSetup);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- GuiDrawHLine(0,127,110,1);
- return;
- }
- }
- /******************************************************
- UI_Loop
- UI循环调用,需要在MainTask的主循环中持续调用,及时处理状态发生变化时的UI显示
- 此处按下OK键显示里面内容
- *******************************************************/
- void UI_Loop(void)
- {
- char StatusUpdate=0;
- if(sutUIstatus.Status!=sutUIstatus.NextStatus||sutUIstatus.ItemRefresh){//状态发生变更
- sutUIstatus.LastStatus=sutUIstatus.Status;
- sutUIstatus.Status=sutUIstatus.NextStatus;
- StatusUpdate=1;
- }
-
- ShowStatusBar(1,StatusUpdate);//顶部状态栏
- switch(sutUIstatus.Status){
- case UIS_STANDBY:
- // Nonloop=1;
- Init_stack(&UI_Stack);//UI 返回栈
- UIShowMainInterface(StatusUpdate);
- 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_CALL_TO_PHONE:
- CallToPhoneNum(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_LCDBRIGHT:
- SetLcdBrightShow(StatusUpdate);
- break;
-
- ////////////////////////////
- case UIS_SET_NET:
- SetNetShow(StatusUpdate);
- break;
- ///////////////////////////
- case UIS_SET_SERVER_PASS:
- UIShowPOCSerPass(StatusUpdate);
- break;
- case UIS_SET_SERVER:
- UIShowPOCSer(StatusUpdate);
- break;
- case UIS_SET_CODETYPE:
- SetCodeTypeShow(StatusUpdate);
- break;
- case UIS_SET_KEYSound:
- SetKeySoundShow(StatusUpdate);
- break;
- case UIS_SET_SOUNDMODE:
- SetSoundModeShow(StatusUpdate);
- break;
- case UIS_SET_PWRMODE:
- SetPowerModeShow(StatusUpdate);
- break;
- case UIS_SET_POC_FOTA:
- SetUpIntercomVerShow(StatusUpdate);
- break;
- case UIS_SET_USBTTL:
- SetUSBorTTLShow(StatusUpdate);
- break;
- case UIS_SET_SIMCARD:
- SetCardShow(StatusUpdate);
- break;
- case UIS_SET_MICLV:
- SetMicLvSelectShow(StatusUpdate);
- break;
- case UIS_POWEROFF_WAIT:
- PoweroffWaitShow(StatusUpdate);
- break;
- }
- }
- SUT_MENU sutMenuMain;
- static void UserSelResponse();
- static void GroupSelResponse();
- void UI_Key()
- {
- int key;
- char buf[30];
- if(!isKeyPress()) return;
- if(g_ucTMMode!=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_DOWN:
- if(g_uslockflag==1)return;
- if(sutPocStatus.danHunStatus==1) {
- if(hgs_poc_type==POC_OWN)ModemSendAt("AT+POC=500000\r\n");
- else {
- snprintf(buf, sizeof(buf),"AT+POC=entergroup,%d\r\n",sutPocStatus.LocalGroup.ID);
- ModemSendAt(buf);
- }
- }
- break;
- }
- break;
-
- case UIS_MENU_MAIN://----主菜单----
- //sutMenuSysSetup
- key=RollMenuResponse(&sutMenuSysSetup);
- if(KEY_PANEL_MENU==g_ulKeyValue){
-
- switch(sutMenuSysSetup.handle){
- case 0://群组选择
- UISetNextStatus(UIS_MENU_GROUP_SEL);
- break;
- case 1://成员选择
- UISetNextStatus(UIS_MENU_USER_SEL);
- break;
- case 2:
- UISetNextStatus(UIS_SET_NET);
- break;
- case 3:
- UISetNextStatus(UIS_SET_KEYSound);
- break;
- case 4: //系统设置
-
- UISetNextStatus(UIS_MENU_SYS_SET);
- break;
- case 5://终端信息
- UISetNextStatus(UIS_MENU_INFO);
- break;
- }
- PushUiStack(&UI_Stack,sutMenuSysSetup.handle);//
- }
- else if(KEY_PANEL_OK==g_ulKeyValue){
- UISetNextStatus(UIS_STANDBY);
- }
- break;
- case UIS_MENU_GROUP_SEL://-----群组选择-----
- GroupSelResponse();
- break;
-
- case UIS_MENU_USER_SEL://-----成员选择-----
- UserSelResponse();
- break;
-
- case UIS_MAIL_BOX://-----短信查阅-----
- MessageResponse();
- break;
-
- case UIS_MENU_SYS_SET://-----系统设置-----
- SetSYSResponse(); //名字没取好,实际上是系统
- break;
-
- case UIS_MENU_INFO://-----终端信息-----
- if(KEY_PANEL_OK==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_LCDBRIGHT:
- SetLcdBrightResponse();
- break;
- ////////////////////////////////////
- case UIS_SET_NET:
- SetNetResponse();
- break;
- //////////////////////////////////
- case UIS_SET_SERVER_PASS:
- POCSetSerPassResponse();
- break;
- case UIS_SET_SERVER:
- POCSetSerResponse();
- break;
- case UIS_SET_CODETYPE:
- SetCodeTypeResponse();
- break;
- case UIS_SET_KEYSound:
- SetKeysoundResponse();
- break;
- case UIS_SET_SOUNDMODE:
- SetSoundModeResponse();
- break;
- case UIS_SET_PWRMODE:
- SetPowerModeResponse();
- break;
- case UIS_SET_POC_FOTA:
- SetUpIntercomVerResponse();
- //SetPocFotaResponse();
- break;
- case UIS_SET_USBTTL:
- SetUSBorTTLResponse();
- break;
- case UIS_SET_SIMCARD:
- SetCardResponse();
- break;
-
- case UIS_SET_MICLV:
- SetMicLvSelectResponse();
- break;
- case UIS_POWEROFF_WAIT:
- PoweroffWaitResponse();
- break;
-
- default:
- break;
- }
- }
- /***********************************
- 显示信号状态
- **********************************/
- void ShowSingle(int CSQ)
- {
- if(netPPP == OPEN) GuiShowBmp(0,0+2,"SingleOK.bmp");
- else GuiShowBmp(0,0+2,"Single.bmp");
- //11 3格
- if(CSQ<1 || CSQ==99){
- GuiClearRect(7,3,18,11);
- }else if(CSQ<8){
- GuiDrawVLine(9,10,7,2,COLOR_WHITE_BACK);
- GuiClearRect(9,3,18,11);
-
- }else if(CSQ<16){
- GuiDrawVLine(9,10,7,2,COLOR_WHITE_BACK);
- GuiDrawVLine(7,10,10,2,COLOR_WHITE_BACK);
- GuiClearRect(13,3,18,11);
- }else if(CSQ<22){
- GuiDrawVLine(9,10,7,2,COLOR_WHITE_BACK);
- GuiDrawVLine(7,10,10,2,COLOR_WHITE_BACK);
- GuiDrawVLine(5,10,13,2,COLOR_WHITE_BACK);
- GuiClearRect(16,3,18,11);
- }else{
- GuiDrawVLine(9,10,7,2,COLOR_WHITE_BACK);
- GuiDrawVLine(7,10,10,2,COLOR_WHITE_BACK);
- GuiDrawVLine(5,10,13,2,COLOR_WHITE_BACK);
- GuiDrawVLine(3,10,16,2,COLOR_WHITE_BACK);//COLOR_DEFAULT_BLUE
- }
- //2G-4G 显示
- //GuiShowBmp(28,5,"2g.bmp");
- }
- static void ShowGPSICon(void)
- {
- GuiClearRect(45,0,75,11);//30
- if(0== sutGpsInfo.isGpsWork) GuiClearRect(45,0,75,11);//未工作或未检测到
- else
- {
- //GPS已工作
- if(0 == sutGpsInfo.isGpsValid)
- {//未定位
- if(sutGpsInfo.isGpsAuthOk==0)//未鉴权
- {
- GuiShowBmp(45,0,"GPS1.bmp");
- }else//已鉴权
- {
- GuiShowBmp(45,0,"GPSA.bmp");//已鉴权
- }
- }else
- {//已定位
- if(sutGpsInfo.isGpsAuthOk==0)//未鉴权
- {
- GuiShowBmp(45,0,"GPS1.bmp");
- }else//已鉴权
- {
- GuiShowBmp(45,0,"GPSA.bmp");//已鉴权
- }
- GuiShowBmp(45+10,0,"GPS2.bmp");//定位辐射放最后//2
- }
- }
- }
- static void ShowBatttery(int bat)
- {
- static unsigned int flashCnt=0;
- static unsigned char flag=0;
- int x=106;
-
- if(bat<WARN_PWR_LEVEL){//请充电
- if(uTimerExpired(&flashCnt)==0) return;
- uTimerStart(&flashCnt, 80);
- if(flag==0)
- {
- GuiShowBmp(x,1,"VBAT1.bmp");
- flag=1;
- }else{
- flag=0;
- GuiClearRect(x,0,x+21,1+12);
- }
- //GuiDrawVLine(5,12,64+x,2,COLOR_WARN_RED);
- }
- else if(bat<355){//340<x<=355 1格
- GuiShowBmp(x,1,"VBAT1.bmp");//3
- GuiDrawVLine(3,8,x+16,3,COLOR_WHITE_BACK);
- }
- else if(bat<375){//355<x<=375 2格
- GuiShowBmp(x,1,"VBAT1.bmp");
- GuiDrawVLine(3,8,x+12,3,COLOR_WHITE_BACK);
- GuiDrawVLine(3,8,x+16,3,COLOR_WHITE_BACK);//5.12
- }
- else if(bat<400){//375<x<=400 3格
- GuiShowBmp(x,1,"VBAT1.bmp");
- GuiDrawVLine(3,8,x+8,3,COLOR_WHITE_BACK);
- GuiDrawVLine(3,8,x+12,3,COLOR_WHITE_BACK);
- GuiDrawVLine(3,8,x+16,3,COLOR_WHITE_BACK);//5.12
- }
- else{//>=400 4格
- GuiShowBmp(x,1,"VBAT1.bmp");
- GuiDrawVLine(3,8,x+4,3,COLOR_WHITE_BACK);
- GuiDrawVLine(3,8,x+8,3,COLOR_WHITE_BACK);
- GuiDrawVLine(3,8,x+12,3,COLOR_WHITE_BACK);
- GuiDrawVLine(3,8,x+16,3,COLOR_WHITE_BACK);//5.12
- }
- }
- static void ShowTime(char update)
- {
- static unsigned char lastS=0xff;
- USER_RTC_DEF tempTime;
-
- char buf[30];
- if(sutPocStatus.FirstLogined==0) return;
- RTC_UserGetTime(&tempTime);
- if(lastS != tempTime.second || update){
- lastS=tempTime.second;
- if(lastS % 2) snprintf(buf, sizeof(buf),"%02d:%02d",tempTime.hour,tempTime.min);
- else snprintf(buf, sizeof(buf),"%02d %02d",tempTime.hour,tempTime.min);
- GuiShowStr(48,0,buf,0x01,0);
- }
- }
- static void Show_Net(unsigned int s_netshowvalue)
- {
- if(sutPocStatus.loginResult==4)return; //未插卡不显示2G
- if(s_netshowvalue==2||s_netshowvalue==0){
- GuiShowStr(30,0,"2G",0x01,0);
- }else if(s_netshowvalue==7){
- GuiShowStr(30,0,"4G",0x01,0);
- }else {
- GuiClearRect(30,0,46,10);
- }
- }
- 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+32,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);
- GuiShowStr(x,y,sutPocStatus.Callname,0x10,0);
- }
- if(++siCt>100) siCt=0;
- }
- /******************************************************
- 在同一个位置交替显示本机用户名和本机当前群组名
- 参数:x,y 显示位置左上角的坐标
- update ==0 时根据内部静态群组名比较决定是否刷屏显示
- update !=0 时强制刷屏显示
- ******************************************************/
- static void ShowGroupAndUserName(u16 x,u16 y,int update)
- {
- static char scNameUser[POC_GROUP_NAME_LEN];
- static char scNameGroup[POC_GROUP_NAME_LEN];
- char name[POC_GROUP_NAME_LEN];
- u16 len;
- unsigned char danHuanBuffer[9]={0xB5,0xA5,0xBA,0xF4,0xC4,0xA3,0xCA,0xBD,0};
- char GroupShowUpdate=0;
- if(sutPocStatus.danHunStatus==0){
- if(0!=strcmp(sutPocStatus.LocalGroup.name,scNameGroup) || update!=0){
- memcpy(scNameGroup,sutPocStatus.LocalGroup.name,sizeof(scNameGroup));
- GroupShowUpdate=1;
- }
- }else{
- if(0!=strcmp((char *)danHuanBuffer,scNameGroup) || update!=0){
- memcpy(scNameGroup, danHuanBuffer,sizeof(danHuanBuffer));
- 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,LCD_WIDTH-1,y+20);//18
- GuiClearRect(x,y+20,LCD_WIDTH-1,y+20+20);//18
-
- // if(sutPocStatus.danHunStatus==0){
- // GuiShowStr(x,y+3,"群组:",0x01,0);
- //
- // }else GuiShowStr(x,y+3,"单呼:",0x01,0);
- //
- // GuiShowStr(x,y+20+3,"成员:",0x01,0);
- // GuiShowStr(x,y+20+20+3,"话权:",0x01,0);
- GuiShowBmp(x,y,"Group2.bmp");
- GuiShowBmp(x,y+16+8,"people2.bmp");
-
- StrIntercept(name,scNameGroup,sizeof(name));
- GuiShowStr(x+16,y,name,0x10,0);
- StrIntercept(name,scNameUser,sizeof(name));
- GuiShowStr(x+16,y+24,name,0x10,0);
- sutPocStatus.statusChaned=1;
- GroupShowUpdate=0;
- }
- }
- void ReFlashItem2(void)
- {
- static unsigned short susCt=0;
- static const char *accIconFileName[]={
- "Group1.bmp",
- "Group2.bmp",
- ""
- };
- int i;
- unsigned short timeout;
- static char NullGroup=0;
- static char *GroupsName[POC_ALL_GROUPS_NUM+1]; //5
- static char GroupFeatures[POC_ALL_GROUPS_NUM+1];//5
- unsigned char buf[10];
- //----------------------------
- for(i=0;i<=POC_ALL_GROUPS_NUM;i++){
- GroupsName[i]=&NullGroup;
- GroupFeatures[i]=0;
- }
- // printf("name111====%d\r\n",sutPocStatus.ListFillIndex);
-
- for(i=0;i<sutPocStatus.ListFillIndex;i++)
- {
- GroupFeatures[i]=1;
- if(sutPocStatus.AllGroups[i].ID==sutPocStatus.LocalGroup.ID)GroupFeatures[i]=0;
- GroupsName[i]=sutPocStatus.AllGroups[i].name;
- //printf("name====%s\r\n",GroupsName[i]);
- }
-
- if(sutPocStatus.ListCurOnlineNum==0)
- {
- GroupsName[0]="空";
- GroupFeatures[i]=0;
- }
- GuiShowStr(2,STATUS_BAR_HEIGH,"群组选择",0x01,0);
- snprintf(buf,sizeof(buf),"%03d/%03d",sutPocStatus.ListCurOnlineNum,sutPocStatus.handleIndex*5+1);
- GuiShowStr(68,STATUS_BAR_HEIGH,buf,0x01,0);
- //初始化ListBox控件
- ListBoxInit(&sutListBox,GroupsName,0,accIconFileName,GroupFeatures);
- }
- /******************************************************
- UIShowGroupSel
- 群组选择
- *******************************************************/
- static void UIShowGroupSel(int update)
- {
- static char machine;
- static unsigned int timer;
-
- static unsigned short susCt=0;
- unsigned short timeout;
- char temp;
-
- if(update){
- machine=0;
- susCt=0;
- }
- switch(machine){
- case 0:
- if(sutPocStatus.Logined == 0){//not login
- ShowMessageBox(" 请先登录... ");
- uTimerStart(&timer, 50);
- machine=1;
- }else{
- UiassistStart(0);
- machine=2;
- }
- break;
- case 1:
- if(uTimerExpired(&timer)){
- UISetNextStatus(UIS_STANDBY);
- }
- break;
- case 2:
- temp=getAssistResult();
- if(temp){//获取完成
- printf("temp===%d\r\n",temp);
- GuiClearAll();
- ReFlashItem2();
- GuiDrawHLine(0,127,110,1);
- machine=3;
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- }
- break;
- }
- if(machine != 3) return;
- //按键提示
- if(susCt==0){
- // GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择 [下]选择",0x01,0);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 确定 下翻>",0x01,0);
- }else if(susCt==200){
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"退出[M]确定",0x01,0);
- }
-
- if(++susCt>=400)susCt=0;
- UserAssistAdd();
- }
- static void ReFlashItem(void)
- {
- //char buf[100];
- static const char *accIconFileName[]={
- "people1.bmp",
- "people2.bmp",
- ""
- };
- int i;
- static char NullUser=0;
- static char *UsersName[POC_ALL_USERS_NUM+1]; //5
- static char UserFeatures[POC_ALL_USERS_NUM+1];//5
- unsigned char buf[10];
- //----------------------------
-
- for(i=0;i<=POC_ALL_USERS_NUM;i++){
- UsersName[i]=&NullUser;
- UserFeatures[i]=0;
- }
- for(i=0;i<sutPocStatus.ListFillIndex;i++)
- {
- UserFeatures[i]=1;
- //UserFeatures[i]=sutPocStatus.AllUsers[i].status-1;
- if(sutPocStatus.AllUsers[i].ID==sutPocStatus.LocalGroup.ID)UserFeatures[i]=0;
- UsersName[i]=sutPocStatus.AllUsers[i].name;
- }
- if(sutPocStatus.ListCurOnlineNum==0)
- {
- UsersName[0]="空";
- UserFeatures[i]=0;
- }
- GuiShowStr(2,STATUS_BAR_HEIGH,"成员选择",0x01,0);
- snprintf(buf,sizeof(buf),"%03d/%03d",sutPocStatus.ListCurOnlineNum,sutPocStatus.handleIndex*5+1);
- GuiShowStr(68,STATUS_BAR_HEIGH,buf,0x01,0);
- //初始化ListBox控件
- ListBoxInit(&sutListBox,UsersName,0,accIconFileName,UserFeatures);
- }
- /******************************************************
- UIShowUserSel
- 用户选择
- *******************************************************/
- static void UIShowUserSel(int update)
- {
- static char machine;
- static unsigned int timer;
-
- static unsigned short susCt=0;
- unsigned short timeout;
-
- if(update){
- machine=0;
- susCt=0;
- }
- switch(machine){
- case 0:
- if(sutPocStatus.Logined == 0){//not login
- ShowMessageBox(" 请先登录... ");
- uTimerStart(&timer, 50);
- machine=1;
- }else{
- UiassistStart(0);
- machine=2;
- }
- break;
- case 1:
- if(uTimerExpired(&timer)){
- UISetNextStatus(UIS_STANDBY);
- }
- break;
- case 2:
- if(getAssistResult()){//获取完成
- GuiClearAll();
- ReFlashItem();
- GuiDrawHLine(0,159,110,1);
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 单呼 下翻>",0x01,0);
- machine=3;
- }
- break;
- }
- if(machine != 3) return;
-
- //按键提示
- if(susCt==0){
- GuiShowStr(0,SUBSCRIPT_LOCATION,"<退出 单呼 下翻>",0x01,0);
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[上]选择 [下]选择",0x01,0);
- }else if(susCt==200){
- //GuiShowStr(0,SUBSCRIPT_LOCATION,"[EXIT]退出[M]单呼",0x01,0);
- }
- if(++susCt>=400)susCt=0;
- UserAssistAdd();
- }
- /******************************************************
- UIShowMenuMain
- 显示主菜单
- *******************************************************/
- SUT_MENU sutMenuMain;
- void UIShowMenuMain(int update)
- {
- static const char *apcMenuMain[]={
- "群组选择",
- "成员选择",
- "网络设置",//"文本消息",
- "按键音设置",//"定位设置",
- "系统设置",
- "终端信息",
- ""
- };
-
- if(update){
-
- #ifdef ROLLMENU
- RollMenuInit(&sutMenuSysSetup,apcMenuMain);
- #else
- PalaceInit(&sutPalace,apcMenuMain,"Palace","主菜单");
- #endif
- }
- }
- static char SelMachine=0; //上一次仍在处理标志
- static void UserAssistAdd(void){
- switch(SelMachine){
- case 1:
- if(getAssistResult()){
- if(sutUIstatus.Status==UIS_MENU_GROUP_SEL)ReFlashItem2();//指针会被重置到0位置
- else ReFlashItem();
- SelMachine=0;
- }
- break;
- case 2:
- if(getAssistResult()){
- if(sutUIstatus.Status==UIS_MENU_GROUP_SEL)ReFlashItem2();//指针会被重置到0位置
- else ReFlashItem();
- SelMachine=0;
- }
- break;
- }
- }
- static void UserSelResponse(){
- char buf[50];
- unsigned long key;
- switch(SelMachine){
- case 0:
- if(sutListBox.handle==0 && KEY_PANEL_UP==g_ulKeyValue){
- UiassistStart(1);
- SelMachine=1;
- }else if((sutListBox.handle+1) == sutListBox.itemnum && (KEY_PANEL_DOWN==g_ulKeyValue)){
- UiassistStart(2);
- SelMachine=2;
- }
-
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_OK==g_ulKeyValue){
- uiAssist.status=0;
- if(UI_Stack.FastUiChange)UISetNextStatus(UIS_STANDBY);
- else UISetNextStatus(UIS_MENU_MAIN);
- }else if(KEY_PANEL_MENU==key){
- //单呼成员 AT+POC=AT+POC=0A0000xxxxxxxx
- ///////////////////////////////////////
- if(0 == sutPocStatus.ListCurOnlineNum){
- break;
- }
- ///////////////////////////////////////
- UiassistEnd(1);
- if(hgs_poc_type==POC_BND)ModemSendAt("AT+POC=autoleavetime,30\r\n");//单呼30秒无人通话自动解散
- if(hgs_poc_type==POC_BND)snprintf(buf, sizeof(buf),"AT+POC=singlecall,%d\r\n",sutPocStatus.AllUsers[sutListBox.handle].ID);
- else snprintf(buf, sizeof(buf),"AT+POC=0A0000%08x\r\n",sutPocStatus.AllUsers[sutListBox.handle].ID);
- ModemSendAt(buf);
- SlwTrace(INF, buf,1);
- snprintf(buf, sizeof(buf),"呼叫:%s",sutPocStatus.AllUsers[sutListBox.handle].name);
- SlwTrace(INF, buf,1);
- //ShowMessageBox(buf);
- //OsDelayTime(200);
- UISetNextStatus(UIS_STANDBY);
- SelMachine=0;
- }
- break;
- }
- }
- static void GroupSelResponse(){
- unsigned int key;
- char buf[50];
- int i;
-
- switch(SelMachine){
- case 0:
- if(sutListBox.handle==0 && KEY_PANEL_UP==g_ulKeyValue){
- UiassistStart(1);
- SelMachine=1;
- }else if((sutListBox.handle+1) == sutListBox.itemnum && (KEY_PANEL_DOWN==g_ulKeyValue)){
- UiassistStart(2);
- SelMachine=2;
- }
- key=ListBoxResponse(&sutListBox);
- if(KEY_PANEL_OK==g_ulKeyValue){
- uiAssist.status=0;
- UI_Stack.OK_back=1;
- if(UI_Stack.FastUiChange)UISetNextStatus(UIS_STANDBY);
- else UISetNextStatus(UIS_MENU_MAIN);
- }else if(KEY_PANEL_MENU==key){
- if(0 == sutPocStatus.ListCurOnlineNum){
- break;
- }
-
- ///////////////////////////////////////
- UiassistEnd(1);
- if(hgs_poc_type==POC_BND)snprintf(buf, sizeof(buf),"AT+POC=entergroup,%d\r\n",sutPocStatus.AllGroups[sutListBox.handle].ID);
- else snprintf(buf, sizeof(buf),"AT+POC=090000%08x\r\n",sutPocStatus.AllGroups[sutListBox.handle].ID);
- ModemSendAt(buf);
- SlwTrace(INF, buf,1);
- snprintf(buf, sizeof(buf),"进入:%s",sutPocStatus.AllGroups[sutListBox.handle].name);
- g_ucEnterGroupFlag=1;//进入播报
- SlwTrace(INF, buf,1);
- UISetNextStatus(UIS_STANDBY);
- SelMachine=0;
- }
- break;
- }
- }
- void speciallShow(char type)
- {//他们的FileSys.c中的中文编码设置不到正常的,其它C的正常,所以要显示只能通过这个方式实现了
- if(type==0) ShowMessageBox("正在设置");
- else ShowMessageBox("设置完成");
- }
|