Beispiel #1
0
        private void OpenDev(int index)
        {
            string vDevId = string.Empty;
            int    vnRet;

            if (!GetDevIdFromListIndex(index, ref vDevId))
            {
                MessageBoxEx.Show(Pub.GetResText(formCode, "MsgNoDevice", ""));
            }
            vnRet = ObjFpReader.pisCreateContext(ref contextId);
            if (vnRet != ObjFpReader.PISFP_OK)
            {
                ErrorDescription(ObjFpReader.INIT_PROC, ObjFpReader.CREATE_CONTEXT_FUNC, vnRet);
            }

            txtInfo.Text = Pub.GetResText(formCode, "MsgOpenDevice", "");

            vnRet = ObjFpReader.pisOpenDevice(contextId, vDevId);
            if (vnRet != ObjFpReader.PISFP_OK)
            {
                ObjFpReader.pisDestroyContext(contextId);
                ErrorDescription(ObjFpReader.INIT_PROC, ObjFpReader.OPEN_DEVICE_FUNC, vnRet);
                return;
            }

            vnRet = ObjFpReader.pisGetDeviceInfo(contextId, ObjFpReader.PISFP_PARAM_KIND_COMPANY, ref deviceCompany);
            if (vnRet != ObjFpReader.PISFP_OK)
            {
                deviceCompany = ObjFpReader.PRODUCT_PEFIS;
            }

            fpAreaTh       = 18;
            noCheckCountTh = 20;
            int temp_DeviceCompany = deviceCompany;

            if (temp_DeviceCompany == ObjFpReader.PRODUCT_HYSOON || temp_DeviceCompany == ObjFpReader.PRODUCT_TAIWAN)
            {
                ObjFpReader.pisLedControl(contextId, ObjFpReader.PISFP_BKLED, ObjFpReader.PISFP_LED_ON);
                fpAreaTh       = 17;
                noCheckCountTh = 20;
            }


            byte[] engineInfo = new byte[1024];
            vnRet = ObjFpReader.pisGetInfo(contextId, ref engineInfo[0], ref imageWidth, ref imageHeight, ref imageRes,
                                           ref featureSize, ref templateSize);

            if (temp_DeviceCompany == ObjFpReader.PRODUCT_HYSOON || temp_DeviceCompany == ObjFpReader.PRODUCT_TAIWAN)
            {
                ObjFpReader.pisLedControl(contextId, ObjFpReader.PISFP_BKLED, ObjFpReader.PISFP_LED_OFF);
            }

            if (vnRet != ObjFpReader.PISFP_OK)
            {
                ObjFpReader.pisDestroyContext(contextId);
                ErrorDescription(ObjFpReader.INIT_PROC, ObjFpReader.GET_INFO_FUNC, vnRet);
                return;
            }

            picFpImage.Width  = imageWidth;
            picFpImage.Height = imageHeight;
            picFpImage.Image  = null;

            imageBuffer     = new byte[picFpImage.Width * picFpImage.Height];
            feature[0]      = new byte[featureSize];
            feature[1]      = new byte[featureSize];
            feature[2]      = new byte[featureSize];
            template        = new byte[templateSize];
            updatedTemplate = new byte[templateSize];
            rawImgBuffer    = new byte[ObjFpReader.IMPORT_RAW_IMAGE_WIDTH * ObjFpReader.IMPORT_RAW_IMAGE_HEIGHT];

            memset(imageBuffer, 0x55, picFpImage.Width * picFpImage.Height);

            vnRet = ObjFpReader.pisSetMatchParameter(contextId, ObjFpReader.PISFP_DEFAULT_ROTATION_RANGE, ObjFpReader.PISFP_DEFAULT_THRESHOLD);
            if (vnRet != ObjFpReader.PISFP_OK)
            {
                ObjFpReader.pisDestroyContext(contextId);
                ErrorDescription(ObjFpReader.INIT_PROC, ObjFpReader.GET_INFO_FUNC, vnRet);
                return;
            }

            StopFlag            = true;
            gbxFpReader.Enabled = true;

            GetDbFingerData(txtEmpNo.Text, txtFingerNo.Text);
            EnrollImport();
            txtInfo.Text    = Pub.GetResText(formCode, "MsgInitSuccess", "");
            btnInit.Enabled = false;
        }