MFS100 Code Hubs
MFS100 Code Hubs
MFS100 Code Hubs
FingerprintScanner;
import android.app.Activity;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.os.SystemClock;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.mantra.mfs100.FingerData;
import com.mantra.mfs100.MFS100;
import com.mantra.mfs100.MFS100Event;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
MFS100CodeHubs.this.SetTextOnUIThread(MFS100CodeHubs.this.mfs100.GetErrorMsg(ret));
} else {
MFS100CodeHubs.this.lastCapFingerData = fingerData;
final Bitmap bitmap =
BitmapFactory.decodeByteArray(fingerData.FingerImage(), 0,
fingerData.FingerImage().length);
MFS100CodeHubs.this.runOnUiThread(new Runnable() {
/* class MFS100Test.AnonymousClass1.AnonymousClass1 */
MFS100CodeHubs.this.imgFinger.setImageBitmap(bitmap);
}
});
MFS100CodeHubs.this.SetTextOnUIThread("Capture Success");
MFS100CodeHubs.this.SetLogOnUIThread("\nQuality: " +
fingerData.Quality() + "\nNFIQ: " + fingerData.Nfiq() + "\nWSQ Compress Ratio: " +
fingerData.WSQCompressRatio() + "\nImage Dimensions (inch): " +
fingerData.InWidth() + "\" X " + fingerData.InHeight() + "\"\nImage Area (inch): "
+ fingerData.InArea() + "\"\nResolution (dpi/ppi): " + fingerData.Resolution() + "\
nGray Scale: " + fingerData.GrayScale() + "\nBits Per Pixal: " + fingerData.Bpp() +
"\nWSQ Info: " + fingerData.WSQInfo());
MFS100CodeHubs.this.SetData2(fingerData);
}
} catch (Exception e) {
MFS100CodeHubs.this.SetTextOnUIThread("Error");
} catch (Throwable th) {
MFS100CodeHubs.this.isCaptureRunning = false;
throw th;
}
MFS100CodeHubs.this.isCaptureRunning = false;
}
}).start();
}
@Override // com.mantra.mfs100.MFS100Event
public void OnDeviceAttached(int vid, int pid, boolean hasPermission) {
if (SystemClock.elapsedRealtime() - this.mLastAttTime >= Threshold) {
this.mLastAttTime = SystemClock.elapsedRealtime();
if (!hasPermission) {
SetTextOnUIThread("Permission denied");
} else if (vid != 1204 && vid != 11279) {
} else {
if (pid == 34323) {
try {
int ret = this.mfs100.LoadFirmware();
if (ret != 0) {
SetTextOnUIThread(this.mfs100.GetErrorMsg(ret));
} else {
SetTextOnUIThread("Load firmware success");
}
} catch (Exception e) {
e.printStackTrace();
}
} else if (pid == 4101) {
int ret2 = this.mfs100.Init();
if (ret2 == 0) {
showSuccessLog("Without Key");
} else {
SetTextOnUIThread(this.mfs100.GetErrorMsg(ret2));
}
}
}
}
}
@Override // com.mantra.mfs100.MFS100Event
public void OnDeviceDetached() {
try {
if (SystemClock.elapsedRealtime() - this.mLastDttTime >= Threshold) {
this.mLastDttTime = SystemClock.elapsedRealtime();
UnInitScanner();
SetTextOnUIThread("Device removed");
}
} catch (Exception e) {
}
}
@Override // com.mantra.mfs100.MFS100Event
public void OnHostCheckFailed(String err) {
try {
SetLogOnUIThread(err);
Toast.makeText(getApplicationContext(), err, 1).show();
} catch (Exception e) {
}
}
}