#include "includes.h" ASSIST_DEF uiAssist; unsigned char assistResult; void uTimerStart(unsigned int *timerId, unsigned int dlyTime){ *timerId=getAppTick()+dlyTime/KEY_TIMER_TICK; } char uTimerExpired(unsigned int *timerId){ return ((getAppTick()>*timerId)?1:0); } void UiassistStart(unsigned char type){ uiAssist.type=type; uiAssist.machine=0; uiAssist.status=1; } void UiassistEnd(unsigned char type){ uiAssist.type=type; uiAssist.machine=0; uiAssist.status=0; assistResult=0; } unsigned char getAssistResult(void){ unsigned char ret=0; ret=assistResult; if(assistResult) assistResult=0; return ret; } char SimpleInfoScan(unsigned char firstIn,unsigned char direction) { } void HookGroupUserInfo() { if(uiAssist.status!=0){ switch(uiAssist.type){ case 0: // switch(uiAssist.machine){ case 0: //初次 if(SimpleInfoScan(1, 2)){ assistResult=1; uiAssist.status=0; } break; } break; case 1: //上翻 switch(uiAssist.machine){ case 0: if(SimpleInfoScan(0,0)){ assistResult=1; uiAssist.status=0; } break; } break; case 2: //下翻 switch(uiAssist.machine){ case 0: if(SimpleInfoScan(0,1)){ assistResult=1; uiAssist.status=0; } break; } break; } } } static unsigned int volTime; static unsigned char volWorkStatus=0; #define VOL_BAR_LENGTH 100 #define VOL_HAR_HEIGHT 10 #define VOL_START_X ((GLCD_WIDTH-(VOL_BAR_LENGTH+2)-2)/2) #define VOL_START_Y (UI_BOTTOM_SHOW_Y-2-(VOL_HAR_HEIGHT+2)-2) #define VOL_HEIGH 16 static void volTimeDlyStart(unsigned int time){ uTimerStart(&volTime, time); volWorkStatus=1; } void HookVolToutCheck(void){ #if 1 unsigned short x=GLCD_WIDTH/2-16; unsigned short y=VOL_START_Y+14-16; if(volWorkStatus==0) return; if(uTimerExpired(&volTime)==0) return; volWorkStatus=0; if(sutUIstatus.Status!=UIS_STANDBY) return; guiClearRect(x, y, x+16+16, y+VOL_HEIGH, guiGetBackColor()); #else unsigned short x=VOL_START_X;//102为音量框长度,其中100为有效长度 unsigned short y=VOL_START_Y;//32为音量框高度,其中30为有效高度 if(volWorkStatus==0) return; if(uTimerExpired(&volTime)==0) return; volWorkStatus=0; if(sutUIstatus.Status!=UIS_STANDBY) return; guiClearRect(x-21, y, x+(VOL_BAR_LENGTH+2)+2-1, y+(VOL_HAR_HEIGHT+2)+2, guiGetBackColor()); #endif } void volUiFlash(unsigned char lev){ #if 1//使用喇叭显示 unsigned short x=GLCD_WIDTH/2-16; unsigned short y=VOL_START_Y+14-16; char info[10]; guiClearRect(x, y, x+16+16, y+VOL_HEIGH, guiGetBackColor()); guiShowBmp(x, y, "volume.bmp"); snprintf(info, sizeof(info), "%02d", lev); guiShowStr(x+16, y+1, info, FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); volTimeDlyStart(2000); #else//使用进度条显示 unsigned short x=VOL_START_X;//102为音量框长度,其中100为有效长度 unsigned short y=VOL_START_Y;//32为音量框高度,其中30为有效高度 char info[10]; guiClearRect(x-21, y, x+(VOL_BAR_LENGTH+2)+2-1, y+(VOL_HAR_HEIGHT+2)+2, guiGetBackColor()); guiDrawRect(x, y, x+(VOL_BAR_LENGTH+2)+2-1, y+(VOL_HAR_HEIGHT+2)+2, 1, COLOR_BLACK); x += 2;y += 2; snprintf(info, sizeof(info), "%d", lev); guiShowStr(x-strlen(info)*8-5, y-1, info, FONT_MODE_12X12, REVERSED_NO, COLOR_BLACK, guiGetBackColor()); guiFillRect(x, y, x+lev*10-1, y+(VOL_HAR_HEIGHT+0),COLOR_STATUS_BAR); volTimeDlyStart(2000); #endif }