123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- /*
- UI具体界面在此文件中实现
- */
- #include "includes.h"
- /********************************UI状态机记录操作功能*************************/
- UI_STACKDEF uiStack;
- UI_STACKDEF *getStackStruct(void){return &uiStack;}
- static void uiStackInit(void){
- memset((unsigned char *)&uiStack, 0, sizeof(uiStack));
- uiStack.ok_back=0;
- uiStack.top=-1;
- uiStack.FastUiChange=0;
- }
- short uiPushStack(unsigned char data){
- if(uiStack.top==4) return 1;
- uiStack.top ++;
- uiStack.sta[uiStack.top]=data;
- return 0;
- }
- short uiPullStack(void){
- unsigned char tmp;
- if(uiStack.top<0) return -1;
- else{
- tmp=uiStack.sta[uiStack.top];
- uiStack.top--;
- return tmp;
- }
- }
- /********************************UI状态切换功能*********************************/
- UI_STATUSDEF sutUIstatus;
- void uISetNextStatus(unsigned char status){
- sutUIstatus.LastStatus=sutUIstatus.NextStatus;
- sutUIstatus.NextStatus=status;
- }
- void uiDataInit(void){
- memset((unsigned char *)&sutUIstatus, 0, sizeof(UI_STATUSDEF));
- uISetNextStatus(UIS_STANDBY);
- }
- void uiLoop(unsigned int exeInterval){
- char StatusUpdate=0;
- if(sutUIstatus.Status!=sutUIstatus.NextStatus){
- sutUIstatus.LastStatus=sutUIstatus.Status;
- sutUIstatus.Status=sutUIstatus.NextStatus;
- sutUIstatus.ItemRefresh=1;
- StatusUpdate=1;
- }
- if(sutApp.forceUiFlash!=0){
- StatusUpdate=1;
- sutApp.forceUiFlash=0;
- }
- uiShowStatusBar(StatusUpdate,exeInterval);
- switch(sutUIstatus.Status){
- /***********0级:待机界面显示入口*************/
- case UIS_STANDBY:
- uiStackInit();
- uiShowMainInterface(StatusUpdate,exeInterval);
- break;
- /***********1级:主菜单界面显示入口*************/
- case UIS_MENU_MAIN:
- uiShowMenuMain(StatusUpdate);
- //broad_request_lbs_info(128,128,(double)0, (double)0);
- break;
- /***********1.1级:群组选择界面显示入口*************/
- case UIS_MENU_GROUP_SEL:
- uiShowGUSel(StatusUpdate,exeInterval,0);
- break;
- /***********1.2级:成员选择界面显示入口*************/
- case UIS_MENU_USER_SEL:
- uiShowGUSel(StatusUpdate,exeInterval,1);
- break;
- /***********1.3级:文本信息界面显示入口*************/
- case UIS_MENU_MAIL_SEL:
- uiShowMailBox(StatusUpdate);
- break;
- /***********1.4级:系统设置界面显示入口*************/
- case UIS_MENU_SYS_SEL:
- uiShowMenuSysSetup(StatusUpdate);
- break;
- /***********1.5级:定位设置界面显示入口*************/
- case UIS_MENU_LOCATION_SEL:
- if(newPara.newold_plam)uiShowLBS_MAP(StatusUpdate);
- else uiShowMenuLocationSel(StatusUpdate);
- break;
- /***********1.6级:终端信息界面显示入口*************/
- case UIS_MENU_INFO_SEL:
- uiShowInformation(StatusUpdate);
- break;
- /****************1.3.1文本消息菜单-消息读界面显示入口*/
- case UIS_MENU_MAIL_READ:
- MessageReadShow(StatusUpdate);
- break;
- /****************1.3.2文本消息菜单-消息选项界面显示入口*/
- case UIS_MENU_MAIL_OPTION:
- MessageOptionShow(StatusUpdate);
- break;
- /****************1.3.2.1文本消息菜单-消息删除界面显示入口*/
- case UIS_MENU_MAIL_DEL:
- MessageDeletShow(StatusUpdate);
- break;
- /****************1.3.2.2文本消息菜单-消息格式化界面显示入口*/
- case UIS_MENU_MAIL_FORMAT:
- MessageFormatShow(StatusUpdate);
- break;
- /***********1.4.1级:系统设置-LCD设置界面显示入口*************/
- case UIS_MENU_SYS_LCD:
- uiShowLcdSel(StatusUpdate);
- break;
- /***********1.4.2级:系统设置-网络设置界面显示入口*************/
- case UIS_MENU_SYS_NET:
- uiShowNetSel(StatusUpdate);
- break;
- /***********1.4.3级:系统设置-卡设置界面显示入口*************/
- case UIS_MENU_SYS_SIM:
- uiShowSimSel(StatusUpdate);
- break;
- /***********1.4.4级:系统设置-功耗设置界面显示入口*************/
- case UIS_MENU_SYS_PWR:
- uiShowPwrSel(StatusUpdate);
- break;
- /***********1.4.5.1级:系统设置-服务器密码设置界面显示入口*************/
- case UIS_MENU_SYS_SERVERPASS:
- uiShowServerPassSel(StatusUpdate);
- break;
- /***********1.4.5.2级:系统设置-服务器设置界面显示入口*************/
- case UIS_MENU_SYS_SERVER:
- uiShowServerSel(StatusUpdate);
- break;
- /***********1.4.6级:系统设置-版本设置界面显示入口*************/
- case UIS_MENU_SYS_VERSION:
- uiShowVersionSel(StatusUpdate);
- break;
- /***********1.4.7级:系统设置-提示音设置界面显示入口*****************/
- case UIS_MENU_SYS_NOTE:
- uiShowNoteSel(StatusUpdate);
- break;
- case UIS_MENU_SYS_PLAT:
- uiShowPingTaiSel(StatusUpdate);
- break;
- case UIS_MENU_SHUT_PWR:
- uiShowShutDown(StatusUpdate);
- break;
- case UIS_MENU_LBS_MAP:
-
- break;
- case UIS_MENU_SYS_WEATHER:
- uiShowWeatherSel(StatusUpdate);
- break;
-
- }
- }
- /********************************UI响应功能********************************/
- void uiResponse(unsigned int exeInterval){
- unsigned short key;
- if(0 != sutApp.gtTMode) return;
- if(!isKeyPress()) return;
- switch(sutUIstatus.Status){
- /****************0级:待机界面响应******************/
- case UIS_STANDBY:
- switch(getKeyValue()){
- case MKEY_VALUE_MENU:
- uISetNextStatus(UIS_MENU_MAIN);
- break;
- case MKEY_VALUE_UP:
- sutApp.voluemUpdate=1;
- break;
- case MKEY_VALUE_DOWN:
- sutApp.voluemUpdate=2;
- break;
-
- case MKEY_VALUE_ESC:
- if(sutPocStatus.danHuStatus!=0) broad_leavegroup();
- break;
- }
- break;
- /****************1级:主菜单界面响应***************/
- case UIS_MENU_MAIN:
- MenuMainResponse();
- break;
- /****************1.1级:群组选择界面响应*************/
- case UIS_MENU_GROUP_SEL:
- GroupSelResponse();
- break;
- /****************1.2级:成员选择界面响应*************/
- case UIS_MENU_USER_SEL:
- UserSelResponse();
- break;
- /****************1.3级:文本消息界面响应*************/
- case UIS_MENU_MAIL_SEL:
- MessageResponse();
- break;
- /****************1.4级:系统设置界面响应*/
- case UIS_MENU_SYS_SEL:
- sysTemSetResponse();
- break;
- /****************1.5级:定位设置界面响应*/
- case UIS_MENU_LOCATION_SEL:
-
- if(newPara.newold_plam)uiShowLBS_MAPResponse();
- else
- loationSetResponse();
- break;
- /****************1.6级:终端信息界面响应*/
- case UIS_MENU_INFO_SEL:
- uiShowInformationResponse();
- break;
- /****************1.3.1文本消息菜单-消息读响应*/
- case UIS_MENU_MAIL_READ:
- MessageReadResponse();
- break;
- /****************1.3.2文本消息菜单-消息选项响应*/
- case UIS_MENU_MAIL_OPTION:
- MessageOptionResponse();
- break;
- /****************1.3.2.1文本消息菜单-消息删除响应*/
- case UIS_MENU_MAIL_DEL:
- MessageDeletResponse();
- break;
- /****************1.3.2.2文本消息菜单-消息格式化响应*/
- case UIS_MENU_MAIL_FORMAT:
- MessageFormatResponse();
- break;
-
- /****************1.4.1系统设置子菜单-LCD设置响应*/
- case UIS_MENU_SYS_LCD:
- uiShowLcdSelResponse();
- break;
- /****************1.4.2系统设置子菜单-网络设置响应*/
- case UIS_MENU_SYS_NET:
- uiShowNetSelResponse();
- break;
- /****************1.4.3系统设置子菜单-卡设置响应*/
- case UIS_MENU_SYS_SIM:
- uiShowSimSelResponse();
- break;
- /****************1.4.4系统设置子菜单-功耗设置响应*/
- case UIS_MENU_SYS_PWR:
- uiShowPwrSelResponse();
- break;
- /****************1.4.5.1系统设置子菜单-服务器密码设置响应*/
- case UIS_MENU_SYS_SERVERPASS:
- uiShowServerSelPassResponse();
- break;
- /****************1.4.5.2系统设置子菜单-服务器设置响应*/
- case UIS_MENU_SYS_SERVER:
- uiShowServerSelResponse();
- break;
- /****************1.4.6系统设置子菜单-版本设置响应*/
- case UIS_MENU_SYS_VERSION:
- uiShowVersionSelResponse();
- break;
- /****************1.4.7系统设置子菜单-提示音设置响应*/
- case UIS_MENU_SYS_NOTE:
- uiShowNoteSelResponse();
- break;
- case UIS_MENU_SYS_PLAT:
- uiShowPingTaiSelResponse();
- break;
- case UIS_MENU_SHUT_PWR:
- uiShowShutDownResponse();
- break;
- case UIS_MENU_SYS_WEATHER:
- uiShowWeatherSelResponse();
- break;
-
- }
- }
- /**********************其它通用接口***********************************/
- void uiMenuShowBottomLine(void){
- guiDrawHLine(0,GLCD_WIDTH-1,UI_BOTTOM_LINE_Y,1,COLOR_STATUS_BAR);
- }
- void uiMenuShowBottomIndacitor(const char *infoLF, const char *infoRI){
- short x,y;
- unsigned short len;
-
- y=UI_NOTE_LOCATION_Y;
-
- guiClearRect(0,y, GLCD_WIDTH-1, GLCD_HEIGHT-1,guiGetBackColor());
- if(NULL != infoLF){
- x=2;
- guiShowStr(x, y,infoLF, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
- }
- if(NULL != infoRI){
- len=strlen(infoRI)*8;
- x=GLCD_WIDTH-1-len;
- guiShowStr(x, y,infoRI, FONT_MODE_12X12, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
- }
- }
- /*
- status: 0 超时10秒返回待机界面 else 直接返回界面界面
- */
- void uiTimeOutToStandby(char status, unsigned int timeinterval){
- static short cnt=0;
- bool needBackToStandBy=false;
- if(sutApp.platfrom_err!=0)return;
- if(sutApp.gtTMode !=0 || sutApp.gtMode != 0||(sutPocStatus.GetLbsOnce!=2&&sutUIstatus.Status==UIS_MENU_LOCATION_SEL))return;
- if(0==status){
- //MSG_INFO(1,"Back to standby1111===%d",sutApp.timeOutCnt);
- if(++sutApp.timeOutCnt<(10000/timeinterval)) return;
- //MSG_INFO(1,"Back to standby2222===%d",sutApp.timeOutCnt);
- sutApp.timeOutCnt=0;
- needBackToStandBy=true;
- }else needBackToStandBy=true;
-
- if(needBackToStandBy==false) return;
- // MSG_INFO(1,"Back to standby");
- if(sutUIstatus.Status==UIS_STANDBY) return;
- if(sutUIstatus.Status==UIS_MENU_GROUP_SEL){
- appSleepCtl(ASLEEP_GGROUP, 0);
- }else if(sutUIstatus.Status==UIS_MENU_USER_SEL){
- appSleepCtl(ASLEEP_GUSER, 0);
- }
- UiassistEnd(0);
- uISetNextStatus(UIS_STANDBY);
- }
|