GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 2 / 0 / 2
Functions: 100.0% 1 / 0 / 1
Branches: 55.6% 55 / 0 / 99

libfprint/fp-print.h
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
55/99
None:
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 1 time.
✗ Branch 9 → 10 not taken.
✓ Branch 9 → 11 taken 1 time.
✗ Branch 11 → 12 not taken.
✗ Branch 11 → 14 not taken.
✓ Branch 21 → 22 taken 1 time.
✗ Branch 21 → 23 not taken.
✗ Branch 67 → 68 not taken.
✓ Branch 67 → 69 taken 8 times.
✓ Branch 69 → 70 taken 33 times.
✗ Branch 69 → 71 not taken.
✗ Branch 73 → 74 not taken.
✗ Branch 73 → 75 not taken.
FP_IS_PRINT:
✓ Branch 3 → 4 taken 759306 times.
✓ Branch 3 → 7 taken 10 times.
✓ Branch 4 → 5 taken 759306 times.
✗ Branch 4 → 6 not taken.
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 759306 times.
✓ Branch 12 → 13 taken 1 time.
✓ Branch 12 → 14 taken 1 time.
✗ Branch 12 → 15 not taken.
✓ Branch 13 → 14 taken 2 times.
✓ Branch 13 → 15 taken 1 time.
✗ Branch 13 → 16 not taken.
✓ Branch 15 → 16 taken 1 time.
✗ Branch 15 → 17 not taken.
✓ Branch 17 → 19 taken 1 time.
✗ Branch 17 → 20 not taken.
✓ Branch 18 → 19 taken 1 time.
✗ Branch 18 → 20 not taken.
✓ Branch 19 → 20 taken 1 time.
✗ Branch 19 → 21 not taken.
✓ Branch 21 → 22 taken 1 time.
✗ Branch 21 → 23 not taken.
✓ Branch 22 → 23 taken 1 time.
✗ Branch 22 → 24 not taken.
✓ Branch 24 → 25 taken 1 time.
✗ Branch 24 → 26 not taken.
✓ Branch 26 → 27 taken 1 time.
✗ Branch 26 → 28 not taken.
✓ Branch 27 → 28 taken 1 time.
✗ Branch 27 → 29 not taken.
✓ Branch 28 → 29 taken 1 time.
✓ Branch 28 → 30 taken 1 time.
✓ Branch 29 → 30 taken 1 time.
✓ Branch 29 → 31 taken 1 time.
✓ Branch 30 → 31 taken 1 time.
✗ Branch 30 → 32 not taken.
✓ Branch 31 → 32 taken 1 time.
✗ Branch 31 → 33 not taken.
✗ Branch 32 → 33 not taken.
✓ Branch 32 → 34 taken 1 time.
✓ Branch 33 → 34 taken 1 time.
✗ Branch 33 → 35 not taken.
✓ Branch 34 → 35 taken 1 time.
✗ Branch 34 → 36 not taken.
✗ Branch 36 → 37 not taken.
✓ Branch 36 → 38 taken 2 times.
✗ Branch 36 → 39 not taken.
✓ Branch 38 → 39 taken 1 time.
✓ Branch 38 → 40 taken 1 time.
✓ Branch 39 → 40 taken 1 time.
✗ Branch 39 → 41 not taken.
✓ Branch 40 → 41 taken 1 time.
✓ Branch 40 → 42 taken 1 time.
✗ Branch 41 → 42 not taken.
✓ Branch 41 → 43 taken 2 times.
✗ Branch 42 → 43 not taken.
✓ Branch 42 → 44 taken 2 times.
✗ Branch 43 → 44 not taken.
✓ Branch 43 → 45 taken 1 time.
✓ Branch 44 → 45 taken 1 time.
✓ Branch 44 → 46 taken 1 time.
✓ Branch 45 → 46 taken 1 time.
✗ Branch 45 → 47 not taken.
✗ Branch 46 → 47 not taken.
✓ Branch 46 → 48 taken 1 time.
✓ Branch 48 → 49 taken 1 time.
✗ Branch 48 → 50 not taken.
✗ Branch 59 → 60 not taken.
✓ Branch 59 → 61 taken 1 time.
✓ Branch 77 → 78 taken 1 time.
✓ Branch 77 → 79 taken 11 times.
✓ Branch 79 → 80 taken 1 time.
✗ Branch 79 → 81 not taken.
✗ Branch 95 → 96 not taken.
✓ Branch 95 → 97 taken 1 time.
✗ Branch 97 → 98 not taken.
✓ Branch 97 → 99 taken 1 time.
✓ Branch 131 → 132 taken 1 time.
✗ Branch 131 → 133 not taken.
✓ Branch 141 → 142 taken 1 time.
✗ Branch 141 → 143 not taken.
✗ Branch 158 → 159 not taken.
✓ Branch 158 → 160 taken 1 time.
✓ Branch 160 → 161 taken 1 time.
✗ Branch 160 → 162 not taken.
759414 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