123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558 |
- /*
- 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();
- PalaceIndexReset();
- uiShowMainInterface(StatusUpdate,exeInterval);
- break;
- /***********1级:主菜单界面显示入口*************/
- case UIS_MENU_MAIN:
- uiShowMenuMain(StatusUpdate);
- 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;
-
- case UIS_MENU_FRIEND_SEL:
- uiShowGUSel(StatusUpdate,exeInterval,2);
- 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_XINBIAO_MAIN:
- //uiShowMenuLocationSel(StatusUpdate);
- uiShowXINBIAOMenuSysSetup(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_FACTORY:
- uiShowFactory(StatusUpdate);
- break;
- case UIS_MENU_SHUT_PWR:
- uiShowShutDown(StatusUpdate);
- break;
- case UIS_MENU_SYS_CSQ:
- uiShowCsqSel(StatusUpdate,exeInterval);
- break;
- case UIS_MENU_SYS_MIC:
- uiShowMicSel(StatusUpdate);
- break;
- case UIS_MENU_SYS_SPK:
- uiShowSpkSel(StatusUpdate);
- break;
- case UIS_MENU_SYS_FONT:
- uiShowFontUpdate(StatusUpdate);
- break;
- case UIS_MENU_SYS_LOCK:
- uiShowLockUpdate(StatusUpdate);
- break;
- case UIS_MENU_BLE_MAIN:
- uiShowBleMenuSysSetup(StatusUpdate);
- break;
- case UIS_MENU_BLE_ENABLE:
- uiShowBleEnableUpdate( StatusUpdate);
- break;
- case UIS_MENU_BLE_MATCH:
- uiShowBleMacth( StatusUpdate);
- break;
- case UIS_MENU_RING_MATCH:
- uiShowRingUpdate( StatusUpdate);
- break;
- case UIS_MENU_BLESPK_SEL:
- uiShowBleSpkUpdate( StatusUpdate);
- break;
- case UIS_MENU_BLEMIC_SEL:
- uiShowBleMicUpdate( StatusUpdate);
- break;
- case UIS_MENU_BLE_REBOOT:
- uiShowBleInitUpdate( StatusUpdate);
- break;
- case UIS_MENU_RING_REBOOT:
- uiShowRingInitUpdate( StatusUpdate);
- break;
-
- case UIS_MENU_GPS_ENABLE:
- uiShowMenuLocationSel(StatusUpdate);
- break;
- /*
- UIS_MENU_GPS_STATION,//GPS 站点
- UIS_MENU_XINBIAO_INFO,
- UIS_MENU_XINBIAO_LIVE,
- UIS_MENU_XINBIAO_SENDMODE,
- UIS_MENU_XINBIAO_TIME,
- UIS_MENU_XINBIAO_IP,
- UIS_MENU_XINBIAO_LISTCLEAR,
- */
- case UIS_MENU_GPS_STATION:
- uiShowXINBIAOStationUpdate(StatusUpdate);
- break;
- case UIS_MENU_XINBIAO_INFO:
- uiShowXINBIAOInfoUpdate(StatusUpdate);
- break;
- case UIS_MENU_XINBIAO_LIVE:
- uiShowXINBIAOEnableLive( StatusUpdate);
- break;
- case UIS_MENU_XINBIAO_SENDMODE:
- uiShowXINBIAOTriggerMode( StatusUpdate);
- break;
- case UIS_MENU_XINBIAO_TIME:
- uiShowXinbiaoTimeUpdate(StatusUpdate);
- break;
- case UIS_MENU_XINBIAO_IP:
- uiShowXINBIAOGateway( StatusUpdate);
- break;
- case UIS_MENU_XINBIAO_LISTCLEAR:
- uiShowXinbiaoClearlist( StatusUpdate);
- break;
-
- case UIS_MENU_SYS_TTSON:
- uiShowMenuTTSEnableUpdate( StatusUpdate);
- break;
- case UIS_MENU_SYS_SHAKE:
- uiShowShakeEnableUpdate( StatusUpdate);
- break;
- case UIS_MENU_SYS_SOUNDSEL:
- uiShowPoc_soundUpdate(StatusUpdate);
- break;
-
- case UIS_MENU_CJ_MIAN:
- uiShowSideKeyMenuSysSetup(StatusUpdate);
- break;
- case UIS_MENU_CFUN_1_SEL:
- uiShowSideKeyFuncUpdate( StatusUpdate,0);
- break;
- case UIS_MENU_CFUN_2_SEL:
- uiShowSideKeyFuncUpdate( StatusUpdate,1);
- break;
- case UIS_MENU_SZ_MIAN:
- uiShowLeaderMenuSysSetup(StatusUpdate);
- break;
- case UIS_MENU_SZ_YAOYUN:
- ReFlashItemLeader(StatusUpdate,0);
- break;
- case UIS_MENU_SZ_YAOYBI:
- ReFlashItemLeader(StatusUpdate,1);
- break;
- case UIS_MENU_SZ_FORCEGPS:
- break;
-
-
- #ifdef ENABLE_DEBUG
- case UIS_DEBUG:
- uiShowDebug(StatusUpdate);
- break;
- #endif
- }
- }
- /********************************UI响应功能********************************/
- void uiResponse(unsigned int exeInterval){
- unsigned short key;
- unsigned char buf[50];
- if(0 != sutApp.gtTMode && sutUIstatus.Status!=UIS_MENU_SHUT_PWR) 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_ESC:
- if(sutPocStatus.danHuStatus!=0) {
- snprintf(buf, sizeof(buf),"AT+POC=090000%08x\r\n",sutPocStatus.LocalGroup.ID);
- msgAtSend(buf);
- }
- 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;
- case UIS_MENU_FRIEND_SEL:
- FriendSelResponse();
- break;
-
- /****************1.3级:文本消息界面响应*************/
- case UIS_MENU_MAIL_SEL:
- MessageResponse();
- break;
- /****************1.4级:系统设置界面响应*/
- case UIS_MENU_SYS_SEL:
- sysTemSetResponse();
- break;
- /****************1.5级:定位设置界面响应*/
- case UIS_MENU_XINBIAO_MAIN:
- //loationSetResponse();
- sysXINBIAOSetResponse();
- 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;
- case UIS_MENU_SYS_FACTORY:
- uiShowFactoryResponse();
- break;
- /****************1.4.7系统设置子菜单-提示音设置响应*/
- case UIS_MENU_SYS_NOTE:
- uiShowNoteSelResponse();
- break;
- case UIS_MENU_SHUT_PWR:
- uiShowShutDownResponse();
- break;
- case UIS_MENU_SYS_CSQ:
- uiShowCsqSelResponse();
- break;
- case UIS_MENU_SYS_MIC:
- uiShowMicSelResponse();
- break;
- case UIS_MENU_SYS_SPK:
- uiShowSpkSelResponse();
- break;
- case UIS_MENU_SYS_FONT:
- uiShowFontUpdateResponse();
- break;
- case UIS_MENU_SYS_LOCK:
- uiShowLockUpdateResponse();
- break;
- case UIS_MENU_BLE_MAIN:
- sysBleSetResponse();
- break;
- case UIS_MENU_BLE_ENABLE:
- uiShowBleEnableUpdateResponse();
- break;
- case UIS_MENU_BLE_MATCH:
- uiShowBleMacthUpdateResponse();
- break;
- case UIS_MENU_RING_MATCH:
- uiShowRingUpdateResponse();
- break;
- case UIS_MENU_BLESPK_SEL:
- uiShowBleSpkUpdateResponse();
- break;
- case UIS_MENU_BLEMIC_SEL:
- uiShowBleMicUpdateResponse();
- break;
- case UIS_MENU_BLE_REBOOT:
- uiShowBleInitUpdateResponse();
- break;
- case UIS_MENU_RING_REBOOT:
- uiShowRingInitUpdateResponse();
- break;
- case UIS_MENU_GPS_ENABLE:
- loationSetResponse();
- break;
- case UIS_MENU_GPS_STATION:
- uiShowXINBIAOStationUpdateResponse();
- break;
- case UIS_MENU_XINBIAO_INFO:
- uiShowXINBIAOInfoResponse();
- break;
- case UIS_MENU_XINBIAO_LIVE:
- uiShowXINBIAOEnableLiveResponse();
- break;
- case UIS_MENU_XINBIAO_SENDMODE:
- uiShowXINBIAOTriggerModeResponse();
- break;
- case UIS_MENU_XINBIAO_TIME:
- uiShowXinbiaoTimeUpdateResponse();
- break;
- case UIS_MENU_XINBIAO_IP:
- uiShowXINBIAOGatewayResponse();
- break;
- case UIS_MENU_XINBIAO_LISTCLEAR:
- uiShowXinbiaoClearlistResponse();
- break;
-
- case UIS_MENU_SYS_TTSON:
- uiShowMenuTTSEnableUpdateResponse();
- break;
- case UIS_MENU_SYS_SHAKE:
- uiShowShakeEnableUpdateResponse();
- break;
- case UIS_MENU_SYS_SOUNDSEL:
- uiShowPoc_soundUpdateResponse();
- break;
- case UIS_MENU_CJ_MIAN:
- sysSetSideKeyResponse();
- break;
- case UIS_MENU_CFUN_1_SEL:
- uiShowSideKeyFuncUpdateResponse(0);
- break;
-
- case UIS_MENU_CFUN_2_SEL:
- uiShowSideKeyFuncUpdateResponse(1);
- break;
- case UIS_MENU_SZ_MIAN:
- sysSetLeaderResponse();
- break;
- case UIS_MENU_SZ_YAOYUN:
- uiShowLeaderFuncResponse();
- break;
- case UIS_MENU_SZ_YAOYBI:
- uiShowLeaderFuncResponse();
- break;
- case UIS_MENU_SZ_FORCEGPS:
-
- break;
-
-
- #ifdef ENABLE_DEBUG
- case UIS_DEBUG:
- uiShowDebugResponse();
- break;
- #endif
- }
-
- if(getKeyValue()==MKEY_VALUE_ESC) uiStack.esc=1;
- else uiStack.esc=0;
- }
- /**********************其它通用接口***********************************/
- 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_BOTTOM_SHOW_Y;
-
- guiClearRect(0,y, GLCD_WIDTH-1, UI_LOCATION_SHOW_Y-1,guiGetBackColor());
- if(NULL != infoLF){
- x=2;
- guiShowStr(x, y,infoLF, FONT_MODE_16X16, REVERSED_NO,COLOR_STATUS_BAR,guiGetBackColor());
- }
- if(NULL != infoRI){
- len=strlen(infoRI)*12;//8
- x=GLCD_WIDTH-1-len;
- guiShowStr(x, y,infoRI, FONT_MODE_16X16, 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.gtTMode !=0 || sutApp.gtMode != 0) return;
- if(0==status){
- if(++sutApp.timeOutCnt<(10000/timeinterval)) return;
- 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);
- }
|