Пример #1
0
        /// <summary>
        /// 用于处理OnFeatureInfoEvent事件
        /// 登记结束后发生onEnroll事件
        /// 抛出:指纹仪未初始化 异常
        /// </summary>
        /// <param name="e">AxZKFPEngXControl中的IZKFPEngXEvents_OnFeatureInfoEvent事件</param>
        /// <param name="fingerPrintDevice">指纹设备(如:AxZKFPEngX1)</param>
        /// <returns>本次采集指纹的质量</returns>
        public static RegStatistics GetRegStat(IZKFPEngXEvents_OnFeatureInfoEvent e, AxZKFPEngX fingerPrintDevice)
        {
            if (fingerPrintDevice == null)
            {
                throw new ArgumentNullException("fingerPrintDevice");
            }
            var stat = new RegStatistics {
                ErrorCode = e.aQuality
            };

            try
            {
                if (!fingerPrintDevice.IsRegister)
                {
                    return(stat);
                }
                stat.TimesNeeded = fingerPrintDevice.EnrollIndex - 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }

            return(stat);
        }
Пример #2
0
 public void Dispose()
 {
     if (connected)
     {
         Disconnect();
     }
     ZKFPEng = null;
 }
Пример #3
0
 public void BeginInit()
 {
     m_zkFprint                  = new AxZKFPEngX();
     m_zkFprint.OnCapture       += zkFprint_OnCapture;
     m_zkFprint.OnImageReceived += zkFprint_OnImageReceived;
     m_zkFprint.OnFeatureInfo   += zkFprint_OnFeatureInfo;
     m_zkFprint.OnEnroll        += zkFprint_OnEnroll;
 }
