Exemplo n.º 1
0
void WriteKeyToBuffer(unsigned char KeyValue)
{
	CurrentPos = CurrentPos + 1;
	if (CurrentPos >= MAXKEYBUFFERLEN)
		CurrentPos = 0;
	PressKeyBuffer[CurrentPos] = KeyValue;
	//printf("%c %d\n", KeyValue,gOptions.KeyLayout);
	if(gOptions.KeyPadBeep&&KeyValue) ExBeep(1);
}
Exemplo n.º 2
0
U32 FPTest( char *ImgBuf)
{
        if(DetectFP((void *)ImgBuf, gOptions.OImageWidth,gOptions.OImageHeight, hasFingerThreshold, noFingerThreshold,0,1,0))
        {
                ExBeep(1);
                return TRUE;
        }else
        {
                return FALSE;
        }
}
Exemplo n.º 3
0
//修改以动态支持有膜无膜指纹头
U32 FPTest( char *ImgBuf)
{
       // int    // reverse = GC0303_NoCoat,  //是否反色
        int        numdetect=1,  //探测图像帧数
                issingle=0;  //是否允许指纹不离开连续比对

         if(DetectFP(ImgBuf, gOptions.OImageWidth,gOptions.OImageHeight, hasFingerThreshold, noFingerThreshold,GC0303_NoCoat,numdetect,issingle))//,sensortype))
        {
                ExBeep(1);
                return TRUE;
        }
        else
        {
                return FALSE;
        }
}
Exemplo n.º 4
0
static int FaceEnrollWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int ret=0;
	RECT rect={142,221,180,240};

	switch (message) 
	{
		case MSG_CREATE:
			UpdateFaceRegWindow( hWnd, hdc);
			InitShowFaceImage();
			FaceRegState=FACE_REG_PREPARE;

			SetTimer(hWnd, IDC_FACE_TIMER1, IDC_TIMER_NUM);
			break;
		case MSG_ERASEBKGND:
                {
                        HDC hdc = (HDC)wParam;
                        const RECT* clip = (const RECT*)lParam;
                        BOOL fGetDC = FALSE;
                        RECT rcTemp;
                        if(hdc == 0)
                        {
                                hdc = GetClientDC(hWnd);
                                fGetDC = TRUE;
                        }

                        if(clip)
                        {
                                rcTemp = *clip;
                                ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
                                ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);
                                IncludeClipRect(hdc, &rcTemp);
                        }
			UpdateFaceRegWindow(hWnd,hdc);

                        if(fGetDC) ReleaseDC (hdc);
                        	return 0;
                }
			return 0;
		
                case MSG_PAINT:
		{
			char buf[20];
                        hdc = BeginPaint(hWnd);
			SelectFont(hdc,gfont);
			SetTextColor(hdc,PIXEL_lightwhite);
       	 		SetBkMode(hdc,BM_TRANSPARENT);
                        SetPenColor(hdc,PIXEL_black);
    			SetBrushColor(hdc,PIXEL_lightgray);
			SetPenWidth(hdc, 2);
			LineEx(hdc,-1,221,322,222);
			FillBox(hdc,-1,223,322,20);
			if(RegBegin == REG_PREPARE)
			{
				sprintf(buf,"0%%");
				TextOut(hdc,145,225,buf);
			}
			else
			{
                        	SetBrushColor (hdc, PIXEL_blue);
                        	if(FaceCount>=FACE_NUM)  // 0,220,320,20
                        	{
                        	        FillBox(hdc,1,223,318,17);
					sprintf(buf,"100%%");
					TextOut(hdc,145,225,buf);
                        	}
                        	else if(FaceCount>0)
                        	{
                        	        FillBox(hdc,1,223,320*FaceCount/FACE_NUM,17);
					sprintf(buf,"%d%%",100*FaceCount/FACE_NUM);
					TextOut(hdc,145,225,buf);
                        	}
				else
				{
					sprintf(buf,"0%%");
					TextOut(hdc,145,225,buf);
				}
			}
                        EndPaint(hWnd,hdc);
		}
		return 0;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
                        if (gOptions.KeyPadBeep)
                                ExKeyBeep();

			if(LOWORD(wParam) == SCANCODE_ESCAPE)
				PostMessage (hWnd, MSG_CLOSE, 0, 0);
			break;

		case MSG_TIMER:
			if (wParam == IDC_FACE_TIMER1)
			{
				KillTimer(hWnd, IDC_FACE_TIMER1);
				if(ismenutimeout)
				{
					PostMessage(hWnd, MSG_CLOSE, 0, 0);
					return 0;
				}
				hdc=GetClientDC(hWnd);
				if(FaceCount==0 && RegCnt==0 && RegBegin<= REG_PREPARE && gOptions.VoiceOn)
				{
					RegCnt=1;
					FaceRegState=FACE_REG_PREPARE;
					ShowFaceHint(hWnd , FACE_REG_PREPARE , hdc, &fvbg,1);
					if(gOptions.VoiceOn)
						ExPlayVoice(VOICE_FACE_START); //start...
					DelayMS(1000);
				}
				if(ShowCaptureFace( hWnd,HDC_SCREEN ,1)) //Extract face template ok
				{

					SetMenuTimeOut(time(NULL));
					ret=RegFaceTmpProc(f_pin);

					if(RET_SUCCESS==ret) //register success
					{
						SendMessage (hWnd, MSG_PAINT, FACE_NUM, 0) ;
						regok=1;
						if(gOptions.VoiceOn)
                                			ExPlayVoice(VOICE_THANK); 
						DelayMS(500);
						PostMessage (hWnd, MSG_CLOSE, 0, 0);
					}
					else if(RET_FAILED==ret) // register failed
					{
						PostMessage (hWnd, MSG_CLOSE, 0, 0);
					}
					else if(RET_SAME==ret && RegBegin != REG_PREPARE) // move face
					{
						ShowFaceHint(hWnd , HINT_FCHG ,hdc, &fvbg,1);
					}
					else if(RET_CONTINUE==ret)
					{
						if(RegBegin != REG_PREPARE)
						{
							SendMessage (hWnd, MSG_PAINT , FaceCount, 0) ;
							if(FaceCount == 0)
							{
								FaceRegState=FACE_REG_FRONT;
								ShowFaceHint(hWnd , FACE_REG_FRONT , hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_FRONT); 
								DelayMS(600);
							}
							else if(FaceCount == 3)
							{
								FaceRegState=FACE_REG_SCREEN;
								ShowFaceHint(hWnd , FACE_REG_SCREEN ,hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_SCREEN); 
								DelayMS(600);
							}
							else if(FaceCount == 6)
							{
								FaceRegState=FACE_REG_LEFT;
								ShowFaceHint(hWnd , FACE_REG_LEFT ,hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_LEFT); 
								DelayMS(600);
							}
							else if(FaceCount == 9)
							{
								FaceRegState=FACE_REG_RIGHT;
								ShowFaceHint(hWnd , FACE_REG_RIGHT ,hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_RIGHT); 
								DelayMS(600);
							}
							else if(FaceCount == 12)
							{
								FaceRegState=FACE_REG_CAMERA;
								ShowFaceHint(hWnd ,FACE_REG_CAMERA ,hdc, &fvbg,1);
								if(gOptions.VoiceOn)
                                					ExPlayVoice(VOICE_FACE_CAMERA); 
								DelayMS(600);
							}
							else
							{
			                        		ExBeep(1);
							}
						}
						else
						{
			                        	ExBeep(1);
						}
					}
				}
				ReleaseDC(hdc);
				SetTimer(hWnd, IDC_FACE_TIMER1,IDC_TIMER_NUM );
			}
			break;

		case MSG_IDLE:
			if(FaceCount==0 && RegCnt==0 && RegBegin<= REG_PREPARE && gOptions.VoiceOn)
 		        {
                        	RegCnt=1;
				FaceRegState=FACE_REG_PREPARE;
				hdc=GetClientDC(hWnd);
				ShowFaceHint(hWnd , FACE_REG_PREPARE ,hdc, &fvbg,1);
				if(gOptions.VoiceOn)
                			ExPlayVoice(VOICE_FACE_START); //start...
				DelayMS(1000);
				ReleaseDC(hdc);
                        }
			break;

		case MSG_CLOSE:
			KillTimer(hWnd, IDC_FACE_TIMER1);


         		// MainWindowCleanup(hWnd);
                        DestroyMainWindow(hWnd);
		        return 0;
        
	}
    
	return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
