コード例 #1
0
        private void ReadButton_Click(object sender, EventArgs e)
        {
            IntPtr BufferToRead = Marshal.AllocHGlobal(UserDataSize);

            if (BufferToRead == IntPtr.Zero)
            {
                MessageBox.Show("Error in Buffer allocation", "ReadButton_Click");
                return;
            }

            Byte[] DataToBeWrittenArray = new Byte[UserDataSize];

            int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_ReadUserData(
                (uint)0, (uint)DataToBeWrittenArray.Length, DataToBeWrittenArray
                );

            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                    RetVal, "PermanentDataStorageForm,GBMSAPI_NET_ReadUserData");
            }

            SaveFileDialog SFDlg = new SaveFileDialog();

            SFDlg.Title = "Open file for saving data";
            if (SFDlg.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show("Error in Opening File");
                return;
            }
            String fname = SFDlg.FileName;

            File.WriteAllBytes(fname, DataToBeWrittenArray);
        }
コード例 #2
0
        public bool GetAcquisitionSettingsOptions(out uint ObjectToScanType, out uint OptionMask, out uint scanArea, out uint FrameRateOptions)
        {
            OptionMask       = 0;
            scanArea         = 0;
            ObjectToScanType = GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_NO_OBJECT_TYPE;
            FrameRateOptions = 0;

            String ObjToScanName = (String)(this.ObjectToScanComboBox.SelectedItem);
            uint   ObjToScan     = GBMSAPI_Example_Util.GetObjectToScanIDFromName(ObjToScanName);

            ObjectToScanType = GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(ObjToScan);
            if (ObjectToScanType != GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_NO_OBJECT_TYPE)
            {
                /*******************************
                 * Get Scan Area
                 * ****************************/
                bool IsUsedGA     = this.RollStandardCheckBox.Enabled && this.RollStandardCheckBox.Checked;
                bool IsFlatOnRoll = this.FlatSingleFingerOnRollAreaCheckBox.Enabled &&
                                    this.FlatSingleFingerOnRollAreaCheckBox.Checked;
                scanArea = GBMSAPI_Example_Util.GetScanAreaFromObjectType(
                    ObjectToScanType,
                    IsFlatOnRoll,
                    IsUsedGA
                    );
                if (scanArea == 0)
                {
                    return(false);
                }

                return(GetOptionMask(out OptionMask, out FrameRateOptions));
            }
            return(false);
        }
コード例 #3
0
ファイル: CalibrationForm.cs プロジェクト: tanluZSC/GBMS
        private void SaveButton_Click(object sender, EventArgs e)
        {
            /////////////////////
            // SAVE FILE
            /////////////////////
            Byte   DeviceID;
            String DeviceSerialNumber;

            // Get Serial Number and ID

            int RetVal = GBMSAPI_NET_DeviceSettingRoutines.GBMSAPI_NET_GetCurrentDevice(
                out DeviceID, out DeviceSerialNumber);

            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                    RetVal, "SaveButton_Click,GBMSAPI_GetImageSize");
                return;
            }

            // build file name
            // ver 2.10.0.0: scan area instead of flat/not flat
            //String FName = GBMSAPI_Example_Util.GBMSAPI_Example_GetDevNameFromDevID(DeviceID) + "_" +
            //    (DeviceSerialNumber) + "_" +
            //    ((this.FlatScanArea == true) ? ("FLAT") : ("ROLL")) + ".raw";
            String FName = GBMSAPI_Example_Util.GBMSAPI_Example_GetDevNameFromDevID(DeviceID) + "_" +
                           (DeviceSerialNumber) + "_" +
                           this.GetAreaNameFromCheckedRadioButton() + ".raw";

            // end ver 2.10.0.0: scan area instead of flat/not flat

            // build image array for saving
            Byte [] CalImageArray = new Byte[this.CalibrationImageSX * this.CalibrationImageSY];
            if (CalImageArray == null)
            {
                MessageBox.Show("MEMORY ALLOCATION ERROR in SaveButton_Click(): close application", "HEAVY ERROR");
                return;
            }

            Marshal.Copy(this.CalibrationImage, CalImageArray, 0, CalImageArray.Length);

            // save image on file
            System.IO.FileStream FS = System.IO.File.Create(FName);
            if (FS != null)
            {
                FS.Write(CalImageArray, 0, CalImageArray.Length);
                FS.Close();
                MessageBox.Show("Image saved in " + FName, "Calibration results");
            }
            else
            {
                MessageBox.Show("Cannot save file " + FName, "WARNING");
            }
        }
コード例 #4
0
        public Boolean GetAcquisitionOptions(
            out uint ObjToScan,
            out uint OptionMask,
            out uint DisplayOptionMask,
            out Byte ContrastLimitToDisplay,
            out Byte CompletenessLimitToDisplay,
            out uint ClipRegionW,
            out uint ClipRegionH,
            out uint RollPreviewTimeout,
            out Byte ArtefactCleaningDepth,
            out Byte ContrastIntermediateLimitToDisplay,
            out Byte CompletenessIntermediateLimitToDisplay,
            out bool RollAreaStandardGa,
            out bool EnableRollCompositionBlock,
            out int HwFfdStrictnessThreshold,
            out int SwFfdStrictnessThreshold)
        {
            ObjToScan                              = 0;
            OptionMask                             = 0;
            DisplayOptionMask                      = 0;
            ContrastLimitToDisplay                 = 0;
            CompletenessLimitToDisplay             = 0;
            ClipRegionW                            = 0;
            ClipRegionH                            = 0;
            RollPreviewTimeout                     = 0;
            ArtefactCleaningDepth                  = 0;
            ContrastIntermediateLimitToDisplay     = 0;
            CompletenessIntermediateLimitToDisplay = 0;
            RollAreaStandardGa                     = false;
            EnableRollCompositionBlock             = false;
            HwFfdStrictnessThreshold               = -1;
            SwFfdStrictnessThreshold               = -1;

            //滚指的GA标准有效化
            RollAreaStandardGa = true;


            // end ver 2.10.0.0
            /////////////////////////////
            // GET OBJECT TO SCAN
            /////////////////////////////
            String ObjToScanName = (String)(this.ObjectToScanComboBox.SelectedItem);

            ObjToScan = GBMSAPI_Example_Util.GetObjectToScanIDFromName(ObjToScanName);


            RollPreviewTimeout = 0;

            return(false);
        }
コード例 #5
0
ファイル: CalibrationForm.cs プロジェクト: tanluZSC/GBMS
        private void CalibrateDeviceButton_Click(object sender, EventArgs e)
        {
            ////////////////////////////
            // OPEN IMAGE FILE
            ////////////////////////////
            OpenFileDialog OFDlg = new OpenFileDialog();

            OFDlg.Title = "Open Calibration Image";
            if (OFDlg.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show("Error in Opening File");
                return;
            }
            String fname = OFDlg.FileName;

            Byte [] CalImageBytes = System.IO.File.ReadAllBytes(fname);

            if (CalImageBytes.Length != (CalibrationImageSX) * (CalibrationImageSY))
            {
                MessageBox.Show("Error: file size not correct");
                return;
            }

            ///////////////////////////////
            // CALIBRATE DEVICE
            ///////////////////////////////
            // ver 2.10.0.0: use "2" functions
            //int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_SetCalibrationImage(
            //    this.FlatScanArea, CalImageBytes);
            int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_SetCalibrationImage2(
                this.ScanArea, CalImageBytes);

            // end ver 2.10.0.0: use "2" functions
            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                    RetVal, "CalibrateDeviceButton_Click,GBMSAPI_NET_SetCalibrationImage2");
            }
            else
            {
                MessageBox.Show("Device Calibrated", "Calibration results");
            }

            return;
        }
コード例 #6
0
ファイル: CalibrationForm.cs プロジェクト: tanluZSC/GBMS
        private void SetScanArea(UInt32 scanA)
        {
            this.ScanArea = scanA;
            UInt32 ImSX, ImSY;
            int    RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetCalibrationImageSize2(
                this.ScanArea, out ImSX, out ImSY
                );

            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(RetVal,
                                                                  "FlatAreaRadioButton_CheckedChanged,GBMSAPI_NET_GetCalibrationImageSize");
                return;
            }

            CalibrationImageSX = (int)ImSX;
            CalibrationImageSY = (int)ImSY;

            if (GBMSAPI_Example_Globals.CalibrationBuffer != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(GBMSAPI_Example_Globals.CalibrationBuffer);
            }
            if (GBMSAPI_Example_Globals.DummyCalibrationBuffer != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(GBMSAPI_Example_Globals.DummyCalibrationBuffer);
            }

            GBMSAPI_Example_Globals.CalibrationBuffer      = Marshal.AllocHGlobal((int)(CalibrationImageSX * CalibrationImageSY));
            GBMSAPI_Example_Globals.DummyCalibrationBuffer = Marshal.AllocHGlobal((int)(CalibrationImageSX * CalibrationImageSY));
            if (GBMSAPI_Example_Globals.CalibrationBuffer == IntPtr.Zero ||
                GBMSAPI_Example_Globals.DummyCalibrationBuffer == IntPtr.Zero)
            {
                MessageBox.Show("CalibrationForm, SetScanArea: Memory allocation failed", "FATAL ERROR");
                return;
            }
            this.CalibrationImage = (GBMSAPI_Example_Globals.CalibrationBuffer);

            this.ImSXTextBox.Text = "" + CalibrationImageSX;
            this.ImSYTextBox.Text = "" + CalibrationImageSY;

            this.DiagnosticListBox.Items.Clear();
            this.CalibrationImagePictureBox.Image = this.OriginalImage;

            this.SaveButton.Enabled = false;
        }