Пример #4
0
        public Huellero()
        {
#if (DEBUG && DESACTIVAHUELLERO)
            System.Windows.Forms.MessageBox.Show("Huellero desactivado", "Modo de prueba", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
#else
            ZKFPEng = new AxZKFPEngX();
            ZKFPEng.CreateControl();
            ZKFPEng.FPEngineVersion = "10";
#endif
        }
Пример #5
0
 /// <summary>
 /// 停止指纹设备
 /// </summary>
 /// <param name="fingerPrinter">指纹设备(如:AxZKFPEngX1)</param>
 public static void StopFingerPrintDevice(AxZKFPEngX fingerPrinter) //停止指纹设备
 {
     try
     {
         fingerPrinter.EndEngine();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         throw;
     }
 }
Пример #6
0
 /// <summary>
 /// 初始化指纹设备 关闭程序时需要停止指纹设备
 /// </summary>
 /// <param name="fingerPrinter">指纹设备(如:AxZKFPEngX1)</param>
 public static void InitFingerPrintDevice(AxZKFPEngX fingerPrinter)//初始化指纹设备
 {
     try
     {
         MessageBox.Show(fingerPrinter.InitEngine() == 0 ? "初始化成功" : "初始化失败");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         throw;
     }
 }
Пример #7
0
 /// <summary>
 /// 开始采集指纹 一共需要采集三次才能触发 OnEnroll事件
 /// </summary>
 /// <param name="fingerPrintDevice">指纹设备(如:AxZKFPEngX1)</param>
 public static void StartCapture(AxZKFPEngX fingerPrintDevice)
 {
     try
     {
         fingerPrintDevice.BeginEnroll();
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
         throw;
     }
 }
        private void initFinger()
        {
            if (null == ZKFPEngX1)
            {
                //实例化OCX控件
                ZKFPEngX1 = new AxZKFPEngXControl.AxZKFPEngX();
                //显式调用该实例的CreateControl方法才能调用其它方法,否则在调用时系统将报AxHost.InvalidActiveXStateException异常
                ZKFPEngX1.CreateControl();
                //连接多个指纹采集器时,选择指纹头的序号,从0 开始;小于零时指纹采集器不工作
                ZKFPEngX1.SensorIndex = 0;
                //取得指纹初始特征
                ZKFPEngX1.OnFeatureInfo += new IZKFPEngXEvents_OnFeatureInfoEventHandler(ZKFPEngX1_OnFeatureInfo);
                ZKFPEngX1.OnEnroll      += new IZKFPEngXEvents_OnEnrollEventHandler(ZKFPEngX1_OnEnroll);
                //指纹图片接收
                ZKFPEngX1.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(ZKFPEngX1_OnImageReceived);
                //指纹识别系统算法引擎版本号
                ZKFPEngX1.FPEngineVersion = "9";
                ZKFPEngX1.Threshold       = 5;
            }
            if (!ZKFPEngX1.EngineValid)
            {
                //初始化指纹识别系统
                int result = ZKFPEngX1.InitEngine();

                if (-2 == result)
                {
                    result = ZKFPEngX1.InitEngine();
                }
                //初始化成功
                if (0 == result)
                {
                    //创建指纹识别高速缓冲空间 并返回其句柄
                    CreateFPCacheDBEx();
                }
                else if (1 == result)
                {
                    endFinger();
                    throw new Exception("指纹识别驱动程序加载失败");
                }
                else if (2 == result)
                {
                    endFinger();
                    throw new Exception("没有连接指纹识别仪");
                }
                else
                {
                    endFinger();
                    throw new Exception("指定的指纹仪不存在");
                }
            }
            ZKFPEngX1.FlushFPImages();
        }
Пример #9
0
        private void FingerPrintForm_Load(object sender, EventArgs e)
        {
            FormManager.GetSingleton().SetCurrentFocusForm(this);
            m_zkFprint = FingerPrint.GetSingleton().GetFingerprint();

            FingerPrint.GetSingleton().SetupFingerprintEvent(Controls, zkFprint_OnFeatureInfo, zkFprint_OnImageReceived, zkFprint_OnEnroll, zkFprint_OnCapture);
            //Console.WriteLine();
            // m_zkFprint.BeginCapture();
            // m_zkFprint.CancelEnroll();
            m_zkFprint.EnrollCount = 3;
            m_zkFprint.BeginEnroll();
            ShowMessage("Please give fingerprint regiss.");
        }
Пример #10
0
//*******指纹验证部分***************//
        /// <summary>
        /// 创建一个高速缓冲区 用于1:N识别指纹
        /// </summary>
        /// <param name="fingerPrintDevice">指纹设备(如:AxZKFPEngX1)</param>
        /// <returns>返回高速缓冲区的编号 此编号需要记录下来,用于添加指纹模板和后期的验证</returns>
        public static int CreateFastBufDatabase(AxZKFPEngX fingerPrintDevice)
        {
            try
            {
                var fpcHandle = fingerPrintDevice.CreateFPCacheDB();
                return(fpcHandle);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                throw;
            }
        }
Пример #11
0
        public Form1()
        {
            InitializeComponent();

            // UsbNotification.RegisterUsbDeviceNotification(this.Handle);
            StorageManager.GetSingleton();
            m_zkFprint = FingerPrint.GetSingleton().GetFingerprint();

            // Custom Move title bar
            Application.AddMessageFilter(this);
            controlsToMove.Add(this.TitleBarPanel);
            m_instance = this;
            FormManager.GetSingleton().SetMainForm(this);
            FormManager.GetSingleton().SetCurrentFocusForm(this);
        }
Пример #12
0
        /// <summary>
        /// 用于处理OnCapture事件,将采集到的指纹模板和高速缓冲区比对
        /// </summary>
        /// <param name="fingerPrintDevice">指纹设备(如:AxZKFPEngX1)</param>
        /// <param name="fpcHandle">高速缓冲区域的ID</param>
        /// <param name="e">IZKFPEngXEvents_OnCaptureEvent事件 一般为e</param>
        /// <param name="similarity">相似度 【引用传值!】</param>
        /// <param name="identificationIndex">认证顺序号码【引用传值!】</param>
        /// <returns>最相似模板的 ID</returns>
        public static int VeryfyAFingerPrint(AxZKFPEngX fingerPrintDevice, int fpcHandle, IZKFPEngXEvents_OnCaptureEvent e, ref int similarity, ref int identificationIndex)
        {
            int resault;

            try
            {
                resault = fingerPrintDevice.IdentificationInFPCacheDB(fpcHandle, e.aTemplate, ref similarity, ref identificationIndex);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }
            return(resault);
        }
        private void AddEditStudentFrm_Load(object sender, EventArgs e)
        {
            // Init Database
            _db = ((MainFrm)Parent)._db;

            // Init FP engine
            _fpEngine = new AxZKFPEngX();
            _fpEngine.BeginInit();
            _fpEngine.OnEnroll += new IZKFPEngXEvents_OnEnrollEventHandler(_fpEngine_OnEnroll);
            _fpEngine.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(_fpEngine_OnImageReceived);
            this.Controls.Add(_fpEngine);

            if (_fpEngine.InitEngine() != 0)
            {
                MessageBox.Show("ไม่สามารถติดต่อเครื่องสแกนลายนิ้วมือได้", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                _fpDeviceConnect = false;
            }
            else
            {
                _fpDeviceConnect = true;
            }

            // For Edit mode
            if (EditMode == true)
            {
                _db.SQLCommand = "SELECT * FROM student WHERE std_id='" + StudentID + "'";
                _db.Query();
                if (_db.Result.HasRows)
                {
                    _db.Result.Read();
                    txtStdID.Text = (string)_db.Result.GetValue(0);
                    txtStdName.Text = (string)_db.Result.GetValue(1);
                    txtStdMajor.Text = (string)_db.Result.GetValue(2);
                    if (_db.Result.GetValue(3) == null)
                    {
                        txtFinger.Text = "";
                    }
                    else
                    {
                        txtFinger.Text = (string)_db.Result.GetValue(3);
                    }
                }
            }
        }
Пример #14
0
        /// <summary>
        /// 用于处理IZKFPEngXEvents_OnImageReceivedEvent事件
        /// 抛出:指纹仪未初始化 异常
        /// </summary>
        /// <param name="e">IZKFPEngXEvents_OnImageReceivedEvent事件</param>
        /// <param name="fingerprintDevice">指纹设备(如:AxZKFPEngX1)</param>
        /// <returns>一个System.Image</returns>
        public static Image GetFingerprintImage(IZKFPEngXEvents_OnImageReceivedEvent e,
                                                AxZKFPEngX fingerprintDevice)
        {
            if (fingerprintDevice == null)
            {
                throw new ArgumentNullException("fingerprintDevice");
            }
            if (!e.aImageValid)
            {
                return(null);
            }
#pragma warning disable 642
            if (File.Exists("temp.bmp"))
            {
                ;
            }
#pragma warning restore 642
            {
                File.Delete("temp.bmp");
            }
            try
            {
                fingerprintDevice.SaveBitmap("temp.bmp");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }
#pragma warning disable 642

#pragma warning restore 642
            {
                var file = FileContent("temp.bmp");
                var ms   = new MemoryStream(file)
                {
                    Position = 0
                };
                File.Delete("temp.bmp");
                return(Image.FromStream(ms));
            }
        }
Пример #15
0
 /// <summary>
 /// 向指定高速缓冲区中添加指纹模板
 /// </summary>
 /// <param name="strFingerPrint">指纹字符串</param>
 /// <param name="fingerPrintDevice">指纹设备</param>
 /// <param name="fpcHandle">高速缓冲存储区的号码</param>
 /// <param name="fingerPrintId">验证成功时将返回的ID 作为指纹的唯一标识</param>
 /// <returns></returns>
 public static bool AddFingerprintTemplate(string strFingerPrint, AxZKFPEngX fingerPrintDevice, int fpcHandle,
                                           int fingerPrintId)
 {
     if (String.IsNullOrWhiteSpace(strFingerPrint))
     {
         return(false);
     }
     MessageBox.Show(strFingerPrint);
     try
     {
         var fRegTemplete = fingerPrintDevice.DecodeTemplate1(strFingerPrint);
         fingerPrintDevice.AddRegTemplateToFPCacheDB(fpcHandle, fingerPrintId, fRegTemplete);
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
 }
Пример #16
0
        /// <summary>
        /// 用于处理OnEnrollEvent事件
        /// 抛出:指纹仪未初始化 异常
        /// </summary>
        /// <param name="e"></param>
        /// <param name="fingerprintDevice">指纹设备(如:AxZKFPEngX1)</param>
        /// <returns></returns>

        public static string GetFingerstring(IZKFPEngXEvents_OnEnrollEvent e,
                                             AxZKFPEngX fingerprintDevice)
        {
            if (fingerprintDevice == null)
            {
                throw new ArgumentNullException("fingerprintDevice");
            }
            var atemplate = e.aTemplate;

            string fingerPrintString;

            try
            {
                fingerPrintString = fingerprintDevice.EncodeTemplate1(atemplate);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                throw;
            }
            return(fingerPrintString);
        }
        private void ScanFingerStdFrm_Load(object sender, EventArgs e)
        {
            // Init Database
            _db = ((TeachingViewFrm)Parent)._db;

            // Init FP engine
            _fpEngine = new AxZKFPEngX();
            _fpEngine.BeginInit();
            _fpEngine.OnEnroll += new IZKFPEngXEvents_OnEnrollEventHandler(_fpEngine_OnEnroll);
            _fpEngine.OnImageReceived += new IZKFPEngXEvents_OnImageReceivedEventHandler(_fpEngine_OnImageReceived);
            this.Controls.Add(_fpEngine);

            if (_fpEngine.InitEngine() != 0)
            {
                MessageBox.Show("ไม่สามารถติดต่อเครื่องสแกนลายนิ้วมือได้", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                if (AutoScanMode == false)
                {
                    this.Close();
                }
                else
                {
                    _fpEngine.EndInit();
                    _fpEngine.EndEngine();
                    StopAutoScan = true;
                    btnCancel.Enabled = false;
                }
            }

            _fpEngine.BeginEnroll();
            txtFPStatus.Text = "วางนิ้ว 3 ครั้ง";
            txtFPNo.Text = _cntFPEnroll.ToString();

            _timer.Enabled = false;
            _timer.Interval = 3000;
            _timer.Tick += new EventHandler(_timer_Tick);

            txtStdID.Text = StdID;
            txtStdName.Text = StdName;

            if (AutoScanMode == false)
            {
                btnStop.Visible = false;
                btnCancel.Visible = false;
            }
        }