Exemplo n.º 5
0
static int WiFiPWDWinProc(HWND  hWnd, int message, WPARAM wParam, LPARAM lParam)
{
	HDC hdc;
	int nc, id;
	static char keyupFlag=0;
	switch (message)
	{
		case MSG_CREATE:
			InitWindow(hWnd);		//add controls
			InitPWDSetting();
			UpdateWindow(hWnd,TRUE);
			curCtlidx=0;
			SetFocusChild(WifiPWDWnd[curCtlidx]);
			break;

		case MSG_ERASEBKGND:
		{
	            	HDC hdc = (HDC)wParam;
			const RECT* clip = (const RECT*)lParam;
			BOOL fGetDC = FALSE;
			RECT rcTemp;
			if(hdc == 0)
			{
				hdc = GetClientDC(hWnd);
				fGetDC = TRUE;
			}

			if(clip)
			{
				rcTemp = *clip;
				ScreenToClient(hWnd, &rcTemp.left, &rcTemp.top);
				ScreenToClient(hWnd,&rcTemp.right, &rcTemp.bottom);
				IncludeClipRect(hdc, &rcTemp);
			}

			FillBoxWithBitmap (hdc, 0, 0, gOptions.LCDWidth, 0, get_submenubg_jgp());
			if(fGetDC) ReleaseDC (hdc);
			return 0;
		}

		case MSG_PAINT:
			hdc=BeginPaint(hWnd);	
			EndPaint(hWnd,hdc);
			return 0;

		case MSG_KEYUP:
			if(3 == gOptions.TFTKeyLayout)
			{
				keyupFlag=1;
			}
			break;
		case MSG_KEYDOWN:
			SetMenuTimeOut(time(NULL));
			if(3 == gOptions.TFTKeyLayout)
			{
				if(1==keyupFlag)
					keyupFlag=0;
				else
					break;
			}
			if (gOptions.KeyPadBeep)
				ExKeyBeep();

			if ((LOWORD(wParam)==SCANCODE_ESCAPE))
			{
				PostMessage(hWnd, MSG_COMMAND, WIFI_PWDEXIT, 0);
			}
			else if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKDOWN) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKUP))
			{
                                if(hIMEWnd!=HWND_INVALID)
                                {
                                        SendMessage(hIMEWnd,MSG_CLOSE,0,0L);
                                        hIMEWnd=HWND_INVALID;
                                }

				SelectNext(wParam);
				return 0;
			}
			else if ((LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT) || (LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)
				|| ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE))
			{
				if(pwdmode==0)
				{
					if(curCtlidx==0 || curCtlidx==1)
					{
						int curidx = SendMessage(WifiPWDWnd[curCtlidx], CB_GETCURSEL, 0, 0);
						if(LOWORD(wParam)==SCANCODE_CURSORBLOCKLEFT  || ((gOptions.TFTKeyLayout==3) && LOWORD(wParam)==SCANCODE_BACKSPACE))
						{
							if(--curidx<0) curidx=3;
						}
						else if(LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT)
						{
							if(++curidx>3) curidx=0;
						}
						SendMessage(WifiPWDWnd[curCtlidx], CB_SETCURSEL, curidx, 0);
						
						if(curCtlidx==0)
						{
							curpwdidx=curidx;
							RefreshPWDWindow(curpwdidx);
						}
						else
						{
							tmppwdmode[curpwdidx]=curidx;
//							SetWindowText(WifiPWDWnd[2+curpwdidx],"");
							SendMessage(WifiPWDWnd[2+curpwdidx], EM_LIMITTEXT, lenValue[curidx], 0L);
						}
						return 0;
					}
					 else if((LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) &&(curCtlidx>=2 && curCtlidx<=5)&&
					    gOptions.IMEFunOn==1&&gOptions.TFTKeyLayout==3)
					{
                        T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0);	//不支持中文输入
						return 0;
					}
					else if(curCtlidx>=6 && curCtlidx<=7)
					{
						if(curCtlidx==6) curCtlidx=7;
						else curCtlidx=6;
						SetFocusChild(WifiPWDWnd[curCtlidx]);
						return 0;
					}
				}
				else
				{
					if(curCtlidx>=1 && curCtlidx<=2)
					{
						if(curCtlidx==1) curCtlidx=2;
						else curCtlidx=1;
						SetFocusChild(WifiPWDWnd[curCtlidx]);
						return 0;
					}
					else if((LOWORD(wParam)==SCANCODE_CURSORBLOCKRIGHT) && curCtlidx==0 &&
					    gOptions.IMEFunOn==1 && gOptions.TFTKeyLayout==3)
					{
                        T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0);	//不支持中文输入
					}
				}
			}
			else if(LOWORD(wParam)==SCANCODE_ENTER) 
			{
				if((pwdmode==0 && curCtlidx<6) || (pwdmode==1 && curCtlidx<1))
					PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0L);
			}
			else if(LOWORD(wParam)==SCANCODE_F10)
			{
				if((pwdmode==0 && curCtlidx==7)||(pwdmode==1 && curCtlidx==2))
					PostMessage(hWnd, MSG_COMMAND, WIFI_PWDEXIT, 0L);
				else
					PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0L);
			}
			else if(LOWORD(wParam)==SCANCODE_MENU)
			{
				PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0);
			}