コード例 #7
0
        private void WriteButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog OFDlg = new OpenFileDialog();

            OFDlg.Title = "Open file containing data";
            if (OFDlg.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show("Error in Opening File");
                return;
            }
            String fname = OFDlg.FileName;

            Byte[] DataToBeWrittenArray = File.ReadAllBytes(fname);

            if (DataToBeWrittenArray.Length > (UserDataSize - 1))             // I need at least a byte at the end of the buffer for CRC calculation
            {
                MessageBox.Show("Warning: Data To be written too much long; they will be truncated to the " + UserDataSize + "-th byte");
            }

            int BytesToBeWritten;

            if (DataToBeWrittenArray.Length > (UserDataSize - 1))
            {
                BytesToBeWritten = (UserDataSize - 1);
            }
            else
            {
                BytesToBeWritten = DataToBeWrittenArray.Length;
            }

            int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_WriteUserData(
                (uint)0, (uint)BytesToBeWritten, DataToBeWrittenArray
                );

            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                    RetVal, "PermanentDataStorageForm,GBMSAPI_WriteUserData");
            }
            else
            {
                MessageBox.Show("Written " + BytesToBeWritten + "bytes");
            }
        }
コード例 #8
0
ファイル: CalibrationForm.cs プロジェクト: tanluZSC/GBMS
        private void SetFactoryCalibrationButton_Click(object sender, EventArgs e)
        {
            ///////////////////////////////
            // CALIBRATE DEVICE
            ///////////////////////////////
            // ver 2.10.0.0: use "2" functions
            //int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_SetCalibrationImage(this.FlatScanArea, null);
            int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_SetCalibrationImage2(
                GBMSAPI_NET_ScanAreas.GBMSAPI_NET_SA_FULL_FRAME, null);

            // end ver 2.10.0.0: use "2" functions
            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                    RetVal, "SetFactoryCalibrationButton_Click,GBMSAPI_GetImageSize");
                return;
            }

            MessageBox.Show("Device Calibrated", "Calibration results");
        }
コード例 #9
0
        public PermanentDataStorageForm()
        {
            InitializeComponent();

            int RetVal, Appoggio;

            RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_GetUserDataSize(out Appoggio);

            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(RetVal, "GBMSAPI_NET_GetUserDataSize");

                this.Close();
            }
            else
            {
                UserDataSize = Appoggio;
                this.StorageSizeLabel.Text = "Available bytes = " + UserDataSize;
            }
        }
