public DeviceSG(int id, SGFPMDeviceName sGFPMDeviceName, String name) { // TODO: Complete member initialization this.devId = id; this.devName = sGFPMDeviceName; this.name = name; Task.Factory.StartNew(() => { deviceThread(); }); }
private void InitializeDevice() { m_FPM = new SGFingerPrintManager(); Int32 error; SGFPMDeviceName device_name = SGFPMDeviceName.DEV_AUTO; Int32 device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT; m_SecurityLevel = SGFPMSecurityLevel.NORMAL; m_DeviceOpened = false; error = m_FPM.Init(device_name); if (error != (Int32)SGFPMError.ERROR_NONE) { error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi); } if (error == (Int32)SGFPMError.ERROR_NONE) { m_FPM.CloseDevice(); error = m_FPM.OpenDevice(device_id); } else { throw new ApplicationException("Unable to initialize scanner. Kindly check the connection"); } if (error == (Int32)SGFPMError.ERROR_NONE) { SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam(); m_FPM.GetDeviceInfo(pInfo); m_ImageWidth = pInfo.ImageWidth; m_ImageHeight = pInfo.ImageHeight; m_Dpi = pInfo.ImageDPI; serialNo = pInfo.DeviceID; } error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ISO19794); error = m_FPM.GetMaxTemplateSize(ref max_template_size); if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.OpenDevice(device_id); if (error == (Int32)SGFPMError.ERROR_NONE) { m_DeviceOpened = true; } } }
private void NuevaEntradaSalidaBitacora_Load(object sender, EventArgs e) { comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; string appPath2 = Path.GetDirectoryName(Application.ExecutablePath); ///create the connection string string connString = @"Data Source= " + appPath2 + @"\DBBIT.s3db ;Version=3;"; //create the database query string query = "SELECT * FROM Entradas"; //create an OleDbDataAdapter to execute the query System.Data.SQLite.SQLiteDataAdapter dAdapter = new System.Data.SQLite.SQLiteDataAdapter(query, connString); //create a command builder System.Data.SQLite.SQLiteCommandBuilder cBuilder = new System.Data.SQLite.SQLiteCommandBuilder(dAdapter); //create a DataTable to hold the query results DataTable dTable = new DataTable(); //fill the DataTable dAdapter.Fill(dTable); dAdapter.Update(dTable); if (dTable.Rows.Count != 0) { DataRow Row = dTable.Rows[dTable.Rows.Count - 1]; string num = Row["Numero"].ToString(); int autonum = Int32.Parse(num); label1.Text = (autonum + 1).ToString(); } else { label1.Text = "1"; } //create the database query query = "SELECT * FROM Salidas"; //create an OleDbDataAdapter to execute the query dAdapter = new System.Data.SQLite.SQLiteDataAdapter(query, connString); //create a command builder cBuilder = new System.Data.SQLite.SQLiteCommandBuilder(dAdapter); //create a DataTable to hold the query results dTable = new DataTable(); //fill the DataTable dAdapter.Fill(dTable); dAdapter.Update(dTable); if (dTable.Rows.Count != 0) { DataRow Row = dTable.Rows[dTable.Rows.Count - 1]; string num = Row["Numero"].ToString(); int autonum = Int32.Parse(num); label12.Text = (autonum + 1).ToString(); } else { label12.Text = "1"; } m_ImageWidth = 260; m_ImageHeight = 300; m_Dpi = 500; m_FPM = new SGFingerPrintManager(); Int32 error; SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN; Int32 device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT; device_name = SGFPMDeviceName.DEV_AUTO; m_DeviceOpened = false; if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.Init(device_name); } else { error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi); } if (error == (Int32)SGFPMError.ERROR_NONE) { SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam(); m_FPM.GetDeviceInfo(pInfo); m_ImageWidth = pInfo.ImageWidth; m_ImageHeight = pInfo.ImageHeight; StatusBar.Text = "Initialization Success"; pictureBox1.Visible = true; progressBar1.Visible = true; button3.Visible = true; button4.Visible = false; } else { StatusBar.Text = "Init() Error " + error; return; } // Set template format to ANSI 378 error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378); // Get Max template size Int32 max_template_size = 0; error = m_FPM.GetMaxTemplateSize(ref max_template_size); m_RegMin1 = new Byte[max_template_size]; m_RegMin2 = new Byte[max_template_size]; m_VrfMin = new Byte[max_template_size]; // OpenDevice if device is selected if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.OpenDevice(device_id); if (error == (Int32)SGFPMError.ERROR_NONE) { m_DeviceOpened = true; } else { StatusBar.Text = "OpenDevice() Error : " + error; } } }
private void AccountForm_Load(object sender, EventArgs e) { // Adding AccountTypes to Selection ComboBox using (LeafSecurityEntities db = new LeafSecurityEntities()) { // Populating ComboList with AccountType(s). foreach (AccountType aType in db.AccountTypes) { accountTypeCombo.Items.Add(aType.TypeName); } if (m_accountInformation != null) { // Gathering User Information UserInformation userInfo = (from acc in db.UserInformations where acc.AccountID == m_accountInformation.AccountID select acc).First(); int accType = userInfo.AccountInformation.AccountType.TypeID; // Setting up AccountForm() // User Information firstNameTxt.Text = userInfo.FirstName.ToString(); lastNameTxt.Text = userInfo.LastName; if (userInfo.Email != null) { emailTxt.Text = userInfo.Email; } if (userInfo.PhoneNumber != null) { phoneNumberTxt.Text = userInfo.PhoneNumber; } if (userInfo.Address != null) { addressTxt.Text = userInfo.Address; } // If Admin Account Selected if (accType.Equals(1)) { accountTypeCombo.SelectedItem = accountTypeCombo.Items[0]; passwordTxt.Text = m_accountInformation.AccountUsername; confirmPasswordTxt.Text = m_accountInformation.AccountUsername; stringHashTxt.Text = "Admin Account Doesn't Contain This Item."; } // If User Account Seleted else { accountTypeCombo.SelectedIndex = 1; passwordTxt.Text = m_accountInformation.AccountUsername; } // AccountInformation usernameTxt.Text = userInfo.AccountInformation.AccountNumber; // BiometricInformation if (accType.Equals(2)) { // Gathering Fingerprint Information FingerprintTemplate fingerTemplate = (from acc in db.FingerprintTemplates where acc.AccountID == m_accountInformation.AccountID select acc).First(); // Only works for User Accounts stringHashTxt.Text = Path.GetFileName(fingerTemplate.MinutiaeTemplatePath.TemplatePath); generateHashBtn.Enabled = false; } } } // Enabling Sensor(s) m_FPM = new SGFingerPrintManager(); device_name = SGFPMDeviceName.DEV_FDU03; // ...Initializing Port Address port_addr = (Int32)SGFPMPortAddr.USB_AUTO_DETECT; // ...Initializing Device (HSDUO03P) m_FPM.Init(device_name); iError = m_FPM.OpenDevice(port_addr); fingerprint_device_connected = true; if (iError != (Int32)SGFPMError.ERROR_NONE) { //DialogResult res = MessageBox.Show(this, "Are you sure you have a fingerprint sensor connected?", // "Fingerprint Sensor not Connected", MessageBoxButtons.OK, MessageBoxIcon.Error); //Console.WriteLine("OpenDevice() Error : " + iError); fingerprint_device_connected = false; } if (fingerprint_device_connected) { // Hiding Some Controls, // These controls are only used when fingerprint is not available. imageFilePath.Hide(); templatePathLbl.Hide(); openTempFileBtn.Hide(); groupBox3.Height = 450; // ...Enabling Auto-On Feature m_FPM.EnableAutoOnEvent(true, (int)this.Handle); AutoReadFingerprint_chk.Checked = true; // Getting Device Info SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam(); pInfo = new SGFPMDeviceInfoParam(); iError = m_FPM.GetDeviceInfo(pInfo); if (iError == (Int32)SGFPMError.ERROR_NONE) { img_w = pInfo.ImageWidth; img_h = pInfo.ImageHeight; img_dpi = pInfo.ImageDPI; } } else { // Hiding Some Controls, // These controls are only used when fingerprint is available. FingerprintPreviewBox.Hide(); AutoReadFingerprint_chk.Hide(); ReadFingerprintBtn.Hide(); fingerprint_preview_lbl.Hide(); } // disabling buttons that are used afer selecting account type AutoReadFingerprint_chk.Checked = false; AutoReadFingerprint_chk.Enabled = false; FingerprintPreviewBox.Hide(); copyHashBtn.Enabled = false; ReadFingerprintBtn.Enabled = false; openTempFileBtn.Enabled = false; imageFilePath.Enabled = false; }
private void button4_Click(object sender, EventArgs e) { Int32 error; SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN; Int32 device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT; m_DeviceOpened = false; // Get device name if (comboBox2.Text == "DEV_FDU03 : 0") { device_name = SGFPMDeviceName.DEV_FDU03; } else if (comboBox2.Text == "Auto Selection") { device_name = SGFPMDeviceName.DEV_AUTO; } if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.Init(device_name); if (error == (Int32)SGFPMError.ERROR_NONE) { m_FPM.CloseDevice(); error = m_FPM.OpenDevice(device_id); } if (error == (Int32)SGFPMError.ERROR_NONE) { SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam(); m_FPM.GetDeviceInfo(pInfo); m_ImageWidth = pInfo.ImageWidth; m_ImageHeight = pInfo.ImageHeight; } } else { error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi); } if (error == (Int32)SGFPMError.ERROR_NONE) { EnableButtons(true); textBox5.Text = "Initialization Success"; } else { EnableButtons(false); textBox5.Text = "Init() Error " + error; return; } if (m_useAnsiTemplate) { // Set template format to ANSI 378 error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378); } else { // Set template format to ISO 19794-2 error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ISO19794); } // Get Max template size Int32 max_template_size = 0; error = m_FPM.GetMaxTemplateSize(ref max_template_size); m_RegMin1 = new Byte[max_template_size]; m_RegMin2 = new Byte[max_template_size]; m_VrfMin = new Byte[max_template_size]; // OpenDevice if device is selected if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.OpenDevice(device_id); if (error == (Int32)SGFPMError.ERROR_NONE) { m_DeviceOpened = true; } else { textBox4.Text = "OpenDevice() Error : " + error; EnableButtons(false); } } }
private void button4_Click(object sender, EventArgs e) { m_ImageWidth = 260; m_ImageHeight = 300; m_Dpi = 500; m_FPM = new SGFingerPrintManager(); Int32 error; SGFPMDeviceName device_name = SGFPMDeviceName.DEV_UNKNOWN; Int32 device_id = (Int32)SGFPMPortAddr.USB_AUTO_DETECT; device_name = SGFPMDeviceName.DEV_AUTO; m_DeviceOpened = false; if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.Init(device_name); } else { error = m_FPM.InitEx(m_ImageWidth, m_ImageHeight, m_Dpi); } if (error == (Int32)SGFPMError.ERROR_NONE) { SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam(); m_FPM.GetDeviceInfo(pInfo); m_ImageWidth = pInfo.ImageWidth; m_ImageHeight = pInfo.ImageHeight; StatusBar.Text = "Initialization Success"; pictureBox1.Visible = true; progressBar1.Visible = true; button3.Visible = true; button4.Visible = false; } else { StatusBar.Text = "Init() Error " + error; return; } // Set template format to ANSI 378 error = m_FPM.SetTemplateFormat(SGFPMTemplateFormat.ANSI378); // Get Max template size Int32 max_template_size = 0; error = m_FPM.GetMaxTemplateSize(ref max_template_size); m_RegMin1 = new Byte[max_template_size]; m_RegMin2 = new Byte[max_template_size]; m_VrfMin = new Byte[max_template_size]; // OpenDevice if device is selected if (device_name != SGFPMDeviceName.DEV_UNKNOWN) { error = m_FPM.OpenDevice(device_id); if (error == (Int32)SGFPMError.ERROR_NONE) { m_DeviceOpened = true; } else { StatusBar.Text = "OpenDevice() Error : " + error; } } }
public static bool Check(DashBoardForm dashboard) { // Creating directory objects for application folder DirectoryOps.DefaultApplicationDirectory defaultDir = new DirectoryOps.DefaultApplicationDirectory(Program.defaultApplicationDirName); DirectoryOps.DefaultApplicationDirectory defaultDatabaseDir = new DirectoryOps.DefaultApplicationDirectory(Program.defaultApplicationDatabaseDirName); DirectoryOps.DefaultApplicationDirectory defaultMatlabDir = new DirectoryOps.DefaultApplicationDirectory(Program.defaultMatlabFunctionDirName); DirectoryOps.DefaultApplicationDirectory defaultTempDir = new DirectoryOps.DefaultApplicationDirectory(Program.defaultApplicationTempDir); // Opening Operation Objects for each folder. DirectoryOps.DirectoryOperation dirOperations = new DirectoryOps.DirectoryOperation(defaultDir); DirectoryOps.DirectoryOperation dbDirOperations = new DirectoryOps.DirectoryOperation(defaultDatabaseDir); DirectoryOps.DirectoryOperation matlabDirOperations = new DirectoryOps.DirectoryOperation(defaultMatlabDir); DirectoryOps.DirectoryOperation tempDirOperations = new DirectoryOps.DirectoryOperation(defaultTempDir); // If application Folder and application database folder // do not exist create them. if (!dirOperations.Exists()) { dirOperations.Create(); } if (!dbDirOperations.Exists()) { dbDirOperations.Create(); } if (!matlabDirOperations.Exists()) { matlabDirOperations.Create(); } if (!tempDirOperations.Exists()) { tempDirOperations.Create(); } // Checking if Fingerprint Machine is Connected SGFingerPrintManager m_FPM = new SGFingerPrintManager(); SGFPMDeviceName device_name = SGFPMDeviceName.DEV_FDU03; //...Initializing Port Address Int32 port_addr = (Int32)SGFPMPortAddr.USB_AUTO_DETECT; m_FPM.Init(device_name); Int32 iError = m_FPM.OpenDevice(port_addr); if (iError != (Int32)SGFPMError.ERROR_NONE) { DialogResult res = MessageBox.Show(dashboard, "Are you sure you want to continue with out a fingerprint sensor?", "Fingerprint Sensor not Connected", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); Console.WriteLine("Openning Device Error : " + iError); if (res == DialogResult.No) { dashboard.Close(); return(false); } dashboard.fp_device_connected(false); // Tell dashboard sensor is not connected } dashboard.fp_device_connected(true); // Tell dashboard sensor is connected return(true); }