Add API for freeing images
[libfprint.git] / libfprint / fprint.h
blob89d05c786f6cb6a4ba99b46ef6fa94b4f8cc64ed
1 /*
2 * Main definitions for libfprint
3 * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef __FPRINT_H__
21 #define __FPRINT_H__
23 /* structs that applications are not allowed to peek into */
24 struct fp_dscv_dev;
25 struct fp_dev;
26 struct fp_driver;
27 struct fp_print_data;
28 struct fp_img;
30 /* misc/general stuff */
31 enum fp_finger {
32 LEFT_THUMB = 1,
33 LEFT_INDEX,
34 LEFT_MIDDLE,
35 LEFT_RING,
36 LEFT_LITTLE,
37 RIGHT_THUMB,
38 RIGHT_INDEX,
39 RIGHT_MIDDLE,
40 RIGHT_RING,
41 RIGHT_LITTLE,
44 /* Device discovery */
45 struct fp_dscv_dev **fp_discover_devs(void);
46 void fp_dscv_devs_free(struct fp_dscv_dev **devs);
47 struct fp_driver *fp_dscv_dev_get_driver(struct fp_dscv_dev *dev);
49 /* Device handling */
50 struct fp_dev *fp_dev_open(struct fp_dscv_dev *ddev);
51 void fp_dev_close(struct fp_dev *dev);
52 struct fp_driver *fp_dev_get_driver(struct fp_dev *dev);
53 int fp_dev_get_nr_enroll_stages(struct fp_dev *dev);
54 struct fp_img_dev *fp_dev_to_img_dev(struct fp_dev *dev);
56 /* Drivers */
57 const char *fp_driver_get_name(struct fp_driver *drv);
58 const char *fp_driver_get_full_name(struct fp_driver *drv);
60 /* Enrollment */
61 enum fp_enroll_result {
62 FP_ENROLL_COMPLETE = 1,
63 FP_ENROLL_FAIL,
64 FP_ENROLL_PASS,
65 FP_ENROLL_RETRY = 100,
66 FP_ENROLL_RETRY_TOO_SHORT,
67 FP_ENROLL_RETRY_CENTER_FINGER,
68 FP_ENROLL_RETRY_REMOVE_FINGER,
71 int fp_enroll_finger(struct fp_dev *dev, struct fp_print_data **print_data);
73 /* Verification */
74 enum fp_verify_result {
75 FP_VERIFY_NO_MATCH = 0,
76 FP_VERIFY_MATCH = 1,
77 FP_VERIFY_RETRY = FP_ENROLL_RETRY,
78 FP_VERIFY_RETRY_TOO_SHORT = FP_ENROLL_RETRY_TOO_SHORT,
79 FP_VERIFY_RETRY_CENTER_FINGER = FP_ENROLL_RETRY_CENTER_FINGER,
80 FP_VERIFY_RETRY_REMOVE_FINGER = FP_ENROLL_RETRY_REMOVE_FINGER,
83 int fp_verify_finger(struct fp_dev *dev, struct fp_print_data *enrolled_print);
85 /* Data handling */
86 int fp_print_data_load(struct fp_dev *dev, enum fp_finger finger,
87 struct fp_print_data **data);
88 int fp_print_data_save(struct fp_print_data *data, enum fp_finger finger);
89 void fp_print_data_free(struct fp_print_data *data);
91 /* Imaging devices */
92 int fp_imgdev_capture(struct fp_img_dev *imgdev, int unconditional,
93 struct fp_img **image);
94 int fp_imgdev_get_img_width(struct fp_img_dev *imgdev);
95 int fp_imgdev_get_img_height(struct fp_img_dev *imgdev);
97 /* Image handling */
98 int fp_img_get_height(struct fp_img *img);
99 int fp_img_get_width(struct fp_img *img);
100 unsigned char *fp_img_get_data(struct fp_img *img);
101 int fp_img_save_to_file(struct fp_img *img, char *path);
102 void fp_img_standardize(struct fp_img *img);
103 void fp_img_free(struct fp_img *img);
105 /* Library */
106 int fp_init(void);
108 #endif