コード例 #10
0
        public int AcquisitionCallback(uint OccurredEventCode, int GetFrameErrorCode, uint EventInfo, byte[] FramePtr, int FrameSizeX, int FrameSizeY, double CurrentFrameRate, double NominalFrameRate, uint GB_Diagnostic, System.IntPtr UserDefinedParameters)
        {
            try
            {
                // LastEventOccurred = OccurredEventCode;
                if (GBMSAPI_Example_Globals.SkipRequested == true)
                {
                    GBMSAPI_Example_Globals.SkipRequested = false;
                    return(0);
                }
                //////////////////////////////////
                // Get Optional external equipment
                //////////////////////////////////
                uint ExternalEquipment;
                int  RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetOptionalExternalEquipment(out ExternalEquipment);

                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                {
                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                    return(0);
                }
                ////////////////
                // ÅжÏÊÇ·ñÓдíÎó
                ////////////////
                if (GetFrameErrorCode != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                {
                    // dummy pedal read in order to clear
                    Boolean PedalState = false;
                    if ((ExternalEquipment & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_PEDAL) != 0)
                    {
                        // check pedal state
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_CheckPedalState(out PedalState);
                    }
                    GBMSAPI_Example_Globals.LastErrorCode = GetFrameErrorCode;
                    // Sound to advise operator that the fingerprint can be
                    // released
                    if ((ExternalEquipment & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_SOUND) != 0)
                    {
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_Sound(12, 2, 1);
                    }
                    else
                    {
                        //Console.Beep(4000, 200);
                        GBMSAPI_Example_Globals.DSBeep(4000, 200);
                    }
                    GBMSAPI_Example_Globals.AcquisitionEnded = true;
                    return(1);
                }

                //////////////////////////////
                // check event:
                // ERROR EVENT ALREASY CHECKED
                //////////////////////////////
                switch (OccurredEventCode)
                {
                case GBMSAPI_NET_AcquisitionEvents.GBMSAPI_NET_AE_SCANNER_STARTED:
                {
                    //GBMSAPI_Example_Util.GBMSAPI_Example_LogStart();
                    GBMSAPI_ExampleFrCount = 0;
                    // Set clipping region
                    if (GBMSAPI_Example_Globals.ClipRegionW > 0 && GBMSAPI_Example_Globals.ClipRegionH > 0)
                    {
                        RetVal = GBMSAPI_NET_ScannerStartedRoutines.GBMSAPI_NET_SetClippingRegionSize(
                            GBMSAPI_Example_Globals.ClipRegionW, GBMSAPI_Example_Globals.ClipRegionH
                            );        //È·¶¨²Ã¼ôÇøÓò
                        if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                        {
                            GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                            GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                            return(0);
                        }
                    }

                    // Set Roll preview timeout and artefact cleaning depth
                    // VER 3.1.0.0: check all rolled objects
                    UInt32 ObjToScanType = GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(GBMSAPI_Example_Globals.ObjToScan);
                    if (GBMSAPI_Example_Util.IsRolled(ObjToScanType))
                    {
                        if (GBMSAPI_Example_Globals.RollPreviewTimeout > 0)
                        {
                            RetVal = GBMSAPI_NET_ScannerStartedRoutines.GBMSAPI_NET_ROLL_SetPreviewTimeout(
                                GBMSAPI_Example_Globals.RollPreviewTimeout);
                            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                            {
                                GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                return(0);
                            }
                        }

                        RetVal = GBMSAPI_NET_ScannerStartedRoutines.GBMSAPI_NET_ROLL_SetArtefactCleaningDepth(
                            GBMSAPI_Example_Globals.ArtefactCleaningDepth);
                        if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                        {
                            GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                            GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                            return(0);
                        }
                    }

                    GBMSAPI_Example_Globals.ScannerStarted = true;
                    break;
                }

                case GBMSAPI_NET_AcquisitionEvents.GBMSAPI_NET_AE_PREVIEW_PHASE_END:
                {
                    GBMSAPI_Example_Util.GBMSAPI_Example_LogError("PREVIEW END");
                    // VER 3.1.0.0: check all rolled objects
                    UInt32 ObjToScanType = GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(GBMSAPI_Example_Globals.ObjToScan);
                    if (GBMSAPI_Example_Util.IsRolled(ObjToScanType))
                    // end VER 3.1.0.0: check all rolled objects
                    // Sound to advise operator that the preview has ended
                    {
                        // ver 3.1.0.0: sound if not external roll procedure
                        // or adaptative roll position
                        if (!((GBMSAPI_Example_Globals.OptionMask &
                               GBMSAPI_NET_AcquisitionOptions.GBMSAPI_NET_AO_EXTERNAL_ROLL_COMPOSITION) != 0) ||
                            ((GBMSAPI_Example_Globals.OptionMask &
                              GBMSAPI_NET_AcquisitionOptions.GBMSAPI_NET_AO_ADAPT_ROLL_AREA_POSITION)) != 0)
                        {
                            if ((ExternalEquipment & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_SOUND) != 0)
                            {
                                GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_Sound(12, 2, 1);
                            }
                            else
                            {
                                //Console.Beep(4000, 200);
                                GBMSAPI_Example_Globals.DSBeep(4000, 200);
                            }
                        }
                        // end ver 3.1.0.0
                    }

                    GBMSAPI_Example_Globals.PreviewEnded = true;
                    break;
                }

                case GBMSAPI_NET_AcquisitionEvents.GBMSAPI_NET_AE_VALID_FRAME_ACQUIRED:
                {
                    GBMSAPI_Example_Globals.LastEventInfo = EventInfo;
                    if (GBMSAPI_Example_Globals.FirstFrameArrived == false)
                    {
                        GBMSAPI_Example_Globals.FirstFrameArrived = true;
                        long     ElapsedTicks = DateTime.Now.Ticks - GBMSAPI_Example_Globals.AcquisitionStartTime.Ticks;
                        TimeSpan elapsedSpan  = new TimeSpan(ElapsedTicks);
                        string   strToLog     = "" + DateTime.Now + ": FirstFrame arrival time = " + elapsedSpan.TotalMilliseconds;
                        GBMSAPI_Example_Util.GBMSAPI_Example_LogError(strToLog);
                    }

                    if (GBMSAPI_Example_Globals.BusyFrame == false)
                    {
                        GBMSAPI_ExampleFrCount++;
                        if ((GBMSAPI_Example_Globals.LastEventInfo & GBMSAPI_NET_EventInfo.GBMSAPI_NET_EI_ACQUISITION_PHASE) == 0)
                        {
                            Marshal.Copy(FramePtr, 0, GBMSAPI_Example_Globals.AcquisitionPreviewBuffer, FrameSizeX * FrameSizeY);
                            // ver 2.10.0.0: with stride
                            GBMSAPI_Example_Util.CopyRawImageIntoBitmap(FramePtr, ref GBMSAPI_Example_Globals.PreviewImage);
                            // end ver 2.10.0.0: with stride
                        }
                        else
                        {
                            Marshal.Copy(FramePtr, 0, GBMSAPI_Example_Globals.AcquisitionFullResBuffer, FrameSizeX * FrameSizeY);
                            // ver 2.10.0.0: with stride
                            GBMSAPI_Example_Util.CopyRawImageIntoBitmap(FramePtr, ref GBMSAPI_Example_Globals.FullResImage);
                            // end ver 2.10.0.0: with stride
                        }
                        GBMSAPI_Example_Globals.BusyFrame = true;
                        GBMSAPI_Example_Globals.FrameNumber++;

                        // check diagnostic
                        if (GB_Diagnostic != 0 &&
                            (
                                ((GB_Diagnostic & GBMSAPI_NET_DiagnosticMessages.GBMSAPI_NET_DM_VSROLL_ROLL_DIRECTION_LEFT) == 0) &&
                                ((GB_Diagnostic & GBMSAPI_NET_DiagnosticMessages.GBMSAPI_NET_DM_VSROLL_ROLL_DIRECTION_RIGHT) == 0) &&
                                // ver 3.2.0.0
                                ((GB_Diagnostic & GBMSAPI_NET_DiagnosticMessages.GBMSAPI_NET_DM_VSROLL_ROLL_DIRECTION_DOWN) == 0) &&
                                ((GB_Diagnostic & GBMSAPI_NET_DiagnosticMessages.GBMSAPI_NET_DM_VSROLL_ROLL_DIRECTION_UP) == 0)
                                // end ver 3.2.0.0
                            )
                            )
                        {
                            // if LED supported blink
                            if ((ExternalEquipment & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_VUI_LED) != 0)
                            {
                                GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_VUI_LED_BlinkDuringAcquisition(1);
                            }
                        }
                        else
                        {
                            // if LED supported blink
                            if ((ExternalEquipment & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_VUI_LED) != 0)
                            {
                                GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_VUI_LED_BlinkDuringAcquisition(0);
                            }
                        }
                        // ver 3.1.0.1: dry/wet area percent
                        RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetDryWetFingerAreaPercent(
                            out GBMSAPI_Example_Globals.DryFingerPercent, out GBMSAPI_Example_Globals.WetFingerPercent);
                        if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                        {
                            GBMSAPI_Example_Globals.DryFingerPercent = GBMSAPI_Example_Globals.WetFingerPercent = 0;
                        }
                        // end ver 3.1.0.1: dry/wet area percent

                        // if autocapture get autocapture phase
                        // VER 3.1.0.0: check all rolled objects
                        UInt32 ObjToScanType =
                            GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(GBMSAPI_Example_Globals.ObjToScan);
                        if (
                            !(GBMSAPI_Example_Util.IsRolled(ObjToScanType)) &&
                            ObjToScanType != GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_PHOTO
                            )
                        // end VER 3.1.0.0: check all rolled objects
                        {
                            // check Auto-Capture option set and not ignored
                            if (((GBMSAPI_Example_Globals.OptionMask & GBMSAPI_NET_AcquisitionOptions.GBMSAPI_NET_AO_AUTOCAPTURE) != 0)
                                )
                            {
                                RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetAutoCapturePhase(
                                    out GBMSAPI_Example_Globals.AutoCapturePhase);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    return(0);
                                }

                                // if diagnostic block autocapture
                                uint DeviceFeatures;
                                RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetDeviceFeatures(out DeviceFeatures);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    return(0);
                                }
                                if ((DeviceFeatures & GBMSAPI_NET_DeviceFeatures.GBMSAPI_NET_DF_AUTO_CAPTURE_BLOCKING) != 0)
                                {
                                    if (GB_Diagnostic != 0)
                                    {
                                        GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_SetAutoCaptureBlocking(true);
                                        GBMSAPI_Example_Globals.AutoCapturePhase = -1;
                                    }
                                    else
                                    {
                                        GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_SetAutoCaptureBlocking(false);
                                    }
                                }
                            }

                            // get clipping
                            RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetClippingRegionPosition(
                                out GBMSAPI_Example_Globals.ClippingRegionPosX,
                                out GBMSAPI_Example_Globals.ClippingRegionPosY,
                                out GBMSAPI_Example_Globals.ClippingRegionSizeX,
                                out GBMSAPI_Example_Globals.ClippingRegionSizeY
                                );
                            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                            {
                                GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                return(0);
                            }

                            // get contrast
                            uint AvailableImageInfo;
                            RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetAvailableImageInfo(
                                GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(GBMSAPI_Example_Globals.ObjToScan),
                                out AvailableImageInfo);
                            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                            {
                                GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                return(0);
                            }
                            if ((AvailableImageInfo & GBMSAPI_NET_AvailableImageInfo.GBMSAPI_NET_AII_FINGERPRINT_CONTRAST) != 0)
                            {
                                RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetFingerprintContrast(
                                    out GBMSAPI_Example_Globals.ImageContrast);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    return(0);
                                }

                                // if customized contrast, set on the LCD
                                if (((GBMSAPI_Example_Globals.DisplayOptionMask &
                                      GBMSAPI_NET_DisplayOptions.GBMSAPI_NET_DO_CUSTOMIZED_CONTRAST) != 0) &&
                                    ((ExternalEquipment & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_VUI_LCD) != 0)
                                    )
                                {
                                    RetVal =
                                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetContrastValueOnAcquisitionScreen(
                                            GBMSAPI_Example_Globals.ImageContrast);
                                    if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                    {
                                        GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                        GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                        return(0);
                                    }
                                }
                            }

                            if ((AvailableImageInfo & GBMSAPI_NET_AvailableImageInfo.GBMSAPI_NET_AII_FINGERPRINT_SIZE) != 0)
                            {
                                RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetFingerprintSize(
                                    out GBMSAPI_Example_Globals.ImageSize);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    return(0);
                                }
                            }
                        }

                        // if half lower palm get completeness
                        if (((GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(GBMSAPI_Example_Globals.ObjToScan)) ==
                             GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_FLAT_LOWER_HALF_PALM))
                        {
                            uint AvailableImageInfo;
                            RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetAvailableImageInfo(
                                GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(GBMSAPI_Example_Globals.ObjToScan),
                                out AvailableImageInfo);
                            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                            {
                                GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                return(0);
                            }
                            if ((AvailableImageInfo & GBMSAPI_NET_AvailableImageInfo.GBMSAPI_NET_AII_LOWER_HALF_PALM_COMPLETENESS) != 0)
                            {
                                RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetLowerHalfPalmCompleteness(
                                    out GBMSAPI_Example_Globals.HalfLowerPalmCompleteness);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    return(0);
                                }

                                // if customized completeness, set on the LCD
                                if (((GBMSAPI_Example_Globals.DisplayOptionMask &
                                      GBMSAPI_NET_DisplayOptions.GBMSAPI_NET_DO_CUSTOMIZED_COMPLETENESS) != 0) &&
                                    ((ExternalEquipment & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_VUI_LCD) != 0)
                                    )
                                {
                                    RetVal =
                                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetCompletenessValueOnAcquisitionScreen(
                                            GBMSAPI_Example_Globals.HalfLowerPalmCompleteness);
                                    if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                    {
                                        GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                        GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                        return(0);
                                    }
                                }
                            }
                        }

                        GBMSAPI_Example_Globals.LastFrameSizeX            = FrameSizeX;
                        GBMSAPI_Example_Globals.LastFrameSizeY            = FrameSizeY;
                        GBMSAPI_Example_Globals.LastFrameCurrentFrameRate = CurrentFrameRate;
                        GBMSAPI_Example_Globals.LastFrameNominalFrameRate = NominalFrameRate;
                        GBMSAPI_Example_Globals.LastDiagnosticValue       = GB_Diagnostic;
                    }
                    break;
                }

                case GBMSAPI_NET_AcquisitionEvents.GBMSAPI_NET_AE_ACQUISITION_END:
                {
                    GBMSAPI_Example_Globals.LastEventInfo    = EventInfo;
                    GBMSAPI_Example_Globals.AcquisitionEnded = true;

                    // Sound to advise operator that the fingerprint can be
                    // released
                    // Sound to advise operator that the preview has ended
                    if ((ExternalEquipment & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_SOUND) != 0)
                    {
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_Sound(12, 2, 1);
                    }
                    else
                    {
                        //Console.Beep(4000, 200);
                        GBMSAPI_Example_Globals.DSBeep(4000, 200);
                    }

                    // dummy pedal read in order to clear
                    Boolean PedalState = false;
                    if ((ExternalEquipment & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_PEDAL) != 0)
                    {
                        // check pedal state
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_CheckPedalState(out PedalState);
                    }

                    GBMSAPI_NET_EndAcquisitionRoutines.GBMSAPI_NET_GetFrameStatistic(
                        out GBMSAPI_Example_Globals.AcquiredFramesNumber,
                        out GBMSAPI_Example_Globals.LostFramesNumber);

                    // Get Type for GetImageSize(...) function
                    uint ObjType = GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(GBMSAPI_Example_Globals.ObjToScan);
                    if (ObjType != GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_NO_OBJECT_TYPE)
                    {
                        if ((GB_Diagnostic & GBMSAPI_NET_DiagnosticMessages.GBMSAPI_NET_DM_SCANNER_SURFACE_NOT_NORMA) == 0 &&
                            (GB_Diagnostic & GBMSAPI_NET_DiagnosticMessages.GBMSAPI_NET_DM_SCANNER_FAILURE) == 0
                            )
                        {
                            // VER 3.1.0.0: check all rolled objects
                            if ((GBMSAPI_Example_Globals.LastEventInfo &
                                 GBMSAPI_NET_EventInfo.GBMSAPI_NET_EI_ACQUISITION_PHASE) != 0 &&
                                !(GBMSAPI_Example_Util.IsRolled(ObjType)) &&
                                (ObjType != GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_PHOTO)
                                )
                            // end VER 3.1.0.0: check all rolled objects
                            {
                                if (GBMSAPI_Example_Globals.UseImageFinalization)
                                {
                                    GBMSAPI_NET_EndAcquisitionRoutines.GBMSAPI_NET_ImageFinalization(
                                        FramePtr);
                                }
                            }
                            // VER 3.1.0.0: check all rolled objects
                            else if
                            (
                                (GBMSAPI_Example_Util.IsRolled(ObjType)) &&
                                (GBMSAPI_Example_Globals.OptionMask &
                                 GBMSAPI_NET_AcquisitionOptions.GBMSAPI_NET_AO_MANUAL_ROLL_PREVIEW_STOP) != 0
                            )
                            // end VER 3.1.0.0: check all rolled objects
                            {
                                if (GBMSAPI_Example_Globals.UseImageFinalization)
                                {
                                    GBMSAPI_NET_EndAcquisitionRoutines.GBMSAPI_NET_ImageFinalization(
                                        FramePtr);
                                }
                            }
                        }


                        if ((GBMSAPI_Example_Globals.LastEventInfo & GBMSAPI_NET_EventInfo.GBMSAPI_NET_EI_ACQUISITION_PHASE) == 0)
                        {
                            Marshal.Copy(FramePtr, 0, GBMSAPI_Example_Globals.AcquisitionPreviewBuffer, FrameSizeX * FrameSizeY);
                            // ver 2.10.0.0: with stride
                            GBMSAPI_Example_Util.CopyRawImageIntoBitmap(FramePtr, ref GBMSAPI_Example_Globals.PreviewImage);
                            // end ver 2.10.0.0: with stride
                        }
                        else
                        {
                            Marshal.Copy(FramePtr, 0, GBMSAPI_Example_Globals.AcquisitionFullResBuffer, FrameSizeX * FrameSizeY);
                            // ver 2.10.0.0: with stride
                            GBMSAPI_Example_Util.CopyRawImageIntoBitmap(FramePtr, ref GBMSAPI_Example_Globals.FullResImage);
                            // end ver 2.10.0.0: with stride
                        }

                        GBMSAPI_Example_Globals.LastFrameSizeX            = FrameSizeX;
                        GBMSAPI_Example_Globals.LastFrameSizeY            = FrameSizeY;
                        GBMSAPI_Example_Globals.LastFrameCurrentFrameRate = CurrentFrameRate;
                        GBMSAPI_Example_Globals.LastFrameNominalFrameRate = NominalFrameRate;
                        GBMSAPI_Example_Globals.LastDiagnosticValue       = GB_Diagnostic;

                        // ver 4.0.0.0: fake fingerprint
                        uint devFeatures = 0;
                        RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetDeviceFeatures(out devFeatures);
                        if (RetVal == GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                        {
                            if ((devFeatures & GBMSAPI_NET_DeviceFeatures.GBMSAPI_NET_DF_HW_ANTIFAKE) != 0)
                            {
                                GBMSAPI_Example_Globals.HwFfdError = GBMSAPI_NET_EndAcquisitionRoutines.GBMSAPI_NET_HardwareFakeFingerDetection(out GBMSAPI_Example_Globals.HwFfdFlag,
                                                                                                                                                out GBMSAPI_Example_Globals.HwFfdDiagnosticValue);
                                if (GBMSAPI_Example_Globals.HwFfdError != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_Example_Globals.HwFfdFlag            = false;
                                    GBMSAPI_Example_Globals.HwFfdDiagnosticValue = 0;
                                }
                            }
                            if ((devFeatures & GBMSAPI_NET_DeviceFeatures.GBMSAPI_NET_DF_SW_ANTIFAKE) != 0)
                            {
                                RetVal = GBMSAPI_NET_EndAcquisitionRoutines.GBMSAPI_NET_SoftwareFakeFingerDetection(
                                    FramePtr, FrameSizeX, FrameSizeY,
                                    out GBMSAPI_Example_Globals.SwFfdFlag);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    return(0);
                                }
                            }
                        }
                        else
                        {
                            GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                            GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                            return(0);
                        }
                        // end ver 4.0.0.0: fake fingerprint
                        GBMSAPI_Example_Globals.BusyFrame = true;


                        // if autocapture get autocapture phase
                        if ((GBMSAPI_Example_Globals.LastEventInfo & GBMSAPI_NET_EventInfo.GBMSAPI_NET_EI_ACQUISITION_PHASE) != 0 &&
                            // VER 3.1.0.0: check all rolled objects
                            !(GBMSAPI_Example_Util.IsRolled(ObjType)) &&
                            // end VER 3.1.0.0: check all rolled objects
                            (ObjType != GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_PHOTO)
                            )
                        {
                            // check Auto-Capture option set and not ignored
                            if (((GBMSAPI_Example_Globals.OptionMask & GBMSAPI_NET_AcquisitionOptions.GBMSAPI_NET_AO_AUTOCAPTURE) != 0)
                                )
                            {
                                RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetAutoCapturePhase(
                                    out GBMSAPI_Example_Globals.AutoCapturePhase);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    //GBMSAPI_Example_Globals.AcquisitionEnded = true;
                                    return(0);
                                }
                            }
                        }

                        // if clipping get clipping region
                        if ((ObjType != GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_PHOTO) &&
                            (GBMSAPI_Example_Globals.ClipRegionW > 0 && GBMSAPI_Example_Globals.ClipRegionH > 0))
                        {
                            RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetClippingRegionPosition(
                                out GBMSAPI_Example_Globals.ClippingRegionPosX,
                                out GBMSAPI_Example_Globals.ClippingRegionPosY,
                                out GBMSAPI_Example_Globals.ClippingRegionSizeX,
                                out GBMSAPI_Example_Globals.ClippingRegionSizeY
                                );
                            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                            {
                                GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                //GBMSAPI_Example_Globals.AcquisitionEnded = true;
                                return(0);
                            }
                        }

                        // if not rolled or photo get contrast
                        if (
                            // VER 3.1.0.0: check all rolled objects
                            !(GBMSAPI_Example_Util.IsRolled(ObjType)) &&
                            // end VER 3.1.0.0: check all rolled objects
                            (ObjType != GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_PHOTO))
                        {
                            // get contrast
                            uint AvailableImageInfo;
                            RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetAvailableImageInfo(
                                GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(GBMSAPI_Example_Globals.ObjToScan),
                                out AvailableImageInfo);
                            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                            {
                                GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                //GBMSAPI_Example_Globals.AcquisitionEnded = true;
                                return(0);
                            }
                            if ((AvailableImageInfo & GBMSAPI_NET_AvailableImageInfo.GBMSAPI_NET_AII_FINGERPRINT_CONTRAST) != 0)
                            {
                                RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetFingerprintContrast(
                                    out GBMSAPI_Example_Globals.ImageContrast);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    //GBMSAPI_Example_Globals.AcquisitionEnded = true;
                                    return(0);
                                }
                            }

                            if ((AvailableImageInfo & GBMSAPI_NET_AvailableImageInfo.GBMSAPI_NET_AII_FINGERPRINT_SIZE) != 0)
                            {
                                RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetFingerprintSize(
                                    out GBMSAPI_Example_Globals.ImageSize);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    //GBMSAPI_Example_Globals.AcquisitionEnded = true;
                                    return(0);
                                }
                            }
                        }

                        // if half lower palm get completeness
                        if ((ObjType == GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_FLAT_LOWER_HALF_PALM))
                        {
                            // get contrast
                            uint AvailableImageInfo;
                            RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetAvailableImageInfo(
                                GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(GBMSAPI_Example_Globals.ObjToScan),
                                out AvailableImageInfo);
                            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                            {
                                GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                //GBMSAPI_Example_Globals.AcquisitionEnded = true;
                                return(0);
                            }
                            if ((AvailableImageInfo & GBMSAPI_NET_AvailableImageInfo.GBMSAPI_NET_AII_LOWER_HALF_PALM_COMPLETENESS) != 0)
                            {
                                RetVal = GBMSAPI_NET_ValidFrameAcquiredRoutines.GBMSAPI_NET_GetLowerHalfPalmCompleteness(
                                    out GBMSAPI_Example_Globals.HalfLowerPalmCompleteness);
                                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                                {
                                    GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                    GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                    //GBMSAPI_Example_Globals.AcquisitionEnded = true;
                                    return(0);
                                }
                            }
                        }

                        // if Roll object get rolled info

                        if (
                            // VER 3.1.0.0: check all rolled objects
                            (GBMSAPI_Example_Util.IsRolled(ObjType))
                            // end VER 3.1.0.0: check all rolled objects
                            )
                        {
                            // ver 2.10.0.0: use "2" function, comment next lines
                            //RetVal = GBMSAPI_NET.GBMSAPI_NET_LibraryFunctions.GBMSAPI_NET_EndAcquisitionRoutines.GBMSAPI_NET_ROLL_GetCompositeImageInfo(
                            //    out GBMSAPI_Example_Globals.RolledArtefactSize,
                            //    out GBMSAPI_Example_Globals.MarkerFrame,
                            //    out GBMSAPI_Example_Globals.NotWipedArtefactFrame,
                            //    out GBMSAPI_Example_Globals.ImageSize,
                            //    out GBMSAPI_Example_Globals.ImageContrast,
                            //    out GBMSAPI_Example_Globals.FlatFingerprintSize
                            //    );
                            // end ver 2.10.0.0: use "2" function, comment next lines
                            // ver 2.10.0.0: use "2" function, add next lines
                            UInt32 imgsx, imgsy;
                            RetVal = GBMSAPI_NET.GBMSAPI_NET_LibraryFunctions.GBMSAPI_NET_EndAcquisitionRoutines.GBMSAPI_NET_ROLL_GetCompositeImageInfo2(
                                out GBMSAPI_Example_Globals.RolledArtefactSize,
                                out GBMSAPI_Example_Globals.MarkerFrame,
                                out GBMSAPI_Example_Globals.NotWipedArtefactFrame,
                                out GBMSAPI_Example_Globals.ImageSize,
                                out GBMSAPI_Example_Globals.ImageContrast,
                                out GBMSAPI_Example_Globals.FlatFingerprintSize,
                                out imgsx, out imgsy
                                );
                            // end ver 2.10.0.0: use "2" function, add next lines
                            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR &&
                                RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_UNAVAILABLE_OPTION
                                // means that rolling has been stopped before roll begins
                                )
                            {
                                GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                                GBMSAPI_Example_Globals.LastErrorCode = RetVal;
                                //GBMSAPI_Example_Globals.AcquisitionEnded = true;
                                return(0);
                            }
                        }
                    }

                    break;
                }
                }


                return(1);
            }
            catch (Exception ex)
            {
                GBMSAPI_NET.GBMSAPI_NET_LibraryFunctions.GBMSAPI_NET_ScanningRoutines.GBMSAPI_NET_StopAcquisition();
                MessageBox.Show("Exception in AcquisitionStateManagement: " + ex.Message);
                return(0);
            }
        }
