Ejemplo n.º 1
0
  // Verify Table Two
  private Boolean Verify_DB_TableTWO(byte[] dbFingureTwo) {

    String msg = "";

    byte[] VerifyFingure = Base64.decode(Base64_templateVerify, Base64.DEFAULT);

    byTemplate1 = VerifyFingure;
    byTemplateFingure2_DB = dbFingureTwo;

    if (byTemplate1 != null && byTemplateFingure2_DB != null) {
      NBioBSPJNI.FIR_HANDLE hLoadFIR1, hLoadFIR2;

      {
        hLoadFIR1 = bsp.new FIR_HANDLE();

        exportEngine.ImportFIR(
            byTemplate1, byTemplate1.length, NBioBSPJNI.EXPORT_MINCONV_TYPE.OLD_FDA, hLoadFIR1);

        if (bsp.IsErrorOccured()) {
          msg = "Template NBioBSP ImportFIR Error: " + bsp.GetErrorCode();
          // tvInfo.setText(msg);
          return false;
        }
      }

      {
        hLoadFIR2 = bsp.new FIR_HANDLE();

        exportEngine.ImportFIR(
            byTemplateFingure2_DB,
            byTemplateFingure2_DB.length,
            NBioBSPJNI.EXPORT_MINCONV_TYPE.OLD_FDA,
            hLoadFIR2);

        if (bsp.IsErrorOccured()) {
          hLoadFIR1.dispose();
          msg = "Template NBioBSP ImportFIR Error: " + bsp.GetErrorCode();
          // tvInfo.setText(msg);
          return false;
        }
      }

      // Verify Match
      NBioBSPJNI.INPUT_FIR inputFIR1, inputFIR2;
      Boolean bResult = new Boolean(false);

      inputFIR1 = bsp.new INPUT_FIR();
      inputFIR2 = bsp.new INPUT_FIR();

      inputFIR1.SetFIRHandle(hLoadFIR1);
      inputFIR2.SetFIRHandle(hLoadFIR2);

      bsp.VerifyMatch(inputFIR1, inputFIR2, bResult, null);

      if (bsp.IsErrorOccured()) {
        msg = "Template NBioBSP Verify Match Error: " + bsp.GetErrorCode();
      } else {
        if (bResult) {
          msg = "Template VerifyMatch Successed";

        } else {
          msg = "Template VerifyMatch Failed";
          hLoadFIR1.dispose();
          hLoadFIR2.dispose();
          return false;
        }
      }

      hLoadFIR1.dispose();
      hLoadFIR2.dispose();
    } else {
      msg = "Can not find captured data";
      return false;
    }

    // tvInfo.setText(msg);
    return true;
  }
Ejemplo n.º 2
0
  public synchronized void OnCapture1(int timeout) {

    NBioBSPJNI.FIR_HANDLE hCapturedFIR, hAuditFIR;
    NBioBSPJNI.CAPTURED_DATA capturedData;

    hCapturedFIR = bsp.new FIR_HANDLE();
    hAuditFIR = bsp.new FIR_HANDLE();
    capturedData = bsp.new CAPTURED_DATA();

    bCapturedFirst = true;

    bsp.Capture(
        NBioBSPJNI.FIR_PURPOSE.ENROLL,
        hCapturedFIR,
        timeout,
        hAuditFIR,
        capturedData,
        MainActivity.this,
        0,
        null);

    if (sampleDialogFragment != null
        && "DIALOG_TYPE_PROGRESS".equals(sampleDialogFragment.getTag()))
      sampleDialogFragment.dismiss();

    if (bsp.IsErrorOccured()) {
      msg = "NBioBSP Capture Error: " + bsp.GetErrorCode();
    } else {
      NBioBSPJNI.INPUT_FIR inputFIR;

      inputFIR = bsp.new INPUT_FIR();

      // Make ISO 19794-2 data
      {
        NBioBSPJNI.Export.DATA exportData;

        inputFIR.SetFIRHandle(hCapturedFIR);

        exportData = exportEngine.new DATA();

        exportEngine.ExportFIR(inputFIR, exportData, NBioBSPJNI.EXPORT_MINCONV_TYPE.OLD_FDA);

        if (bsp.IsErrorOccured()) {
          runOnUiThread(
              new Runnable() {

                public void run() {
                  msg = "NBioBSP ExportFIR Error: " + bsp.GetErrorCode();
                }
              });
          return;
        }

        if (byTemplate1 != null) byTemplate1 = null;

        byTemplate1 = new byte[exportData.FingerData[0].Template[0].Data.length];
        byTemplate1 = exportData.FingerData[0].Template[0].Data;

        Base64_templateVerify = Base64.encodeToString(byTemplate1, Base64.DEFAULT);

        // Base64_templateVerify is the fingure that is placed on the machine
        // Start ASYNC TASK
        if (Base64_templateVerify != null) {
          VerifyFinger VF = new VerifyFinger();
          VF.execute(Base64_templateVerify);
        } else {
          msg = "String Empty";
        }
      }

      // Make Raw Image data
      {
        NBioBSPJNI.Export.AUDIT exportAudit;

        inputFIR.SetFIRHandle(hAuditFIR);

        exportAudit = exportEngine.new AUDIT();

        exportEngine.ExportAudit(inputFIR, exportAudit);

        if (bsp.IsErrorOccured()) {

          runOnUiThread(
              new Runnable() {

                public void run() {
                  msg = "NBioBSP ExportAudit Error: " + bsp.GetErrorCode();
                }
              });

          return;
        }

        if (byCapturedRaw1 != null) byCapturedRaw1 = null;

        byCapturedRaw1 = new byte[exportAudit.FingerData[0].Template[0].Data.length];
        byCapturedRaw1 = exportAudit.FingerData[0].Template[0].Data;

        nCapturedRawWidth1 = exportAudit.ImageWidth;
        nCapturedRawHeight1 = exportAudit.ImageHeight;

        msg = "First Capture Success";
      }
    }

    runOnUiThread(
        new Runnable() {

          public void run() {

            if (byTemplate1 != null && byTemplate1 != null) {
            } else {
            }
          }
        });
  }