├── JlibFprint_jni ├── build │ └── .gitkeep ├── Makefile.am ├── autogen.sh ├── src │ ├── jlibfprint_JlibFprint_fp_print_data.h │ ├── jlibfprint_JlibFprint_fp_enroll_results.h │ ├── jlibfprint_EnrollResult.h │ ├── jlibfprint_Exceptions.h │ ├── jlibfprint_EnrollResult.cpp │ ├── JniUtils.h │ ├── jlibfprint_DiscoveredDeviceList.h │ ├── jlibfprint_PrintData.h │ ├── jlibfprint_Driver.h │ ├── jlibfprint_JlibFprint_fp_print_data_type.h │ ├── jlibfprint_JlibFprint_EnrollException.h │ ├── jlibfprint_Exceptions.cpp │ ├── jlibfprint_DiscoveredDevice.h │ ├── jlibfprint_Device.h │ ├── jlibfprint_Driver.cpp │ ├── jlibfprint_JlibFprint.h │ ├── JniUtils.cpp │ ├── jlibfprint_DiscoveredDeviceList.cpp │ ├── jlibfprint_JlibFprint_fp_enroll_result.h │ ├── jlibfprint_PrintData.cpp │ ├── Makefile.am │ ├── jlibfprint_Device.cpp │ ├── jlibfprint_DiscoveredDevice.cpp │ ├── libfprintWrapper.h │ └── jlibfprint_JlibFprint.cpp ├── .gitignore └── configure.ac ├── JlibFprint ├── src │ └── main │ │ └── java │ │ └── jlibfprint │ │ ├── CoreException.java │ │ ├── Driver.java │ │ ├── PrintData.java │ │ ├── EnrollResult.java │ │ ├── DiscoveredDeviceList.java │ │ ├── DiscoveredDevice.java │ │ ├── VerifyResultCode.java │ │ ├── EnrollResultCode.java │ │ ├── Device.java │ │ ├── SampleRun.java │ │ └── JlibFprint.java └── pom.xml ├── .gitignore ├── README.md └── LICENSE.txt /JlibFprint_jni/build/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /JlibFprint_jni/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | SUBDIRS=src 3 | ACLOCAL_AMFLAGS=-I m4 4 | -------------------------------------------------------------------------------- /JlibFprint_jni/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | 4 | aclocal \ 5 | && automake --add-missing \ 6 | && autoconf -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/CoreException.java: -------------------------------------------------------------------------------- 1 | package jlibfprint; 2 | 3 | public class CoreException extends Exception { 4 | 5 | public CoreException(String message) { 6 | super(message); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/Driver.java: -------------------------------------------------------------------------------- 1 | package jlibfprint; 2 | 3 | public class Driver { 4 | 5 | public long internalPointer; 6 | 7 | private Driver() { 8 | } 9 | 10 | public native String getName(); 11 | 12 | public native String getFullName(); 13 | 14 | public native int getId(); 15 | } 16 | -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/PrintData.java: -------------------------------------------------------------------------------- 1 | package jlibfprint; 2 | 3 | public class PrintData { 4 | 5 | private long internalPointer; 6 | 7 | private native void free(); 8 | 9 | @Override 10 | protected void finalize() throws Throwable { 11 | free(); 12 | super.finalize(); 13 | } 14 | 15 | public native byte[] getData(); 16 | } 17 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_JlibFprint_fp_print_data.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class jlibfprint_JlibFprint_fp_print_data */ 4 | 5 | #ifndef _Included_jlibfprint_JlibFprint_fp_print_data 6 | #define _Included_jlibfprint_JlibFprint_fp_print_data 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_JlibFprint_fp_enroll_results.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class jlibfprint_JlibFprint_fp_enroll_results */ 4 | 5 | #ifndef _Included_jlibfprint_JlibFprint_fp_enroll_results 6 | #define _Included_jlibfprint_JlibFprint_fp_enroll_results 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif 14 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_EnrollResult.h: -------------------------------------------------------------------------------- 1 | #ifndef _Included_jlibfprint_EnrollResult 2 | #define _Included_jlibfprint_EnrollResult 3 | 4 | #include "libfprintWrapper.h" 5 | #include 6 | 7 | #define ENROLL_RESULT_CLASS "jlibfprint/EnrollResult" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | jobject createEnrollResult(JNIEnv *env, fp_print_data* printData, int enrollCode); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif 19 | -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/EnrollResult.java: -------------------------------------------------------------------------------- 1 | package jlibfprint; 2 | 3 | public class EnrollResult { 4 | 5 | private PrintData printData; 6 | private EnrollResultCode code; 7 | 8 | private EnrollResult(int code, PrintData printData) { 9 | this.code = EnrollResultCode.getValueByCode(code); 10 | this.printData = printData; 11 | } 12 | 13 | public PrintData getPrintData() { 14 | return printData; 15 | } 16 | 17 | public EnrollResultCode getCode() { 18 | return code; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_Exceptions.h: -------------------------------------------------------------------------------- 1 | #ifndef _Included_jlibfprint_Exceptions 2 | #define _Included_jlibfprint_Exceptions 3 | 4 | #include 5 | 6 | #define CORE_EXCEPTION_CLASS "jlibfprint/CoreException" 7 | #define ENROLL_EXCEPTION_CLASS "jlibfprint/JlibFprint$EnrollException" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | void throw_core_exception(JNIEnv* env, const char* message); 14 | 15 | void throw_enroll_exception(JNIEnv* env, int errorCode); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | #endif 21 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_EnrollResult.cpp: -------------------------------------------------------------------------------- 1 | #include "jlibfprint_EnrollResult.h" 2 | #include "jlibfprint_PrintData.h" 3 | #include "libfprintWrapper.h" 4 | #include "JniUtils.h" 5 | 6 | jobject createEnrollResult(JNIEnv *env, fp_print_data* fpPrintData, int enrollCode) { 7 | jobject printData = createPrintData(env, fpPrintData); 8 | const jclass clazz = env->FindClass(ENROLL_RESULT_CLASS); 9 | const jmethodID constructor = env->GetMethodID(clazz, "", "(ILjlibfprint/PrintData;)V"); 10 | return env->NewObject(clazz, constructor, enrollCode, printData); 11 | } -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/DiscoveredDeviceList.java: -------------------------------------------------------------------------------- 1 | package jlibfprint; 2 | 3 | public class DiscoveredDeviceList { 4 | 5 | private long internalPointer; 6 | private DiscoveredDevice[] discoveredDevices; 7 | 8 | private DiscoveredDeviceList() { 9 | } 10 | 11 | public DiscoveredDevice[] getDiscoveredDevices() { 12 | return discoveredDevices; 13 | } 14 | 15 | @Override 16 | protected void finalize() throws Throwable { 17 | free(); 18 | super.finalize(); 19 | } 20 | 21 | private native void free(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/JniUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef JNIUTILS_H 2 | #define JNIUTILS_H 3 | 4 | #include 5 | 6 | class JniUtils { 7 | public: 8 | static void setObjectAttribute(JNIEnv* env, jobject object, const char* attributeName, 9 | const char* typeSignature, jobject value); 10 | static void setIntegerAttribute(JNIEnv* env, jobject object, const char* attributeName, 11 | int value); 12 | static void* getInternalPointer(JNIEnv* env, jobject object); 13 | static void setInternalPointer(JNIEnv* env, jobject object, void* pointer); 14 | 15 | }; 16 | #endif /* JNIUTILS_H */ -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_DiscoveredDeviceList.h: -------------------------------------------------------------------------------- 1 | #ifndef _Included_jlibfprint_DiscoveredDeviceList 2 | #define _Included_jlibfprint_DiscoveredDeviceList 3 | 4 | #include 5 | #include "libfprintWrapper.h" 6 | 7 | #define DISCOVERED_DEVICE_LIST_CLASS "jlibfprint/DiscoveredDeviceList" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | jobject createDiscoveredDeviceList(JNIEnv *env, fp_dscv_dev** fpDiscoveredDevices); 14 | 15 | JNIEXPORT jint JNICALL Java_jlibfprint_DiscoveredDeviceList_free 16 | (JNIEnv *, jobject, jobject); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_PrintData.h: -------------------------------------------------------------------------------- 1 | #ifndef _Included_jlibfprint_PrintData 2 | #define _Included_jlibfprint_PrintData 3 | 4 | #include "libfprintWrapper.h" 5 | #include 6 | 7 | #define PRINT_DATA_CLASS "jlibfprint/PrintData" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | jobject createPrintData(JNIEnv *env, fp_print_data* printData); 14 | 15 | JNIEXPORT jbyteArray JNICALL Java_jlibfprint_PrintData_getData 16 | (JNIEnv *, jobject); 17 | 18 | JNIEXPORT void JNICALL Java_jlibfprint_PrintData_free 19 | (JNIEnv *, jobject); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_Driver.h: -------------------------------------------------------------------------------- 1 | #ifndef _Included_jlibfprint_Driver 2 | #define _Included_jlibfprint_Driver 3 | 4 | #include "libfprintWrapper.h" 5 | #include 6 | 7 | #define DRIVER_CLASS "jlibfprint/Driver" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | jobject createDriver(JNIEnv *env, fp_driver* fpDriver); 14 | 15 | JNIEXPORT jint JNICALL Java_jlibfprint_Driver_getId(JNIEnv *, jobject); 16 | JNIEXPORT jstring JNICALL Java_jlibfprint_Driver_getName(JNIEnv *, jobject); 17 | JNIEXPORT jstring JNICALL Java_jlibfprint_Driver_getFullName(JNIEnv *, jobject); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif 23 | -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/DiscoveredDevice.java: -------------------------------------------------------------------------------- 1 | package jlibfprint; 2 | 3 | /** 4 | * 5 | * @author eduardo 6 | */ 7 | public class DiscoveredDevice { 8 | 9 | private long internalPointer; 10 | private DiscoveredDeviceList sourceList; 11 | private Driver driver; 12 | 13 | private DiscoveredDevice() { 14 | } 15 | 16 | public native int getType(); 17 | 18 | public native int getDriverId(); 19 | 20 | public Driver getDriver() { 21 | if (driver == null) { 22 | driver = nativeGetDriver(); 23 | } 24 | return driver; 25 | } 26 | 27 | private native Driver nativeGetDriver(); 28 | 29 | public native Device open(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_JlibFprint_fp_print_data_type.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class jlibfprint_JlibFprint_fp_print_data_type */ 4 | 5 | #ifndef _Included_jlibfprint_JlibFprint_fp_print_data_type 6 | #define _Included_jlibfprint_JlibFprint_fp_print_data_type 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef jlibfprint_JlibFprint_fp_print_data_type_PRINT_DATA_RAW 11 | #define jlibfprint_JlibFprint_fp_print_data_type_PRINT_DATA_RAW 0L 12 | #undef jlibfprint_JlibFprint_fp_print_data_type_PRINT_DATA_NBIS_MINUTIAE 13 | #define jlibfprint_JlibFprint_fp_print_data_type_PRINT_DATA_NBIS_MINUTIAE 1L 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_JlibFprint_EnrollException.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class jlibfprint_JlibFprint_EnrollException */ 4 | 5 | #ifndef _Included_jlibfprint_JlibFprint_EnrollException 6 | #define _Included_jlibfprint_JlibFprint_EnrollException 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef jlibfprint_JlibFprint_EnrollException_serialVersionUID 11 | #define jlibfprint_JlibFprint_EnrollException_serialVersionUID -3042686055658047285LL 12 | #undef jlibfprint_JlibFprint_EnrollException_serialVersionUID 13 | #define jlibfprint_JlibFprint_EnrollException_serialVersionUID -3387516993124229948LL 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/VerifyResultCode.java: -------------------------------------------------------------------------------- 1 | package jlibfprint; 2 | 3 | public enum VerifyResultCode { 4 | 5 | NO_MATCH(0), 6 | MATCH(1), 7 | RETRY(100), 8 | RETRY_TOO_SHORT(101), 9 | RETRY_CENTER_FINGER(102), 10 | RETRY_REMOVE_FINGER(103); 11 | 12 | private int code; 13 | 14 | VerifyResultCode(int code) { 15 | this.code = code; 16 | } 17 | 18 | public int getCode() { 19 | return code; 20 | } 21 | 22 | public static VerifyResultCode getValueByCode(int code) { 23 | for (VerifyResultCode vr : VerifyResultCode.values()) { 24 | if (vr.code == code) { 25 | return vr; 26 | } 27 | } 28 | return null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/EnrollResultCode.java: -------------------------------------------------------------------------------- 1 | package jlibfprint; 2 | 3 | public enum EnrollResultCode { 4 | 5 | COMPLETE(1), 6 | FAIL(2), 7 | PASS(3), 8 | RETRY(100), 9 | RETRY_TOO_SHORT(101), 10 | RETRY_CENTER_FINGER(102), 11 | RETRY_REMOVE_FINGER(103); 12 | 13 | private final int code; 14 | 15 | EnrollResultCode(int code) { 16 | this.code = code; 17 | } 18 | 19 | public int getCode() { 20 | return code; 21 | } 22 | 23 | public static EnrollResultCode getValueByCode(int code) { 24 | for (EnrollResultCode vr : EnrollResultCode.values()) { 25 | if (vr.code == code) { 26 | return vr; 27 | } 28 | } 29 | return null; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_Exceptions.cpp: -------------------------------------------------------------------------------- 1 | #include "jlibfprint_Exceptions.h" 2 | 3 | void throw_core_exception(JNIEnv* env, const char* message) { 4 | const jclass clazz = env->FindClass(CORE_EXCEPTION_CLASS); 5 | const jmethodID constructor = env->GetMethodID(clazz, "", "(Ljava/lang/String;)V"); 6 | jobject exception = env->NewObject(clazz, constructor, message); 7 | env->Throw((jthrowable) exception); 8 | } 9 | 10 | void throw_enroll_exception(JNIEnv* env, int errorCode) { 11 | const jclass eeClass = env->FindClass(ENROLL_EXCEPTION_CLASS); 12 | jobject enrollException = env->AllocObject(eeClass); 13 | jfieldID eeExcp_id = env->GetFieldID(eeClass, "enroll_exception", "I"); 14 | env->SetIntField(enrollException, eeExcp_id, errorCode); 15 | env->Throw((jthrowable) enrollException); 16 | } -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/Device.java: -------------------------------------------------------------------------------- 1 | package jlibfprint; 2 | 3 | public class Device { 4 | 5 | private long internalPointer; 6 | private boolean closed = false; 7 | 8 | private Device() { 9 | } 10 | 11 | public native int getNumberEnrollStages(); 12 | 13 | public native int getImageWidth(); 14 | 15 | public native int getImageHeight(); 16 | 17 | public void close() { 18 | if (!closed) { 19 | nativeClose(); 20 | } 21 | } 22 | 23 | private native void nativeClose(); 24 | 25 | public native EnrollResult enroll(); 26 | 27 | public VerifyResultCode verify(PrintData printData) { 28 | return VerifyResultCode.getValueByCode(nativeVerify(printData)); 29 | } 30 | 31 | private native int nativeVerify(PrintData printData); 32 | 33 | @Override 34 | protected void finalize() throws Throwable { 35 | close(); 36 | super.finalize(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /JlibFprint_jni/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Autotools template 3 | # http://www.gnu.org/software/automake 4 | 5 | Makefile 6 | Makefile.in 7 | 8 | # http://www.gnu.org/software/autoconf 9 | 10 | /autom4te.cache 11 | /aclocal.m4 12 | /compile 13 | /configure 14 | /depcomp 15 | /install-sh 16 | /missing 17 | /stamp-h1 18 | config.guess 19 | config.sub 20 | config.log 21 | config.status 22 | ltmain.sh 23 | libtool 24 | autoscan.log 25 | 26 | 27 | #m4 28 | m4 29 | 30 | # Autotools 31 | .deps 32 | .libs 33 | 34 | # Temporary 35 | *.swp 36 | *.~ 37 | *.project 38 | *.cproject 39 | 40 | ### C++ template 41 | # Compiled Object files 42 | *.slo 43 | *.lo 44 | *.o 45 | *.obj 46 | 47 | # Precompiled Headers 48 | *.gch 49 | *.pch 50 | 51 | # Compiled Dynamic libraries 52 | *.so 53 | *.dylib 54 | *.dll 55 | 56 | # Fortran module files 57 | *.mod 58 | 59 | # Compiled Static libraries 60 | *.lai 61 | *.la 62 | *.a 63 | *.lib 64 | 65 | # Executables 66 | *.exe 67 | *.out 68 | *.app 69 | 70 | 71 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_DiscoveredDevice.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class jlibfprint_JlibFprint */ 4 | 5 | #ifndef _Included_jlibfprint_JlibFprint 6 | #define _Included_jlibfprint_JlibFprint 7 | 8 | #include "libfprintWrapper.h" 9 | 10 | #define DISCOVERED_DEVICE_CLASS "jlibfprint/DiscoveredDevice" 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | 17 | jobject createDiscoveredDevice(JNIEnv *env, fp_dscv_dev* fpDiscoveredDevice, jobject discoveredDeviceList); 18 | 19 | JNIEXPORT jint JNICALL Java_jlibfprint_DiscoveredDevice_getType 20 | (JNIEnv *, jobject); 21 | 22 | JNIEXPORT jint JNICALL Java_jlibfprint_DiscoveredDevice_getDriverId 23 | (JNIEnv*, jobject); 24 | 25 | JNIEXPORT jobject JNICALL Java_jlibfprint_DiscoveredDevice_nativeGetDriver 26 | (JNIEnv *, jobject); 27 | 28 | JNIEXPORT jobject JNICALL Java_jlibfprint_DiscoveredDevice_open 29 | (JNIEnv *, jobject); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | #endif 35 | -------------------------------------------------------------------------------- /JlibFprint/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | jlibfprint 6 | jlibfprint 7 | 1.0-SNAPSHOT 8 | jar 9 | 10 | jlibfprint 11 | http://maven.apache.org 12 | 13 | 14 | UTF-8 15 | 1.7 16 | 1.7 17 | 18 | 19 | 20 | 21 | junit 22 | junit 23 | 3.8.1 24 | test 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_Device.h: -------------------------------------------------------------------------------- 1 | #ifndef _Included_jlibfprint_Device 2 | #define _Included_jlibfprint_Device 3 | 4 | #include "libfprintWrapper.h" 5 | #include 6 | 7 | #define DEVICE_CLASS "jlibfprint/Device" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | jobject createDevice(JNIEnv *env, fp_dev * fpDevice); 14 | 15 | JNIEXPORT jint JNICALL Java_jlibfprint_Device_getNumberEnrollStages 16 | (JNIEnv *, jobject); 17 | 18 | JNIEXPORT jint JNICALL Java_jlibfprint_Device_getImageWidth 19 | (JNIEnv *, jobject); 20 | 21 | JNIEXPORT jint JNICALL Java_jlibfprint_Device_getImageHeight 22 | (JNIEnv *, jobject); 23 | 24 | JNIEXPORT void JNICALL Java_jlibfprint_Device_nativeClose 25 | (JNIEnv *, jobject); 26 | 27 | JNIEXPORT jobject JNICALL Java_jlibfprint_Device_enroll 28 | (JNIEnv *, jobject); 29 | 30 | JNIEXPORT jint JNICALL Java_jlibfprint_Device_nativeVerify 31 | (JNIEnv *, jobject, jobject); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | #endif 37 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_Driver.cpp: -------------------------------------------------------------------------------- 1 | #include "jlibfprint_Driver.h" 2 | #include "libfprintWrapper.h" 3 | #include "JniUtils.h" 4 | 5 | jobject createDriver(JNIEnv *env, fp_driver* fpDriver) { 6 | const jclass driverClass = env->FindClass(DRIVER_CLASS); 7 | jobject driver = env->AllocObject(driverClass); 8 | JniUtils::setInternalPointer(env, driver, fpDriver); 9 | return driver; 10 | } 11 | 12 | JNIEXPORT jint JNICALL Java_jlibfprint_Driver_getId(JNIEnv * env, jobject object) { 13 | fp_driver* fpDriver = (fp_driver*) JniUtils::getInternalPointer(env, object); 14 | return fp_driver_get_driver_id(fpDriver); 15 | } 16 | 17 | JNIEXPORT jstring JNICALL Java_jlibfprint_Driver_getName(JNIEnv * env, jobject object) { 18 | fp_driver* fpDriver = (fp_driver*) JniUtils::getInternalPointer(env, object); 19 | const char* name = fp_driver_get_name(fpDriver); 20 | return env->NewStringUTF(name); 21 | } 22 | 23 | JNIEXPORT jstring JNICALL Java_jlibfprint_Driver_getFullName(JNIEnv * env, jobject object) { 24 | fp_driver* fpDriver = (fp_driver*) JniUtils::getInternalPointer(env, object); 25 | const char* fullName = fp_driver_get_full_name(fpDriver); 26 | return env->NewStringUTF(fullName); 27 | } -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_JlibFprint.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class jlibfprint_JlibFprint */ 4 | 5 | #ifndef _Included_jlibfprint_JlibFprint 6 | #define _Included_jlibfprint_JlibFprint 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef jlibfprint_JlibFprint_BOZORTH_THRESHOLD 11 | #define jlibfprint_JlibFprint_BOZORTH_THRESHOLD 40L 12 | /* 13 | * Class: jlibfprint_JlibFprint 14 | * Method: enroll_finger 15 | * Signature: ()Ljlibfprint/JlibFprint/fp_print_data; 16 | */ 17 | JNIEXPORT jobject JNICALL Java_jlibfprint_JlibFprint_enroll_1finger 18 | (JNIEnv *, jobject); 19 | 20 | /* 21 | * Class: jlibfprint_JlibFprint 22 | * Method: img_compare_print_data 23 | * Signature: (Ljlibfprint/JlibFprint/fp_print_data;Ljlibfprint/JlibFprint/fp_print_data;)I 24 | */ 25 | JNIEXPORT jint JNICALL Java_jlibfprint_JlibFprint_img_1compare_1print_1data 26 | (JNIEnv *, jclass, jobject, jobject); 27 | 28 | /* 29 | * Class: jlibfprint_JlibFprint 30 | * Method: discoverDevices 31 | * Signature: 32 | */ 33 | JNIEXPORT jobject JNICALL Java_jlibfprint_JlibFprint_discoverDevices 34 | (JNIEnv *, jclass); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/JniUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "JniUtils.h" 2 | 3 | void JniUtils::setObjectAttribute(JNIEnv* env, jobject object, 4 | const char* attributeName, const char* typeSignature, jobject value) { 5 | const jclass clazz = env->GetObjectClass(object); 6 | jfieldID fieldId = env->GetFieldID(clazz, attributeName, typeSignature); 7 | env->SetObjectField(object, fieldId, value); 8 | } 9 | 10 | void JniUtils::setIntegerAttribute(JNIEnv* env, jobject object, 11 | const char* attributeName, int value) { 12 | const jclass clazz = env->GetObjectClass(object); 13 | jfieldID fieldId = env->GetFieldID(clazz, attributeName, "I"); 14 | env->SetIntField(object, fieldId, value); 15 | } 16 | 17 | void* JniUtils::getInternalPointer(JNIEnv* env, jobject object) { 18 | const jclass clazz = env->GetObjectClass(object); 19 | jfieldID internalPointerFieldId = env->GetFieldID(clazz, "internalPointer", "J"); 20 | return (void*) env->GetLongField(object, internalPointerFieldId); 21 | } 22 | 23 | void JniUtils::setInternalPointer(JNIEnv* env, jobject object, void* pointer) { 24 | const jclass clazz = env->GetObjectClass(object); 25 | jfieldID internalPointerFieldId = env->GetFieldID(clazz, "internalPointer", "J"); 26 | env->SetLongField(object, internalPointerFieldId, (long) pointer); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_DiscoveredDeviceList.cpp: -------------------------------------------------------------------------------- 1 | #include "jlibfprint_DiscoveredDeviceList.h" 2 | #include "JniUtils.h" 3 | #include "jlibfprint_DiscoveredDevice.h" 4 | 5 | jobject createDiscoveredDeviceList(JNIEnv *env, fp_dscv_dev** fpDiscoveredDevices) { 6 | const jclass discoveredDeviceListClass = env->FindClass(DISCOVERED_DEVICE_LIST_CLASS); 7 | jobject list = env->AllocObject(discoveredDeviceListClass); 8 | JniUtils::setInternalPointer(env, list, fpDiscoveredDevices); 9 | 10 | int count = 0; 11 | for (int i = 0; fpDiscoveredDevices[i] != NULL; ++i) { 12 | count++; 13 | } 14 | const jclass discoveredDeviceClass = env->FindClass(DISCOVERED_DEVICE_CLASS); 15 | jobjectArray discoveredDeviceArray = env->NewObjectArray(count, discoveredDeviceClass, 0); 16 | 17 | for (int i = 0; i < count; ++i) { 18 | jobject discoveredDevice = createDiscoveredDevice(env, fpDiscoveredDevices[i], list); 19 | env->SetObjectArrayElement(discoveredDeviceArray, i, discoveredDevice); 20 | } 21 | JniUtils::setObjectAttribute(env, list, "discoveredDevices", "[L" DISCOVERED_DEVICE_CLASS ";", 22 | discoveredDeviceArray); 23 | return list; 24 | } 25 | 26 | JNIEXPORT jint JNICALL Java_jlibfprint_DiscoveredDeviceList_free(JNIEnv * env, jobject object) { 27 | fp_dscv_devs_free((fp_dscv_dev**) JniUtils::getInternalPointer(env, object)); 28 | } 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | 3 | 4 | ### Java template 5 | *.class 6 | 7 | # Mobile Tools for Java (J2ME) 8 | .mtj.tmp/ 9 | 10 | # Package Files # 11 | *.jar 12 | *.war 13 | *.ear 14 | 15 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 16 | hs_err_pid* 17 | 18 | 19 | ### JetBrains template 20 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 21 | 22 | *.iml 23 | 24 | ## Directory-based project format: 25 | .idea/ 26 | # if you remove the above rule, at least ignore the following: 27 | 28 | # User-specific stuff: 29 | # .idea/workspace.xml 30 | # .idea/tasks.xml 31 | # .idea/dictionaries 32 | 33 | # Sensitive or high-churn files: 34 | # .idea/dataSources.ids 35 | # .idea/dataSources.xml 36 | # .idea/sqlDataSources.xml 37 | # .idea/dynamic.xml 38 | # .idea/uiDesigner.xml 39 | 40 | # Gradle: 41 | # .idea/gradle.xml 42 | # .idea/libraries 43 | 44 | # Mongo Explorer plugin: 45 | # .idea/mongoSettings.xml 46 | 47 | ## File-based project format: 48 | *.ipr 49 | *.iws 50 | 51 | ## Plugin-specific files: 52 | 53 | # IntelliJ 54 | out/ 55 | 56 | # mpeltonen/sbt-idea plugin 57 | .idea_modules/ 58 | 59 | # JIRA plugin 60 | atlassian-ide-plugin.xml 61 | 62 | # Crashlytics plugin (for Android Studio and IntelliJ) 63 | com_crashlytics_export_strings.xml 64 | crashlytics.properties 65 | crashlytics-build.properties 66 | 67 | 68 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_JlibFprint_fp_enroll_result.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class jlibfprint_JlibFprint_fp_enroll_result */ 4 | 5 | #ifndef _Included_jlibfprint_JlibFprint_fp_enroll_result 6 | #define _Included_jlibfprint_JlibFprint_fp_enroll_result 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_COMPLETE 11 | #define jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_COMPLETE 1L 12 | #undef jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_FAIL 13 | #define jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_FAIL 2L 14 | #undef jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_PASS 15 | #define jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_PASS 3L 16 | #undef jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_RETRY 17 | #define jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_RETRY 100L 18 | #undef jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_RETRY_TOO_SHORT 19 | #define jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_RETRY_TOO_SHORT 101L 20 | #undef jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_RETRY_CENTER_FINGER 21 | #define jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_RETRY_CENTER_FINGER 102L 22 | #undef jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_RETRY_REMOVE_FINGER 23 | #define jlibfprint_JlibFprint_fp_enroll_result_FP_ENROLL_RETRY_REMOVE_FINGER 103L 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_PrintData.cpp: -------------------------------------------------------------------------------- 1 | #include "jlibfprint_PrintData.h" 2 | #include "libfprintWrapper.h" 3 | #include "JniUtils.h" 4 | #include "jlibfprint_Exceptions.h" 5 | #include 6 | 7 | jobject createPrintData(JNIEnv *env, fp_print_data* printData) { 8 | const jclass driverClass = env->FindClass(PRINT_DATA_CLASS); 9 | jobject driver = env->AllocObject(driverClass); 10 | JniUtils::setInternalPointer(env, driver, printData); 11 | return driver; 12 | } 13 | 14 | JNIEXPORT void JNICALL Java_jlibfprint_PrintData_free(JNIEnv* env, jobject object) { 15 | fp_print_data_free((fp_print_data*) JniUtils::getInternalPointer(env, object)); 16 | } 17 | 18 | JNIEXPORT jbyteArray JNICALL Java_jlibfprint_PrintData_getData(JNIEnv * env, jobject object) { 19 | fp_print_data* fpPrintData = (fp_print_data*) JniUtils::getInternalPointer(env, object); 20 | unsigned char* buffer; 21 | int writed = fp_print_data_get_data(fpPrintData, &buffer); 22 | if (writed == 0) { 23 | throw_core_exception(env, "PrintData data buffer could not be allocated"); 24 | return NULL; 25 | } else { 26 | jbyteArray byteData = env->NewByteArray(writed); 27 | jboolean isCopy; 28 | void *data = env->GetPrimitiveArrayCritical((jarray) byteData, &isCopy); 29 | memcpy(data, buffer, writed); 30 | env->ReleasePrimitiveArrayCritical(byteData, data, 0); 31 | return byteData; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /JlibFprint_jni/configure.ac: -------------------------------------------------------------------------------- 1 | # initial information about the project 2 | AC_INIT([libfprint_jni],[1.0]) 3 | 4 | # check if the source folder is correct 5 | AC_CONFIG_SRCDIR([src/jlibfprint_JlibFprint.cpp]) 6 | 7 | AC_COPYRIGHT(GNU General Public License) 8 | 9 | # Checks for programs 10 | 11 | # check for C++ compiler and the library compiler 12 | AC_PROG_CXX 13 | AC_PROG_RANLIB 14 | AC_PROG_CC 15 | 16 | # automake initialisation (mandatory) and check for minimal automake API version 1.9 17 | AM_INIT_AUTOMAKE([1.9]) 18 | 19 | # use the C++ compiler for the following checks 20 | AC_LANG([C++]) 21 | 22 | # Checks for header files. 23 | AC_HEADER_STDC 24 | AC_CHECK_HEADERS([string]) 25 | AC_CHECK_HEADERS([iostream]) 26 | AC_CHECK_HEADERS([jni]) 27 | AC_CHECK_HEADERS([libfprint/fprint.h]) 28 | 29 | AX_JNI_INCLUDE_DIR 30 | for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS 31 | do 32 | CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" 33 | done 34 | 35 | 36 | LT_INIT 37 | 38 | # Checks for typedefs, structures, and compiler characteristics. 39 | AC_TYPE_SIZE_T 40 | 41 | AC_CONFIG_MACRO_DIR([m4]) 42 | 43 | # distribute additional compiler and linker flags 44 | # --> set these variables instead of CXXFLAGS or LDFLAGS 45 | AC_SUBST([AM_CXXFLAGS]) 46 | AC_SUBST([AM_LDFLAGS]) 47 | AC_SUBST([LIBS]) 48 | 49 | # files to generate via autotools (.am or .in source files) 50 | AC_CONFIG_FILES([ 51 | Makefile 52 | src/Makefile 53 | ]) 54 | 55 | # generate the final Makefile etc. 56 | AC_OUTPUT 57 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/Makefile.am: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # The list of libraries we are building seperated by spaces. 3 | # The 'lib_' indicates that these build products will be installed 4 | # in the $(libdir) directory. For example /usr/lib 5 | lib_LTLIBRARIES = libfprint_jni.la 6 | 7 | ####################################### 8 | # Build information for each library 9 | 10 | AUTOMAKE_OPTIONS = gnu 11 | 12 | # Link Libraries and Options 13 | LDLIBSOPTIONS=`pkg-config --libs libfprint` 14 | 15 | # whatever flags you want to pass to the C compiler & linker 16 | AM_CFLAGS = --pedantic -Wall -std=c99 -O2 17 | AM_LDFLAGS = -lm $(LDLIBSOPTIONS) 18 | 19 | # Sources 20 | libfprint_jni_la_SOURCES = \ 21 | jlibfprint_JlibFprint.cpp \ 22 | jlibfprint_Device.cpp \ 23 | jlibfprint_DiscoveredDevice.cpp \ 24 | jlibfprint_DiscoveredDeviceList.cpp \ 25 | jlibfprint_PrintData.cpp \ 26 | jlibfprint_Driver.cpp \ 27 | jlibfprint_EnrollResult.cpp \ 28 | jlibfprint_Exceptions.cpp \ 29 | JniUtils.cpp 30 | 31 | # Linker options library 32 | libfprint_jni_la_LDFLAGS = -module -avoid-version -shared $(LDLIBSOPTIONS) 33 | 34 | 35 | # ------------------- 36 | # Modify the includes of the project, add you jdk include directory and libfprint includes 37 | ADD_INCLUDES= 38 | # Example 39 | # ADD_INCLUDES=-I/opt/jdk1.7.0_03/include -I/opt/jdk1.7.0_03/include/linux -I../../Downloads/libfprint-0.4.0 -I../../Downloads/libfprint-0.4.0/libfprint/nbis/include 40 | #-------------------- 41 | 42 | # Compiler options. Here we are adding the include directory 43 | # to be searched for headers included in the source code. 44 | libfprint_jni_la_CPPFLAGS = $(CPPFLAGS) $(ADD_INCLUDES) 45 | 46 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_Device.cpp: -------------------------------------------------------------------------------- 1 | #include "jlibfprint_Device.h" 2 | #include "libfprintWrapper.h" 3 | #include "JniUtils.h" 4 | #include "jlibfprint_EnrollResult.h" 5 | 6 | jobject createDevice(JNIEnv *env, fp_dev * fpDevice) { 7 | const jclass driverClass = env->FindClass(DEVICE_CLASS); 8 | jobject driver = env->AllocObject(driverClass); 9 | JniUtils::setInternalPointer(env, driver, fpDevice); 10 | return driver; 11 | } 12 | 13 | JNIEXPORT jint JNICALL Java_jlibfprint_Device_getNumberEnrollStages(JNIEnv * env, jobject object) { 14 | return fp_dev_get_nr_enroll_stages((fp_dev*) JniUtils::getInternalPointer(env, object)); 15 | } 16 | 17 | JNIEXPORT jint JNICALL Java_jlibfprint_Device_getImageWidth(JNIEnv * env, jobject object) { 18 | return fp_dev_get_img_width((fp_dev*) JniUtils::getInternalPointer(env, object)); 19 | } 20 | 21 | JNIEXPORT jint JNICALL Java_jlibfprint_Device_getImageHeight(JNIEnv * env, jobject object) { 22 | return fp_dev_get_img_height((fp_dev*) JniUtils::getInternalPointer(env, object)); 23 | } 24 | 25 | JNIEXPORT void JNICALL Java_jlibfprint_Device_nativeClose(JNIEnv * env, jobject object) { 26 | return fp_dev_close((fp_dev*) JniUtils::getInternalPointer(env, object)); 27 | } 28 | 29 | JNIEXPORT jobject JNICALL Java_jlibfprint_Device_enroll(JNIEnv * env, jobject object) { 30 | fp_dev* fpDevice = (fp_dev*) JniUtils::getInternalPointer(env, object); 31 | fp_print_data* fpPrintData; 32 | int code = fp_enroll_finger(fpDevice, &fpPrintData); 33 | return createEnrollResult(env, fpPrintData, code); 34 | } 35 | 36 | JNIEXPORT jint JNICALL Java_jlibfprint_Device_nativeVerify(JNIEnv *env, jobject object, jobject printData) { 37 | fp_dev* fpDevice = (fp_dev*) JniUtils::getInternalPointer(env, object); 38 | fp_print_data* fpPrintData = (fp_print_data*) JniUtils::getInternalPointer(env, printData); 39 | return fp_verify_finger(fpDevice, fpPrintData); 40 | } -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_DiscoveredDevice.cpp: -------------------------------------------------------------------------------- 1 | #include "jlibfprint_DiscoveredDevice.h" 2 | #include "libfprintWrapper.h" 3 | #include "JniUtils.h" 4 | #include "jlibfprint_Driver.h" 5 | #include "jlibfprint_Device.h" 6 | #include "jlibfprint_DiscoveredDeviceList.h" 7 | 8 | jobject createDiscoveredDevice(JNIEnv *env, fp_dscv_dev* fpDiscoveredDevice, jobject discoveredDeviceList) { 9 | const jclass discoveredDeviceClass = env->FindClass(DISCOVERED_DEVICE_CLASS); 10 | jobject device = env->AllocObject(discoveredDeviceClass); 11 | JniUtils::setInternalPointer(env, device, fpDiscoveredDevice); 12 | JniUtils::setObjectAttribute(env, device, "sourceList", "L"DISCOVERED_DEVICE_LIST_CLASS";", discoveredDeviceList); 13 | return device; 14 | } 15 | 16 | JNIEXPORT jint JNICALL Java_jlibfprint_DiscoveredDevice_getType(JNIEnv* env, jobject object) { 17 | fp_dscv_dev* fpDiscoveredDevice = (fp_dscv_dev*) JniUtils::getInternalPointer(env, object); 18 | return fp_dscv_dev_get_devtype(fpDiscoveredDevice); 19 | } 20 | 21 | JNIEXPORT jint JNICALL Java_jlibfprint_DiscoveredDevice_getDriverId(JNIEnv* env, jobject object) { 22 | fp_dscv_dev* fpDiscoveredDevice = (fp_dscv_dev*) JniUtils::getInternalPointer(env, object); 23 | return fp_dscv_dev_get_driver_id(fpDiscoveredDevice); 24 | } 25 | 26 | JNIEXPORT jobject JNICALL Java_jlibfprint_DiscoveredDevice_nativeGetDriver(JNIEnv* env, jobject object) { 27 | fp_dscv_dev* fpDiscoveredDevice = (fp_dscv_dev*) JniUtils::getInternalPointer(env, object); 28 | fp_driver* fpDriver = fp_dscv_dev_get_driver(fpDiscoveredDevice); 29 | return createDriver(env, fpDriver); 30 | } 31 | 32 | JNIEXPORT jobject JNICALL Java_jlibfprint_DiscoveredDevice_open(JNIEnv* env, jobject object) { 33 | fp_dscv_dev* fpDiscoveredDevice = (fp_dscv_dev*) JniUtils::getInternalPointer(env, object); 34 | fp_dev* fpDevice = fp_dev_open(fpDiscoveredDevice); 35 | printf("Device: %p\n", fpDevice); 36 | return createDevice(env, fpDevice); 37 | } -------------------------------------------------------------------------------- /JlibFprint_jni/src/libfprintWrapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Jlibfprint - A Java Bridge for libfprint 3 | * Copyright (C) 2012 Fabio Scippacercola 4 | * Agostino Savignano 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef LIBFPRINTWRAPPER_H 22 | #define LIBFPRINTWRAPPER_H 23 | 24 | #include 25 | 26 | #define MAX_BOZORTH_MINUTIAE 200 27 | 28 | /** 29 | * The following code in this header file was adapted by libfprint project. 30 | * See the README for information about the license and the authors. 31 | */ 32 | 33 | extern "C" 34 | { 35 | #include 36 | struct xyt_struct { 37 | int nrows; 38 | int xcol[ MAX_BOZORTH_MINUTIAE ]; 39 | int ycol[ MAX_BOZORTH_MINUTIAE ]; 40 | int thetacol[ MAX_BOZORTH_MINUTIAE ]; 41 | }; 42 | 43 | struct fp_minutiae { 44 | int alloc; 45 | int num; 46 | struct fp_minutia **list; 47 | }; 48 | 49 | struct fp_img { 50 | int width; 51 | int height; 52 | size_t length; 53 | uint16_t flags; 54 | struct fp_minutiae *minutiae; 55 | unsigned char *binarized; 56 | unsigned char data[0]; 57 | }; 58 | 59 | enum fp_print_data_type { 60 | PRINT_DATA_RAW = 0, /* memset-imposed default */ 61 | PRINT_DATA_NBIS_MINUTIAE, 62 | }; 63 | 64 | static const int FP_PRINT_DATA_DATA_SIZE = sizeof(xyt_struct); 65 | static const int UNABLE_TO_LOAD_LIBFPRINT = -1; 66 | static const int DEVICE_NOT_FOUND = -2; 67 | 68 | struct fp_print_data { 69 | uint16_t driver_id; 70 | uint32_t devtype; 71 | enum fp_print_data_type type; 72 | size_t length; 73 | unsigned char data[FP_PRINT_DATA_DATA_SIZE]; 74 | }; 75 | 76 | int fpi_img_compare_print_data(struct fp_print_data *enrolled_print, 77 | struct fp_print_data *new_print); 78 | 79 | } 80 | 81 | 82 | #endif /* LIBFPRINTWRAPPER_H */ 83 | 84 | -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/SampleRun.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Jlibfprint 3 | * Copyright (C) 2012 Fabio Scippacercola 4 | * Agostino Savignano 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package jlibfprint; 21 | 22 | import java.util.Arrays; 23 | 24 | /** 25 | * A simple execution can be used to test the library. 26 | * @author agostino 27 | */ 28 | public class SampleRun { 29 | /** 30 | * @param args the command line arguments 31 | */ 32 | public static void main(String[] args) { 33 | DiscoveredDeviceList discoveredDeviceList = JlibFprint.discoverDevices(); 34 | listDiscoveredDevices(discoveredDeviceList); 35 | DiscoveredDevice firstDiscoveredDevice = getFirstDiscoveredDevice(discoveredDeviceList); 36 | 37 | if (firstDiscoveredDevice == null) { 38 | System.out.println("No device found to enroll fingers"); 39 | } else { 40 | Device device = firstDiscoveredDevice.open(); 41 | showDeviceInfo(device); 42 | EnrollResult enrollResult = enroll(device); 43 | if (EnrollResultCode.COMPLETE.equals(enrollResult.getCode())) { 44 | System.out.println("Print data: " + Arrays.toString(enrollResult.getPrintData().getData())); //print data get's set now only. 45 | identify(device, enrollResult.getPrintData()); 46 | } 47 | device.close(); 48 | } 49 | 50 | } 51 | 52 | private static void showDeviceInfo(Device device) { 53 | System.out.println("====================================="); 54 | System.out.println("Device: " + device); 55 | System.out.println("\tNumber of enroll stages: " + device.getNumberEnrollStages()); 56 | System.out.println("\tImage width: " + device.getImageWidth()); 57 | System.out.println("\tImage height: " + device.getImageHeight()); 58 | System.out.println("====================================="); 59 | } 60 | 61 | private static void listDiscoveredDevices(DiscoveredDeviceList discoveredDeviceList) { 62 | System.out.println("Devices discovered: " + discoveredDeviceList.getDiscoveredDevices().length); 63 | for(DiscoveredDevice discoveredDevice: discoveredDeviceList.getDiscoveredDevices()) { 64 | System.out.println("====================================="); 65 | System.out.println(discoveredDevice); 66 | System.out.println("\ttype_id: " + discoveredDevice.getType()); 67 | System.out.println("\tdriver_id: " + discoveredDevice.getDriverId()); 68 | System.out.println("\tDriver.name: " + discoveredDevice.getDriver().getName()); 69 | System.out.println("\tDriver.full_name: " + discoveredDevice.getDriver().getFullName()); 70 | System.out.println("\tDriver.id: " + discoveredDevice.getDriver().getId()); 71 | } 72 | System.out.println("====================================="); 73 | } 74 | 75 | private static DiscoveredDevice getFirstDiscoveredDevice(DiscoveredDeviceList discoveredDeviceList) { 76 | return discoveredDeviceList.getDiscoveredDevices().length > 0 77 | ? discoveredDeviceList.getDiscoveredDevices()[0] 78 | : null; 79 | } 80 | 81 | private static EnrollResult enroll(Device device) { 82 | EnrollResult enrollResult = null; 83 | for ( int i = 0 ; i < device.getNumberEnrollStages() ; i++ ) { 84 | System.out.println("Please, enroll the finger"); 85 | enrollResult = device.enroll(); 86 | System.out.println("Enroll result code: " + enrollResult.getCode()); 87 | } 88 | return enrollResult; 89 | } 90 | 91 | private static void identify(Device device, PrintData printData) { 92 | System.out.println("Please, enroll the finger again to verify"); 93 | VerifyResultCode result = device.verify(printData); 94 | System.out.println("Verify result code: " + result); 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Jlibfprint 2 | ========= 3 | 4 | Jlibfprint was developed as part of a small project during our studies 5 | at the University of Naples (Università degli studi di Napoli Federico II). 6 | It was not developed in the sight to provide a full support to 7 | the fingerprint sensors under Linux, but just as basic access to these 8 | peripherals under Java. 9 | 10 | We are sharing the code in the hope that it can be enough for your 11 | purposes or at least can just be a good starting point to extend 12 | the integration of Java with the libfprint library. 13 | 14 | This project is fully independent from our university and from 15 | the libfprint project. We want thank all the authors of libfprint 16 | for their contribution to the open source world on top of which 17 | our small software bridge is collocated. 18 | 19 | This software is given to you without any warranty, it is licensed 20 | under the GNU LGPL version 2.1. See the LICENSE file for the license text. 21 | 22 | Installation 23 | ------------ 24 | 25 | The Jlibfprint is a JNI bridge to libfprint, so it is strictly dependent 26 | from that library. 27 | 28 | Jlibfprint is divided in two folder: JlibFprint, JlibFprint_jni. 29 | The first one contains the Java class used for the bridging 30 | with the native library along with an example, the second one is the dynamic library used by JNI. 31 | 32 | - Download the (latest) sources of libfprint 33 | ```bash 34 | $ wget http://people.freedesktop.org/~hadess/libfprint-0.6.0.tar.xz 35 | $ tar -xvf libfprint-0.6.0.tar.xz 36 | $ cd libfprint-0.6.0 37 | ``` 38 | 39 | - To give the ability to compare two fingerprint data in Jlibfprint you need to patch it. 40 | 41 | - In libfprint find the file img.c and open it 42 | - Find the function 43 | 44 | ```c 45 | int fpi_img_compare_print_data(struct fp_print_data *enrolled_print, struct fp_print_data *new_print) 46 | ``` 47 | - Add the attribute "API_EXPORTED" before the definition of the function: 48 | 49 | ```c 50 | API_EXPORTED int fpi_img_compare_print_data(struct fp_print_data *enrolled_print, struct fp_print_data *new_print) 51 | ``` 52 | - Configure, compile and install libfprint in the library folder your system use for dynamic linking. 53 | 54 | ```bash 55 | $ ./configure --prefix=/usr 56 | $ make 57 | $ sudo make install 58 | ``` 59 | 60 | - Setup enviroment variables. 61 | - Edit the file ```JlibFprint_jni/src/Makefile.am``` 62 | - search for the ADD_INCLUDE variable (near line 53), and specify the JDK include library and the path of the source files of the libfprint you have just patched. Please take care to add also this subfolder: libfprint/nbis/include. 63 | 64 | ``` 65 | #Modify the includes of the project, add you jdk include directory and libfprint includes 66 | ADD_INCLUDES= 67 | # Example 68 | # ADD_INCLUDES=-I/opt/jdk1.7.0_03/include -I/opt/jdk1.7.0_03/include/linux -I/home/user/Downloads/libfprint-0.4.0 -I/home/user/Downloads/libfprint-0.4.0/libfprint/nbis/include 69 | 70 | ``` 71 | 72 | - Compile 73 | ```bash 74 | $ cd JlibFprint_jni 75 | $ libtoolize 76 | $ ./autogen.sh 77 | $ cd build 78 | $ ../configure 79 | $ make 80 | $ sudo make install 81 | ``` 82 | 83 | - Run! 84 | ```bash 85 | $ export JLIBFPRINT_JNI=/usr/local/lib/libfprint_jni.so 86 | $ cd JlibFprint 87 | $ mvn install 88 | $ java -cp target/jlibfprint-1.0-SNAPSHOT.jar jlibfprint.SampleRun 89 | ``` 90 | 91 | 92 | Contacts 93 | ---------- 94 | If you encounter any problem or want inform us that you are using our Bridge, 95 | feel free to contact us to our email addresses. 96 | See http://code.google.com/p/jlibfprint for all the things concerning the project. 97 | 98 | 99 | Contributors 100 | ---------- 101 | 102 | - Copyright (C) 2012 Fabio Scippacercola 103 | - Copyright (C) 2012 Agostino Savignano 104 | - Copyright (C) 2015 Kinshuk Bairagi 105 | 106 | Because we have built our software on the top of Libfprint we want thank all the authors 107 | of the libfprint project. Look the Libfprint license file for more informations. 108 | See http://www.freedesktop.org/wiki/Software/fprint/libfprint 109 | 110 | Thanks to: 111 | 112 | - Copyright (C) 2007 Daniel Drake 113 | - Copyright (C) 2006-2007 Timo Hoenig 114 | - Copyright (C) 2006 Pavel Machek 115 | - Copyright (C) 1999 Erik Walthinsen 116 | - Copyright (C) 2004,2006 Thomas Vander Stichele 117 | - Copyright (C) 2007 Cyrille Bagard 118 | - Copyright (C) 2007 Vasily Khoruzhick 119 | - Copyright (C) 2007 Jan-Michael Brummer 120 | - Copyright (C) 2007 Anthony Bretaudeau 121 | - Copyright (C) 2010 Hugo Grostabussiat 122 | - Copyright (C) 2015 Eduardo Bogoni 123 | -------------------------------------------------------------------------------- /JlibFprint/src/main/java/jlibfprint/JlibFprint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Jlibfprint - A Java Bridge for libfprint 3 | * Copyright (C) 2012 Fabio Scippacercola 4 | * Agostino Savignano 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | package jlibfprint; 21 | 22 | /** 23 | * The bridge class for the libFprint services. 24 | * This class is not designed to be thread-safe. 25 | */ 26 | public class JlibFprint { 27 | 28 | public static final String JNI_ENV = "JLIBFPRINT_JNI"; 29 | 30 | static { 31 | String jniEnv = System.getenv(JNI_ENV); 32 | if (jniEnv == null) { 33 | throw new RuntimeException("Environment variable \"" + JNI_ENV + "\" not set"); 34 | } 35 | System.load(jniEnv); 36 | } 37 | 38 | /** 39 | * Enrollment result codes returned from fp_enroll_finger(). 40 | * Result codes with RETRY in the name suggest that the scan failed due to 41 | * user error. Applications will generally want to inform the user of the 42 | * problem and then retry the enrollment stage. For more info on the semantics 43 | * of interpreting these result codes and tracking enrollment process, see 44 | * \ref enrolling. 45 | */ 46 | static public interface fp_enroll_result { 47 | /** 48 | * Enrollment completed successfully, the enrollment data has been 49 | * returned to the caller. 50 | */ 51 | int FP_ENROLL_COMPLETE = 1, 52 | /** 53 | * Enrollment failed due to incomprehensible data; this may occur when 54 | * the user scans a different finger on each enroll stage. 55 | */ 56 | FP_ENROLL_FAIL = 2, 57 | /** 58 | * Enroll stage passed; more stages are need to complete the process. 59 | */ 60 | FP_ENROLL_PASS = 3, 61 | /** 62 | * The enrollment scan did not succeed due to poor scan quality or 63 | * other general user scanning problem. 64 | */ 65 | FP_ENROLL_RETRY = 100, 66 | /** 67 | * The enrollment scan did not succeed because the finger swipe was 68 | * too short. 69 | */ 70 | FP_ENROLL_RETRY_TOO_SHORT = 101, 71 | /** 72 | * The enrollment scan did not succeed because the finger was not 73 | * centered on the scanner. 74 | */ 75 | FP_ENROLL_RETRY_CENTER_FINGER = 102, 76 | /** 77 | * The verification scan did not succeed due to quality or pressure 78 | * problems; the user should remove their finger from the scanner before 79 | * retrying. 80 | */ 81 | FP_ENROLL_RETRY_REMOVE_FINGER = 103, 82 | /** 83 | * This problem occurs when it's impossible to load the native library. 84 | */ 85 | UNABLE_TO_LOAD_LIBFPRINT = -1, 86 | /** 87 | * This code is raised when was selected an invalid Device id. 88 | */ 89 | DEVICE_NOT_FOUND = -2; 90 | 91 | }; 92 | 93 | static public interface fp_print_data_type { 94 | int PRINT_DATA_RAW = 0, 95 | PRINT_DATA_NBIS_MINUTIAE = 1; 96 | }; 97 | 98 | /** 99 | * The data-structure of the fingerprint-data. It can be created 100 | * only using the methods of the JlibFPrint. 101 | */ 102 | static public class fp_print_data implements java.io.Serializable { 103 | private fp_print_data() {} 104 | 105 | /** 106 | * Clears the private data encapsulated in this object. 107 | * You always should clear an fp_print_data as soon you can. 108 | */ 109 | public void clear() 110 | { 111 | driver_id = 0; 112 | devtype = 0; 113 | type = 0; 114 | length = 0; 115 | for (int i = 0; i < data.length; i++) data[i] = 0; 116 | } 117 | 118 | private int driver_id; 119 | private int devtype; 120 | private int type; 121 | private int length; 122 | private byte data[]; 123 | }; 124 | 125 | /** 126 | * The id of this Exception follows the conventions of 127 | * the fp_enroll_result interface. 128 | * 129 | */ 130 | static public class EnrollException extends Exception { 131 | public int enroll_exception; 132 | }; 133 | 134 | /** 135 | * Specify which device use for the fingerprint enrollment. 136 | * @param deviceID the id of the device (starting from zero). 137 | */ 138 | public void setDeviceID(int deviceID) { 139 | this.deviceID = deviceID; 140 | } 141 | 142 | /** 143 | * Acquires a fingerprint data. The method is synchronous, 144 | * blocks the caller and is not thread-safe. 145 | * 146 | * @return the data structure with the data associated to the finger enrolled. 147 | * @throws jlibfprint.JlibFprint.EnrollException raised if something is gone wrong. 148 | */ 149 | public native fp_print_data enroll_finger() throws EnrollException; 150 | 151 | /** 152 | * Compares two fingerprint data and returns a matching 153 | * value computed by the Bozorth library used in libfprint. 154 | * 155 | * @param enrolled_print the fingerprint stored for the comparisons. 156 | * @param new_print the fingerprint to compare. 157 | * @return a matching value. 158 | */ 159 | public static native int img_compare_print_data(fp_print_data enrolled_print, fp_print_data new_print); 160 | 161 | /** 162 | * The default BOZORTH_THRESHOLD defined in libfprint for 163 | * the fingerprint comparisons. 164 | */ 165 | static public final int BOZORTH_THRESHOLD=40; 166 | 167 | /** 168 | * The default deviceID to be used by the library. 169 | * Typically only one fingerprint sensor is available on a computer. 170 | */ 171 | private int deviceID = 0; 172 | 173 | public static native DiscoveredDeviceList discoverDevices(); 174 | } 175 | -------------------------------------------------------------------------------- /JlibFprint_jni/src/jlibfprint_JlibFprint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Jlibfprint - A Java Bridge for libfprint 3 | * Copyright (C) 2012 Fabio Scippacercola 4 | * Agostino Savignano 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation; either 9 | * version 2.1 of the License, or (at your option) any later version. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | 22 | #include "jlibfprint_JlibFprint.h" 23 | #include "libfprintWrapper.h" 24 | #include 25 | #include "jlibfprint_DiscoveredDeviceList.h" 26 | #include "jlibfprint_Exceptions.h" 27 | 28 | /** 29 | * Populate a jlibfprint/JlibFprint$fp_print_data object with the data 30 | * stored in a fp_print_data struct. 31 | * 32 | * @param env the Java Environment pointer. 33 | * @param obj the jobject of the type jlibfprint/JlibFprint$fp_print_data to be filled. 34 | * @param fpd a pointer to the fp_print_data to be mapped on obj. 35 | */ 36 | void cfp2jfp(JNIEnv* env, jobject obj, fp_print_data* fpd) 37 | { 38 | /* Determines all the fields of the object */ 39 | jclass fpClass = env->FindClass("jlibfprint/JlibFprint$fp_print_data"); 40 | jfieldID driver_id; 41 | jfieldID devtype; 42 | jfieldID type; 43 | jfieldID length; 44 | jfieldID data; 45 | 46 | jbyteArray dataArray; 47 | driver_id = env->GetFieldID(fpClass, "driver_id", "I"); 48 | devtype = env->GetFieldID(fpClass, "devtype", "I"); 49 | type = env->GetFieldID(fpClass, "type", "I"); 50 | length = env->GetFieldID(fpClass, "length", "I"); 51 | data = env->GetFieldID(fpClass, "data", "[B"); 52 | 53 | /* Starts to fill the obj */ 54 | env->SetIntField(obj, driver_id, fpd->driver_id); 55 | env->SetIntField(obj, devtype, fpd->devtype); 56 | env->SetIntField(obj, type, (int)fpd->type); 57 | env->SetIntField(obj, length, fpd->length); 58 | 59 | dataArray = env->NewByteArray(FP_PRINT_DATA_DATA_SIZE); 60 | env->SetByteArrayRegion(dataArray, 0, FP_PRINT_DATA_DATA_SIZE, (jbyte*)fpd->data); 61 | 62 | env->SetObjectField(obj, data, dataArray); 63 | } 64 | 65 | /** 66 | * Fills a fp_print_data struct with the data obtained by 67 | * a jlibfprint/JlibFprint$fp_print_data object. 68 | * 69 | * @param env the Java Environment pointer. 70 | * @param obj the jobject of the type jlibfprint/JlibFprint$fp_print_data. 71 | * @param fpd a reference to a fp_print_data object to be filled with the data of obj. 72 | */ 73 | void jfp2cfp(JNIEnv* env, jobject obj, fp_print_data& fpd) 74 | { 75 | /* Determines all the fields of the object */ 76 | jclass fpClass = env->FindClass("jlibfprint/JlibFprint$fp_print_data"); 77 | jfieldID driver_id; 78 | jfieldID devtype; 79 | jfieldID type; 80 | jfieldID length; 81 | jfieldID data; 82 | 83 | jbyteArray dataArray; 84 | driver_id = env->GetFieldID(fpClass, "driver_id", "I"); 85 | devtype = env->GetFieldID(fpClass, "devtype", "I"); 86 | type = env->GetFieldID(fpClass, "type", "I"); 87 | length = env->GetFieldID(fpClass, "length", "I"); 88 | data = env->GetFieldID(fpClass, "data", "[B"); 89 | 90 | /* Starts to fill fpd */ 91 | fpd.driver_id = (unsigned short)(env->GetIntField(obj, driver_id)); 92 | fpd.devtype = env->GetIntField(obj, devtype); 93 | 94 | fpd.type = (((int)env->GetIntField(obj, type)) ? PRINT_DATA_NBIS_MINUTIAE : PRINT_DATA_RAW); 95 | fpd.length = env->GetIntField(obj, length); 96 | 97 | dataArray = static_cast(env->GetObjectField(obj, data)); 98 | env->GetByteArrayRegion(dataArray, 0, FP_PRINT_DATA_DATA_SIZE, (jbyte*)fpd.data); 99 | } 100 | 101 | /** 102 | * Check if the device_id setted for obj is available. 103 | * 104 | * @param env the Java Environment pointer. 105 | * @param obj the jobject of the type jlibfprint/JlibFprint. 106 | * @param device output variable, it sets *device to the fp_dev specified in obj if is available. 107 | * @return true if the fp-device specified in obj is available and a pointer to it was setted in *device. 108 | */ 109 | bool get_device_id(JNIEnv* env, jobject obj, fp_dev** device) 110 | { 111 | const jclass jlibClass = env->FindClass("jlibfprint/JlibFprint"); 112 | jfieldID device_id = env->GetFieldID(jlibClass, "deviceID", "I"); 113 | 114 | int devId = env->GetIntField(obj, device_id); 115 | bool found = (devId >= 0); // If devId < 0 => Not found 116 | fp_dscv_dev **fpList = fp_discover_devs(); 117 | 118 | /* devId is a list, we need to scan and check if it terminates before devId */ 119 | for (int i = 0; i <= devId; i++) // All ids < devID must be != NULL 120 | if (fpList[i] == NULL) 121 | { 122 | found = false; 123 | break; 124 | } 125 | 126 | if (found) 127 | { 128 | *device = fp_dev_open(fpList[devId]); 129 | if (*device == NULL) found = false; 130 | } 131 | fp_dscv_devs_free(fpList); 132 | return found; 133 | } 134 | 135 | /** 136 | * Enrolls a finger and returns the associated fp-data. 137 | * 138 | * @param env the Java Environment pointer. 139 | * @param obj the jobject of the type jlibfprint/JlibFprint. 140 | * @return the jlibfprint/JlibFprint$fp_print_data with the data just given by the scanner. 141 | * @throws an enroll_exception is raised is something gone wrong. 142 | */ 143 | JNIEXPORT jobject JNICALL Java_jlibfprint_JlibFprint_enroll_1finger(JNIEnv* env, jobject ref) 144 | { 145 | const jclass fpClass = env->FindClass("jlibfprint/JlibFprint$fp_print_data"); 146 | 147 | /* Starts the library */ 148 | if (fp_init()) // Se differente da 0 => Exception 149 | { 150 | throw_enroll_exception(env, UNABLE_TO_LOAD_LIBFPRINT); 151 | return NULL; 152 | } 153 | fp_dev *device; 154 | fp_print_data* pdp; 155 | 156 | /* Gets the pointer to the device */ 157 | if (!get_device_id(env, ref, &device)) 158 | { 159 | throw_enroll_exception(env, DEVICE_NOT_FOUND); 160 | return NULL; 161 | } 162 | 163 | /* Enrolls the finger */ 164 | int ef = fp_enroll_finger(device, &pdp); 165 | /* Create a new obj to store the data */ 166 | jobject obj = env->AllocObject(fpClass); 167 | 168 | /* Raises an exception if the enrollment was not completed */ 169 | if (ef != FP_ENROLL_COMPLETE) 170 | { 171 | throw_enroll_exception(env, ef); 172 | } 173 | else 174 | { 175 | /* Fills the object with the enrollment data */ 176 | cfp2jfp(env, obj, pdp); 177 | memset(pdp, 0, sizeof(fp_print_data)); 178 | fp_print_data_free(pdp); 179 | } 180 | fp_dev_close(device); 181 | fp_exit(); 182 | 183 | return obj; 184 | } 185 | 186 | 187 | /** 188 | * Compares two fingerprints data and returns a matching value. 189 | * 190 | * @param env the Java Environment pointer. 191 | * @param cls a reference to the caller class. 192 | * @param fp1 the first fingerprint data (an jobject of type jlibfprint/JlibFprint$fp_print_data). 193 | * @param fp2 the second fingerprint data (an jobject of type jlibfprint/JlibFprint$fp_print_data). 194 | * @return a measure of the similarities between fp1 and fp2. 195 | */ 196 | JNIEXPORT jint JNICALL Java_jlibfprint_JlibFprint_img_1compare_1print_1data(JNIEnv *env, jclass cls, jobject fp1, jobject fp2) 197 | { 198 | fp_print_data fpd1, fpd2; 199 | jint retVal; 200 | 201 | jfp2cfp(env, fp1, fpd1); 202 | jfp2cfp(env, fp2, fpd2); 203 | 204 | retVal = static_cast(fpi_img_compare_print_data(&fpd1, &fpd2)); 205 | 206 | memset(&fpd1, 0, sizeof(fp_print_data)); 207 | memset(&fpd2, 0, sizeof(fp_print_data)); 208 | 209 | return retVal; 210 | } 211 | 212 | JNIEXPORT jobject JNICALL Java_jlibfprint_JlibFprint_discoverDevices(JNIEnv *env, jclass cls) { 213 | if (fp_init()) { 214 | throw_core_exception(env, "Could not load libfprint"); 215 | return NULL; 216 | } 217 | fp_dscv_dev **discoveredDevices = fp_discover_devs(); 218 | if (!discoveredDevices) { 219 | throw_core_exception(env, "Could not discover devices"); 220 | return NULL; 221 | } 222 | return createDiscoveredDeviceList(env, discoveredDevices); 223 | } 224 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 2.1, February 1999 3 | 4 | Copyright (C) 1991, 1999 Free Software Foundation, Inc. 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | [This is the first released version of the Lesser GPL. It also counts 10 | as the successor of the GNU Library Public License, version 2, hence 11 | the version number 2.1.] 12 | 13 | Preamble 14 | 15 | The licenses for most software are designed to take away your 16 | freedom to share and change it. By contrast, the GNU General Public 17 | Licenses are intended to guarantee your freedom to share and change 18 | free software--to make sure the software is free for all its users. 19 | 20 | This license, the Lesser General Public License, applies to some 21 | specially designated software packages--typically libraries--of the 22 | Free Software Foundation and other authors who decide to use it. You 23 | can use it too, but we suggest you first think carefully about whether 24 | this license or the ordinary General Public License is the better 25 | strategy to use in any particular case, based on the explanations below. 26 | 27 | When we speak of free software, we are referring to freedom of use, 28 | not price. Our General Public Licenses are designed to make sure that 29 | you have the freedom to distribute copies of free software (and charge 30 | for this service if you wish); that you receive source code or can get 31 | it if you want it; that you can change the software and use pieces of 32 | it in new free programs; and that you are informed that you can do 33 | these things. 34 | 35 | To protect your rights, we need to make restrictions that forbid 36 | distributors to deny you these rights or to ask you to surrender these 37 | rights. These restrictions translate to certain responsibilities for 38 | you if you distribute copies of the library or if you modify it. 39 | 40 | For example, if you distribute copies of the library, whether gratis 41 | or for a fee, you must give the recipients all the rights that we gave 42 | you. You must make sure that they, too, receive or can get the source 43 | code. If you link other code with the library, you must provide 44 | complete object files to the recipients, so that they can relink them 45 | with the library after making changes to the library and recompiling 46 | it. And you must show them these terms so they know their rights. 47 | 48 | We protect your rights with a two-step method: (1) we copyright the 49 | library, and (2) we offer you this license, which gives you legal 50 | permission to copy, distribute and/or modify the library. 51 | 52 | To protect each distributor, we want to make it very clear that 53 | there is no warranty for the free library. Also, if the library is 54 | modified by someone else and passed on, the recipients should know 55 | that what they have is not the original version, so that the original 56 | author's reputation will not be affected by problems that might be 57 | introduced by others. 58 | 59 | Finally, software patents pose a constant threat to the existence of 60 | any free program. We wish to make sure that a company cannot 61 | effectively restrict the users of a free program by obtaining a 62 | restrictive license from a patent holder. Therefore, we insist that 63 | any patent license obtained for a version of the library must be 64 | consistent with the full freedom of use specified in this license. 65 | 66 | Most GNU software, including some libraries, is covered by the 67 | ordinary GNU General Public License. This license, the GNU Lesser 68 | General Public License, applies to certain designated libraries, and 69 | is quite different from the ordinary General Public License. We use 70 | this license for certain libraries in order to permit linking those 71 | libraries into non-free programs. 72 | 73 | When a program is linked with a library, whether statically or using 74 | a shared library, the combination of the two is legally speaking a 75 | combined work, a derivative of the original library. The ordinary 76 | General Public License therefore permits such linking only if the 77 | entire combination fits its criteria of freedom. The Lesser General 78 | Public License permits more lax criteria for linking other code with 79 | the library. 80 | 81 | We call this license the "Lesser" General Public License because it 82 | does Less to protect the user's freedom than the ordinary General 83 | Public License. It also provides other free software developers Less 84 | of an advantage over competing non-free programs. These disadvantages 85 | are the reason we use the ordinary General Public License for many 86 | libraries. However, the Lesser license provides advantages in certain 87 | special circumstances. 88 | 89 | For example, on rare occasions, there may be a special need to 90 | encourage the widest possible use of a certain library, so that it becomes 91 | a de-facto standard. To achieve this, non-free programs must be 92 | allowed to use the library. A more frequent case is that a free 93 | library does the same job as widely used non-free libraries. In this 94 | case, there is little to gain by limiting the free library to free 95 | software only, so we use the Lesser General Public License. 96 | 97 | In other cases, permission to use a particular library in non-free 98 | programs enables a greater number of people to use a large body of 99 | free software. For example, permission to use the GNU C Library in 100 | non-free programs enables many more people to use the whole GNU 101 | operating system, as well as its variant, the GNU/Linux operating 102 | system. 103 | 104 | Although the Lesser General Public License is Less protective of the 105 | users' freedom, it does ensure that the user of a program that is 106 | linked with the Library has the freedom and the wherewithal to run 107 | that program using a modified version of the Library. 108 | 109 | The precise terms and conditions for copying, distribution and 110 | modification follow. Pay close attention to the difference between a 111 | "work based on the library" and a "work that uses the library". The 112 | former contains code derived from the library, whereas the latter must 113 | be combined with the library in order to run. 114 | 115 | GNU LESSER GENERAL PUBLIC LICENSE 116 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 117 | 118 | 0. This License Agreement applies to any software library or other 119 | program which contains a notice placed by the copyright holder or 120 | other authorized party saying it may be distributed under the terms of 121 | this Lesser General Public License (also called "this License"). 122 | Each licensee is addressed as "you". 123 | 124 | A "library" means a collection of software functions and/or data 125 | prepared so as to be conveniently linked with application programs 126 | (which use some of those functions and data) to form executables. 127 | 128 | The "Library", below, refers to any such software library or work 129 | which has been distributed under these terms. A "work based on the 130 | Library" means either the Library or any derivative work under 131 | copyright law: that is to say, a work containing the Library or a 132 | portion of it, either verbatim or with modifications and/or translated 133 | straightforwardly into another language. (Hereinafter, translation is 134 | included without limitation in the term "modification".) 135 | 136 | "Source code" for a work means the preferred form of the work for 137 | making modifications to it. For a library, complete source code means 138 | all the source code for all modules it contains, plus any associated 139 | interface definition files, plus the scripts used to control compilation 140 | and installation of the library. 141 | 142 | Activities other than copying, distribution and modification are not 143 | covered by this License; they are outside its scope. The act of 144 | running a program using the Library is not restricted, and output from 145 | such a program is covered only if its contents constitute a work based 146 | on the Library (independent of the use of the Library in a tool for 147 | writing it). Whether that is true depends on what the Library does 148 | and what the program that uses the Library does. 149 | 150 | 1. You may copy and distribute verbatim copies of the Library's 151 | complete source code as you receive it, in any medium, provided that 152 | you conspicuously and appropriately publish on each copy an 153 | appropriate copyright notice and disclaimer of warranty; keep intact 154 | all the notices that refer to this License and to the absence of any 155 | warranty; and distribute a copy of this License along with the 156 | Library. 157 | 158 | You may charge a fee for the physical act of transferring a copy, 159 | and you may at your option offer warranty protection in exchange for a 160 | fee. 161 | 162 | 2. You may modify your copy or copies of the Library or any portion 163 | of it, thus forming a work based on the Library, and copy and 164 | distribute such modifications or work under the terms of Section 1 165 | above, provided that you also meet all of these conditions: 166 | 167 | a) The modified work must itself be a software library. 168 | 169 | b) You must cause the files modified to carry prominent notices 170 | stating that you changed the files and the date of any change. 171 | 172 | c) You must cause the whole of the work to be licensed at no 173 | charge to all third parties under the terms of this License. 174 | 175 | d) If a facility in the modified Library refers to a function or a 176 | table of data to be supplied by an application program that uses 177 | the facility, other than as an argument passed when the facility 178 | is invoked, then you must make a good faith effort to ensure that, 179 | in the event an application does not supply such function or 180 | table, the facility still operates, and performs whatever part of 181 | its purpose remains meaningful. 182 | 183 | (For example, a function in a library to compute square roots has 184 | a purpose that is entirely well-defined independent of the 185 | application. Therefore, Subsection 2d requires that any 186 | application-supplied function or table used by this function must 187 | be optional: if the application does not supply it, the square 188 | root function must still compute square roots.) 189 | 190 | These requirements apply to the modified work as a whole. If 191 | identifiable sections of that work are not derived from the Library, 192 | and can be reasonably considered independent and separate works in 193 | themselves, then this License, and its terms, do not apply to those 194 | sections when you distribute them as separate works. But when you 195 | distribute the same sections as part of a whole which is a work based 196 | on the Library, the distribution of the whole must be on the terms of 197 | this License, whose permissions for other licensees extend to the 198 | entire whole, and thus to each and every part regardless of who wrote 199 | it. 200 | 201 | Thus, it is not the intent of this section to claim rights or contest 202 | your rights to work written entirely by you; rather, the intent is to 203 | exercise the right to control the distribution of derivative or 204 | collective works based on the Library. 205 | 206 | In addition, mere aggregation of another work not based on the Library 207 | with the Library (or with a work based on the Library) on a volume of 208 | a storage or distribution medium does not bring the other work under 209 | the scope of this License. 210 | 211 | 3. You may opt to apply the terms of the ordinary GNU General Public 212 | License instead of this License to a given copy of the Library. To do 213 | this, you must alter all the notices that refer to this License, so 214 | that they refer to the ordinary GNU General Public License, version 2, 215 | instead of to this License. (If a newer version than version 2 of the 216 | ordinary GNU General Public License has appeared, then you can specify 217 | that version instead if you wish.) Do not make any other change in 218 | these notices. 219 | 220 | Once this change is made in a given copy, it is irreversible for 221 | that copy, so the ordinary GNU General Public License applies to all 222 | subsequent copies and derivative works made from that copy. 223 | 224 | This option is useful when you wish to copy part of the code of 225 | the Library into a program that is not a library. 226 | 227 | 4. You may copy and distribute the Library (or a portion or 228 | derivative of it, under Section 2) in object code or executable form 229 | under the terms of Sections 1 and 2 above provided that you accompany 230 | it with the complete corresponding machine-readable source code, which 231 | must be distributed under the terms of Sections 1 and 2 above on a 232 | medium customarily used for software interchange. 233 | 234 | If distribution of object code is made by offering access to copy 235 | from a designated place, then offering equivalent access to copy the 236 | source code from the same place satisfies the requirement to 237 | distribute the source code, even though third parties are not 238 | compelled to copy the source along with the object code. 239 | 240 | 5. A program that contains no derivative of any portion of the 241 | Library, but is designed to work with the Library by being compiled or 242 | linked with it, is called a "work that uses the Library". Such a 243 | work, in isolation, is not a derivative work of the Library, and 244 | therefore falls outside the scope of this License. 245 | 246 | However, linking a "work that uses the Library" with the Library 247 | creates an executable that is a derivative of the Library (because it 248 | contains portions of the Library), rather than a "work that uses the 249 | library". The executable is therefore covered by this License. 250 | Section 6 states terms for distribution of such executables. 251 | 252 | When a "work that uses the Library" uses material from a header file 253 | that is part of the Library, the object code for the work may be a 254 | derivative work of the Library even though the source code is not. 255 | Whether this is true is especially significant if the work can be 256 | linked without the Library, or if the work is itself a library. The 257 | threshold for this to be true is not precisely defined by law. 258 | 259 | If such an object file uses only numerical parameters, data 260 | structure layouts and accessors, and small macros and small inline 261 | functions (ten lines or less in length), then the use of the object 262 | file is unrestricted, regardless of whether it is legally a derivative 263 | work. (Executables containing this object code plus portions of the 264 | Library will still fall under Section 6.) 265 | 266 | Otherwise, if the work is a derivative of the Library, you may 267 | distribute the object code for the work under the terms of Section 6. 268 | Any executables containing that work also fall under Section 6, 269 | whether or not they are linked directly with the Library itself. 270 | 271 | 6. As an exception to the Sections above, you may also combine or 272 | link a "work that uses the Library" with the Library to produce a 273 | work containing portions of the Library, and distribute that work 274 | under terms of your choice, provided that the terms permit 275 | modification of the work for the customer's own use and reverse 276 | engineering for debugging such modifications. 277 | 278 | You must give prominent notice with each copy of the work that the 279 | Library is used in it and that the Library and its use are covered by 280 | this License. You must supply a copy of this License. If the work 281 | during execution displays copyright notices, you must include the 282 | copyright notice for the Library among them, as well as a reference 283 | directing the user to the copy of this License. Also, you must do one 284 | of these things: 285 | 286 | a) Accompany the work with the complete corresponding 287 | machine-readable source code for the Library including whatever 288 | changes were used in the work (which must be distributed under 289 | Sections 1 and 2 above); and, if the work is an executable linked 290 | with the Library, with the complete machine-readable "work that 291 | uses the Library", as object code and/or source code, so that the 292 | user can modify the Library and then relink to produce a modified 293 | executable containing the modified Library. (It is understood 294 | that the user who changes the contents of definitions files in the 295 | Library will not necessarily be able to recompile the application 296 | to use the modified definitions.) 297 | 298 | b) Use a suitable shared library mechanism for linking with the 299 | Library. A suitable mechanism is one that (1) uses at run time a 300 | copy of the library already present on the user's computer system, 301 | rather than copying library functions into the executable, and (2) 302 | will operate properly with a modified version of the library, if 303 | the user installs one, as long as the modified version is 304 | interface-compatible with the version that the work was made with. 305 | 306 | c) Accompany the work with a written offer, valid for at 307 | least three years, to give the same user the materials 308 | specified in Subsection 6a, above, for a charge no more 309 | than the cost of performing this distribution. 310 | 311 | d) If distribution of the work is made by offering access to copy 312 | from a designated place, offer equivalent access to copy the above 313 | specified materials from the same place. 314 | 315 | e) Verify that the user has already received a copy of these 316 | materials or that you have already sent this user a copy. 317 | 318 | For an executable, the required form of the "work that uses the 319 | Library" must include any data and utility programs needed for 320 | reproducing the executable from it. However, as a special exception, 321 | the materials to be distributed need not include anything that is 322 | normally distributed (in either source or binary form) with the major 323 | components (compiler, kernel, and so on) of the operating system on 324 | which the executable runs, unless that component itself accompanies 325 | the executable. 326 | 327 | It may happen that this requirement contradicts the license 328 | restrictions of other proprietary libraries that do not normally 329 | accompany the operating system. Such a contradiction means you cannot 330 | use both them and the Library together in an executable that you 331 | distribute. 332 | 333 | 7. You may place library facilities that are a work based on the 334 | Library side-by-side in a single library together with other library 335 | facilities not covered by this License, and distribute such a combined 336 | library, provided that the separate distribution of the work based on 337 | the Library and of the other library facilities is otherwise 338 | permitted, and provided that you do these two things: 339 | 340 | a) Accompany the combined library with a copy of the same work 341 | based on the Library, uncombined with any other library 342 | facilities. This must be distributed under the terms of the 343 | Sections above. 344 | 345 | b) Give prominent notice with the combined library of the fact 346 | that part of it is a work based on the Library, and explaining 347 | where to find the accompanying uncombined form of the same work. 348 | 349 | 8. You may not copy, modify, sublicense, link with, or distribute 350 | the Library except as expressly provided under this License. Any 351 | attempt otherwise to copy, modify, sublicense, link with, or 352 | distribute the Library is void, and will automatically terminate your 353 | rights under this License. However, parties who have received copies, 354 | or rights, from you under this License will not have their licenses 355 | terminated so long as such parties remain in full compliance. 356 | 357 | 9. You are not required to accept this License, since you have not 358 | signed it. However, nothing else grants you permission to modify or 359 | distribute the Library or its derivative works. These actions are 360 | prohibited by law if you do not accept this License. Therefore, by 361 | modifying or distributing the Library (or any work based on the 362 | Library), you indicate your acceptance of this License to do so, and 363 | all its terms and conditions for copying, distributing or modifying 364 | the Library or works based on it. 365 | 366 | 10. Each time you redistribute the Library (or any work based on the 367 | Library), the recipient automatically receives a license from the 368 | original licensor to copy, distribute, link with or modify the Library 369 | subject to these terms and conditions. You may not impose any further 370 | restrictions on the recipients' exercise of the rights granted herein. 371 | You are not responsible for enforcing compliance by third parties with 372 | this License. 373 | 374 | 11. If, as a consequence of a court judgment or allegation of patent 375 | infringement or for any other reason (not limited to patent issues), 376 | conditions are imposed on you (whether by court order, agreement or 377 | otherwise) that contradict the conditions of this License, they do not 378 | excuse you from the conditions of this License. If you cannot 379 | distribute so as to satisfy simultaneously your obligations under this 380 | License and any other pertinent obligations, then as a consequence you 381 | may not distribute the Library at all. For example, if a patent 382 | license would not permit royalty-free redistribution of the Library by 383 | all those who receive copies directly or indirectly through you, then 384 | the only way you could satisfy both it and this License would be to 385 | refrain entirely from distribution of the Library. 386 | 387 | If any portion of this section is held invalid or unenforceable under any 388 | particular circumstance, the balance of the section is intended to apply, 389 | and the section as a whole is intended to apply in other circumstances. 390 | 391 | It is not the purpose of this section to induce you to infringe any 392 | patents or other property right claims or to contest validity of any 393 | such claims; this section has the sole purpose of protecting the 394 | integrity of the free software distribution system which is 395 | implemented by public license practices. Many people have made 396 | generous contributions to the wide range of software distributed 397 | through that system in reliance on consistent application of that 398 | system; it is up to the author/donor to decide if he or she is willing 399 | to distribute software through any other system and a licensee cannot 400 | impose that choice. 401 | 402 | This section is intended to make thoroughly clear what is believed to 403 | be a consequence of the rest of this License. 404 | 405 | 12. If the distribution and/or use of the Library is restricted in 406 | certain countries either by patents or by copyrighted interfaces, the 407 | original copyright holder who places the Library under this License may add 408 | an explicit geographical distribution limitation excluding those countries, 409 | so that distribution is permitted only in or among countries not thus 410 | excluded. In such case, this License incorporates the limitation as if 411 | written in the body of this License. 412 | 413 | 13. The Free Software Foundation may publish revised and/or new 414 | versions of the Lesser General Public License from time to time. 415 | Such new versions will be similar in spirit to the present version, 416 | but may differ in detail to address new problems or concerns. 417 | 418 | Each version is given a distinguishing version number. If the Library 419 | specifies a version number of this License which applies to it and 420 | "any later version", you have the option of following the terms and 421 | conditions either of that version or of any later version published by 422 | the Free Software Foundation. If the Library does not specify a 423 | license version number, you may choose any version ever published by 424 | the Free Software Foundation. 425 | 426 | 14. If you wish to incorporate parts of the Library into other free 427 | programs whose distribution conditions are incompatible with these, 428 | write to the author to ask for permission. For software which is 429 | copyrighted by the Free Software Foundation, write to the Free 430 | Software Foundation; we sometimes make exceptions for this. Our 431 | decision will be guided by the two goals of preserving the free status 432 | of all derivatives of our free software and of promoting the sharing 433 | and reuse of software generally. 434 | 435 | NO WARRANTY 436 | 437 | 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 438 | WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 439 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 440 | OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 441 | KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 442 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 443 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 444 | LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 445 | THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 446 | 447 | 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 448 | WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 449 | AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 450 | FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 451 | CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 452 | LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 453 | RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 454 | FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 455 | SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 456 | DAMAGES. 457 | 458 | END OF TERMS AND CONDITIONS 459 | 460 | How to Apply These Terms to Your New Libraries 461 | 462 | If you develop a new library, and you want it to be of the greatest 463 | possible use to the public, we recommend making it free software that 464 | everyone can redistribute and change. You can do so by permitting 465 | redistribution under these terms (or, alternatively, under the terms of the 466 | ordinary General Public License). 467 | 468 | To apply these terms, attach the following notices to the library. It is 469 | safest to attach them to the start of each source file to most effectively 470 | convey the exclusion of warranty; and each file should have at least the 471 | "copyright" line and a pointer to where the full notice is found. 472 | 473 | 474 | Copyright (C) 475 | 476 | This library is free software; you can redistribute it and/or 477 | modify it under the terms of the GNU Lesser General Public 478 | License as published by the Free Software Foundation; either 479 | version 2.1 of the License, or (at your option) any later version. 480 | 481 | This library is distributed in the hope that it will be useful, 482 | but WITHOUT ANY WARRANTY; without even the implied warranty of 483 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 484 | Lesser General Public License for more details. 485 | 486 | You should have received a copy of the GNU Lesser General Public 487 | License along with this library; if not, write to the Free Software 488 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 489 | 490 | Also add information on how to contact you by electronic and paper mail. 491 | 492 | You should also get your employer (if you work as a programmer) or your 493 | school, if any, to sign a "copyright disclaimer" for the library, if 494 | necessary. Here is a sample; alter the names: 495 | 496 | Yoyodyne, Inc., hereby disclaims all copyright interest in the 497 | library `Frob' (a library for tweaking knobs) written by James Random Hacker. 498 | 499 | , 1 April 1990 500 | Ty Coon, President of Vice 501 | 502 | That's all there is to it! 503 | 504 | 505 | --------------------------------------------------------------------------------