コード例 #11
0
        /**************************************
        * Display management
        **************************************/
        public static void DisplayImageEvaluationParameters()
        {
            uint LcdFeatures;
            int  RetVal =
                GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_GetLcdFeatures(out LcdFeatures);

            if ((GBMSAPI_Example_Globals.DisplayOptionMask &
                 GBMSAPI_NET_DisplayOptions.GBMSAPI_NET_DO_FINAL_SCREEN) != 0
                // stop screen enabled after acquisition
                )
            {
                UInt32 ObjToScanType = GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(
                    GBMSAPI_Example_Globals.ObjToScan);

                // set image evaluation parameters
                if (
                    // VER 3.1.0.0: check all rolled objects
                    (GBMSAPI_Example_Util.IsRolled(ObjToScanType))
                    // end VER 3.1.0.0: check all rolled objects
                    )
                {
                    // ARTEFACTS
                    RetVal =
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetArtefactLimitOnStopScreen
                        (
                            7,
                            GBMSAPI_NET_LimitsDirection.GBMSAPI_NET_VILCD_SMALLER_THAN_LIMIT_DIRECTION
                        );
                    if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                    {
                        GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                            RetVal, "WAIT_PREVIEW_END_STATUS");
                    }
                    if ((LcdFeatures & GBMSAPI_NET_DisplayFeatures.GBMSAPI_NET_VILCD_LF_INTERMEDIATE_LIMIT) != 0)
                    {
                        RetVal = GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetArtefactIntermediateLimitOnStopScreen(14);
                        if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                        {
                            GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                                RetVal,
                                "WAIT_PREVIEW_END_STATUS, GBMSAPI_NET_VUI_LCD_SetArtefactIntermediateLimitOnStopScreen");
                        }
                    }

                    int ArtefactSize;
                    ArtefactSize = (int)(GBMSAPI_Example_Globals.RolledArtefactSize);

                    RetVal =
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetArtefactOnStopScreen
                            (ArtefactSize);
                    if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                    {
                        GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                            RetVal, "WAIT_PREVIEW_END_STATUS");
                    }
                    #region 质量评估说明
                    /////////////////////
                    // 质量评估算法
                    /////////////////////
                    // Quality parameter should be got by using the GBNFIQ or the
                    // GBFINIMG libraries (FULL-ENHANCED package), not included in
                    // the basic version of the GBMSAPI. Therefore quality will
                    // be calculated by dividing contrast value by 2,56, in order
                    // to have a value ranging from 0 (lowest) to 100 (highest)
                    RetVal =
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetQualityLimitOnStopScreen(
                            95,
                            GBMSAPI_NET_LimitsDirection.GBMSAPI_NET_VILCD_GREATER_THAN_LIMIT_DIRECTION
                            );
                    if ((LcdFeatures & GBMSAPI_NET_DisplayFeatures.GBMSAPI_NET_VILCD_LF_INTERMEDIATE_LIMIT) != 0)
                    {
                        RetVal = GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetQualityIntermediateLimitOnStopScreen(90);
                        if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                        {
                            GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                                RetVal,
                                "WAIT_PREVIEW_END_STATUS, GBMSAPI_NET_VUI_LCD_SetQualityIntermediateLimitOnStopScreen");
                        }
                    }
                    if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                    {
                        GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                            RetVal, "WAIT_PREVIEW_END_STATUS");
                    }
                    Byte QualityToShow = (Byte)(((double)GBMSAPI_Example_Globals.ImageContrast) / 2.56);
                    RetVal =
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetQualityOnStopScreen
                            (QualityToShow);
                    if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                    {
                        GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                            RetVal, "WAIT_PREVIEW_END_STATUS");
                    }
                }
                else if ((GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(
                              GBMSAPI_Example_Globals.ObjToScan) !=
                          GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_PHOTO))
                {
                    // CONTRAST
                    RetVal =
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetContrastLimitOnStopScreen
                            (230);
                    if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                    {
                        GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                            RetVal, "WAIT_PREVIEW_END_STATUS");
                    }
                    if ((LcdFeatures & GBMSAPI_NET_DisplayFeatures.GBMSAPI_NET_VILCD_LF_INTERMEDIATE_LIMIT) != 0)
                    {
                        RetVal = GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetContrastIntermediateLimitOnStopScreen(200);
                        if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                        {
                            GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                                RetVal,
                                "WAIT_PREVIEW_END_STATUS, GBMSAPI_NET_VUI_LCD_SetContrastIntermediateLimitOnStopScreen");
                        }
                    }
                    RetVal =
                        GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetContrastValueOnStopScreen
                            (GBMSAPI_Example_Globals.ImageContrast);
                    if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                    {
                        GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                            RetVal, "WAIT_PREVIEW_END_STATUS");
                    }
                    // COMPLETENESS
                    if ((GBMSAPI_NET_ScanObjectsUtilities.GBMSAPI_NET_GetTypeFromObject(
                             GBMSAPI_Example_Globals.ObjToScan) ==
                         GBMSAPI_NET_ScannableBiometricTypes.GBMSAPI_NET_SBT_FLAT_LOWER_HALF_PALM))
                    {
                        RetVal =
                            GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetCompletenessLimitOnStopScreen
                                (90);
                        if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                        {
                            GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                                RetVal, "WAIT_PREVIEW_END_STATUS");
                        }
                        if ((LcdFeatures & GBMSAPI_NET_DisplayFeatures.GBMSAPI_NET_VILCD_LF_INTERMEDIATE_LIMIT) != 0)
                        {
                            RetVal = GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetCompletenessIntermediateLimitOnStopScreen(60);
                            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                            {
                                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                                    RetVal,
                                    "WAIT_PREVIEW_END_STATUS, GBMSAPI_NET_VUI_LCD_SetContrastIntermediateLimitOnStopScreen");
                            }
                        }
                        RetVal =
                            GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetCompletenessValueOnStopScreen
                                (GBMSAPI_Example_Globals.HalfLowerPalmCompleteness);
                        if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                        {
                            GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                                RetVal, "WAIT_PREVIEW_END_STATUS");
                        }
                    }
                }

                RetVal =
                    GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_EnableOKButtonOnStopScreen();
                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                {
                    GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                        RetVal, "WAIT_PREVIEW_END_STATUS");
                }
                // show message
                RetVal = GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_SetPreloadedMessageOnStopScreen(
                    GBMSAPI_NET_PreloadedGeneralMessages.GBMSAPI_NET_VILCD_MSG_ACQUISITION_SUCCESSFUL,
                    GBMSAPI_NET_PreloadedMessagesArea.GBMSAPI_NET_VILCD_MSG_AREA);
                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                {
                    GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                        RetVal, "WAIT_PREVIEW_END_STATUS");
                }
            }
            else
            {
                RetVal = GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_VUI_LCD_EnableStartButtonOnLogoScreen();
                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                {
                    GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                        RetVal, "WAIT_PREVIEW_END_STATUS");
                }
            }
            #endregion
        }
