00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef THINKFINGER_H
00028 #define THINKFINGER_H
00029
00030 #include <stdio.h>
00031 #include <stdbool.h>
00032 #include <string.h>
00033 #include <usb.h>
00034 #include <fcntl.h>
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00044 typedef unsigned int u32;
00045 typedef unsigned short u16;
00046 typedef unsigned char u8;
00047
00048 typedef struct libthinkfinger_s libthinkfinger;
00049
00050 typedef enum {
00051 TF_INIT_SUCCESS = 0x00,
00052 TF_INIT_NO_MEMORY = 0x01,
00053 TF_INIT_USB_INIT_SUCCESS = 0x02,
00054 TF_INIT_USB_DEVICE_NOT_FOUND = 0x03,
00055 TF_INIT_USB_OPEN_FAILED = 0x04,
00056 TF_INIT_USB_CLAIM_FAILED = 0x05,
00057 TF_INIT_USB_HELLO_FAILED = 0x06,
00058 TF_INIT_UNDEFINED = 0xff
00059 } libthinkfinger_init_status;
00060
00061 typedef enum {
00062 TF_TASK_IDLE = 0x00,
00063 TF_TASK_INIT = 0x01,
00064 TF_TASK_ACQUIRE = 0x02,
00065 TF_TASK_VERIFY = 0x03,
00066 TF_TASK_UNDEFINED = 0xff
00067 } libthinkfinger_task;
00068
00069 typedef enum {
00070 TF_STATE_INITIAL = 0x00,
00071 TF_STATE_UNCHANGED = 0x01,
00072 TF_STATE_SWIPE_0 = 0x02,
00073 TF_STATE_SWIPE_1 = 0x03,
00074 TF_STATE_SWIPE_2 = 0x04,
00075 TF_STATE_SWIPE_SUCCESS = 0x05,
00076 TF_STATE_SWIPE_FAILED = 0x06,
00077 TF_STATE_ENROLL_SUCCESS = 0x07,
00078 TF_STATE_ACQUIRE_SUCCESS = 0x08,
00079 TF_STATE_ACQUIRE_FAILED = 0x09,
00080 TF_STATE_VERIFY_SUCCESS = 0x0a,
00081 TF_STATE_VERIFY_FAILED = 0x0b,
00082 TF_STATE_COMM_FAILED = 0xff
00083 } libthinkfinger_state;
00084
00085 typedef enum {
00086 TF_RESULT_ACQUIRE_SUCCESS = TF_STATE_ACQUIRE_SUCCESS,
00087 TF_RESULT_ACQUIRE_FAILED = TF_STATE_ACQUIRE_FAILED,
00088 TF_RESULT_VERIFY_SUCCESS = TF_STATE_VERIFY_SUCCESS,
00089 TF_RESULT_VERIFY_FAILED = TF_STATE_VERIFY_FAILED,
00090 TF_RESULT_COMM_FAILED = TF_STATE_COMM_FAILED
00091 } libthinkfinger_result;
00092
00101 typedef void (*libthinkfinger_state_cb) (libthinkfinger_state state, void *data);
00102
00110 int libthinkfinger_set_file(libthinkfinger *tf, const char *file);
00111
00121 int libthinkfinger_set_callback(libthinkfinger *tf, libthinkfinger_state_cb state, void *data);
00122
00131 int libthinkfinger_acquire(libthinkfinger *tf);
00132
00141 int libthinkfinger_verify(libthinkfinger *tf);
00142
00143
00152 libthinkfinger *libthinkfinger_new(libthinkfinger_init_status* init_status);
00153
00160 void libthinkfinger_free(libthinkfinger *tf);
00161
00162 #ifdef __cplusplus
00163 }
00164 #endif
00165
00166 #endif
00167