Exemplo n.º 1
0
        public String CapturarDigitaisParaInscricao()
        {
            try
            {
                NBioAPI.Type.HFIR template = new NBioAPI.Type.HFIR();

                uint retorno = api.Enroll(out template, null);

                if (retorno == NBioAPI.Error.NONE)
                {
                    NBioAPI.Type.FIR_TEXTENCODE binario = new NBioAPI.Type.FIR_TEXTENCODE();
                    api.GetTextFIRFromHandle(template, out binario, false);
                    return(binario.TextFIR);
                }
                else
                {
                    Console.WriteLine(retorno);
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao capturar as digitais.", ex);
            }
        }
Exemplo n.º 2
0
        public string Enroll()
        {
            NBioAPI.Type.FIR_TEXTENCODE m_textFIR   = new NBioAPI.Type.FIR_TEXTENCODE();
            NBioAPI.Type.HFIR           NewFIR      = new NBioAPI.Type.HFIR();
            NBioAPI.Type.WINDOW_OPTION  m_WinOption = new NBioAPI.Type.WINDOW_OPTION();
            m_WinOption.WindowStyle = (uint)NBioAPI.Type.WINDOW_STYLE.NO_WELCOME;
            string Retorno = "";
            uint   device  = m_NBioAPI.OpenDevice(255);

            if (device != NBioAPI.Error.NONE)
            {
                return(null);
            }

            uint ret = m_NBioAPI.Enroll(out NewFIR, null);

            if (NewFIR != null)
            {
                m_NBioAPI.GetTextFIRFromHandle(NewFIR, out m_textFIR, true);
                if (m_textFIR.TextFIR != null)
                {
                    m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
                    Retorno = m_textFIR.TextFIR.ToString();
                }
            }
            m_NBioAPI.CloseDevice(255);
            return(Retorno);
        }
Exemplo n.º 3
0
        private void btnRegist_Click(object sender, System.EventArgs e)
        {
            NBioAPI.Type.HFIR hNewFIR;
            uint nUserID = 0;

            // Get User ID
            try
            {
                int test = Convert.ToInt32(textUserID.Text, 10);
                if (test == 0)
                {
                    throw(new Exception());
                }
            }
            catch
            {
                MessageBox.Show("User ID must be have numeric type and greater than 0.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            nUserID = Convert.ToUInt32(textUserID.Text, 10);

            // Get FIR data
            m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            uint ret = m_NBioAPI.Enroll(out hNewFIR, null);

            if (ret != NBioAPI.Error.NONE)
            {
                DisplayErrorMsg(ret);
                m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
                return;
            }

            m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);

            // Regist FIR to IndexSearch DB
            NBioAPI.IndexSearch.FP_INFO[] fpInfo;
            ret = m_IndexSearch.AddFIR(hNewFIR, nUserID, out fpInfo);
            if (ret != NBioAPI.Error.NONE)
            {
                DisplayErrorMsg(ret);
                return;
            }

            // Add item to list of SearchDB
            foreach (NBioAPI.IndexSearch.FP_INFO sampleInfo in fpInfo)
            {
                ListViewItem listItem = new ListViewItem();
                listItem.Text = sampleInfo.ID.ToString();
                listItem.SubItems.Add(sampleInfo.FingerID.ToString());
                listItem.SubItems.Add(sampleInfo.SampleNumber.ToString());
                listSearchDB.Items.Add(listItem);
            }

            textUserID.Text = Convert.ToString(Convert.ToInt32(textUserID.Text) + 1);
        }
Exemplo n.º 4
0
        //Enroll
        public void CadastrarDigital()
        {
            NBioAPI.Type.FIR  biFIR  = null;
            NBioAPI.Type.HFIR newFIR = null;
            Inicializar();
            uint ret = nBioApi.Enroll(out newFIR, null);

            if (ret == NBioAPI.Error.NONE)
            {
                nBioApi.GetFIRFromHandle(newFIR, out biFIR);
            }
            Finalizar();
        }
        //Ativa leitor pra cadastrar a digital
        private void cadastraDigital()
        {
            uint ret5 = m_NBioAPI.Enroll(out m_hNewFIR, null);

            if (ret5 == NBioAPI.Error.NONE)
            {
                MessageBox.Show("Digital cadastrada com sucesso");
                //Converter FIR capturada para textoFIR
                m_NBioAPI.GetTextFIRFromHandle(m_hNewFIR, out m_textFIR, true);
                //Coloca o texto obtido na String para guardar no banco.
                firDigital = m_textFIR.TextFIR;
                //Joga a FIR no TextBox (Apenas para visualização
                digitalTextBox.Text = firDigital;
                //MessageBox.Show(codigo.ToString());
            }
        }
        //Ativa leitor pra cadastrar a digital
        //return Template da digital capturada.
        public String cadastraDigital()
        {
            abreDispositivo();
            //Aciona método para chamar a dll traduzida da janela de coleta da digital.
            mudaSkin();
            //Método que faz a captura da digitasl.
            uint ret5 = m_NBioAPI.Enroll(null, out m_hNewFIR, null, NBioAPI.Type.TIMEOUT.DEFAULT, null, m_WinOption);

            if (ret5 == NBioAPI.Error.NONE)
            {
                //Converter FIR capturada para textoFIR
                m_NBioAPI.GetTextFIRFromHandle(m_hNewFIR, out m_textFIR, true);
                //Coloca o texto obtido na String para guardar no banco.
                firDigital = m_textFIR.TextFIR;
                fechaDispositivo();
                return(firDigital);
            }
            //Retorna nulo, caso de algum erro no meio do processo.
            return(null);
        }
        public string Enroll(int id)
        {
            NBioAPI m_NBioAPI = new NBioAPI();

            NBioAPI.Type.FIR_TEXTENCODE m_textFIR;
            NBioAPI.Type.HFIR           NewFIR;
            NBioAPI.IndexSearch         m_IndexSearch = new NBioAPI.IndexSearch(m_NBioAPI);


            NBioAPI.Type.WINDOW_OPTION m_WinOption = new NBioAPI.Type.WINDOW_OPTION();
            m_WinOption.WindowStyle = (uint)NBioAPI.Type.WINDOW_STYLE.NO_WELCOME;

            string Retorno = "";

            m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            uint ret = m_NBioAPI.Enroll(out NewFIR, null);

            //uint ret = m_NBioAPI.Enroll(null, out NewFIR, null, NBioAPI.Type.TIMEOUT.DEFAULT, null, m_WinOption);


            if (ret != NBioAPI.Error.NONE)
            {
                m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            }

            if (NewFIR != null)
            {
                m_NBioAPI.GetTextFIRFromHandle(NewFIR, out m_textFIR, true);


                if (m_textFIR.TextFIR != null)
                {
                    m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
                    Retorno = m_textFIR.TextFIR.ToString();
                }
            }
            return(Retorno);
        }
Exemplo n.º 8
0
        private void ISOV1_Click(object sender, EventArgs e)
        {
            string szTemp;

            listRet.Items.Clear();
            listRet.Items.Add("OpenDevice start...");

            uint nRet = m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);

            if (nRet == NBioAPI.Error.NONE)
            {
                NBioAPI.Type.HFIR hFIR, hAuditFIR;

                hAuditFIR = new NBioAPI.Type.HFIR();

                listRet.Items.Add("Enroll start...");

                m_NBioAPI.Enroll(null, out hFIR, null, NBioAPI.Type.TIMEOUT.DEFAULT, hAuditFIR, null);

                if (nRet == NBioAPI.Error.NONE)
                {
                    NBioAPI.Export.EXPORT_AUDIT_DATA exportData;

                    listRet.Items.Add("NBioBSPToImage start...");

                    nRet = m_Export.NBioBSPToImage(hAuditFIR, out exportData);

                    if (nRet == NBioAPI.Error.NONE)
                    {
                        byte[] ISOBuf;

                        listRet.Items.Add("ExportRawToISOV1 start...");

                        nRet = NBioBSPISO4.ExportRawToISOV1(exportData, false, NBioBSPISO4.COMPRESS_MOD.NONE, out ISOBuf);

                        if (nRet == NBioAPI.Error.NONE)
                        {
                            NBioBSPISO4.NIMPORTRAWSET ImportRawSet;

                            listRet.Items.Add("ImportISOToRaw start...");

                            nRet = NBioBSPISO4.ImportISOToRaw(ISOBuf, out ImportRawSet);

                            if (nRet == NBioAPI.Error.NONE)
                            {
                                listRet.Items.Add("Test result");

                                for (byte i = 0; i < ImportRawSet.nDataCount; i++)
                                {
                                    szTemp = "DataLen: " + ImportRawSet.ImportRawData[i].RawData.Length;
                                    listRet.Items.Add(szTemp);

                                    szTemp = "FingerID: " + ImportRawSet.ImportRawData[i].nFingerID;
                                    listRet.Items.Add(szTemp);

                                    szTemp = "Image Width: " + ImportRawSet.ImportRawData[i].nImgWidth;
                                    listRet.Items.Add(szTemp);

                                    szTemp = "Image Height: " + ImportRawSet.ImportRawData[i].nImgHeight;
                                    listRet.Items.Add(szTemp);
                                }
                            }
                            else
                            {
                                szTemp = "ImportISOToRaw Error: " + nRet;
                                listRet.Items.Add(szTemp);
                            }
                        }
                        else
                        {
                            szTemp = "ExportRawToISOV1 Error: " + nRet;
                            listRet.Items.Add(szTemp);
                        }
                    }
                    else
                    {
                        szTemp = "NBioBSPToImage Error: " + nRet;
                        listRet.Items.Add(szTemp);
                    }

                    hFIR.Dispose();
                    hAuditFIR.Dispose();
                }
                else
                {
                    szTemp = "Enroll Error: " + nRet;
                    listRet.Items.Add(szTemp);
                }

                m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            }
            else
            {
                szTemp = "CloseDevice Error: " + nRet;
                listRet.Items.Add(szTemp);
            }
        }
Exemplo n.º 9
0
        private void btnRegist_Click(object sender, System.EventArgs e)
        {
            NBioAPI.Type.HFIR hNewFIR;
            uint nUserID = 0;

            nUserID = Convert.ToUInt32(textUserID.Text, 10);

            // Get FIR data
            m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            uint ret = m_NBioAPI.Enroll(out hNewFIR, null);

            if (ret != NBioAPI.Error.NONE)
            {
                DisplayErrorMsg(ret);
                m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
                return;
            }

            m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);

            // Regist FIR to IndexSearch DB
            NBioAPI.IndexSearch.FP_INFO[] fpInfo;
            ret = m_IndexSearch.AddFIR(hNewFIR, nUserID, out fpInfo);
            if (ret != NBioAPI.Error.NONE)
            {
                DisplayErrorMsg(ret);
                return;
            }

            // Add item to list of SearchDB
            foreach (NBioAPI.IndexSearch.FP_INFO sampleInfo in fpInfo)
            {
                string          config  = "server=localhost; database=lanche;  userid=root; password=vertrigo;";
                MySqlConnection conexao = new MySqlConnection(config);

                string query = "SELECT apelido FROM users where id =" + sampleInfo.ID;;
                //instância do comando onde passo
                //a query e a conexão
                MySqlCommand cmd = new MySqlCommand(query, conexao);
                //Abro conexão
                conexao.Open();
                //instância do leitor que recebe
                //o comando
                MySqlDataReader leitor = cmd.ExecuteReader();
                leitor.Read();
                //atribuo os valores do bd
                msg = "Usuário " + leitor["apelido"] + " adicionado com sucesso!";

                ListViewItem listItem = new ListViewItem();
                listItem.Text = sampleInfo.ID.ToString();
                listItem.SubItems.Add(sampleInfo.FingerID.ToString());
                listItem.SubItems.Add(leitor["apelido"].ToString());

                listSearchDB.Items.Add(listItem);
                //fecho conexão
                conexao.Close();
            }
            MessageBox.Show(msg);

            btnSaveFile_Click(sender, e);
        }