//			else if (LOWORD(wParam) == gOptions.IMESwitchKey)
			else if((LOWORD(wParam)==SCANCODE_F9) || 
				(LOWORD(wParam)==SCANCODE_F11 && (gOptions.TFTKeyLayout==0 || gOptions.TFTKeyLayout==4)))
                        {
                                if(((pwdmode==0 && curCtlidx>=2 && curCtlidx<=5) || (pwdmode==1 && curCtlidx==0)) && gOptions.IMEFunOn==1)
                                        T9IMEWindow(hWnd,0,200,gOptions.LCDWidth, gOptions.LCDHeight, 0);	//不支持中文输入
                                break;
                        }
			break;
//Liaozz 20080928 fix bug second 43
		case MSG_CHAR:
		{
			char schar[255];
			int slen;
//			printf("*************char=======l:%d,,,w:%d===\n",lParam, wParam);
			HWND Edtmp = GetFocusChild(hWnd);
			if(pwdmode==0)
			{
				curpwdidx=SendMessage(WifiPWDWnd[0], CB_GETCURSEL, 0, 0);			//password index
				tmppwdmode[curpwdidx]=SendMessage(WifiPWDWnd[1], CB_GETCURSEL, 0, 0);		//password type
				GetWindowText(WifiPWDWnd[2+curpwdidx], schar, 255);				//password string
				slen=strlen(schar);
				//13:Enter; 27:ESC; 127:Backspace
				if(slen==lenValue[tmppwdmode[curpwdidx]] && Edtmp == WifiPWDWnd[2+curpwdidx]
				         && wParam != 127 && wParam != 27 && wParam != 13) {
						ExBeep(1);
					}
			} else {//Liaozz 20081009 fix bug second 43
				 GetWindowText(WifiPWDWnd[0], schar, 255);
					int slen = strlen(schar);
					if (slen == 64 && Edtmp == WifiPWDWnd[0]
					               && wParam != 127 && wParam != 27 && wParam != 13)
						ExBeep(1);
			}
			break;
		}
		//Liaozz end
		case MSG_COMMAND:
			id = LOWORD(wParam);
			nc = HIWORD(wParam);
			if(id==WIFI_PWDSAVE)
			{
				if(beModified())
				{
					if(SaveWifiPWDSetting(hWnd) && !ismenutimeout)
						PostMessage(hWnd, MSG_CLOSE, 0, 0);
				}
				else
					PostMessage(hWnd, MSG_CLOSE, 0, 0);
					
			}
			else if(id==WIFI_PWDEXIT)
			{
				if(beModified() && MessageBox1(hWnd,LoadStrByID(MID_SAVEDATA),LoadStrByID(MID_APPNAME),
									MB_OKCANCEL|MB_ICONQUESTION|MB_BASEDONPARENT)==IDOK)
					PostMessage(hWnd, MSG_COMMAND, WIFI_PWDSAVE, 0);
				else
				{
					if(!ismenutimeout) PostMessage(hWnd, MSG_CLOSE, 0, 0);
				}
			}
			break;

		case MSG_CLOSE:
			//UnloadBitmap(&wifipwdbkg);
			//MainWindowCleanup(hWnd);
			DestroyMainWindow(hWnd);
			return 0;

	}
	return DefaultMainWinProc(hWnd,message,wParam,lParam);

}