コード例 #12
0
        private void UpdateListButton_Click(object sender, EventArgs e)
        {
            this.Enabled   = true;
            Cursor.Current = Cursors.WaitCursor;
            Application.DoEvents();
            try
            {
                this.DeviceTypeComboBox.Items.Clear();
                ////////////////////////////////
                ///// 获取设备列表存到数组中,最多存储127个设备。GBMSAPI_NET_MAX_PLUGGED_DEVICE_NUM=127常量
                ////////////////////////////////
                GBMSAPI_NET_DeviceInfoStruct[] AttachedDeviceList = new GBMSAPI_NET_DeviceInfoStruct[
                    GBMSAPI_NET_DeviceInfoConstants.GBMSAPI_NET_MAX_PLUGGED_DEVICE_NUM];
                Console.WriteLine(GBMSAPI_NET_DeviceInfoConstants.GBMSAPI_NET_MAX_PLUGGED_DEVICE_NUM);
                for (int i = 0; i < GBMSAPI_NET_DeviceInfoConstants.GBMSAPI_NET_MAX_PLUGGED_DEVICE_NUM; i++)
                {
                    AttachedDeviceList[i] = new GBMSAPI_NET_DeviceInfoStruct();
                }

                int  AttachedDeviceNumber;
                uint USBErrorCode;

                int RetVal = GBMSAPI_NET_DeviceSettingRoutines.GBMSAPI_NET_GetAttachedDeviceList(
                    AttachedDeviceList, out AttachedDeviceNumber, out USBErrorCode);
                Console.WriteLine(AttachedDeviceNumber);
                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR || AttachedDeviceNumber <= 0)
                {
                    if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                    {
                        GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(RetVal, USBErrorCode, "UpdateListButton_Click");
                        MessageBox.Show("Error in GBMSAPI_NET_GetAttachedDeviceList function: " + RetVal);
                    }
                    return;
                }
                // Console.WriteLine(RetVal);
                ////////////////////////////////
                //// Store device list 存储设备列表
                ////////////////////////////////
                for (int i = 0; i < AttachedDeviceNumber; i++)
                {
                    String StrToAdd = GBMSAPI_Example_Util.GBMSAPI_Example_GetDevNameFromDevID(
                        AttachedDeviceList[i].DeviceID);
                    StrToAdd += " " + (AttachedDeviceList[i].DeviceSerialNumber);//获取设备型号
                    this.DeviceTypeComboBox.Items.Add(StrToAdd);
                }
                if (AttachedDeviceNumber > 0)
                {
                    this.DeviceTypeComboBox.SelectedIndex = 0;//指定索引号为0
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in UpdateListButton_Click function: " + ex.Message);
                this.Close();
            }
            finally
            {
                Cursor.Current = Cursors.Default;
                this.Enabled   = true;
            }
        }
