123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- #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)
- {
- static char first=1;
- static unsigned char machine;
- static unsigned int timer;
-
- char buf[60];//30
- char ret =0;
- if(firstIn && first){
- sutPocStatus.handleIndex=0;//渭卤?掳貌3
- machine=0;
- first=0;
- ret=0;
- }
- switch(machine){
- case 0:
- if(sutUIstatus.Status==UIS_MENU_GROUP_SEL){
- snprintf(buf, sizeof(buf),"AT+POC=0D00000000000100000000\r\n");
- }
- else if(sutUIstatus.Status==UIS_MENU_USER_SEL||sutUIstatus.Status==UIS_MENU_SZ_YAOYUN||sutUIstatus.Status==UIS_MENU_SZ_YAOYBI) {
- snprintf(buf, sizeof(buf),"AT+POC=3B0000%08x\r\n",sutPocStatus.LocalGroup.ID);//?猫?眉D?脳眉锚y
- }else if(sutUIstatus.Status==UIS_MENU_FRIEND_SEL) {
- snprintf(buf, sizeof(buf),"AT+POC=0D00000000000100000000\r\n");
- }
-
- msgAtSend(buf);
- MSG_INFO(1,buf);
- sutPocStatus.ListUpdate=0;
- sutPocStatus.ListFillIndex=0;
- sutPocStatus.ListDetailValid=0;
- uTimerStart(&timer, 5000);//500
- machine=1;
- break;
- case 1:
- if(sutPocStatus.ListUpdate || uTimerExpired(&timer) ){
- if(sutPocStatus.ListCurOnlineNum<=0){
- sutPocStatus.ListFillIndex=0;
- MSG_INFO(1,"sutPocStatus.ListUpdate==%d,ListCurOnlineNum==%d\r\n",sutPocStatus.ListUpdate,sutPocStatus.ListCurOnlineNum);
- goto QUIT_FUNCTION;
- }
- machine=2;
- }
- break;
-
- case 2:
- if(firstIn!=1){
- if(direction==1){
- sutPocStatus.handleIndex ++;
- if(sutPocStatus.handleIndex>sutPocStatus.ListCurOnlineNum/5){
- sutPocStatus.handleIndex=0;
- }
- if(sutPocStatus.ListCurOnlineNum%5==0){
- if(sutPocStatus.handleIndex==sutPocStatus.ListCurOnlineNum/5)sutPocStatus.handleIndex=0;
- }
-
- }
- else {
- if(sutPocStatus.handleIndex>0)sutPocStatus.handleIndex--;
- else if(sutPocStatus.handleIndex==0){
- if(sutPocStatus.ListCurOnlineNum%5==0)sutPocStatus.handleIndex=(sutPocStatus.ListCurOnlineNum/5)-1;
- else sutPocStatus.handleIndex=sutPocStatus.ListCurOnlineNum/5;
- MSG_INFO(1,"sutPocStatus.ListCurOnlineNum===%d,sutPocStatus.handleIndex==%d\r\n",sutPocStatus.ListCurOnlineNum,sutPocStatus.handleIndex);
- }
- }
- }
- /*
- ????2霉脳梅?????篓 ?陇?谩?渭sutPocStatus.ExceptionReadNum
- */
- if((sutPocStatus.handleIndex+1)*5 >sutPocStatus.ListCurOnlineNum){ //3?1y 锚脳貌3 +1
- snprintf(buf, sizeof(buf), "over:%d",sutPocStatus.handleIndex);
- MSG_INFO(1, buf);
- if(sutPocStatus.ListCurOnlineNum%5==0)sutPocStatus.ExceptionReadNum=5;
- else sutPocStatus.ExceptionReadNum=sutPocStatus.ListCurOnlineNum%5;
- } else{
- sutPocStatus.ExceptionReadNum=5; //??铆篓?茅?? 5??
- }
- sutPocStatus.ListFillIndex=0;
- machine=3;
- break;
-
- case 3:
- sutPocStatus.ListGetOneFlag=0;
- if(sutUIstatus.Status==UIS_MENU_GROUP_SEL){
- snprintf(buf, sizeof(buf), "AT+POC=0D000000000005%08x\r\n",sutPocStatus.handleIndex*5+1);
- }
- else if(sutUIstatus.Status==UIS_MENU_USER_SEL||sutUIstatus.Status==UIS_MENU_SZ_YAOYUN||sutUIstatus.Status==UIS_MENU_SZ_YAOYBI){
- snprintf(buf, sizeof(buf), "AT+POC=130000%08x00000005%08x\r\n",sutPocStatus.LocalGroup.ID,sutPocStatus.handleIndex*5);
- }else if(sutUIstatus.Status==UIS_MENU_FRIEND_SEL){
- snprintf(buf, sizeof(buf), "AT+POC=0E00000000000000000005%08x\r\n",sutPocStatus.handleIndex*5);
- }
- msgAtSend(buf);
- MSG_INFO(1, buf);
- uTimerStart(&timer, 3000);//2000
- machine=4;
- break;
-
- case 4:
- if(sutPocStatus.ListGetOneFlag){
- machine=5;
- }
- if(uTimerExpired(&timer)){
- machine=5;
- }
- break;
- case 5:
-
- QUIT_FUNCTION:
- first=1;
- //guiClearRect(0, 40, GLCD_WIDTH-1, GLCD_HEIGHT-32,guiGetBackColor());
- sutPocStatus.ListGetOneFlag=0;
- machine=0;//
- return 1;
- break;
- }
-
- return ret;
- }
- void HookGroupUserInfo()
- {
- if(uiAssist.status!=0){
- switch(uiAssist.type){
- case 0: //
- switch(uiAssist.machine){
- case 0:
- if(SimpleInfoScan(1, 2)){//
- //printf("??è?3é1|á?---\r\n");
- 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+3;
- unsigned short y=VOL_START_Y-2;//VOL_START_Y+14;
-
- 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+3;
- unsigned short y=VOL_START_Y-2;//VOL_START_Y+14;
- char info[10];
-
- guiClearRect(x, y, x+16+16, y+VOL_HEIGH, guiGetBackColor());
- guiShowBmp(x, y, "volume.bmp");
- snprintf(info, sizeof(info), "%d", lev);
- guiShowStr(x+16, y+1, info, FONT_MODE_16X16, 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_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
- guiFillRect(x, y, x+lev*10-1, y+(VOL_HAR_HEIGHT+0),COLOR_STATUS_BAR);
- volTimeDlyStart(2000);
- #endif
- }
|