Commit 5413069bec5248d4f717702916844acc749ed381

Authored by Nitin Agarwal
0 parents
Exists in master

First and Last Commit

Showing 58 changed files with 2481 additions and 0 deletions   Show diff stats
.DS_Store 0 → 100644
No preview for this file type
.classpath 0 → 100755
  1 +++ a/.classpath
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" path="src"/>
  4 + <classpathentry kind="src" path="gen"/>
  5 + <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
  6 + <classpathentry kind="lib" path="C:/workspace/code/trunk/android/java/build/FDX_SDK_PRO_Android/FDxSDKProAndroid.jar"/>
  7 + <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
  8 + <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
  9 + <classpathentry kind="output" path="bin/classes"/>
  10 +</classpath>
.project 0 → 100755
  1 +++ a/.project
@@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>SecuGenUSBDist</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + <buildCommand>
  14 + <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
  15 + <arguments>
  16 + </arguments>
  17 + </buildCommand>
  18 + <buildCommand>
  19 + <name>org.eclipse.jdt.core.javabuilder</name>
  20 + <arguments>
  21 + </arguments>
  22 + </buildCommand>
  23 + <buildCommand>
  24 + <name>com.android.ide.eclipse.adt.ApkBuilder</name>
  25 + <arguments>
  26 + </arguments>
  27 + </buildCommand>
  28 + </buildSpec>
  29 + <natures>
  30 + <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
  31 + <nature>org.eclipse.jdt.core.javanature</nature>
  32 + </natures>
  33 +</projectDescription>
.settings/org.eclipse.jdt.core.prefs 0 → 100755
  1 +++ a/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +#Fri Mar 16 16:18:29 CDT 2012
  2 +eclipse.preferences.version=1
  3 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
  4 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
  5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
  6 +org.eclipse.jdt.core.compiler.compliance=1.6
  7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate
  8 +org.eclipse.jdt.core.compiler.debug.localVariable=generate
  9 +org.eclipse.jdt.core.compiler.debug.sourceFile=generate
  10 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
  11 +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
  12 +org.eclipse.jdt.core.compiler.source=1.6
AndroidManifest.xml 0 → 100755
  1 +++ a/AndroidManifest.xml
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  2 + package="SecuGen.Demo">
  3 +
  4 + <uses-feature android:name="android.hardware.usb.host" />
  5 + <uses-sdk android:minSdkVersion="12" />
  6 +
  7 + <application android:debuggable="true">
  8 + <activity android:name="JSGDActivity"
  9 + android:label="SecuGen Android Demo"
  10 + android:screenOrientation="nosensor">
  11 + <intent-filter>
  12 + <action android:name="android.intent.action.MAIN" />
  13 + <category android:name="android.intent.category.DEFAULT" />
  14 + <category android:name="android.intent.category.LAUNCHER" />
  15 + </intent-filter>
  16 +
  17 + <intent-filter>
  18 + <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
  19 + </intent-filter>
  20 +
  21 + <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
  22 + android:resource="@xml/device_filter" />
  23 + </activity>
  24 + </application>
  25 +</manifest>
README.txt 0 → 100755
  1 +++ a/README.txt
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
  1 +MissileLauncher is a simple program that controls Dream Cheeky USB missile launchers.
  2 +You control the left/right/up/down orientation of the launcher using the accelerometer.
  3 +Tilt the tablet to change the direction of the launcher.
  4 +Pressing the "Fire" button will fire one missile.
  5 +
  6 +This program serves as an example of the following USB host features:
  7 +
  8 +- filtering for multiple devices based on vendor and product IDs (see device_filter.xml)
  9 +
  10 +- Sending control requests on endpoint zero that contain data
  11 +
  12 +- Receiving packets on an interrupt endpoint using a thread that calls
  13 + UsbRequest.queue and UsbDeviceConnection.requestWait()
bin/AndroidManifest.xml 0 → 100755
  1 +++ a/bin/AndroidManifest.xml
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  2 + package="SecuGen.Demo">
  3 +
  4 + <uses-feature android:name="android.hardware.usb.host" />
  5 + <uses-sdk android:minSdkVersion="12" />
  6 +
  7 + <application android:debuggable="true">
  8 + <activity android:name="JSGDActivity"
  9 + android:label="SecuGen Android Demo"
  10 + android:screenOrientation="nosensor">
  11 + <intent-filter>
  12 + <action android:name="android.intent.action.MAIN" />
  13 + <category android:name="android.intent.category.DEFAULT" />
  14 + <category android:name="android.intent.category.LAUNCHER" />
  15 + </intent-filter>
  16 +
  17 + <intent-filter>
  18 + <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
  19 + </intent-filter>
  20 +
  21 + <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
  22 + android:resource="@xml/device_filter" />
  23 + </activity>
  24 + </application>
  25 +</manifest>
bin/dexedLibs/annotations-e6481d9dd4491a2b5097af0d00fe409d.jar 0 → 100755
No preview for this file type
bin/res/crunch/drawable-hdpi/hamster4.png 0 → 100755

8.07 KB

bin/res/crunch/drawable-hdpi/icon.png 0 → 100755

3.87 KB

bin/res/crunch/drawable-ldpi/hamster4.png 0 → 100755

2.6 KB

bin/res/crunch/drawable-ldpi/icon.png 0 → 100755

1.5 KB

bin/res/crunch/drawable-mdpi/hamster4.png 0 → 100755

4.16 KB

bin/res/crunch/drawable-mdpi/icon.png 0 → 100755

2.15 KB

bin/res/drawable-hdpi/hamster4.png 0 → 100755

8.07 KB

bin/res/drawable-hdpi/icon.png 0 → 100755

3.87 KB

bin/res/drawable-ldpi/hamster4.png 0 → 100755

2.6 KB

bin/res/drawable-ldpi/icon.png 0 → 100755

1.5 KB

bin/res/drawable-mdpi/hamster4.png 0 → 100755

4.16 KB

bin/res/drawable-mdpi/icon.png 0 → 100755

2.15 KB

gen/SecuGen/Demo/BuildConfig.java 0 → 100755
  1 +++ a/gen/SecuGen/Demo/BuildConfig.java
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +/** Automatically generated file. DO NOT MODIFY */
  2 +package SecuGen.Demo;
  3 +
  4 +public final class BuildConfig {
  5 + public final static boolean DEBUG = true;
  6 +}
0 \ No newline at end of file 7 \ No newline at end of file
gen/SecuGen/Demo/R.java 0 → 100755
  1 +++ a/gen/SecuGen/Demo/R.java
@@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
  1 +/* AUTO-GENERATED FILE. DO NOT MODIFY.
  2 + *
  3 + * This class was automatically generated by the
  4 + * aapt tool from the resource data it found. It
  5 + * should not be modified by hand.
  6 + */
  7 +
  8 +package SecuGen.Demo;
  9 +
  10 +public final class R {
  11 + public static final class attr {
  12 + }
  13 + public static final class drawable {
  14 + public static final int hamster4=0x7f020000;
  15 + public static final int icon=0x7f020001;
  16 + }
  17 + public static final class id {
  18 + public static final int AbsoluteLayout1=0x7f070000;
  19 + public static final int buttonCapture=0x7f070010;
  20 + public static final int buttonLedOn=0x7f070006;
  21 + public static final int buttonMatch=0x7f070003;
  22 + public static final int buttonRegister=0x7f070002;
  23 + public static final int buttonSDKTest=0x7f070008;
  24 + public static final int checkBoxMatched=0x7f07000b;
  25 + public static final int editLog=0x7f070009;
  26 + public static final int fire=0x7f070005;
  27 + public static final int imageView1=0x7f07000d;
  28 + public static final int imageViewFingerprint=0x7f07000a;
  29 + public static final int imageViewRegister=0x7f070007;
  30 + public static final int imageViewVerify=0x7f070004;
  31 + public static final int textView1=0x7f070001;
  32 + public static final int textViewResult=0x7f07000c;
  33 + public static final int toggleButtonAutoOn=0x7f07000e;
  34 + public static final int toggleButtonSmartCapture=0x7f07000f;
  35 + }
  36 + public static final class layout {
  37 + public static final int launcher=0x7f030000;
  38 + }
  39 + public static final class raw {
  40 + public static final int finger_0_10_3=0x7f050000;
  41 + public static final int finger_1_10_3=0x7f050001;
  42 + public static final int finger_2_10_3=0x7f050002;
  43 + }
  44 + public static final class string {
  45 + public static final int auto_on=0x7f06000b;
  46 + public static final int auto_on_disabled=0x7f060010;
  47 + public static final int auto_on_enabled=0x7f06000f;
  48 + public static final int capture=0x7f060000;
  49 + public static final int cb_matched=0x7f060009;
  50 + public static final int cb_scenabled=0x7f06000a;
  51 + public static final int init=0x7f060001;
  52 + public static final int ledoff=0x7f060003;
  53 + public static final int ledon=0x7f060002;
  54 + public static final int match=0x7f060006;
  55 + public static final int register=0x7f060007;
  56 + public static final int sdktest=0x7f060004;
  57 + public static final int smart_capture=0x7f06000c;
  58 + public static final int smart_capture_off=0x7f06000e;
  59 + public static final int smart_capture_on=0x7f06000d;
  60 + public static final int toggle_led=0x7f060005;
  61 + public static final int welcome=0x7f060008;
  62 + }
  63 + public static final class xml {
  64 + public static final int device_filter=0x7f040000;
  65 + }
  66 +}