コード例 #13
0
        // end ver 3.1.0.0: option mask
        public Boolean GetAcquisitionOptions(
            out uint ObjToScan,
            out uint OptionMask,
            out uint DisplayOptionMask,
            out Byte ContrastLimitToDisplay,
            out Byte CompletenessLimitToDisplay,
            out uint ClipRegionW,
            out uint ClipRegionH,
            out uint RollPreviewTimeout,
            out Byte ArtefactCleaningDepth,
            out Byte ContrastIntermediateLimitToDisplay,
            out Byte CompletenessIntermediateLimitToDisplay,
            // ver 2.10.0.0
            out bool RollAreaStandardGa,
            // end ver 2.10.0.0
            // ver 3.2.0.0
            out bool EnableRollCompositionBlock,
            // end ver 3.2.0.0
            // ver 4.0.0.0
            out int HwFfdStrictnessThreshold,
            out int SwFfdStrictnessThreshold
            // end ver 4.0.0.0
            )
        {
            ObjToScan                              = 0;
            OptionMask                             = 0;
            DisplayOptionMask                      = 0;
            ContrastLimitToDisplay                 = 0;
            CompletenessLimitToDisplay             = 0;
            ClipRegionW                            = 0;
            ClipRegionH                            = 0;
            RollPreviewTimeout                     = 0;
            ArtefactCleaningDepth                  = 0;
            ContrastIntermediateLimitToDisplay     = 0;
            CompletenessIntermediateLimitToDisplay = 0;
            RollAreaStandardGa                     = false;
            // ver 3.2.0.0
            EnableRollCompositionBlock = false;
            // end ver 3.2.0.0
            // ver 4.0.0.0
            HwFfdStrictnessThreshold = -1;
            SwFfdStrictnessThreshold = -1;
            // end ver 4.0.0.0

            try
            {
                // ver 2.10.0.0
                /////////////////////////////
                // ROLL AREA STANDARD
                /////////////////////////////
                if (this.RollStandardCheckBox.Enabled && this.RollStandardCheckBox.Checked)
                {
                    RollAreaStandardGa = true;
                }
                else
                {
                    RollAreaStandardGa = false;
                }
                // end ver 2.10.0.0
                /////////////////////////////
                // GET OBJECT TO SCAN
                /////////////////////////////
                String ObjToScanName = (String)(this.ObjectToScanComboBox.SelectedItem);
                ObjToScan = GBMSAPI_Example_Util.GetObjectToScanIDFromName(ObjToScanName);

                /////////////////////////////
                // GET OPTION MASK
                /////////////////////////////
                uint dummyFrOpt;
                GetOptionMask(out OptionMask, out dummyFrOpt);

                /////////////////////////////////////
                // GET DISPLAY OPTION MASK
                /////////////////////////////////////
                DisplayOptionMask = 0;

                uint ExternalDevicesMask;
                int  RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetOptionalExternalEquipment(out ExternalDevicesMask);

                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                {
                    GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                        RetVal, "GetAcquisitionOptions,GBMSAPI_NET_GetOptionalExternalEquipment");
                    return(false);
                }

                if ((ExternalDevicesMask & GBMSAPI_NET_OptionalExternalEquipment.GBMSAPI_NET_OED_VUI_LCD) != 0)
                {
                    // Stop screen after acquisition
                    if (this.StopScreenAfterAcquisitionCheckBox.Enabled == true &&
                        this.StopScreenAfterAcquisitionCheckBox.Checked == true)
                    {
                        (DisplayOptionMask) |= GBMSAPI_NET_DisplayOptions.GBMSAPI_NET_DO_FINAL_SCREEN;
                    }

                    // customized contrast
                    if (this.ShowCustomizedContrastCheckBox.Enabled == true &&
                        this.ShowCustomizedContrastCheckBox.Checked == true)
                    {
                        // read limit value
                        try
                        {
                            Byte ContrastLimit = Byte.Parse(this.ContrastLimitTextBox.Text);
                            ContrastLimitToDisplay = ContrastLimit;
                        }
                        catch (Exception ReadEx)
                        {
                            if ((ReadEx.GetType()).ToString() == ((new ArgumentNullException()).GetType()).ToString() ||
                                (ReadEx.GetType()).ToString() == ((new FormatException()).GetType()).ToString() ||
                                (ReadEx.GetType()).ToString() == ((new OverflowException()).GetType()).ToString()
                                )
                            {
                                // default value
                                ContrastLimitToDisplay = 120;
                            }
                            else
                            {
                                MessageBox.Show("Exception in GetAcquisitionOptions: " + ReadEx.Message);
                                ObjToScan                  = 0;
                                OptionMask                 = 0;
                                DisplayOptionMask          = 0;
                                ContrastLimitToDisplay     = 0;
                                CompletenessLimitToDisplay = 0;
                                ClipRegionW                = 0;
                                ClipRegionH                = 0;
                                RollPreviewTimeout         = 0;
                                ArtefactCleaningDepth      = 0;
                                return(false);
                            }
                        }
                        (DisplayOptionMask) |= GBMSAPI_NET_DisplayOptions.GBMSAPI_NET_DO_CUSTOMIZED_CONTRAST;
                    }

                    // customized completeness
                    if (this.ShowCustomizedCompletenessCheckBox.Enabled == true && this.ShowCustomizedCompletenessCheckBox.Checked == true)
                    {
                        // read limit value
                        try
                        {
                            Byte CompletenessLimit = Byte.Parse(this.CompletenessLimitTextBox.Text);
                            CompletenessLimitToDisplay = CompletenessLimit;
                        }
                        catch (Exception ReadEx)
                        {
                            if ((ReadEx.GetType()).ToString() == ((new ArgumentNullException()).GetType()).ToString() ||
                                (ReadEx.GetType()).ToString() == ((new FormatException()).GetType()).ToString() ||
                                (ReadEx.GetType()).ToString() == ((new OverflowException()).GetType()).ToString()
                                )
                            {
                                // default value
                                CompletenessLimitToDisplay = 90;
                            }
                            else
                            {
                                MessageBox.Show("Exception in GetAcquisitionOptions: " + ReadEx.Message);
                                ObjToScan                  = 0;
                                OptionMask                 = 0;
                                DisplayOptionMask          = 0;
                                ContrastLimitToDisplay     = 0;
                                CompletenessLimitToDisplay = 0;
                                ClipRegionW                = 0;
                                ClipRegionH                = 0;
                                RollPreviewTimeout         = 0;
                                ArtefactCleaningDepth      = 0;
                                return(false);
                            }
                        }
                        (DisplayOptionMask) |= GBMSAPI_NET_DisplayOptions.GBMSAPI_NET_DO_CUSTOMIZED_COMPLETENESS;
                    }
                }
                #region »ñÈ¡²Ã¼ôÊý¾Ý
                ///////////////////////////////////////
                // GET CLIP DATA
                ///////////////////////////////////////
                ClipRegionW = 0;
                ClipRegionH = 0;
                if (this.ClipEnableCheckBox.Enabled == true &&
                    this.ClipEnableCheckBox.Checked == true)
                {
                    // read clip values
                    try
                    {
                        UInt32 ClipSizeX = UInt32.Parse(this.ClipRegionSizeXTextBox.Text);
                        UInt32 ClipSizeY = UInt32.Parse(this.ClipRegionSizeYTextBox.Text);
                        ClipRegionW = ClipSizeX;
                        ClipRegionH = ClipSizeY;
                    }
                    catch (Exception ReadEx)
                    {
                        if ((ReadEx.GetType()).ToString() == ((new ArgumentNullException()).GetType()).ToString() ||
                            (ReadEx.GetType()).ToString() == ((new FormatException()).GetType()).ToString() ||
                            (ReadEx.GetType()).ToString() == ((new OverflowException()).GetType()).ToString()
                            )
                        {
                            // default value
                            ClipRegionW = 0;
                            ClipRegionH = 0;
                        }
                        else
                        {
                            MessageBox.Show("Exception in GetAcquisitionOptions: " + ReadEx.Message);
                            ObjToScan                  = 0;
                            OptionMask                 = 0;
                            DisplayOptionMask          = 0;
                            ContrastLimitToDisplay     = 0;
                            CompletenessLimitToDisplay = 0;
                            ClipRegionW                = 0;
                            ClipRegionH                = 0;
                            RollPreviewTimeout         = 0;
                            ArtefactCleaningDepth      = 0;
                            return(false);
                        }
                    }
                }
                #endregion
                ///////////////////////////////////////////
                // GET ROLL OPTIONS
                ///////////////////////////////////////////
                // Roll Preview Timeout
                RollPreviewTimeout = 0;
                if (this.AutomaticRollPreviewTimeoutTextBox.Enabled == true)
                {
                    // read timeout
                    try
                    {
                        UInt32 Timeout = UInt32.Parse(this.AutomaticRollPreviewTimeoutTextBox.Text);
                        RollPreviewTimeout = Timeout;
                    }
                    catch (Exception ReadEx)
                    {
                        if ((ReadEx.GetType()).ToString() == ((new ArgumentNullException()).GetType()).ToString() ||
                            (ReadEx.GetType()).ToString() == ((new FormatException()).GetType()).ToString() ||
                            (ReadEx.GetType()).ToString() == ((new OverflowException()).GetType()).ToString()
                            )
                        {
                            // default value
                            RollPreviewTimeout = 0;
                        }
                        else
                        {
                            MessageBox.Show("Exception in GetAcquisitionOptions: " + ReadEx.Message);
                            ObjToScan                  = 0;
                            OptionMask                 = 0;
                            DisplayOptionMask          = 0;
                            ContrastLimitToDisplay     = 0;
                            CompletenessLimitToDisplay = 0;
                            ClipRegionW                = 0;
                            ClipRegionH                = 0;
                            RollPreviewTimeout         = 0;
                            ArtefactCleaningDepth      = 0;
                            return(false);
                        }
                    }
                }
                // Artefact Cleaning Depth
                ArtefactCleaningDepth = 0;
                if (this.ArtefactCleaningDepthTextBox.Enabled == true)
                {
                    // read Clean Depth
                    try
                    {
                        Byte CleanDepth = Byte.Parse(this.ArtefactCleaningDepthTextBox.Text);
                        if (CleanDepth > GBMSAPI_NET_CleaningDepth.GBMSAPI_NET_ARTEFACT_CLEANING_DEPTH_MAX &&
                            CleanDepth != GBMSAPI_NET_CleaningDepth.GBMSAPI_NET_ARTEFACT_CLEANING_DEPTH_UNLIMITED)
                        {
                            MessageBox.Show("Clean depth greater than maximum allowed value; will be automatically set to max", "Warning");
                            CleanDepth = GBMSAPI_NET_CleaningDepth.GBMSAPI_NET_ARTEFACT_CLEANING_DEPTH_MAX;
                        }
                        ArtefactCleaningDepth = CleanDepth;
                    }
                    catch (Exception ReadEx)
                    {
                        if ((ReadEx.GetType()).ToString() == ((new ArgumentNullException()).GetType()).ToString() ||
                            (ReadEx.GetType()).ToString() == ((new FormatException()).GetType()).ToString() ||
                            (ReadEx.GetType()).ToString() == ((new OverflowException()).GetType()).ToString()
                            )
                        {
                            // default value
                            ArtefactCleaningDepth = 0;
                        }
                        else
                        {
                            MessageBox.Show("Exception in GetAcquisitionOptions: " + ReadEx.Message);
                            ObjToScan                  = 0;
                            OptionMask                 = 0;
                            DisplayOptionMask          = 0;
                            ContrastLimitToDisplay     = 0;
                            CompletenessLimitToDisplay = 0;
                            ClipRegionW                = 0;
                            ClipRegionH                = 0;
                            RollPreviewTimeout         = 0;
                            ArtefactCleaningDepth      = 0;
                            return(false);
                        }
                    }
                }

                // ver 3.2.0.0
                // EnableRollCompositionBlock
                if (this.cbEnableRollCompositionBlock.Checked)
                {
                    EnableRollCompositionBlock = true;
                }
                // end ver 3.2.0.0

                ///////////////////////////////////////////
                // GET FFD OPTIONS
                ///////////////////////////////////////////
                // ver 4.0.0.0
                if (this.gbHwFfdSettings.Enabled)
                {
                    if (this.rbHwFfdHighStrictness.Checked)
                    {
                        HwFfdStrictnessThreshold = GBMSAPI_NET_HwAntifakeStrictnessThresholds.GBMSAPI_NET_HW_ANTIFAKE_THRESHOLD_HIGH_STRICTNESS;
                    }
                    else if (this.rbHwFfdMediumStrictness.Checked)
                    {
                        HwFfdStrictnessThreshold = GBMSAPI_NET_HwAntifakeStrictnessThresholds.GBMSAPI_NET_HW_ANTIFAKE_THRESHOLD_MEDIUM_STRICTNESS;
                    }
                    else if (this.rbHwFfdLowStrictness.Checked)
                    {
                        HwFfdStrictnessThreshold = GBMSAPI_NET_HwAntifakeStrictnessThresholds.GBMSAPI_NET_HW_ANTIFAKE_THRESHOLD_LOW_STRICTNESS;
                    }
                    else if (this.rbHwFfdPersonalizedStrictness.Checked)
                    {
                        int dummyFfdStrictTh;
                        if (int.TryParse(this.tbHwFfdPersonalizedStrictValue.Text, out dummyFfdStrictTh))
                        {
                            // ver 4.1.0: max value for hw ffd threshold set to 150
                            if (dummyFfdStrictTh >= 10 && dummyFfdStrictTh <= 150)
                            {
                                HwFfdStrictnessThreshold = dummyFfdStrictTh;
                            }
                        }
                    }
                }
                if (this.gbSwFfdSettings.Enabled)
                {
                    int dummyFfdStrictTh;
                    if (int.TryParse(this.tbSwFfdThreshold.Text, out dummyFfdStrictTh))
                    {
                        if (dummyFfdStrictTh >= 0 && dummyFfdStrictTh <= 100)
                        {
                            SwFfdStrictnessThreshold = dummyFfdStrictTh;
                        }
                    }
                }
                // end ver 4.0.0.0

                ///////////////////////////
                //// RETURN OK
                ///////////////////////////
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in GetAcquisitionOptions function: " + ex.Message);
                ObjToScan                  = 0;
                OptionMask                 = 0;
                DisplayOptionMask          = 0;
                ContrastLimitToDisplay     = 0;
                CompletenessLimitToDisplay = 0;
                ClipRegionW                = 0;
                ClipRegionH                = 0;
                RollPreviewTimeout         = 0;
                ArtefactCleaningDepth      = 0;
                EnableRollCompositionBlock = false;

                return(false);
            }
        }
