/dar/build/thinkfinger-0.3/libthinkfinger/libthinkfinger.h

00001 /*
00002  *   ThinkFinger - A driver for the UPEK/SGS Thomson Microelectronics
00003  *   fingerprint reader.
00004  *
00005  *   Copyright (C) 2006 Pavel Machek <pavel@suse.cz>
00006  *                      Timo Hoenig <thoenig@suse.de>
00007  *
00008  *   Copyright (C) 2007 Timo Hoenig <thoenig@suse.de>
00009  *
00010  *   This program is free software; you can redistribute it and/or modify
00011  *   it under the terms of the GNU General Public License as published by
00012  *   the Free Software Foundation; either version 2 of the License, or
00013  *   (at your option) any later version.
00014  *
00015  *   This program is distributed in the hope that it will be useful,
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *   GNU General Public License for more details.
00019  *
00020  *   You should have received a copy of the GNU General Public License
00021  *   along with this program; if not, write to the
00022  *   Free Software Foundation, Inc.,
00023  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00024  *
00025  */
00026 
00027 #ifndef THINKFINGER_H
00028 #define THINKFINGER_H
00029 
00030 #define _GNU_SOURCE
00031 
00032 #include <stdio.h>
00033 #include <stdbool.h>
00034 #include <string.h>
00035 #include <signal.h>
00036 #include <usb.h>
00037 #include <fcntl.h>
00038 #include <errno.h>
00039 #include <pthread.h>
00040 
00041 #include <config.h>
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif /* __cplusplus */
00046 
00051 typedef unsigned int   u32;
00052 typedef unsigned short u16;
00053 typedef unsigned char  u8;
00054 
00055 typedef struct libthinkfinger_s libthinkfinger;
00056 
00057 typedef enum {
00058         TF_INIT_SUCCESS              = 0x00, // initialization succeeded
00059         TF_INIT_NO_MEMORY            = 0x01, // couldn't allocate memory
00060         TF_INIT_USB_INIT_SUCCESS     = 0x02, // USB initialization succeeded
00061         TF_INIT_USB_DEVICE_NOT_FOUND = 0x03, // USB device not found
00062         TF_INIT_USB_OPEN_FAILED      = 0x04, // USB device could not be opened
00063         TF_INIT_USB_CLAIM_FAILED     = 0x05, // USB device could not be claimed
00064         TF_INIT_USB_HELLO_FAILED     = 0x06, // could not send HELLO sequence to USB device
00065         TF_INIT_UNDEFINED            = 0xff  // undefined
00066 } libthinkfinger_init_status;
00067 
00068 typedef enum {
00069         TF_TASK_IDLE                 = 0x00, // idle
00070         TF_TASK_INIT                 = 0x01, // initialization
00071         TF_TASK_ACQUIRE              = 0x02, // acquirement
00072         TF_TASK_VERIFY               = 0x03, // verification
00073         TF_TASK_UNDEFINED            = 0xff  // undefined
00074 } libthinkfinger_task;
00075 
00076 typedef enum {
00077         TF_STATE_INITIAL             = 0x00, // initial state
00078         TF_STATE_UNCHANGED           = 0x01, // no change
00079         TF_STATE_SWIPE_0             = 0x02, // first swipe
00080         TF_STATE_SWIPE_1             = 0x03, // second swipe
00081         TF_STATE_SWIPE_2             = 0x04, // third swipe
00082         TF_STATE_SWIPE_SUCCESS       = 0x05, // successful swipe
00083         TF_STATE_SWIPE_FAILED        = 0x06, // bad swipe
00084         TF_STATE_ENROLL_SUCCESS      = 0x07, // enroll failed
00085         TF_STATE_ACQUIRE_SUCCESS     = 0x08, // acquirement successful
00086         TF_STATE_ACQUIRE_FAILED      = 0x09, // acquirement failed
00087         TF_STATE_VERIFY_SUCCESS      = 0x0a, // verification successful
00088         TF_STATE_VERIFY_FAILED       = 0x0b, // verification failed
00089         TF_STATE_OPEN_FAILED         = 0xfb, // open(2) failed
00090         TF_STATE_SIGINT              = 0xfc, // received sigint
00091         TF_STATE_USB_ERROR           = 0xfd, // USB error
00092         TF_STATE_COMM_FAILED         = 0xfe, // communication error
00093         TF_STATE_UNDEFINED           = 0xff  // undefined
00094 } libthinkfinger_state;
00095 
00096 typedef enum {
00097         TF_RESULT_ACQUIRE_SUCCESS    = TF_STATE_ACQUIRE_SUCCESS, // acquirement successful
00098         TF_RESULT_ACQUIRE_FAILED     = TF_STATE_ACQUIRE_FAILED,  // acquirement failed
00099         TF_RESULT_VERIFY_SUCCESS     = TF_STATE_VERIFY_SUCCESS,  // verification successful
00100         TF_RESULT_VERIFY_FAILED      = TF_STATE_VERIFY_FAILED,   // verification failed
00101         TF_RESULT_OPEN_FAILED        = TF_STATE_OPEN_FAILED,     // open(2) failed
00102         TF_RESULT_SIGINT             = TF_STATE_SIGINT,          // received sigint
00103         TF_RESULT_USB_ERROR          = TF_STATE_USB_ERROR,       // USB error
00104         TF_RESULT_COMM_FAILED        = TF_STATE_COMM_FAILED,     // communication error
00105         TF_RESULT_UNDEFINED          = TF_STATE_UNDEFINED        // undefined
00106 } libthinkfinger_result;
00107 
00116 typedef void (*libthinkfinger_state_cb) (libthinkfinger_state state, void *data);
00117 
00125 int libthinkfinger_set_file(libthinkfinger *tf, const char *file);
00126 
00136 int libthinkfinger_set_callback(libthinkfinger *tf, libthinkfinger_state_cb state, void *data);
00137 
00146 libthinkfinger_result libthinkfinger_acquire(libthinkfinger *tf);
00147 
00156 libthinkfinger_result libthinkfinger_verify(libthinkfinger *tf);
00157 
00166 libthinkfinger *libthinkfinger_new(libthinkfinger_init_status* init_status);
00167 
00176 int libthinkfinger_has_device(libthinkfinger *tf);
00177 
00184 void libthinkfinger_free(libthinkfinger *tf);
00185 
00186 #ifdef __cplusplus
00187 }
00188 #endif /* __cplusplus */
00189 
00190 #endif /* THINKFINGER_H */
00191 // end of libthinkfinger group

Generated on Fri Dec 19 15:10:28 2008 for libthinkfinger by  doxygen 1.4.7