libs/FDxSDKProAndroid.jar 0 → 100755
No preview for this file type
libs/armeabi/gdb.setup 0 → 100755
  1 +++ a/libs/armeabi/gdb.setup
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +set solib-search-path C:/workspace/code/trunk/android/java/SecuGenUSB/obj/local/armeabi
  2 +directory C:/workspace/code/trunk/android/android-ndk-r9d/platforms/android-12/arch-arm/usr/include C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/libsgfdu05 C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/linuxcommon C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/usb-dev C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/FDU05/dll C:/workspace/code/trunk/android/android-ndk-r9d/sources/cxx-stl/stlport/stlport C:/workspace/code/trunk/android/android-ndk-r9d/sources/cxx-stl//gabi++/include C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/libsgfdu03 C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/FDU03/dll C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/libsgfdu04 C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/FDU04/dll C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/unixcommon C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/Common C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/include C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/FDxSDKPro/Inc C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/FDxSDKPro/Source C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/FDxSDKPro/Source/Algorithm
libs/armeabi/gdbserver 0 → 100755
No preview for this file type
libs/armeabi/libjnisgfdetect.so 0 → 100755
No preview for this file type
libs/armeabi/libjnisgfdu03.so 0 → 100755
No preview for this file type
libs/armeabi/libjnisgfdu04.so 0 → 100755
No preview for this file type
libs/armeabi/libjnisgfdu05.so 0 → 100755
No preview for this file type
libs/armeabi/libjnisgfplib.so 0 → 100755
No preview for this file type
libs/armeabi/libsgfpamx.so 0 → 100755
No preview for this file type
libs/x86/gdb.setup 0 → 100755
  1 +++ a/libs/x86/gdb.setup
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +set solib-search-path C:/workspace/code/trunk/android/java/SecuGenUSB/obj/local/x86
  2 +directory C:/workspace/code/trunk/android/android-ndk-r9d/platforms/android-12/arch-x86/usr/include C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/libsgfdu05 C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/linuxcommon C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/usb-dev C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/FDU05/dll C:/workspace/code/trunk/android/android-ndk-r9d/sources/cxx-stl/stlport/stlport C:/workspace/code/trunk/android/android-ndk-r9d/sources/cxx-stl//gabi++/include C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/libsgfdu03 C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/FDU03/dll C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/libsgfdu04 C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/venus/Drivers/FDU04/dll C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/unixcommon C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/Common C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/include C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/FDxSDKPro/Inc C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/FDxSDKPro/Source C:/workspace/code/trunk/android/java/SecuGenUSB/jni/../../../../linux/FDU04_SDK_PRO_UNIX_LINUX/src/FDxSDKPro/Source/Algorithm
libs/x86/gdbserver 0 → 100755
No preview for this file type
libs/x86/libjnisgfdetect.so 0 → 100755
No preview for this file type
libs/x86/libjnisgfdu03.so 0 → 100755
No preview for this file type
libs/x86/libjnisgfdu04.so 0 → 100755
No preview for this file type
libs/x86/libjnisgfdu05.so 0 → 100755
No preview for this file type
libs/x86/libjnisgfplib.so 0 → 100755
No preview for this file type
libs/x86/libsgfpamx.so 0 → 100755
No preview for this file type
lint.xml 0 → 100755
  1 +++ a/lint.xml
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<lint>
  3 +</lint>
0 \ No newline at end of file 4 \ No newline at end of file
proguard.cfg 0 → 100755
  1 +++ a/proguard.cfg
@@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
  1 +-optimizationpasses 5
  2 +-dontusemixedcaseclassnames
  3 +-dontskipnonpubliclibraryclasses
  4 +-dontpreverify
  5 +-verbose
  6 +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  7 +
  8 +-keep public class * extends android.app.Activity
  9 +-keep public class * extends android.app.Application
  10 +-keep public class * extends android.app.Service
  11 +-keep public class * extends android.content.BroadcastReceiver
  12 +-keep public class * extends android.content.ContentProvider
  13 +-keep public class * extends android.app.backup.BackupAgentHelper
  14 +-keep public class * extends android.preference.Preference
  15 +-keep public class com.android.vending.licensing.ILicensingService
  16 +
  17 +-keepclasseswithmembernames class * {
  18 + native <methods>;
  19 +}
  20 +
  21 +-keepclasseswithmembers class * {
  22 + public <init>(android.content.Context, android.util.AttributeSet);
  23 +}
  24 +
  25 +-keepclasseswithmembers class * {
  26 + public <init>(android.content.Context, android.util.AttributeSet, int);
  27 +}
  28 +
  29 +-keepclassmembers class * extends android.app.Activity {
  30 + public void *(android.view.View);
  31 +}
  32 +
  33 +-keepclassmembers enum * {
  34 + public static **[] values();
  35 + public static ** valueOf(java.lang.String);
  36 +}
  37 +
  38 +-keep class * implements android.os.Parcelable {
  39 + public static final android.os.Parcelable$Creator *;
  40 +}
project.properties 0 → 100755
  1 +++ a/project.properties
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +# This file is automatically generated by Android Tools.
  2 +# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
  3 +#
  4 +# This file must be checked in Version Control Systems.
  5 +#
  6 +# To customize properties used by the Ant build system use,
  7 +# "ant.properties", and override values to adapt the script to your
  8 +# project structure.
  9 +
  10 +# Project target.
  11 +target=android-12
res/drawable-hdpi/hamster4.png 0 → 100755

11.7 KB

res/drawable-hdpi/icon.png 0 → 100755

4.05 KB

res/drawable-ldpi/hamster4.png 0 → 100755

3.46 KB

res/drawable-ldpi/icon.png 0 → 100755

1.68 KB

res/drawable-mdpi/hamster4.png 0 → 100755

5.7 KB

res/drawable-mdpi/icon.png 0 → 100755

2.51 KB

res/drawable-xhdpi/hamster4.png 0 → 100755

19.4 KB

res/layout/launcher.xml 0 → 100755
  1 +++ a/res/layout/launcher.xml
@@ -0,0 +1,161 @@ @@ -0,0 +1,161 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<!--
  3 + Copyright (C) 2011 The Android Open Source Project
  4 +
  5 + Licensed under the Apache License, Version 2.0 (the "License");
  6 + you may not use this file except in compliance with the License.
  7 + You may obtain a copy of the License at
  8 +
  9 + http://www.apache.org/licenses/LICENSE-2.0
  10 +
  11 + Unless required by applicable law or agreed to in writing, software
  12 + distributed under the License is distributed on an "AS IS" BASIS,
  13 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14 + See the License for the specific language governing permissions and
  15 + limitations under the License. -->
  16 +<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
  17 + android:id="@+id/AbsoluteLayout1"
  18 + android:layout_width="match_parent"
  19 + android:layout_height="match_parent" >
  20 +
  21 + <TextView
  22 + android:id="@+id/textView1"
  23 + android:layout_width="wrap_content"
  24 + android:layout_height="30dp"
  25 + android:layout_x="957dp"
  26 + android:layout_y="62dp"
  27 + android:text="Log"
  28 + android:textAppearance="?android:attr/textAppearanceLarge" />
  29 +
  30 + <Button
  31 + android:id="@+id/buttonRegister"
  32 + android:layout_width="wrap_content"
  33 + android:layout_height="wrap_content"
  34 + android:layout_x="11dp"
  35 + android:layout_y="465dp"
  36 + android:text="@string/register"
  37 + android:textSize="28sp" />
  38 +
  39 + <Button
  40 + android:id="@+id/buttonMatch"
  41 + android:layout_width="wrap_content"
  42 + android:layout_height="wrap_content"
  43 + android:layout_x="170dp"
  44 + android:layout_y="465dp"
  45 + android:text="@string/match"
  46 + android:textSize="28sp" />
  47 +
  48 + <ImageView
  49 + android:id="@+id/imageViewVerify"
  50 + android:layout_width="130dp"
  51 + android:layout_height="150dp"
  52 + android:layout_x="145dp"
  53 + android:layout_y="310dp"
  54 + android:src="@android:drawable/picture_frame" />
  55 +
  56 + <Button
  57 + android:id="@+id/fire"
  58 + android:layout_width="wrap_content"
  59 + android:layout_height="wrap_content"
  60 + android:layout_x="982dp"
  61 + android:layout_y="1dp"
  62 + android:text="@string/init"
  63 + android:textSize="36sp" />
  64 +
  65 + <Button
  66 + android:id="@+id/buttonLedOn"
  67 + android:layout_width="wrap_content"
  68 + android:layout_height="wrap_content"
  69 + android:layout_x="11dp"
  70 + android:layout_y="0dp"
  71 + android:text="@string/ledon"
  72 + android:textSize="28sp" />
  73 +
  74 + <ImageView
  75 + android:id="@+id/imageViewRegister"
  76 + android:layout_width="130dp"
  77 + android:layout_height="150dp"
  78 + android:layout_x="14dp"
  79 + android:layout_y="310dp"
  80 + android:src="@android:drawable/picture_frame" />
  81 +
  82 + <Button
  83 + android:id="@+id/buttonSDKTest"
  84 + android:layout_width="wrap_content"
  85 + android:layout_height="wrap_content"
  86 + android:layout_x="765dp"
  87 + android:layout_y="1dp"
  88 + android:text="@string/sdktest"
  89 + android:textSize="36sp" />
  90 +
  91 + <EditText
  92 + android:id="@+id/editLog"
  93 + android:layout_width="372dp"
  94 + android:layout_height="533dp"
  95 + android:layout_x="775dp"
  96 + android:layout_y="100dp"
  97 + android:inputType="none|textMultiLine" />
  98 +
  99 + <ImageView
  100 + android:id="@+id/imageViewFingerprint"
  101 + android:layout_width="208dp"
  102 + android:layout_height="240dp"
  103 + android:layout_x="13dp"
  104 + android:layout_y="61dp"
  105 + android:src="@android:drawable/picture_frame" />
  106 +
  107 + <CheckBox
  108 + android:id="@+id/checkBoxMatched"
  109 + android:layout_width="wrap_content"
  110 + android:layout_height="wrap_content"
  111 + android:layout_x="214dp"
  112 + android:layout_y="266dp"
  113 + android:text="@string/cb_matched" />
  114 +
  115 + <TextView
  116 + android:id="@+id/textViewResult"
  117 + android:layout_width="291dp"
  118 + android:layout_height="wrap_content"
  119 + android:layout_x="17dp"
  120 + android:layout_y="516dp"
  121 + android:text="@string/welcome"
  122 + android:textAppearance="?android:attr/textAppearanceLarge" />
  123 +
  124 + <ImageView
  125 + android:id="@+id/imageView1"
  126 + android:layout_width="155dp"
  127 + android:layout_height="155dp"
  128 + android:layout_x="448dp"
  129 + android:layout_y="8dp"
  130 + android:src="@drawable/hamster4" />
  131 +
  132 + <ToggleButton
  133 + android:id="@+id/toggleButtonAutoOn"
  134 + android:layout_width="wrap_content"
  135 + android:layout_height="wrap_content"
  136 + android:layout_x="214dp"
  137 + android:layout_y="92dp"
  138 + android:text="ToggleButton"
  139 + android:textOff="@string/auto_on_disabled"
  140 + android:textOn="@string/auto_on_enabled" />
  141 +
  142 + <ToggleButton
  143 + android:id="@+id/toggleButtonSmartCapture"
  144 + android:layout_width="wrap_content"
  145 + android:layout_height="wrap_content"
  146 + android:layout_x="214dp"
  147 + android:layout_y="143dp"
  148 + android:text="@string/smart_capture"
  149 + android:textOff="@string/smart_capture_off"
  150 + android:textOn="@string/smart_capture_on" />
  151 +
  152 + <Button
  153 + android:id="@+id/buttonCapture"
  154 + android:layout_width="wrap_content"
  155 + android:layout_height="wrap_content"
  156 + android:layout_x="177dp"
  157 + android:layout_y="0dp"
  158 + android:text="@string/capture"
  159 + android:textSize="28sp" />
  160 +
  161 +</AbsoluteLayout>