コード例 #14
0
ファイル: CalibrationForm.cs プロジェクト: tanluZSC/GBMS
        public CalibrationForm()
        {
            InitializeComponent();

            // ver 2.10.0.0: use "2" functions
            UInt32 scanA;
            int    RetVal = GBMSAPI_NET_DeviceCharacteristicsRoutines.GBMSAPI_NET_GetSupportedScanAreas(out scanA);

            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(RetVal, "CalibrationForm,GBMSAPI_NET_GetSupportedScanAreas");
                return;
            }
            this.rbFullFrameArea.Enabled    = false;
            this.rbRollIqsArea.Enabled      = false;
            this.rbRollGaArea.Enabled       = false;
            this.rbRolledThenarArea.Enabled = false;
            this.rbRolledJointArea.Enabled  = false;
            if ((scanA & GBMSAPI_NET_ScanAreas.GBMSAPI_NET_SA_FULL_FRAME) != 0)
            {
                this.rbFullFrameArea.Enabled = true;
            }
            if ((scanA & GBMSAPI_NET_ScanAreas.GBMSAPI_NET_SA_ROLL_IQS) != 0)
            {
                this.rbRollIqsArea.Enabled = true;
            }
            if ((scanA & GBMSAPI_NET_ScanAreas.GBMSAPI_NET_SA_ROLL_GA) != 0)
            {
                this.rbRollGaArea.Enabled = true;
            }
            if ((scanA & GBMSAPI_NET_ScanAreas.GBMSAPI_NET_SA_ROLL_THENAR) != 0)
            {
                this.rbRolledThenarArea.Enabled = true;
            }
            if ((scanA & GBMSAPI_NET_ScanAreas.GBMSAPI_NET_SA_ROLL_JOINT) != 0)
            {
                this.rbRolledJointArea.Enabled = true;
            }

            if (this.rbFullFrameArea.Enabled)
            {
                rbFullFrameArea.Checked = true;
                this.rbFullFrameArea_CheckedChanged(null, null);
            }
            else if (this.rbRollIqsArea.Enabled)
            {
                rbRollIqsArea.Checked = true;
                this.rbRollIqsArea_CheckedChanged(null, null);
            }
            else if (this.rbRollGaArea.Enabled)
            {
                rbRollGaArea.Checked = true;
                this.rbRollGaArea_CheckedChanged(null, null);
            }
            else if (this.rbRolledThenarArea.Enabled)
            {
                rbRolledThenarArea.Checked = true;
                this.rbRolledThenarArea_CheckedChanged(null, null);
            }
            else if (this.rbRolledJointArea.Enabled)
            {
                rbRolledJointArea.Checked = true;
                this.rbRolledJointArea_CheckedChanged(null, null);
            }
            else
            {
                MessageBox.Show("NO SCANNABLE AREAS AVAILABLE", "HEAVY ERROR!!!!");
                return;
            }
            // end ver 2.10.0.0: use "2" functions
            this.OriginalImage = this.CalibrationImagePictureBox.Image;
        }
