static public void connect() { if (zkfp.ZKFP_ERR_OK == fpInstance.Initialize()) // Device Connect { if (FingerTap == 0) { REGISTER_FINGER_COUNT = 1; } else { REGISTER_FINGER_COUNT = 3; } DeviceConnected = 1; openDeviceCallBackCode = fpInstance.OpenDevice(0); // Open Device if (zkfp.ZKFP_ERR_OK != openDeviceCallBackCode) // In Build error code { return; } for (int i = 0; i < 3; i++) { RegTmps[i] = new byte[2048]; } size = 4; fpInstance.GetParameters(1, paramValue, ref size); zkfp2.ByteArray2Int(paramValue, ref mfpWidth); size = 4; fpInstance.GetParameters(2, paramValue, ref size); zkfp2.ByteArray2Int(paramValue, ref mfpHeight); FPBuffer = new byte[mfpWidth * mfpHeight]; } else { DeviceConnected = 0; } }
// [ INITALIZE DEVICE ] private void bnInit_Click(object sender, EventArgs e) // PASO 2 INICIALIZA EL DISPOISTIVO { parentForm.statusBar.Visible = false; cmbIdx.Items.Clear(); int initializeCallBackCode = fpInstance.Initialize(); if (zkfp.ZKFP_ERR_OK == initializeCallBackCode) { int nCount = fpInstance.GetDeviceCount(); if (nCount > 0) { for (int i = 1; i <= nCount; i++) { cmbIdx.Items.Add(i.ToString()); } cmbIdx.SelectedIndex = 0; btnInit.Enabled = false; DisplayMessage(MessageManager.msg_FP_InitComplete, true); } else { int finalizeCount = fpInstance.Finalize(); DisplayMessage(MessageManager.msg_FP_NotConnected, false); } // CONNECT DEVICE #region -------- CONNECT DEVICE -------- int openDeviceCallBackCode = fpInstance.OpenDevice(cmbIdx.SelectedIndex); if (zkfp.ZKFP_ERR_OK != openDeviceCallBackCode) { DisplayMessage($"Uable to connect with the device! (Return Code: {openDeviceCallBackCode} )", false); return; } Utilities.EnableControls(false, btnInit); Utilities.EnableControls(true, btnClose, btnEnroll, btnVerify, btnIdentify, btnFree); RegisterCount = 0; regTempLen = 0; iFid = 1; //for (int i = 0; i < 3; i++) for (int i = 0; i < REGISTER_FINGER_COUNT; i++) { RegTmps[i] = new byte[2048]; } byte[] paramValue = new byte[4]; int size = 4; //fpInstance.GetParameters fpInstance.GetParameters(1, paramValue, ref size); zkfp2.ByteArray2Int(paramValue, ref mfpWidth); size = 4; fpInstance.GetParameters(2, paramValue, ref size); zkfp2.ByteArray2Int(paramValue, ref mfpHeight); FPBuffer = new byte[mfpWidth * mfpHeight]; //FPBuffer = new byte[fpInstance.imageWidth * fpInstance.imageHeight]; captureThread = new Thread(new ThreadStart(DoCapture)); captureThread.IsBackground = true; captureThread.Start(); bIsTimeToDie = false; string devSN = fpInstance.devSn; lblDeviceStatus.Text = "Connected \nDevice S.No: " + devSN; DisplayMessage("You are now connected to the device.", true); #endregion } else { DisplayMessage("Unable to initailize the device. " + FingerPrintDeviceUtilities.DisplayDeviceErrorByCode(initializeCallBackCode) + " !! ", false); } }