package [Link].
FingerprintScanner;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link].mfs100.MFS100;
import [Link].mfs100.MFS100Event;
import [Link];
import [Link];
import [Link];
public class MFS100CodeHubs extends Activity implements MFS100Event {
private static long Threshold = 1500;
private static long mLastClkTime = 0;
byte[] Enroll_Template;
byte[] Verify_Template;
Button btnClearLog;
Button btnExtractAnsi;
Button btnExtractISOImage;
Button btnExtractWSQImage;
Button btnInit;
Button btnMatchISOTemplate;
Button btnStopCapture;
Button btnSyncCapture;
Button btnUninit;
CheckBox cbFastDetection;
ImageView imgFinger;
private boolean isCaptureRunning = false;
private FingerData lastCapFingerData = null;
TextView lblMessage;
private long mLastAttTime = 0;
long mLastDttTime = 0;
MFS100 mfs100 = null;
ScannerAction scannerAction = [Link];
int timeout = 10000;
EditText txtEventLog;
/* access modifiers changed from: private */
public enum ScannerAction {
Capture,
Verify
}
/* access modifiers changed from: protected */
public void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_mfs100_sample);
FindFormControls();
try {
getWindow().setSoftInputMode(3);
} catch (Exception e) {
Log.e("Error", [Link]());
}
try {
this.mfs100 = new MFS100(this);
[Link](this);
} catch (Exception e2) {
[Link]();
}
}
/* access modifiers changed from: protected */
public void onStart() {
try {
if (this.mfs100 == null) {
this.mfs100 = new MFS100(this);
[Link](this);
} else {
InitScanner();
}
} catch (Exception e) {
[Link]();
}
[Link]();
}
/* access modifiers changed from: protected */
public void onStop() {
try {
if ([Link]) {
[Link]();
}
[Link](500);
} catch (InterruptedException e) {
[Link]();
}
[Link]();
}
/* access modifiers changed from: protected */
public void onResume() {
[Link]();
}
/* access modifiers changed from: protected */
public void onDestroy() {
try {
if (this.mfs100 != null) {
[Link]();
}
} catch (Exception e) {
[Link]();
}
[Link]();
}
public void FindFormControls() {
try {
[Link] = (Button) findViewById([Link]);
[Link] = (Button) findViewById([Link]);
[Link] = (Button)
findViewById([Link]);
[Link] = (Button)
findViewById([Link]);
[Link] = (Button) findViewById([Link]);
[Link] = (Button)
findViewById([Link]);
[Link] = (Button) findViewById([Link]);
[Link] = (TextView) findViewById([Link]);
[Link] = (EditText) findViewById([Link]);
[Link] = (ImageView) findViewById([Link]);
[Link] = (Button) findViewById([Link]);
[Link] = (Button) findViewById([Link]);
[Link] = (CheckBox) findViewById([Link]);
} catch (Exception e) {
[Link]();
}
}
public void onControlClicked(View v) {
if ([Link]() - mLastClkTime >= Threshold) {
mLastClkTime = [Link]();
try {
switch ([Link]()) {
case [Link]:
ClearLog();
return;
case [Link]:
ExtractANSITemplate();
return;
case [Link]:
ExtractISOImage();
return;
case [Link]:
ExtractWSQImage();
return;
case [Link]:
InitScanner();
return;
case [Link]:
[Link] = [Link];
if (![Link]) {
StartSyncCapture();
return;
}
return;
case [Link]:
StopCapture();
return;
case [Link]:
[Link] = [Link];
if (![Link]) {
StartSyncCapture();
return;
}
return;
case [Link]:
UnInitScanner();
return;
default:
return;
}
} catch (Exception e) {
[Link]();
}
}
}
public void onConfigurationChanged(Configuration newConfig) {
[Link](newConfig);
setContentView([Link].activity_mfs100_sample);
FindFormControls();
try {
if (this.mfs100 == null) {
this.mfs100 = new MFS100(this);
[Link](this);
}
if ([Link] && this.mfs100 != null) {
[Link]();
}
} catch (Exception e) {
[Link]();
}
}
private void InitScanner() {
try {
int ret = [Link]();
if (ret != 0) {
SetTextOnUIThread([Link](ret));
return;
}
SetTextOnUIThread("Init success");
SetLogOnUIThread("Serial: " + [Link]().SerialNo() +
" Make: " + [Link]().Make() + " Model: " +
[Link]().Model() + "\nCertificate: " +
[Link]());
} catch (Exception e) {
[Link](getApplicationContext(), "Init failed, unhandled
exception", 1).show();
SetTextOnUIThread("Init failed, unhandled exception");
}
}
private void StartSyncCapture() {
new Thread(new Runnable() {
/* class MFS100Test.AnonymousClass1 */
public void run() {
[Link]("");
[Link] = true;
try {
FingerData fingerData = new FingerData();
int ret = [Link](fingerData,
[Link], [Link]());
Log.e("[Link]", "" + ret);
if (ret != 0) {
[Link]([Link](ret));
} else {
[Link] = fingerData;
final Bitmap bitmap =
[Link]([Link](), 0,
[Link]().length);
[Link](new Runnable() {
/* class MFS100Test.AnonymousClass1.AnonymousClass1 */
public void run() {
[Link](bitmap);
}
});
[Link]("Capture Success");
[Link]("\nQuality: " +
[Link]() + "\nNFIQ: " + [Link]() + "\nWSQ Compress Ratio: " +
[Link]() + "\nImage Dimensions (inch): " +
[Link]() + "\" X " + [Link]() + "\"\nImage Area (inch): "
+ [Link]() + "\"\nResolution (dpi/ppi): " + [Link]() + "\
nGray Scale: " + [Link]() + "\nBits Per Pixal: " + [Link]() +
"\nWSQ Info: " + [Link]());
[Link].SetData2(fingerData);
}
} catch (Exception e) {
[Link]("Error");
} catch (Throwable th) {
[Link] = false;
throw th;
}
[Link] = false;
}
}).start();
}
private void StopCapture() {
try {
[Link]();
} catch (Exception e) {
SetTextOnUIThread("Error");
}
}
private void ExtractANSITemplate() {
try {
if ([Link] == null) {
SetTextOnUIThread("Finger not capture");
return;
}
byte[] tempData = new byte[2000];
int dataLen =
[Link]([Link](), tempData);
if (dataLen > 0) {
byte[] ansiTemplate = new byte[dataLen];
[Link](tempData, 0, ansiTemplate, 0, dataLen);
WriteFile("[Link]", ansiTemplate);
SetTextOnUIThread("Extract ANSI Template Success");
} else if (dataLen == 0) {
SetTextOnUIThread("Failed to extract ANSI Template");
} else {
SetTextOnUIThread([Link](dataLen));
}
} catch (Exception e) {
Log.e("Error", "Extract ANSI Template Error", e);
}
}
private void ExtractISOImage() {
try {
if ([Link] == null) {
SetTextOnUIThread("Finger not capture");
return;
}
byte[] tempData = new byte[(([Link]().Width() *
[Link]().Height()) + 1078)];
int dataLen =
[Link]([Link](), tempData, 2);
if (dataLen > 0) {
byte[] isoImage = new byte[dataLen];
[Link](tempData, 0, isoImage, 0, dataLen);
WriteFile("[Link]", isoImage);
SetTextOnUIThread("Extract ISO Image Success");
} else if (dataLen == 0) {
SetTextOnUIThread("Failed to extract ISO Image");
} else {
SetTextOnUIThread([Link](dataLen));
}
} catch (Exception e) {
Log.e("Error", "Extract ISO Image Error", e);
}
}
private void ExtractWSQImage() {
try {
if ([Link] == null) {
SetTextOnUIThread("Finger not capture");
return;
}
byte[] tempData = new byte[(([Link]().Width() *
[Link]().Height()) + 1078)];
int dataLen =
[Link]([Link](), tempData);
if (dataLen > 0) {
byte[] wsqImage = new byte[dataLen];
[Link](tempData, 0, wsqImage, 0, dataLen);
WriteFile("[Link]", wsqImage);
SetTextOnUIThread("Extract WSQ Image Success");
} else if (dataLen == 0) {
SetTextOnUIThread("Failed to extract WSQ Image");
} else {
SetTextOnUIThread([Link](dataLen));
}
} catch (Exception e) {
Log.e("Error", "Extract WSQ Image Error", e);
}
}
private void UnInitScanner() {
try {
int ret = [Link]();
if (ret != 0) {
SetTextOnUIThread([Link](ret));
return;
}
SetLogOnUIThread("Uninit Success");
SetTextOnUIThread("Uninit Success");
[Link] = null;
} catch (Exception e) {
Log.e("[Link]", [Link]());
}
}
private void WriteFile(String filename, byte[] bytes) {
try {
String path = [Link]() +
"//FingerData";
File file = new File(path);
if (![Link]()) {
[Link]();
}
String path2 = path + "//" + filename;
File file2 = new File(path2);
if (![Link]()) {
[Link]();
}
FileOutputStream stream = new FileOutputStream(path2);
[Link](bytes);
[Link]();
} catch (Exception e1) {
[Link]();
}
}
private void WriteFileString(String filename, String data) {
try {
String path = [Link]() +
"//FingerData";
File file = new File(path);
if (![Link]()) {
[Link]();
}
String path2 = path + "//" + filename;
File file2 = new File(path2);
if (![Link]()) {
[Link]();
}
FileOutputStream stream = new FileOutputStream(path2);
OutputStreamWriter writer = new OutputStreamWriter(stream);
[Link](data);
[Link]();
[Link]();
[Link]();
} catch (Exception e1) {
[Link]();
}
}
private void ClearLog() {
[Link](new Runnable() {
/* class MFS100Test.AnonymousClass2 */
public void run() {
try {
[Link]("",
[Link]);
} catch (Exception e) {
[Link]();
}
}
});
}
/* access modifiers changed from: private */
/* access modifiers changed from: public */
private void SetTextOnUIThread(final String str) {
[Link](new Runnable() {
/* class MFS100Test.AnonymousClass3 */
public void run() {
try {
[Link](str);
} catch (Exception e) {
[Link]();
}
}
});
}
/* access modifiers changed from: private */
/* access modifiers changed from: public */
private void SetLogOnUIThread(final String str) {
[Link](new Runnable() {
/* class MFS100Test.AnonymousClass4 */
public void run() {
try {
EditText editText = [Link];
[Link]("\n" + str);
} catch (Exception e) {
[Link]();
}
}
});
}
public void SetData2(FingerData fingerData) {
try {
if ([Link]([Link])) {
this.Enroll_Template = new byte[[Link]().length];
[Link]([Link](), 0, this.Enroll_Template,
0, [Link]().length);
} else if ([Link]([Link])) {
if (this.Enroll_Template != null) {
this.Verify_Template = new
byte[[Link]().length];
[Link]([Link](), 0,
this.Verify_Template, 0, [Link]().length);
int ret = [Link](this.Enroll_Template,
this.Verify_Template);
if (ret < 0) {
SetTextOnUIThread("Error: " + ret + "(" +
[Link](ret) + ")");
} else if (ret >= 96) {
SetTextOnUIThread("Finger matched with score: " + ret);
} else {
SetTextOnUIThread("Finger not matched, score: " + ret);
}
} else {
return;
}
}
} catch (Exception e) {
[Link]();
}
try {
WriteFile("[Link]", [Link]());
WriteFile("[Link]", [Link]());
WriteFile("[Link]", [Link]());
} catch (Exception e2) {
[Link]();
}
}
@Override // [Link].mfs100.MFS100Event
public void OnDeviceAttached(int vid, int pid, boolean hasPermission) {
if ([Link]() - [Link] >= Threshold) {
[Link] = [Link]();
if (!hasPermission) {
SetTextOnUIThread("Permission denied");
} else if (vid != 1204 && vid != 11279) {
} else {
if (pid == 34323) {
try {
int ret = [Link]();
if (ret != 0) {
SetTextOnUIThread([Link](ret));
} else {
SetTextOnUIThread("Load firmware success");
}
} catch (Exception e) {
[Link]();
}
} else if (pid == 4101) {
int ret2 = [Link]();
if (ret2 == 0) {
showSuccessLog("Without Key");
} else {
SetTextOnUIThread([Link](ret2));
}
}
}
}
}
private void showSuccessLog(String key) {
try {
SetTextOnUIThread("Init success");
SetLogOnUIThread("\nKey: " + key + "\nSerial: " +
[Link]().SerialNo() + " Make: " +
[Link]().Make() + " Model: " +
[Link]().Model() + "\nCertificate: " +
[Link]());
} catch (Exception e) {
}
}
@Override // [Link].mfs100.MFS100Event
public void OnDeviceDetached() {
try {
if ([Link]() - [Link] >= Threshold) {
[Link] = [Link]();
UnInitScanner();
SetTextOnUIThread("Device removed");
}
} catch (Exception e) {
}
}
@Override // [Link].mfs100.MFS100Event
public void OnHostCheckFailed(String err) {
try {
SetLogOnUIThread(err);
[Link](getApplicationContext(), err, 1).show();
} catch (Exception e) {
}
}
}