コード例 #15
0
ファイル: CalibrationForm.cs プロジェクト: tanluZSC/GBMS
        // end ver 2.10.0.0: use "2" functions
        private void GetNewCalibrationImageButton_Click(object sender, EventArgs e)
        {
            try
            {
                uint    CalibrationDiagnostic;
                Byte [] CalImageArray;

                // ver 2.10.0.0: use "2" functions
                //int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_GetCalibrationImage(
                //    FlatScanArea,out CalImageArray,out CalibrationDiagnostic);
                int RetVal = GBMSAPI_NET_AuxiliaryRoutines.GBMSAPI_NET_GetCalibrationImage2(
                    this.ScanArea, out CalImageArray, out CalibrationDiagnostic);
                // end ver 2.10.0.0: use "2" functions

                if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
                {
                    GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(
                        RetVal, "GetNewCalibrationImageButton_Click,GBMSAPI_GetImageSize");
                    return;
                }

                Marshal.Copy(CalImageArray, 0, this.CalibrationImage, CalImageArray.Length);

                // show diagnostic
                this.Diagnostic = CalibrationDiagnostic;
                this.DiagnosticListBox.Items.Clear();
                if (CalibrationDiagnostic != 0)
                {
                    List <String> DiagList = GBMSAPI_Example_Util.GetDiagStringsFromDiagMask(CalibrationDiagnostic);
                    if ((DiagList != null) && (DiagList.Count > 0))
                    {
                        for (int i = 0; i < DiagList.Count; i++)
                        {
                            this.DiagnosticListBox.Items.Add(DiagList[i]);
                        }
                    }
                }

                // be aware of stride
                int    stride;
                IntPtr BmpBuffer;
                if ((CalibrationImageSX % 4) != 0)
                {
                    stride = CalibrationImageSX - (CalibrationImageSX % 4);

                    Byte [] Dest; Byte [] Src;
                    Dest = new Byte[stride * CalibrationImageSY];
                    Src  = new Byte[CalibrationImageSX * CalibrationImageSY];

                    if (Dest == null || Src == null)
                    {
                        MessageBox.Show("Error in memory allocation in GetNewCalibrationImageButton_Click");
                    }

                    Marshal.Copy(GBMSAPI_Example_Globals.CalibrationBuffer, Src, 0, Src.Length);
                    Marshal.Copy(GBMSAPI_Example_Globals.DummyCalibrationBuffer, Dest, 0, Dest.Length);

                    int DestOffset = 0, SrcOffset = 0;
                    for (int i = 0; i < CalibrationImageSY;
                         i++, DestOffset += stride, SrcOffset += CalibrationImageSX)
                    {
                        Buffer.BlockCopy(Src, SrcOffset, Dest, DestOffset, stride);
                    }

                    Marshal.Copy(Dest, 0, GBMSAPI_Example_Globals.DummyCalibrationBuffer, Dest.Length);

                    BmpBuffer = GBMSAPI_Example_Globals.DummyCalibrationBuffer;
                }
                else
                {
                    stride    = CalibrationImageSX;
                    BmpBuffer = GBMSAPI_Example_Globals.CalibrationBuffer;
                }

                // draw image
                this.CalibrationImagePictureBox.Image = new Bitmap(
                    CalibrationImageSX, CalibrationImageSY,
                    stride,
                    System.Drawing.Imaging.PixelFormat.Format8bppIndexed,
                    BmpBuffer
                    );

                System.Drawing.Imaging.ColorPalette pal = this.CalibrationImagePictureBox.Image.Palette;
                for (int i = 0; i < pal.Entries.Length; i++)
                {
                    pal.Entries[i] = Color.FromArgb(255, i, i, i);
                }
                this.CalibrationImagePictureBox.Image.Palette = pal;
                this.CalibrationImagePictureBox.SizeMode      = PictureBoxSizeMode.StretchImage;

                this.SaveButton.Enabled = true;

                this.Update();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception in GetNewCalibrationImageButton_Click: " + ex.Message);
            }
        }
コード例 #16
0
ファイル: VUI_LED.cs プロジェクト: tanluZSC/GBMS
        private void SetButton_Click(object sender, EventArgs e)
        {
            uint IndicatorMask = 0x0000;
            int  Color = 0, RetVal;
            bool Blink;

            // check blink
            if (BlinkCheckBox.Checked)
            {
                Blink = true;
            }
            else
            {
                Blink = false;
            }

            // check Color
            if (GreenRadioButton.Checked)
            {
                Color = GBMSAPI_NET_LEDColors.GBMSAPI_NET_COLOR_GREEN;
            }
            if (RedRadioButton.Checked)
            {
                Color = GBMSAPI_NET_LEDColors.GBMSAPI_NET_COLOR_RED;
            }
            if (YellowRadioButton.Checked)
            {
                Color = GBMSAPI_NET_LEDColors.GBMSAPI_NET_COLOR_YELLOW;
            }
            if (OffRadioButton.Checked)
            {
                Color = GBMSAPI_NET_LEDColors.GBMSAPI_NET_COLOR_OFF;
            }

            // set indicator mask
            if (RightThumbCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_THUMB_RIGHT;
            }
            if (RightIndexCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_INDEX_RIGHT;
            }
            if (RightMiddleCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_MIDDLE_RIGHT;
            }
            if (RightRingCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_RING_RIGHT;
            }
            if (RightLittleCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_LITTLE_RIGHT;
            }
            if (LeftThumbCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_THUMB_LEFT;
            }
            if (LeftIndexCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_INDEX_LEFT;
            }
            if (LeftMiddleCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_MIDDLE_LEFT;
            }
            if (LeftRingCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_RING_LEFT;
            }
            if (LeftLittleCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_LITTLE_LEFT;
            }
            if (RollIndicationCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_ROLL;
            }
            if (StatusCheckBox.Checked)
            {
                IndicatorMask |= GBMSAPI_NET_LEDMaskValues.GBMSAPI_NET_VIL_STATUS;
            }


            RetVal = GBMSAPI_NET_ExternalDevicesControlRoutines.GBMSAPI_NET_SetFingerIndicatorVUIState(IndicatorMask, Color, Blink);

            if (RetVal != GBMSAPI_NET_ErrorCodes.GBMSAPI_NET_ERROR_CODE_NO_ERROR)
            {
                GBMSAPI_Example_Util.GBMSAPI_Example_ManageErrors(RetVal, "SetButton_Click,GBMSAPI_SetFingerIndicatorVUIState");
                return;
            }

            return;
        }