123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- #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[40];//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=3D0000\r\n");
- }
- else {
-
- snprintf(buf, sizeof(buf),"AT+POC=3E0000\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=1D0000%04x0005\r\n",sutPocStatus.handleIndex*5);
- }
- else {
-
- snprintf(buf, sizeof(buf), "AT+POC=1E0000%04x0005\r\n",sutPocStatus.handleIndex*5);
- }
- msgAtSend(buf);
-
- uTimerStart(&timer, 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());
- 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)
- static void volTimeDlyStart(unsigned int time){
- uTimerStart(&volTime, time);
- volWorkStatus=1;
- }
- void HookVolToutCheck(void){
- 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, y, x+(VOL_BAR_LENGTH+2)+2-1, y+(VOL_HAR_HEIGHT+2)+2, guiGetBackColor());
- }
- void volUiFlash(unsigned char lev){
- unsigned short x=VOL_START_X;//102为音量框长度,其中100为有效长度
- unsigned short y=VOL_START_Y;//32为音量框高度,其中30为有效高度
-
- guiClearRect(x, 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;
- guiFillRect(x, y, x+lev*10-1, y+(VOL_HAR_HEIGHT+0),COLOR_STATUS_BAR);
- volTimeDlyStart(1000);
- }
|