0 \ No newline at end of file 162 \ No newline at end of file
res/raw/finger_0_10_3.raw 0 → 100755
No preview for this file type
res/raw/finger_1_10_3.raw 0 → 100755
No preview for this file type
res/raw/finger_2_10_3.raw 0 → 100755
No preview for this file type
res/values/strings.xml 0 → 100755
  1 +++ a/res/values/strings.xml
@@ -0,0 +1,38 @@ @@ -0,0 +1,38 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<!-- Copyright (C) 2011 The Android Open Source Project
  3 +
  4 + Licensed under the Apache License, Version 2.0 (the "License");
  5 + you may not use this file except in compliance with the License.
  6 + You may obtain a copy of the License at
  7 +
  8 + http://www.apache.org/licenses/LICENSE-2.0
  9 +
  10 + Unless required by applicable law or agreed to in writing, software
  11 + distributed under the License is distributed on an "AS IS" BASIS,
  12 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + See the License for the specific language governing permissions and
  14 + limitations under the License.
  15 +-->
  16 +
  17 +<resources>
  18 +
  19 + <string name="capture">Capture</string><string name="init">Initialize</string>
  20 +
  21 + <string name="ledon">LED</string>
  22 + <string name="ledoff">LED Off</string>
  23 + <string name="sdktest">SDK Test</string>
  24 + <string name="toggle_led">Toggle LED</string>
  25 + <string name="match">Verify</string>
  26 + <string name="register">Register</string>
  27 + <string name="welcome">Welcome!</string>
  28 + <string name="cb_matched">Match</string>
  29 + <string name="cb_scenabled">SC En</string>
  30 + <string name="auto_on">Auto On</string>
  31 + <string name="smart_capture">Smart Capture</string>
  32 + <string name="smart_capture_on">Smart Cap ON</string>
  33 + <string name="smart_capture_off">Smart Cap OFF</string>
  34 + <string name="auto_on_enabled">AutoOn Enabled</string>
  35 + <string name="auto_on_disabled">AutoOn Disabled</string>
  36 +
  37 +</resources>
  38 +
res/xml/device_filter.xml 0 → 100755
  1 +++ a/res/xml/device_filter.xml
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<!-- Copyright (C) 2011 The Android Open Source Project
  3 +
  4 + Licensed under the Apache License, Version 2.0 (the "License");
  5 + you may not use this file except in compliance with the License.
  6 + You may obtain a copy of the License at
  7 +
  8 + http://www.apache.org/licenses/LICENSE-2.0
  9 +
  10 + Unless required by applicable law or agreed to in writing, software
  11 + distributed under the License is distributed on an "AS IS" BASIS,
  12 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + See the License for the specific language governing permissions and
  14 + limitations under the License.
  15 +-->
  16 +<resources>
  17 + <!--SecuGen SDU03P-->
  18 + <usb-device vendor-id="1162" product-id="1000" />
  19 + <!--SecuGen SDU03M-->
  20 + <usb-device vendor-id="1162" product-id="322" ></usb-device><!--SecuGen FDU03FRS--><usb-device
  21 + vendor-id="1162" product-id="320">
  22 +</usb-device>
  23 +</resources>
src/.DS_Store 0 → 100644
No preview for this file type
src/SecuGen/.DS_Store 0 → 100644
No preview for this file type
src/SecuGen/Demo/JSGDActivity.java 0 → 100755
  1 +++ a/src/SecuGen/Demo/JSGDActivity.java
