GCC Code Coverage Report


Directory: ./
File: libfprint/fp-print.h
Date: 2024-09-16 14:36:32
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 1 1 100.0%
Branches: 57 108 52.8%

Line Branch Exec Source
1 /*
2 * FPrint Print handling
3 * Copyright (C) 2007 Daniel Drake <dsd@gentoo.org>
4 * Copyright (C) 2019 Benjamin Berg <bberg@redhat.com>
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 #pragma once
22
23 #include "fp-image.h"
24 #include "fp-enums.h"
25
26 G_BEGIN_DECLS
27
28 #define FP_TYPE_PRINT (fp_print_get_type ())
29
57/108
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 5958 times.
✓ Branch 2 taken 18 times.
✓ Branch 3 taken 5945 times.
✓ Branch 4 taken 753547 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 759457 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 753512 times.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
✗ Branch 19 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 1 times.
✗ Branch 24 not taken.
✓ Branch 27 taken 1 times.
✗ Branch 28 not taken.
✗ Branch 31 not taken.
✓ Branch 32 taken 1 times.
✗ Branch 34 not taken.
✓ Branch 35 taken 1 times.
✓ Branch 37 taken 1 times.
✗ Branch 38 not taken.
✗ Branch 41 not taken.
✓ Branch 42 taken 1 times.
✗ Branch 44 not taken.
✓ Branch 45 taken 1 times.
✗ Branch 48 not taken.
✓ Branch 49 taken 1 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 1 times.
✓ Branch 54 taken 1 times.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✓ Branch 57 taken 1 times.
✗ Branch 59 not taken.
✓ Branch 60 taken 1 times.
✓ Branch 62 taken 1 times.
✗ Branch 63 not taken.
✗ Branch 64 not taken.
✓ Branch 65 taken 1 times.
✓ Branch 67 taken 1 times.
✗ Branch 68 not taken.
✗ Branch 70 not taken.
✓ Branch 71 taken 1 times.
✓ Branch 72 taken 1 times.
✗ Branch 73 not taken.
✓ Branch 75 taken 1 times.
✗ Branch 76 not taken.
✗ Branch 78 not taken.
✓ Branch 79 taken 1 times.
✗ Branch 80 not taken.
✓ Branch 81 taken 1 times.
✓ Branch 83 taken 1 times.
✗ Branch 84 not taken.
✗ Branch 87 not taken.
✓ Branch 88 taken 1 times.
✓ Branch 90 taken 1 times.
✗ Branch 91 not taken.
✓ Branch 94 taken 1 times.
✗ Branch 95 not taken.
✓ Branch 97 taken 1 times.
✗ Branch 98 not taken.
✗ Branch 99 not taken.
✓ Branch 100 taken 1 times.
✓ Branch 102 taken 1 times.
✗ Branch 103 not taken.
✗ Branch 106 not taken.
✓ Branch 107 taken 1 times.
✓ Branch 109 taken 1 times.
✗ Branch 110 not taken.
✓ Branch 113 taken 1 times.
✗ Branch 114 not taken.
✓ Branch 116 taken 1 times.
✗ Branch 117 not taken.
✗ Branch 120 not taken.
✓ Branch 121 taken 1 times.
✓ Branch 123 taken 1 times.
✗ Branch 124 not taken.
✓ Branch 126 taken 1 times.
✗ Branch 127 not taken.
✓ Branch 128 taken 1 times.
✗ Branch 129 not taken.
✓ Branch 131 taken 1 times.
✗ Branch 132 not taken.
✓ Branch 135 taken 1 times.
✗ Branch 136 not taken.
✓ Branch 139 taken 1 times.
✗ Branch 140 not taken.
✓ Branch 147 taken 1 times.
✗ Branch 148 not taken.
✗ Branch 151 not taken.
✓ Branch 152 taken 1 times.
✓ Branch 155 taken 1 times.
✗ Branch 156 not taken.
✓ Branch 160 taken 1 times.
✗ Branch 161 not taken.
✓ Branch 162 taken 1 times.
✗ Branch 163 not taken.
✗ Branch 164 not taken.
✓ Branch 165 taken 1 times.
759566 G_DECLARE_FINAL_TYPE (FpPrint, fp_print, FP, PRINT, GInitiallyUnowned)
30
31 #define FP_FINGER_IS_VALID(finger) \
32 ((finger) >= FP_FINGER_FIRST && (finger) <= FP_FINGER_LAST)
33
34 #include "fp-device.h"
35
36 /**
37 * FpFinger:
38 * @FP_FINGER_UNKNOWN: The finger is unknown
39 * @FP_FINGER_LEFT_THUMB: Left thumb
40 * @FP_FINGER_LEFT_INDEX: Left index finger
41 * @FP_FINGER_LEFT_MIDDLE: Left middle finger
42 * @FP_FINGER_LEFT_RING: Left ring finger
43 * @FP_FINGER_LEFT_LITTLE: Left little finger
44 * @FP_FINGER_RIGHT_THUMB: Right thumb
45 * @FP_FINGER_RIGHT_INDEX: Right index finger
46 * @FP_FINGER_RIGHT_MIDDLE: Right middle finger
47 * @FP_FINGER_RIGHT_RING: Right ring finger
48 * @FP_FINGER_RIGHT_LITTLE: Right little finger
49 * @FP_FINGER_FIRST: The first finger in the fp-print order
50 * @FP_FINGER_LAST: The last finger in the fp-print order
51 */
52 typedef enum {
53 FP_FINGER_UNKNOWN = 0,
54 FP_FINGER_LEFT_THUMB,
55 FP_FINGER_LEFT_INDEX,
56 FP_FINGER_LEFT_MIDDLE,
57 FP_FINGER_LEFT_RING,
58 FP_FINGER_LEFT_LITTLE,
59 FP_FINGER_RIGHT_THUMB,
60 FP_FINGER_RIGHT_INDEX,
61 FP_FINGER_RIGHT_MIDDLE,
62 FP_FINGER_RIGHT_RING,
63 FP_FINGER_RIGHT_LITTLE,
64
65 FP_FINGER_FIRST = FP_FINGER_LEFT_THUMB,
66 FP_FINGER_LAST = FP_FINGER_RIGHT_LITTLE,
67 } FpFinger;
68
69 /**
70 * FpFingerStatusFlags:
71 * @FP_FINGER_STATUS_NONE: Sensor has not the finger on it, nor requires it
72 * @FP_FINGER_STATUS_NEEDED: Sensor waits for the finger
73 * @FP_FINGER_STATUS_PRESENT: Sensor has the finger on it
74 */
75 typedef enum {
76 FP_FINGER_STATUS_NONE = 0,
77 FP_FINGER_STATUS_NEEDED = 1 << 0,
78 FP_FINGER_STATUS_PRESENT = 1 << 1,
79 } FpFingerStatusFlags;
80
81 FpPrint *fp_print_new (FpDevice *device);
82
83 const gchar *fp_print_get_driver (FpPrint *print);
84 const gchar *fp_print_get_device_id (FpPrint *print);
85 FpImage *fp_print_get_image (FpPrint *print);
86
87 FpFinger fp_print_get_finger (FpPrint *print);
88 const gchar *fp_print_get_username (FpPrint *print);
89 const gchar *fp_print_get_description (FpPrint *print);
90 const GDate *fp_print_get_enroll_date (FpPrint *print);
91 gboolean fp_print_get_device_stored (FpPrint *print);
92
93 void fp_print_set_finger (FpPrint *print,
94 FpFinger finger);
95 void fp_print_set_username (FpPrint *print,
96 const gchar *username);
97 void fp_print_set_description (FpPrint *print,
98 const gchar *description);
99 void fp_print_set_enroll_date (FpPrint *print,
100 const GDate *enroll_date);
101
102 gboolean fp_print_compatible (FpPrint *self,
103 FpDevice *device);
104 gboolean fp_print_equal (FpPrint *self,
105 FpPrint *other);
106
107 gboolean fp_print_serialize (FpPrint *print,
108 guchar **data,
109 gsize *length,
110 GError **error);
111
112 FpPrint *fp_print_deserialize (const guchar *data,
113 gsize length,
114 GError **error);
115
116 G_END_DECLS
117