@@ -0,0 +1,879 @@ @@ -0,0 +1,879 @@
  1 +/*
  2 + * Copyright (C) 2013 SecuGen Corporation
  3 + *
  4 + */
  5 +
  6 +package SecuGen.Demo;
  7 +
  8 +import java.io.*;
  9 +import java.nio.ByteBuffer;
  10 +
  11 +import SecuGen.Demo.R;
  12 +import android.app.Activity;
  13 +import android.app.AlertDialog;
  14 +import android.app.PendingIntent;
  15 +import android.content.Context;
  16 +import android.content.DialogInterface;
  17 +import android.content.Intent;
  18 +import android.content.IntentFilter;
  19 +import android.content.BroadcastReceiver;
  20 +import android.hardware.usb.UsbDevice;
  21 +import android.hardware.usb.UsbManager;
  22 +import android.os.Bundle;
  23 +import android.os.Handler;
  24 +import android.os.Message;
  25 +import android.util.Log;
  26 +import android.view.View;
  27 +import android.widget.Button;
  28 +import android.widget.EditText;
  29 +import android.widget.ImageView;
  30 +import android.graphics.Bitmap;
  31 +import android.graphics.Canvas;
  32 +import android.graphics.Color;
  33 +import android.graphics.ColorMatrix;
  34 +import android.graphics.ColorMatrixColorFilter;
  35 +import android.graphics.Paint;
  36 +import SecuGen.FDxSDKPro.*;
  37 +
  38 +public class JSGDActivity extends Activity
  39 + implements View.OnClickListener, java.lang.Runnable, SGFingerPresentEvent {
  40 +
  41 + private static final String TAG = "SecuGen USB";
  42 +
  43 + private Button mCapture;
  44 + private Button mButtonRegister;
  45 + private Button mButtonMatch;
  46 + private Button mButtonLed;
  47 + private Button mSDKTest;
  48 + private EditText mEditLog;
  49 + private android.widget.TextView mTextViewResult;
  50 + private android.widget.CheckBox mCheckBoxMatched;
  51 + private android.widget.ToggleButton mToggleButtonSmartCapture;
  52 + private android.widget.ToggleButton mToggleButtonAutoOn;
  53 + private PendingIntent mPermissionIntent;
  54 + private ImageView mImageViewFingerprint;
  55 + private ImageView mImageViewRegister;
  56 + private ImageView mImageViewVerify;
  57 + private byte[] mRegisterImage;
  58 + private byte[] mVerifyImage;
  59 + private byte[] mRegisterTemplate;
  60 + private byte[] mVerifyTemplate;
  61 + private int[] mMaxTemplateSize;
  62 + private int mImageWidth;
  63 + private int mImageHeight;
  64 + private int[] grayBuffer;
  65 + private Bitmap grayBitmap;
  66 + private IntentFilter filter; //2014-04-11
  67 + private SGAutoOnEventNotifier autoOn;
  68 + private boolean mLed;
  69 + private boolean mAutoOnEnabled;
  70 +
  71 + private JSGFPLib sgfplib;
  72 +
  73 + private void debugMessage(String message) {
  74 + this.mEditLog.append(message);
  75 + this.mEditLog.invalidate(); //TODO trying to get Edit log to update after each line written
  76 + }
  77 +
  78 + //RILEY
  79 + //This broadcast receiver is necessary to get user permissions to access the attached USB device
  80 + private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION";
  81 + private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver() {
  82 + public void onReceive(Context context, Intent intent) {
  83 + String action = intent.getAction();
  84 + //DEBUG Log.d(TAG,"Enter mUsbReceiver.onReceive()");
  85 + if (ACTION_USB_PERMISSION.equals(action)) {
  86 + synchronized (this) {
  87 + UsbDevice device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
  88 + if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
  89 + if(device != null){
  90 + //DEBUG Log.d(TAG, "Vendor ID : " + device.getVendorId() + "\n");
  91 + //DEBUG Log.d(TAG, "Product ID: " + device.getProductId() + "\n");
  92 + debugMessage("Vendor ID : " + device.getVendorId() + "\n");
  93 + debugMessage("Product ID: " + device.getProductId() + "\n");
  94 + }
  95 + else
  96 + Log.e(TAG, "mUsbReceiver.onReceive() Device is null");
  97 + }
  98 + else
  99 + Log.e(TAG, "mUsbReceiver.onReceive() permission denied for device " + device);
  100 + }
  101 + }
  102 + }
  103 + };
  104 +
  105 + //RILEY
  106 + //This message handler is used to access local resources not
  107 + //accessible by SGFingerPresentCallback() because it is called by
  108 + //a separate thread.
  109 + public Handler fingerDetectedHandler = new Handler(){
  110 + // @Override
  111 + public void handleMessage(Message msg) {
  112 + //Handle the message
  113 + CaptureFingerPrint();
  114 + if (mAutoOnEnabled) {
  115 + mToggleButtonAutoOn.toggle();
  116 + EnableControls();
  117 + }
  118 + }
  119 + };
  120 +
  121 + public void EnableControls(){
  122 + this.mCapture.setClickable(true);
  123 + this.mCapture.setTextColor(getResources().getColor(android.R.color.white));
  124 + this.mButtonRegister.setClickable(true);
  125 + this.mButtonRegister.setTextColor(getResources().getColor(android.R.color.white));
  126 + this.mButtonMatch.setClickable(true);
  127 + this.mButtonMatch.setTextColor(getResources().getColor(android.R.color.white));
  128 + }
  129 +
  130 + public void DisableControls(){
  131 + this.mCapture.setClickable(false);
  132 + this.mCapture.setTextColor(getResources().getColor(android.R.color.black));
  133 + this.mButtonRegister.setClickable(false);
  134 + this.mButtonRegister.setTextColor(getResources().getColor(android.R.color.black));
  135 + this.mButtonMatch.setClickable(false);
  136 + this.mButtonMatch.setTextColor(getResources().getColor(android.R.color.black));
  137 + }
  138 +
  139 +
  140 + //RILEY
  141 + @Override
  142 + public void onCreate(Bundle savedInstanceState) {
  143 + super.onCreate(savedInstanceState);
  144 +
  145 + setContentView(R.layout.launcher);
  146 + mCapture = (Button)findViewById(R.id.buttonCapture);
  147 + mCapture.setOnClickListener(this);
  148 + mButtonRegister = (Button)findViewById(R.id.buttonRegister);
  149 + mButtonRegister.setOnClickListener(this);
  150 + mButtonMatch = (Button)findViewById(R.id.buttonMatch);
  151 + mButtonMatch.setOnClickListener(this);
  152 + mButtonLed = (Button)findViewById(R.id.buttonLedOn);
  153 + mButtonLed.setOnClickListener(this);
  154 + mSDKTest = (Button)findViewById(R.id.buttonSDKTest);
  155 + mSDKTest.setOnClickListener(this);
  156 + mEditLog = (EditText)findViewById(R.id.editLog);
  157 + mTextViewResult = (android.widget.TextView)findViewById(R.id.textViewResult);
  158 + mCheckBoxMatched = (android.widget.CheckBox) findViewById(R.id.checkBoxMatched);
  159 + mToggleButtonSmartCapture = (android.widget.ToggleButton) findViewById(R.id.toggleButtonSmartCapture);
  160 + mToggleButtonSmartCapture.setOnClickListener(this);
  161 + mToggleButtonAutoOn = (android.widget.ToggleButton) findViewById(R.id.toggleButtonAutoOn);
  162 + mToggleButtonAutoOn.setOnClickListener(this);
  163 + mImageViewFingerprint = (ImageView)findViewById(R.id.imageViewFingerprint);
  164 + mImageViewRegister = (ImageView)findViewById(R.id.imageViewRegister);
  165 + mImageViewVerify = (ImageView)findViewById(R.id.imageViewVerify);
  166 + grayBuffer = new int[JSGFPLib.MAX_IMAGE_WIDTH_ALL_DEVICES*JSGFPLib.MAX_IMAGE_HEIGHT_ALL_DEVICES];
  167 + for (int i=0; i<grayBuffer.length; ++i)
  168 + grayBuffer[i] = android.graphics.Color.GRAY;
  169 + grayBitmap = Bitmap.createBitmap(JSGFPLib.MAX_IMAGE_WIDTH_ALL_DEVICES, JSGFPLib.MAX_IMAGE_HEIGHT_ALL_DEVICES, Bitmap.Config.ARGB_8888);
  170 + grayBitmap.setPixels(grayBuffer, 0, JSGFPLib.MAX_IMAGE_WIDTH_ALL_DEVICES, 0, 0, JSGFPLib.MAX_IMAGE_WIDTH_ALL_DEVICES, JSGFPLib.MAX_IMAGE_HEIGHT_ALL_DEVICES);
  171 + mImageViewFingerprint.setImageBitmap(grayBitmap);
  172 +
  173 + int[] sintbuffer = new int[(JSGFPLib.MAX_IMAGE_WIDTH_ALL_DEVICES/2)*(JSGFPLib.MAX_IMAGE_HEIGHT_ALL_DEVICES/2)];
  174 + for (int i=0; i<sintbuffer.length; ++i)
  175 + sintbuffer[i] = android.graphics.Color.GRAY;
  176 + Bitmap sb = Bitmap.createBitmap(JSGFPLib.MAX_IMAGE_WIDTH_ALL_DEVICES/2, JSGFPLib.MAX_IMAGE_HEIGHT_ALL_DEVICES/2, Bitmap.Config.ARGB_8888);
  177 + sb.setPixels(sintbuffer, 0, JSGFPLib.MAX_IMAGE_WIDTH_ALL_DEVICES/2, 0, 0, JSGFPLib.MAX_IMAGE_WIDTH_ALL_DEVICES/2, JSGFPLib.MAX_IMAGE_HEIGHT_ALL_DEVICES/2);
  178 + mImageViewRegister.setImageBitmap(grayBitmap);
  179 + mImageViewVerify.setImageBitmap(grayBitmap);
  180 +
  181 + mMaxTemplateSize = new int[1];
  182 +
  183 + //USB Permissions
  184 + mPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(ACTION_USB_PERMISSION), 0);
  185 + filter = new IntentFilter(ACTION_USB_PERMISSION);
  186 + registerReceiver(mUsbReceiver, filter);
  187 + sgfplib = new JSGFPLib((UsbManager)getSystemService(Context.USB_SERVICE));
  188 + this.mToggleButtonSmartCapture.toggle();
  189 +
  190 +
  191 + debugMessage("jnisgfplib version: " + sgfplib.Version() + "\n");
  192 + mLed = false;
  193 + autoOn = new SGAutoOnEventNotifier (sgfplib, this);
  194 + mAutoOnEnabled = false;
  195 + }
  196 +
  197 + @Override
  198 + public void onPause() {
  199 + Log.d(TAG, "onPause()");
  200 + autoOn.stop();
  201 + EnableControls();
  202 + sgfplib.CloseDevice();
  203 + unregisterReceiver(mUsbReceiver);
  204 + mRegisterImage = null;
  205 + mVerifyImage = null;
  206 + mRegisterTemplate = null;
  207 + mVerifyTemplate = null;
  208 + mImageViewFingerprint.setImageBitmap(grayBitmap);
  209 + mImageViewRegister.setImageBitmap(grayBitmap);
  210 + mImageViewVerify.setImageBitmap(grayBitmap);
  211 + super.onPause();
  212 + }
  213 +
  214 + @Override
  215 + public void onResume(){
  216 + Log.d(TAG, "onResume()");
  217 + super.onResume();
  218 + registerReceiver(mUsbReceiver, filter);
  219 + long error = sgfplib.Init( SGFDxDeviceName.SG_DEV_AUTO);
  220 + if (error != SGFDxErrorCode.SGFDX_ERROR_NONE){
  221 + AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
  222 + if (error == SGFDxErrorCode.SGFDX_ERROR_DEVICE_NOT_FOUND)
  223 + dlgAlert.setMessage("The attached fingerprint device is not supported on Android");
  224 + else
  225 + dlgAlert.setMessage("Fingerprint device initialization failed!");
  226 + dlgAlert.setTitle("SecuGen Fingerprint SDK");
  227 + dlgAlert.setPositiveButton("OK",
  228 + new DialogInterface.OnClickListener() {
  229 + public void onClick(DialogInterface dialog,int whichButton){
  230 + finish();
  231 + return;
  232 + }
  233 + }
  234 + );
  235 + dlgAlert.setCancelable(false);
  236 + dlgAlert.create().show();
  237 + }
  238 + else {
  239 + UsbDevice usbDevice = sgfplib.GetUsbDevice();
  240 + if (usbDevice == null){
  241 + AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
  242 + dlgAlert.setMessage("SDU04P or SDU03P fingerprint sensor not found!");
  243 + dlgAlert.setTitle("SecuGen Fingerprint SDK");
  244 + dlgAlert.setPositiveButton("OK",
  245 + new DialogInterface.OnClickListener() {
  246 + public void onClick(DialogInterface dialog,int whichButton){
  247 + finish();
  248 + return;
  249 + }
  250 + }
  251 + );
  252 + dlgAlert.setCancelable(false);
  253 + dlgAlert.create().show();
  254 + }
  255 + else {
  256 + sgfplib.GetUsbManager().requestPermission(usbDevice, mPermissionIntent);
  257 + error = sgfplib.OpenDevice(0);
  258 + debugMessage("OpenDevice() ret: " + error + "\n");
  259 + SecuGen.FDxSDKPro.SGDeviceInfoParam deviceInfo = new SecuGen.FDxSDKPro.SGDeviceInfoParam();
  260 + error = sgfplib.GetDeviceInfo(deviceInfo);
  261 + debugMessage("GetDeviceInfo() ret: " + error + "\n");
  262 + mImageWidth = deviceInfo.imageWidth;
  263 + mImageHeight= deviceInfo.imageHeight;
  264 + sgfplib.SetTemplateFormat(SGFDxTemplateFormat.TEMPLATE_FORMAT_SG400);
  265 + sgfplib.GetMaxTemplateSize(mMaxTemplateSize);
  266 + debugMessage("TEMPLATE_FORMAT_SG400 SIZE: " + mMaxTemplateSize[0] + "\n");
  267 + mRegisterTemplate = new byte[mMaxTemplateSize[0]];
  268 + mVerifyTemplate = new byte[mMaxTemplateSize[0]];
  269 + boolean smartCaptureEnabled = this.mToggleButtonSmartCapture.isChecked();
  270 + if (smartCaptureEnabled)
  271 + sgfplib.WriteData((byte)5, (byte)1);
  272 + else
  273 + sgfplib.WriteData((byte)5, (byte)0);
  274 + if (mAutoOnEnabled){
  275 + autoOn.start();
  276 + DisableControls();
  277 + }
  278 + //Thread thread = new Thread(this);
  279 + //thread.start();
  280 + }
  281 + }
  282 + }
  283 +
  284 + @Override
  285 + public void onDestroy() {
  286 + Log.d(TAG, "onDestroy()");
  287 + sgfplib.CloseDevice();
  288 + mRegisterImage = null;
  289 + mVerifyImage = null;
  290 + mRegisterTemplate = null;
  291 + mVerifyTemplate = null;
  292 + sgfplib.Close();
  293 + super.onDestroy();
  294 + }
  295 +
  296 + //Converts image to grayscale (NEW)
  297 + public Bitmap toGrayscale(Bitmap bmpOriginal)
  298 + {
  299 + int width, height;
  300 + height = bmpOriginal.getHeight();
  301 + width = bmpOriginal.getWidth();
  302 + Bitmap bmpGrayscale = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
  303 + for (int y=0; y< height; ++y) {
  304 + for (int x=0; x< width; ++x){
  305 + int color = bmpOriginal.getPixel(x, y);
  306 + int r = (color >> 16) & 0xFF;
  307 + int g = (color >> 8) & 0xFF;
  308 + int b = color & 0xFF;
  309 + int gray = (r+g+b)/3;
  310 + color = Color.rgb(gray, gray, gray);
  311 + //color = Color.rgb(r/3, g/3, b/3);
  312 + bmpGrayscale.setPixel(x, y, color);
  313 + }
  314 + }
  315 + return bmpGrayscale;
  316 + }
  317 +
  318 + //Converts image to binary (OLD)
  319 + public Bitmap toBinary(Bitmap bmpOriginal)
  320 + {
  321 + int width, height;
  322 + height = bmpOriginal.getHeight();
  323 + width = bmpOriginal.getWidth();
  324 + Bitmap bmpGrayscale = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
  325 + Canvas c = new Canvas(bmpGrayscale);
  326 + Paint paint = new Paint();
  327 + ColorMatrix cm = new ColorMatrix();
  328 + cm.setSaturation(0);
  329 + ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm);
  330 + paint.setColorFilter(f);
  331 + c.drawBitmap(bmpOriginal, 0, 0, paint);
  332 + return bmpGrayscale;
  333 + }
  334 +
  335 +
  336 + public void DumpFile(String fileName, byte[] buffer)
  337 + {
  338 + //Uncomment section below to dump images and templates to SD card
  339 + /*
  340 + try {
  341 + File myFile = new File("/sdcard/Download/" + fileName);
  342 + myFile.createNewFile();
  343 + FileOutputStream fOut = new FileOutputStream(myFile);
  344 + fOut.write(buffer,0,buffer.length);
  345 + fOut.close();
  346 + } catch (Exception e) {
  347 + debugMessage("Exception when writing file" + fileName);
  348 + }
  349 + */
  350 + }
  351 +
  352 + public void SGFingerPresentCallback (){
  353 + autoOn.stop();
  354 + fingerDetectedHandler.sendMessage(new Message());
  355 + }
  356 +
  357 + public void CaptureFingerPrint(){
  358 + long dwTimeStart = 0, dwTimeEnd = 0, dwTimeElapsed = 0;
  359 + this.mCheckBoxMatched.setChecked(false);
  360 + byte[] buffer = new byte[mImageWidth*mImageHeight];
  361 + dwTimeStart = System.currentTimeMillis();
  362 + long result = sgfplib.GetImage(buffer);
  363 + DumpFile("capture.raw", buffer);
  364 + dwTimeEnd = System.currentTimeMillis();
  365 + dwTimeElapsed = dwTimeEnd-dwTimeStart;
  366 + debugMessage("getImage() ret:" + result + " [" + dwTimeElapsed + "ms]\n");
  367 + mTextViewResult.setText("getImage() ret: " + result + " [" + dwTimeElapsed + "ms]\n");
  368 + Bitmap b = Bitmap.createBitmap(mImageWidth,mImageHeight, Bitmap.Config.ARGB_8888);
  369 + b.setHasAlpha(false);
  370 + int[] intbuffer = new int[mImageWidth*mImageHeight];
  371 + for (int i=0; i<intbuffer.length; ++i)
  372 + intbuffer[i] = (int) buffer[i];
  373 + b.setPixels(intbuffer, 0, mImageWidth, 0, 0, mImageWidth, mImageHeight);
  374 + mImageViewFingerprint.setImageBitmap(this.toGrayscale(b));
  375 + }
  376 + public void onClick(View v) {
  377 + long dwTimeStart = 0, dwTimeEnd = 0, dwTimeElapsed = 0;
  378 + if (v== mToggleButtonSmartCapture)
  379 + {
  380 + if(mToggleButtonSmartCapture.isChecked())
  381 + sgfplib.WriteData((byte)5, (byte)1); //Enable Smart Capture
  382 + else
  383 + sgfplib.WriteData((byte)5, (byte)0); //Disable Smart Capture
  384 + }
  385 +
  386 + if (v == mCapture) {
  387 + //DEBUG Log.d(TAG, "Pressed CAPTURE");
  388 + CaptureFingerPrint();
  389 + }
  390 + if (v == mToggleButtonAutoOn) {
  391 + if(mToggleButtonAutoOn.isChecked()) {
  392 + mAutoOnEnabled = true;
  393 + autoOn.start(); //Enable Auto On
  394 + DisableControls();
  395 + }
  396 + else {
  397 + mAutoOnEnabled = false;
  398 + autoOn.stop(); //Disable Auto On
  399 + EnableControls();
  400 + }
  401 +
  402 + }
  403 +
  404 +
  405 + if (v == mButtonLed) {
  406 + this.mCheckBoxMatched.setChecked(false);
  407 + mLed = !mLed;
  408 + dwTimeStart = System.currentTimeMillis();
  409 + long result = sgfplib.SetLedOn(mLed);
  410 + dwTimeEnd = System.currentTimeMillis();
  411 + dwTimeElapsed = dwTimeEnd-dwTimeStart;
  412 + debugMessage("setLedOn(" + mLed +") ret:" + result + " [" + dwTimeElapsed + "ms]\n");
  413 + mTextViewResult.setText("setLedOn(" + mLed +") ret: " + result + " [" + dwTimeElapsed + "ms]\n");
  414 + }
  415 + if (v == mSDKTest) {
  416 + SDKTest();
  417 + }
  418 + if (v == this.mButtonRegister) {
  419 + //DEBUG Log.d(TAG, "Clicked REGISTER");
  420 + debugMessage("Clicked REGISTER\n");
  421 + if (mRegisterImage != null)
  422 + mRegisterImage = null;
  423 + mRegisterImage = new byte[mImageWidth*mImageHeight];
  424 +
  425 + this.mCheckBoxMatched.setChecked(false);
  426 + ByteBuffer byteBuf = ByteBuffer.allocate(mImageWidth*mImageHeight);
  427 + dwTimeStart = System.currentTimeMillis();
  428 + long result = sgfplib.GetImage(mRegisterImage);
  429 + DumpFile("register.raw", mRegisterImage);
  430 + dwTimeEnd = System.currentTimeMillis();
  431 + dwTimeElapsed = dwTimeEnd-dwTimeStart;
  432 + debugMessage("GetImage() ret:" + result + " [" + dwTimeElapsed + "ms]\n");
  433 + Bitmap b = Bitmap.createBitmap(mImageWidth,mImageHeight, Bitmap.Config.ARGB_8888);
  434 + byteBuf.put(mRegisterImage);
  435 + int[] intbuffer = new int[mImageWidth*mImageHeight];
  436 + for (int i=0; i<intbuffer.length; ++i)
  437 + intbuffer[i] = (int) mRegisterImage[i];
  438 + b.setPixels(intbuffer, 0, mImageWidth, 0, 0, mImageWidth, mImageHeight);
  439 + //DEBUG Log.d(TAG, "Show Register image");
  440 + mImageViewFingerprint.setImageBitmap(this.toGrayscale(b));
  441 + dwTimeStart = System.currentTimeMillis();
  442 + result = sgfplib.SetTemplateFormat(SecuGen.FDxSDKPro.SGFDxTemplateFormat.TEMPLATE_FORMAT_SG400);
  443 + dwTimeEnd = System.currentTimeMillis();
  444 + dwTimeElapsed = dwTimeEnd-dwTimeStart;
  445 + debugMessage("SetTemplateFormat(SG400) ret:" + result + " [" + dwTimeElapsed + "ms]\n");
  446 + SGFingerInfo fpInfo = new SGFingerInfo();
  447 + for (int i=0; i< mRegisterTemplate.length; ++i)
  448 + mRegisterTemplate[i] = 0;
  449 + dwTimeStart = System.currentTimeMillis();
  450 + result = sgfplib.CreateTemplate(fpInfo, mRegisterImage, mRegisterTemplate);
  451 + DumpFile("register.min", mRegisterTemplate);
  452 + dwTimeEnd = System.currentTimeMillis();
  453 + dwTimeElapsed = dwTimeEnd-dwTimeStart;
  454 + debugMessage("CreateTemplate() ret:" + result + " [" + dwTimeElapsed + "ms]\n");
  455 + this.mImageViewRegister.setImageBitmap(this.toGrayscale(b));
  456 + mTextViewResult.setText("Click Verify");
  457 + }
  458 + if (v == this.mButtonMatch) {
  459 + //DEBUG Log.d(TAG, "Clicked MATCH");
  460 + debugMessage("Clicked MATCH\n");
  461 + if (mVerifyImage != null)
  462 + mVerifyImage = null;
  463 + mVerifyImage = new byte[mImageWidth*mImageHeight];
  464 + ByteBuffer byteBuf = ByteBuffer.allocate(mImageWidth*mImageHeight);
  465 + dwTimeStart = System.currentTimeMillis();
  466 + long result = sgfplib.GetImage(mVerifyImage);
  467 + DumpFile("verify.raw", mVerifyImage);
  468 + dwTimeEnd = System.currentTimeMillis();
  469 + dwTimeElapsed = dwTimeEnd-dwTimeStart;
  470 + debugMessage("GetImage() ret:" + result + " [" + dwTimeElapsed + "ms]\n");
  471 + Bitmap b = Bitmap.createBitmap(mImageWidth,mImageHeight, Bitmap.Config.ARGB_8888);
  472 + byteBuf.put(mVerifyImage);
  473 + int[] intbuffer = new int[mImageWidth*mImageHeight];
  474 + for (int i=0; i<intbuffer.length; ++i)
  475 + intbuffer[i] = (int) mVerifyImage[i];
  476 + b.setPixels(intbuffer, 0, mImageWidth, 0, 0, mImageWidth, mImageHeight);
  477 + //DEBUG Log.d(TAG, "Show Verify image");
  478 + mImageViewFingerprint.setImageBitmap(this.toGrayscale(b));
  479 + this.mImageViewVerify.setImageBitmap(this.toGrayscale(b));
  480 + dwTimeStart = System.currentTimeMillis();
  481 + result = sgfplib.SetTemplateFormat(SecuGen.FDxSDKPro.SGFDxTemplateFormat.TEMPLATE_FORMAT_SG400);
  482 + dwTimeEnd = System.currentTimeMillis();
  483 + dwTimeElapsed = dwTimeEnd-dwTimeStart;
  484 + debugMessage("SetTemplateFormat(SG400) ret:" + result + " [" + dwTimeElapsed + "ms]\n");
  485 + SGFingerInfo fpInfo = new SGFingerInfo();
  486 + for (int i=0; i< mVerifyTemplate.length; ++i)
  487 + mVerifyTemplate[i] = 0;
  488 + dwTimeStart = System.currentTimeMillis();
  489 + result = sgfplib.CreateTemplate(fpInfo, mVerifyImage, mVerifyTemplate);
  490 + DumpFile("verify.min", mVerifyTemplate);
  491 + dwTimeEnd = System.currentTimeMillis();
  492 + dwTimeElapsed = dwTimeEnd-dwTimeStart;
  493 + debugMessage("CreateTemplate() ret:" + result+ " [" + dwTimeElapsed + "ms]\n");
  494 + boolean[] matched = new boolean[1];
  495 + dwTimeStart = System.currentTimeMillis();
  496 + result = sgfplib.MatchTemplate(mRegisterTemplate, mVerifyTemplate, SGFDxSecurityLevel.SL_NORMAL, matched);
  497 + dwTimeEnd = System.currentTimeMillis();
  498 + dwTimeElapsed = dwTimeEnd-dwTimeStart;
  499 + debugMessage("MatchTemplate() ret:" + result+ " [" + dwTimeElapsed + "ms]\n");
  500 + if (matched[0]) {
  501 + mTextViewResult.setText("MATCHED!!\n");
  502 + this.mCheckBoxMatched.setChecked(true);
  503 + debugMessage("MATCHED!!\n");
  504 + }
  505 + else {
  506 + mTextViewResult.setText("NOT MATCHED!!");
  507 + this.mCheckBoxMatched.setChecked(false);
  508 + debugMessage("NOT MATCHED!!\n");
  509 + }
  510 + }
  511 + }
  512 +
  513 +
  514 + private void SDKTest(){
  515 + mTextViewResult.setText("");
  516 + debugMessage("\n###############\n");
  517 + debugMessage("### SDK Test ###\n");
  518 + debugMessage("###############\n");
  519 +
  520 + int X_SIZE = 248;
  521 + int Y_SIZE = 292;
  522 +
  523 + long error = 0;
  524 + byte[] sgTemplate1;
  525 + byte[] sgTemplate2;
  526 + byte[] sgTemplate3;
  527 + byte[] ansiTemplate1;
  528 + byte[] ansiTemplate2;
  529 + byte[] isoTemplate1;
  530 + byte[] isoTemplate2;
  531 +
  532 + int[] size = new int[1];
  533 + int[] score = new int[1];
  534 + int[] quality1 = new int[1];
  535 + int[] quality2 = new int[1];
  536 + int[] quality3 = new int[1];
  537 + boolean[] matched = new boolean[1];
  538 +
  539 + byte[] finger1 = new byte[X_SIZE*Y_SIZE];
  540 + byte[] finger2 = new byte[X_SIZE*Y_SIZE];
  541 + byte[] finger3 = new byte[X_SIZE*Y_SIZE];
  542 + try {
  543 + InputStream fileInputStream =getResources().openRawResource(R.raw.finger_0_10_3);
  544 + error = fileInputStream.read(finger1);
  545 + fileInputStream.close();
  546 + } catch (IOException ex){
  547 + debugMessage("Error: Unable to find fingerprint image R.raw.finger_0_10_3.\n");
  548 + return;
  549 + }
  550 + try {
  551 + InputStream fileInputStream =getResources().openRawResource(R.raw.finger_1_10_3);
  552 + error = fileInputStream.read(finger2);
  553 + fileInputStream.close();
  554 + } catch (IOException ex){
  555 + debugMessage("Error: Unable to find fingerprint image R.raw.finger_1_10_3.\n");
  556 + return;
  557 + }
  558 + try {
  559 + InputStream fileInputStream =getResources().openRawResource(R.raw.finger_2_10_3);
  560 + error = fileInputStream.read(finger3);
  561 + fileInputStream.close();
  562 + } catch (IOException ex){
  563 + debugMessage("Error: Unable to find fingerprint image R.raw.finger_2_10_3.\n");
  564 + return;
  565 + }
  566 +
  567 + JSGFPLib sgFplibSDKTest = new JSGFPLib((UsbManager)getSystemService(Context.USB_SERVICE));
  568 +
  569 + error = sgFplibSDKTest.InitEx( X_SIZE, Y_SIZE, 500);
  570 + debugMessage("InitEx("+ X_SIZE + "," + Y_SIZE + ",500) ret:" + error + "\n");
  571 +
  572 + SGFingerInfo fpInfo1 = new SGFingerInfo();
  573 + SGFingerInfo fpInfo2 = new SGFingerInfo();
  574 + SGFingerInfo fpInfo3 = new SGFingerInfo();
  575 +
  576 + error = sgFplibSDKTest.GetImageQuality((long)X_SIZE, (long)Y_SIZE, finger1, quality1);
  577 + debugMessage("GetImageQuality(R.raw.finger_0_10_3) ret:" + error + " Finger quality=" + quality1[0] + "\n");
  578 + error = sgFplibSDKTest.GetImageQuality((long)X_SIZE, (long)Y_SIZE, finger2, quality2);
  579 + debugMessage("GetImageQuality(R.raw.finger_1_10_3) ret:" + error + " Finger quality=" + quality2[0] + "\n");
  580 + error = sgFplibSDKTest.GetImageQuality((long)X_SIZE, (long)Y_SIZE, finger3, quality3);
  581 + debugMessage("GetImageQuality(R.raw.finger_2_10_3) ret:" + error + " Finger quality=" + quality3[0] + "\n");
  582 +
  583 + fpInfo1.FingerNumber = 1;
  584 + fpInfo1.ImageQuality = quality1[0];
  585 + fpInfo1.ImpressionType = SGImpressionType.SG_IMPTYPE_LP;
  586 + fpInfo1.ViewNumber = 1;
  587 +
  588 + fpInfo2.FingerNumber = 1;
  589 + fpInfo2.ImageQuality = quality2[0];
  590 + fpInfo2.ImpressionType = SGImpressionType.SG_IMPTYPE_LP;
  591 + fpInfo2.ViewNumber = 2;
  592 +
  593 + fpInfo3.FingerNumber = 1;
  594 + fpInfo3.ImageQuality = quality3[0];
  595 + fpInfo3.ImpressionType = SGImpressionType.SG_IMPTYPE_LP;
  596 + fpInfo3.ViewNumber = 3;
  597 +
  598 +
  599 +
  600 + ///////////////////////////////////////////////////////////////////////////////////////////////
  601 + ///////////////////////////////////////////////////////////////////////////////////////////////
  602 + //TEST SG400
  603 + debugMessage("#######################\n");
  604 + debugMessage("TEST SG400\n");
  605 + debugMessage("###\n###\n");
  606 + error = sgFplibSDKTest.SetTemplateFormat(SecuGen.FDxSDKPro.SGFDxTemplateFormat.TEMPLATE_FORMAT_SG400);
  607 + debugMessage("SetTemplateFormat(SG400) ret:" + error + "\n");
  608 + error = sgFplibSDKTest.GetMaxTemplateSize(size);
  609 + debugMessage("GetMaxTemplateSize() ret:" + error + " SG400_MAX_SIZE=" + size[0] + "\n");
  610 +
  611 + sgTemplate1 = new byte[size[0]];
  612 + sgTemplate2 = new byte[size[0]];
  613 + sgTemplate3 = new byte[size[0]];
  614 +
  615 + //TEST DeviceInfo
  616 +
  617 + error = sgFplibSDKTest.CreateTemplate(null, finger1, sgTemplate1);
  618 + debugMessage("CreateTemplate(finger3) ret:" + error + "\n");
  619 + error = sgFplibSDKTest.GetTemplateSize(sgTemplate1, size);
  620 + debugMessage("GetTemplateSize() ret:" + error + " size=" + size[0] + "\n");
  621 +
  622 + error = sgFplibSDKTest.CreateTemplate(null, finger2, sgTemplate2);
  623 + debugMessage("CreateTemplate(finger2) ret:" + error + "\n");
  624 + error = sgFplibSDKTest.GetTemplateSize(sgTemplate2, size);
  625 + debugMessage("GetTemplateSize() ret:" + error + " size=" + size[0] + "\n");
  626 +
  627 + error = sgFplibSDKTest.CreateTemplate(null, finger3, sgTemplate3);
  628 + debugMessage("CreateTemplate(finger3) ret:" + error + "\n");
  629 + error = sgFplibSDKTest.GetTemplateSize(sgTemplate3, size);
  630 + debugMessage("GetTemplateSize() ret:" + error + " size=" + size[0] + "\n");
  631 +
  632 + ///////////////////////////////////////////////////////////////////////////////////////////////
  633 + error = sgFplibSDKTest.MatchTemplate(sgTemplate1, sgTemplate2, SGFDxSecurityLevel.SL_NORMAL, matched);
  634 + debugMessage("MatchTemplate(sgTemplate1,sgTemplate2) ret:" + error + "\n");
  635 + if (matched[0])
  636 + debugMessage("MATCHED!!\n");
  637 + else
  638 + debugMessage("NOT MATCHED!!\n");
  639 +
  640 + error = sgFplibSDKTest.GetMatchingScore(sgTemplate1, sgTemplate2, score);
  641 + debugMessage("GetMatchingScore(sgTemplate1, sgTemplate2) ret:" + error + ". Score:" + score[0] + "\n");
  642 +
  643 +
  644 + ///////////////////////////////////////////////////////////////////////////////////////////////
  645 + error = sgFplibSDKTest.MatchTemplate(sgTemplate1, sgTemplate3, SGFDxSecurityLevel.SL_NORMAL, matched);
  646 + debugMessage("MatchTemplate(sgTemplate1,sgTemplate3) ret:" + error + "\n");
  647 + if (matched[0])
  648 + debugMessage("MATCHED!!\n");
  649 + else
  650 + debugMessage("NOT MATCHED!!\n");
  651 +
  652 + error = sgFplibSDKTest.GetMatchingScore(sgTemplate1, sgTemplate3, score);
  653 + debugMessage("GetMatchingScore(sgTemplate1, sgTemplate3) ret:" + error + ". Score:" + score[0] + "\n");
  654 +
  655 +
  656 + ///////////////////////////////////////////////////////////////////////////////////////////////
  657 + error = sgFplibSDKTest.MatchTemplate(sgTemplate2, sgTemplate3, SGFDxSecurityLevel.SL_NORMAL, matched);
  658 + debugMessage("MatchTemplate(sgTemplate2,sgTemplate3) ret:" + error + "\n");
  659 + if (matched[0])
  660 + debugMessage("MATCHED!!\n");
  661 + else
  662 + debugMessage("NOT MATCHED!!\n");
  663 +
  664 + error = sgFplibSDKTest.GetMatchingScore(sgTemplate2, sgTemplate3, score);
  665 + debugMessage("GetMatchingScore(sgTemplate2, sgTemplate3) ret:" + error + ". Score:" + score[0] + "\n");
  666 +
  667 +
  668 + ///////////////////////////////////////////////////////////////////////////////////////////////
  669 + ///////////////////////////////////////////////////////////////////////////////////////////////
  670 + //TEST ANSI378
  671 + debugMessage("#######################\n");
  672 + debugMessage("TEST ANSI378\n");
  673 + debugMessage("###\n###\n");
  674 + error = sgFplibSDKTest.SetTemplateFormat(SecuGen.FDxSDKPro.SGFDxTemplateFormat.TEMPLATE_FORMAT_ANSI378);
  675 + debugMessage("SetTemplateFormat(ANSI378) ret:" + error + "\n");
  676 + error = sgFplibSDKTest.GetMaxTemplateSize(size);
  677 + debugMessage("GetMaxTemplateSize() ret:" + error + " ANSI378_MAX_SIZE=" + size[0] + "\n");
  678 +
  679 + ansiTemplate1 = new byte[size[0]];
  680 + ansiTemplate2 = new byte[size[0]];
  681 +
  682 + error = sgFplibSDKTest.CreateTemplate(fpInfo1, finger1, ansiTemplate1);
  683 + debugMessage("CreateTemplate(finger1) ret:" + error + "\n");
  684 + error = sgFplibSDKTest.GetTemplateSize(ansiTemplate1, size);
  685 + debugMessage("GetTemplateSize(ansi) ret:" + error + " size=" + size[0] + "\n");
  686 +
  687 + error = sgFplibSDKTest.CreateTemplate(fpInfo2, finger2, ansiTemplate2);
  688 + debugMessage("CreateTemplate(finger2) ret:" + error + "\n");
  689 + error = sgFplibSDKTest.GetTemplateSize(ansiTemplate2, size);
  690 + debugMessage("GetTemplateSize(ansi) ret:" + error + " size=" + size[0] + "\n");
  691 +
  692 + error = sgFplibSDKTest.MatchTemplate(ansiTemplate1, ansiTemplate2, SGFDxSecurityLevel.SL_NORMAL, matched);
  693 + debugMessage("MatchTemplate(ansi) ret:" + error + "\n");
  694 + if (matched[0])
  695 + debugMessage("MATCHED!!\n");
  696 + else
  697 + debugMessage("NOT MATCHED!!\n");
  698 +
  699 + error = sgFplibSDKTest.GetMatchingScore(ansiTemplate1, ansiTemplate2, score);
  700 + debugMessage("GetMatchingScore(ansi) ret:" + error + ". Score:" + score[0] + "\n");
  701 +
  702 + error = sgFplibSDKTest.GetTemplateSizeAfterMerge(ansiTemplate1, ansiTemplate2, size);
  703 + debugMessage("GetTemplateSizeAfterMerge(ansi) ret:" + error + ". Size:" + size[0] + "\n");
  704 +
  705 + byte[] mergedAnsiTemplate1 = new byte[size[0]];
  706 + error = sgFplibSDKTest.MergeAnsiTemplate(ansiTemplate1, ansiTemplate2, mergedAnsiTemplate1);
  707 + debugMessage("MergeAnsiTemplate() ret:" + error + "\n");
  708 +
  709 + error = sgFplibSDKTest.MatchAnsiTemplate(ansiTemplate1, 0, mergedAnsiTemplate1, 0, SGFDxSecurityLevel.SL_NORMAL, matched);
  710 + debugMessage("MatchAnsiTemplate(0,0) ret:" + error + "\n");
  711 + if (matched[0])
  712 + debugMessage("MATCHED!!\n");
  713 + else
  714 + debugMessage("NOT MATCHED!!\n");
  715 +
  716 + error = sgFplibSDKTest.MatchAnsiTemplate(ansiTemplate1, 0, mergedAnsiTemplate1, 1, SGFDxSecurityLevel.SL_NORMAL, matched);
  717 + debugMessage("MatchAnsiTemplate(0,1) ret:" + error + "\n");
  718 + if (matched[0])
  719 + debugMessage("MATCHED!!\n");
  720 + else
  721 + debugMessage("NOT MATCHED!!\n");
  722 +
  723 + error = sgFplibSDKTest.GetAnsiMatchingScore(ansiTemplate1, 0, mergedAnsiTemplate1, 0, score);
  724 + debugMessage("GetAnsiMatchingScore(0,0) ret:" + error + ". Score:" + score[0] + "\n");
  725 +
  726 + error = sgFplibSDKTest.GetAnsiMatchingScore(ansiTemplate1, 0, mergedAnsiTemplate1, 1, score);
  727 + debugMessage("GetAnsiMatchingScore(0,1) ret:" + error + ". Score:" + score[0] + "\n");
  728 +
  729 + SGANSITemplateInfo ansiTemplateInfo = new SGANSITemplateInfo();
  730 + error = sgFplibSDKTest.GetAnsiTemplateInfo(ansiTemplate1, ansiTemplateInfo);
  731 + debugMessage("GetAnsiTemplateInfo(ansiTemplate1) ret:" + error + "\n");
  732 + debugMessage(" TotalSamples=" + ansiTemplateInfo.TotalSamples + "\n");
  733 + for (int i=0; i<ansiTemplateInfo.TotalSamples; ++i){
  734 + debugMessage(" Sample[" + i + "].FingerNumber=" + ansiTemplateInfo.SampleInfo[i].FingerNumber + "\n");
  735 + debugMessage(" Sample[" + i + "].ImageQuality=" + ansiTemplateInfo.SampleInfo[i].ImageQuality + "\n");
  736 + debugMessage(" Sample[" + i + "].ImpressionType=" + ansiTemplateInfo.SampleInfo[i].ImpressionType + "\n");
  737 + debugMessage(" Sample[" + i + "].ViewNumber=" + ansiTemplateInfo.SampleInfo[i].ViewNumber + "\n");
  738 + }
  739 +
  740 + error = sgFplibSDKTest.GetAnsiTemplateInfo(mergedAnsiTemplate1, ansiTemplateInfo);
  741 + debugMessage("GetAnsiTemplateInfo(mergedAnsiTemplate1) ret:" + error + "\n");
  742 + debugMessage(" TotalSamples=" + ansiTemplateInfo.TotalSamples + "\n");
  743 +
  744 + for (int i=0; i<ansiTemplateInfo.TotalSamples; ++i){
  745 + debugMessage(" Sample[" + i + "].FingerNumber=" + ansiTemplateInfo.SampleInfo[i].FingerNumber + "\n");
  746 + debugMessage(" Sample[" + i + "].ImageQuality=" + ansiTemplateInfo.SampleInfo[i].ImageQuality + "\n");
  747 + debugMessage(" Sample[" + i + "].ImpressionType=" + ansiTemplateInfo.SampleInfo[i].ImpressionType + "\n");
  748 + debugMessage(" Sample[" + i + "].ViewNumber=" + ansiTemplateInfo.SampleInfo[i].ViewNumber + "\n");
  749 + }
  750 +
  751 + ///////////////////////////////////////////////////////////////////////////////////////////////
  752 + ///////////////////////////////////////////////////////////////////////////////////////////////
  753 + //TEST ISO19794-2
  754 + debugMessage("#######################\n");
  755 + debugMessage("TEST ISO19794-2\n");
  756 + debugMessage("###\n###\n");
  757 + error = sgFplibSDKTest.SetTemplateFormat(SecuGen.FDxSDKPro.SGFDxTemplateFormat.TEMPLATE_FORMAT_ISO19794);
  758 + debugMessage("SetTemplateFormat(ISO19794) ret:" + error + "\n");
  759 + error = sgFplibSDKTest.GetMaxTemplateSize(size);
  760 + debugMessage("GetMaxTemplateSize() ret:" + error + " ISO19794_MAX_SIZE=" + size[0] + "\n");
  761 +
  762 + isoTemplate1 = new byte[size[0]];
  763 + isoTemplate2 = new byte[size[0]];
  764 +
  765 + error = sgFplibSDKTest.CreateTemplate(fpInfo1, finger1, isoTemplate1);
  766 + debugMessage("CreateTemplate(finger1) ret:" + error + "\n");
  767 + error = sgFplibSDKTest.GetTemplateSize(isoTemplate1, size);
  768 + debugMessage("GetTemplateSize(iso) ret:" + error + " size=" + size[0] + "\n");
  769 +
  770 + error = sgFplibSDKTest.CreateTemplate(fpInfo2, finger2, isoTemplate2);
  771 + debugMessage("CreateTemplate(finger2) ret:" + error + "\n");
  772 + error = sgFplibSDKTest.GetTemplateSize(isoTemplate2, size);
  773 + debugMessage("GetTemplateSize(iso) ret:" + error + " size=" + size[0] + "\n");
  774 +
  775 + error = sgFplibSDKTest.MatchTemplate(isoTemplate1, isoTemplate2, SGFDxSecurityLevel.SL_NORMAL, matched);
  776 + debugMessage("MatchTemplate(iso) ret:" + error + "\n");
  777 + if (matched[0])
  778 + debugMessage("MATCHED!!\n");
  779 + else
  780 + debugMessage("NOT MATCHED!!\n");
  781 +
  782 + error = sgFplibSDKTest.GetMatchingScore(isoTemplate1, isoTemplate2, score);
  783 + debugMessage("GetMatchingScore(iso) ret:" + error + ". Score:" + score[0] + "\n");
  784 +
  785 + error = sgFplibSDKTest.GetIsoTemplateSizeAfterMerge(isoTemplate1, isoTemplate2, size);
  786 + debugMessage("GetIsoTemplateSizeAfterMerge() ret:" + error + ". Size:" + size[0] + "\n");
  787 +
  788 +
  789 + byte[] mergedIsoTemplate1 = new byte[size[0]];
  790 + error = sgFplibSDKTest.MergeIsoTemplate(isoTemplate1, isoTemplate2, mergedIsoTemplate1);
  791 + debugMessage("MergeIsoTemplate() ret:" + error + "\n");
  792 +
  793 + error = sgFplibSDKTest.MatchIsoTemplate(isoTemplate1, 0, mergedIsoTemplate1, 0, SGFDxSecurityLevel.SL_NORMAL, matched);
  794 + debugMessage("MatchIsoTemplate(0,0) ret:" + error + "\n");
  795 + if (matched[0])
  796 + debugMessage("MATCHED!!\n");
  797 + else
  798 + debugMessage("NOT MATCHED!!\n");
  799 +
  800 + error = sgFplibSDKTest.MatchIsoTemplate(isoTemplate1, 0, mergedIsoTemplate1, 1, SGFDxSecurityLevel.SL_NORMAL, matched);
  801 + debugMessage("MatchIsoTemplate(0,1) ret:" + error + "\n");
  802 + if (matched[0])
  803 + debugMessage("MATCHED!!\n");
  804 + else
  805 + debugMessage("NOT MATCHED!!\n");
  806 +
  807 + error = sgFplibSDKTest.GetIsoMatchingScore(isoTemplate1, 0, mergedIsoTemplate1, 0, score);
  808 + debugMessage("GetIsoMatchingScore(0,0) ret:" + error + ". Score:" + score[0] + "\n");
  809 +
  810 + error = sgFplibSDKTest.GetIsoMatchingScore(isoTemplate1, 0, mergedIsoTemplate1, 1, score);
  811 + debugMessage("GetIsoMatchingScore(0,1) ret:" + error + ". Score:" + score[0] + "\n");
  812 +
  813 + SGISOTemplateInfo isoTemplateInfo = new SGISOTemplateInfo();
  814 + error = sgFplibSDKTest.GetIsoTemplateInfo(isoTemplate1, isoTemplateInfo);
  815 + debugMessage("GetIsoTemplateInfo(isoTemplate1) ret:" + error + "\n");
  816 + debugMessage(" TotalSamples=" + isoTemplateInfo.TotalSamples + "\n");
  817 + for (int i=0; i<isoTemplateInfo.TotalSamples; ++i){
  818 + debugMessage(" Sample[" + i + "].FingerNumber=" + isoTemplateInfo.SampleInfo[i].FingerNumber + "\n");
  819 + debugMessage(" Sample[" + i + "].ImageQuality=" + isoTemplateInfo.SampleInfo[i].ImageQuality + "\n");
  820 + debugMessage(" Sample[" + i + "].ImpressionType=" + isoTemplateInfo.SampleInfo[i].ImpressionType + "\n");
  821 + debugMessage(" Sample[" + i + "].ViewNumber=" + isoTemplateInfo.SampleInfo[i].ViewNumber + "\n");
  822 + }
  823 +
  824 + error = sgFplibSDKTest.GetIsoTemplateInfo(mergedIsoTemplate1, isoTemplateInfo);
  825 + debugMessage("GetIsoTemplateInfo(mergedIsoTemplate1) ret:" + error + "\n");
  826 + debugMessage(" TotalSamples=" + isoTemplateInfo.TotalSamples + "\n");
  827 + for (int i=0; i<isoTemplateInfo.TotalSamples; ++i){
  828 + debugMessage(" Sample[" + i + "].FingerNumber=" + isoTemplateInfo.SampleInfo[i].FingerNumber + "\n");
  829 + debugMessage(" Sample[" + i + "].ImageQuality=" + isoTemplateInfo.SampleInfo[i].ImageQuality + "\n");
  830 + debugMessage(" Sample[" + i + "].ImpressionType=" + isoTemplateInfo.SampleInfo[i].ImpressionType + "\n");
  831 + debugMessage(" Sample[" + i + "].ViewNumber=" + isoTemplateInfo.SampleInfo[i].ViewNumber + "\n");
  832 + }
  833 +
  834 + //Reset extractor/matcher for attached device opened in resume() method
  835 + error = sgFplibSDKTest.InitEx( mImageWidth, mImageHeight, 500);
  836 + debugMessage("InitEx("+ mImageWidth + "," + mImageHeight + ",500) ret:" + error + "\n");
  837 +
  838 + debugMessage("\n## END SDK TEST ##\n");
  839 + }
  840 +
  841 + @Override
  842 + public void run() {
  843 +
  844 + Log.d(TAG, "Enter run()");
  845 + //ByteBuffer buffer = ByteBuffer.allocate(1);
  846 + //UsbRequest request = new UsbRequest();
  847 + //request.initialize(mSGUsbInterface.getConnection(), mEndpointBulk);
  848 + //byte status = -1;
  849 + while (true) {
  850 +
  851 +
  852 + // queue a request on the interrupt endpoint
  853 + //request.queue(buffer, 1);
  854 + // send poll status command
  855 + // sendCommand(COMMAND_STATUS);
  856 + // wait for status event
  857 + /*
  858 + if (mSGUsbInterface.getConnection().requestWait() == request) {
  859 + byte newStatus = buffer.get(0);
  860 + if (newStatus != status) {
  861 + Log.d(TAG, "got status " + newStatus);
  862 + status = newStatus;
  863 + if ((status & COMMAND_FIRE) != 0) {
  864 + // stop firing
  865 + sendCommand(COMMAND_STOP);
  866 + }
  867 + }
  868 + try {
  869 + Thread.sleep(100);
  870 + } catch (InterruptedException e) {
  871 + }
  872 + } else {
  873 + Log.e(TAG, "requestWait failed, exiting");
  874 + break;
  875 + }
  876 + */
  877 + }
  878 + }
  879 +}
0 \ No newline at end of file 880 \ No newline at end of file