cleanup: Use FPI prefix for all the internal enum types

This commit is contained in:
Marco Trevisan (Treviño) 2019-12-16 22:45:00 +01:00
parent 2158c5e2d1
commit c8e1269f61
20 changed files with 264 additions and 266 deletions

View file

@ -129,7 +129,7 @@ fpi_get_driver_types
<FILE>fpi-device</FILE>
FpDeviceClass
FpTimeoutFunc
FpDeviceAction
FpiDeviceAction
FpIdEntry
fpi_device_get_usb_device
fpi_device_get_virtual_env
@ -173,7 +173,7 @@ fpi_image_resize
<SECTION>
<FILE>fpi-image-device</FILE>
<TITLE>FpImageDevice</TITLE>
FpImageDeviceState
FpiImageDeviceState
FpImageDeviceClass
fpi_image_device_session_error
fpi_image_device_open_complete
@ -197,7 +197,7 @@ BUG
<SECTION>
<FILE>fpi-print</FILE>
FpPrintType
FpiPrintType
FpiMatchResult
fpi_print_add_print
fpi_print_set_type

View file

@ -90,7 +90,7 @@ fp_image_get_width
<TITLE>Base class for image devices</TITLE>
FpImageDevice
FpImageDeviceClass
FpImageDeviceState
FpiImageDeviceState
</SECTION>
<SECTION>
@ -114,5 +114,3 @@ FpUsbTransferCallback
FP_USB_ENDPOINT_IN
FP_USB_ENDPOINT_OUT
</SECTION>

View file

@ -74,8 +74,8 @@ struct _FpiDeviceElan
/* state */
gboolean deactivating;
FpImageDeviceState dev_state;
FpImageDeviceState dev_state_next;
FpiImageDeviceState dev_state;
FpiImageDeviceState dev_state_next;
unsigned char *last_read;
unsigned char calib_atts_left;
unsigned char calib_status;
@ -481,7 +481,7 @@ stop_capture_complete (FpiSsm *ssm, FpDevice *_dev, GError *error)
/* The device is inactive at this point. */
self->dev_state = FP_IMAGE_DEVICE_STATE_INACTIVE;
self->dev_state = FPI_IMAGE_DEVICE_STATE_INACTIVE;
if (self->deactivating)
{
@ -538,7 +538,7 @@ capture_run_state (FpiSsm *ssm, FpDevice *dev)
break;
case CAPTURE_READ_DATA:
self->dev_state = FP_IMAGE_DEVICE_STATE_CAPTURE;
self->dev_state = FPI_IMAGE_DEVICE_STATE_CAPTURE;
/* 0x55 - finger present
* 0xff - device not calibrated (probably) */
@ -773,7 +773,7 @@ calibrate_complete (FpiSsm *ssm, FpDevice *dev, GError *error)
if (error)
{
self->dev_state = FP_IMAGE_DEVICE_STATE_INACTIVE;
self->dev_state = FPI_IMAGE_DEVICE_STATE_INACTIVE;
fpi_image_device_session_error (FP_IMAGE_DEVICE (dev), error);
}
else
@ -951,7 +951,7 @@ elan_change_state (FpImageDevice *idev)
{
FpDevice *dev = FP_DEVICE (idev);
FpiDeviceElan *self = FPI_DEVICE_ELAN (dev);
FpImageDeviceState next_state = self->dev_state_next;
FpiImageDeviceState next_state = self->dev_state_next;
if (self->dev_state == next_state)
{
@ -965,18 +965,18 @@ elan_change_state (FpImageDevice *idev)
switch (next_state)
{
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
case FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
/* activation completed or another enroll stage started */
self->dev_state = FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON;
self->dev_state = FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON;
elan_calibrate (dev);
break;
case FP_IMAGE_DEVICE_STATE_CAPTURE:
case FPI_IMAGE_DEVICE_STATE_CAPTURE:
/* not used */
break;
case FP_IMAGE_DEVICE_STATE_INACTIVE:
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF:
case FPI_IMAGE_DEVICE_STATE_INACTIVE:
case FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF:
elan_stop_capture (dev);
break;
}
@ -991,7 +991,7 @@ elan_change_state_async (FpDevice *dev,
}
static void
dev_change_state (FpImageDevice *dev, FpImageDeviceState state)
dev_change_state (FpImageDevice *dev, FpiImageDeviceState state)
{
FpiDeviceElan *self = FPI_DEVICE_ELAN (dev);
GSource *timeout;
@ -999,17 +999,17 @@ dev_change_state (FpImageDevice *dev, FpImageDeviceState state)
G_DEBUG_HERE ();
/* Inactive and await finger off are equivalent for the elan driver. */
if (state == FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF)
state = FP_IMAGE_DEVICE_STATE_INACTIVE;
if (state == FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF)
state = FPI_IMAGE_DEVICE_STATE_INACTIVE;
if (self->dev_state_next == state)
fp_dbg ("change to state %d already queued", state);
switch (state)
{
case FP_IMAGE_DEVICE_STATE_INACTIVE:
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF: {
case FPI_IMAGE_DEVICE_STATE_INACTIVE:
case FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
case FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF: {
char *name;
/* schedule state change instead of calling it directly to allow all actions
@ -1026,7 +1026,7 @@ dev_change_state (FpImageDevice *dev, FpImageDeviceState state)
break;
}
case FP_IMAGE_DEVICE_STATE_CAPTURE:
case FPI_IMAGE_DEVICE_STATE_CAPTURE:
/* TODO MAYBE: split capture ssm into smaller ssms and use this state */
self->dev_state = state;
self->dev_state_next = state;
@ -1044,7 +1044,7 @@ dev_deactivate (FpImageDevice *dev)
G_DEBUG_HERE ();
if (self->dev_state == FP_IMAGE_DEVICE_STATE_INACTIVE)
if (self->dev_state == FPI_IMAGE_DEVICE_STATE_INACTIVE)
{
/* The device is inactive already, complete the operation immediately. */
fpi_image_device_deactivate_complete (dev, NULL);
@ -1055,7 +1055,7 @@ dev_deactivate (FpImageDevice *dev)
* need to signal back deactivation) and then ensure we will change
* to the inactive state eventually. */
self->deactivating = TRUE;
dev_change_state (dev, FP_IMAGE_DEVICE_STATE_INACTIVE);
dev_change_state (dev, FPI_IMAGE_DEVICE_STATE_INACTIVE);
}
}

View file

@ -222,4 +222,4 @@ static void elan_calibrate (FpDevice *dev);
static void elan_capture (FpDevice *dev);
static void dev_change_state (FpImageDevice *dev,
FpImageDeviceState state);
FpiImageDeviceState state);

View file

@ -517,7 +517,7 @@ list_msg_cb (FpiDeviceSynaptics *self,
get_enroll_templates_resp->templates[n].finger_id,
uid);
fpi_print_set_type (print, FP_PRINT_RAW);
fpi_print_set_type (print, FPI_PRINT_RAW);
fpi_print_set_device_stored (print, TRUE);
g_object_set (print, "fp-data", data, NULL);
g_object_set (print, "description", get_enroll_templates_resp->templates[n].user_id, NULL);
@ -856,7 +856,7 @@ enroll (FpDevice *device)
finger,
uid);
fpi_print_set_type (print, FP_PRINT_RAW);
fpi_print_set_type (print, FPI_PRINT_RAW);
fpi_print_set_device_stored (print, TRUE);
g_object_set (print, "fp-data", data, NULL);
g_object_set (print, "description", user_id, NULL);

View file

@ -122,7 +122,7 @@ struct _FpiDeviceUru4000
const struct uru4k_dev_profile *profile;
uint8_t interface;
FpImageDeviceState activate_state;
FpiImageDeviceState activate_state;
unsigned char last_reg_rd[16];
unsigned char last_hwstat;
@ -408,16 +408,16 @@ change_state_write_reg_cb (FpiUsbTransfer *transfer,
}
static void
dev_change_state (FpImageDevice *dev, FpImageDeviceState state)
dev_change_state (FpImageDevice *dev, FpiImageDeviceState state)
{
FpiDeviceUru4000 *self = FPI_DEVICE_URU4000 (dev);
switch (state)
{
case FP_IMAGE_DEVICE_STATE_INACTIVE:
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF:
case FP_IMAGE_DEVICE_STATE_CAPTURE:
case FPI_IMAGE_DEVICE_STATE_INACTIVE:
case FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
case FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF:
case FPI_IMAGE_DEVICE_STATE_CAPTURE:
break;
default:
@ -773,7 +773,7 @@ imaging_run_state (FpiSsm *ssm, FpDevice *_dev)
fpimg->flags |= FPI_IMAGE_V_FLIPPED | FPI_IMAGE_H_FLIPPED;
fpi_image_device_image_captured (dev, fpimg);
if (self->activate_state == FP_IMAGE_DEVICE_STATE_CAPTURE)
if (self->activate_state == FPI_IMAGE_DEVICE_STATE_CAPTURE)
fpi_ssm_jump_to_state (ssm, IMAGING_CAPTURE);
else
fpi_ssm_mark_completed (ssm);
@ -1176,7 +1176,7 @@ deactivate_write_reg_cb (FpiUsbTransfer *transfer, FpDevice *dev,
static void
dev_deactivate (FpImageDevice *dev)
{
dev_change_state (dev, FP_IMAGE_DEVICE_STATE_INACTIVE);
dev_change_state (dev, FPI_IMAGE_DEVICE_STATE_INACTIVE);
}
static void
@ -1187,7 +1187,7 @@ execute_state_change (FpImageDevice *dev)
switch (self->activate_state)
{
case FP_IMAGE_DEVICE_STATE_INACTIVE:
case FPI_IMAGE_DEVICE_STATE_INACTIVE:
fp_dbg ("deactivating");
self->irq_cb = NULL;
self->irq_cb_data = NULL;
@ -1195,7 +1195,7 @@ execute_state_change (FpImageDevice *dev)
deactivate_write_reg_cb, NULL);
break;
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
case FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON:
fp_dbg ("wait finger on");
if (!IRQ_HANDLER_IS_RUNNING (self))
{
@ -1209,7 +1209,7 @@ execute_state_change (FpImageDevice *dev)
change_state_write_reg_cb, NULL);
break;
case FP_IMAGE_DEVICE_STATE_CAPTURE:
case FPI_IMAGE_DEVICE_STATE_CAPTURE:
fp_dbg ("starting capture");
self->irq_cb = NULL;
@ -1229,7 +1229,7 @@ execute_state_change (FpImageDevice *dev)
change_state_write_reg_cb, NULL);
break;
case FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF:
case FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF:
fp_dbg ("await finger off");
if (!IRQ_HANDLER_IS_RUNNING (self))
{

View file

@ -41,7 +41,7 @@ typedef struct
GSList *sources;
/* We always make sure that only one task is run at a time. */
FpDeviceAction current_action;
FpiDeviceAction current_action;
GTask *current_task;
GAsyncReadyCallback current_user_cb;
gulong current_cancellable_id;

View file

@ -81,7 +81,7 @@ fp_device_cancel_in_idle_cb (gpointer user_data)
FpDevicePrivate *priv = fp_device_get_instance_private (self);
g_assert (cls->cancel);
g_assert (priv->current_action != FP_DEVICE_ACTION_NONE);
g_assert (priv->current_action != FPI_DEVICE_ACTION_NONE);
g_debug ("Idle cancelling on ongoing operation!");
@ -148,7 +148,7 @@ fp_device_finalize (GObject *object)
FpDevice *self = (FpDevice *) object;
FpDevicePrivate *priv = fp_device_get_instance_private (self);
g_assert (priv->current_action == FP_DEVICE_ACTION_NONE);
g_assert (priv->current_action == FPI_DEVICE_ACTION_NONE);
g_assert (priv->current_task == NULL);
if (priv->is_open)
g_warning ("User destroyed open device! Not cleaning up properly!");
@ -268,7 +268,7 @@ fp_device_async_initable_init_async (GAsyncInitable *initable,
return;
}
priv->current_action = FP_DEVICE_ACTION_PROBE;
priv->current_action = FPI_DEVICE_ACTION_PROBE;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (self, cancellable);
@ -584,7 +584,7 @@ fp_device_open (FpDevice *device,
return;
}
priv->current_action = FP_DEVICE_ACTION_OPEN;
priv->current_action = FPI_DEVICE_ACTION_OPEN;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (device, cancellable);
@ -648,7 +648,7 @@ fp_device_close (FpDevice *device,
return;
}
priv->current_action = FP_DEVICE_ACTION_CLOSE;
priv->current_action = FPI_DEVICE_ACTION_CLOSE;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (device, cancellable);
@ -709,7 +709,7 @@ fp_device_enroll (FpDevice *device,
g_autoptr(GTask) task = NULL;
FpDevicePrivate *priv = fp_device_get_instance_private (device);
FpEnrollData *data;
FpPrintType print_type;
FpiPrintType print_type;
task = g_task_new (device, cancellable, callback, user_data);
if (g_task_return_error_if_cancelled (task))
@ -738,7 +738,7 @@ fp_device_enroll (FpDevice *device,
}
g_object_get (template_print, "fp-type", &print_type, NULL);
if (print_type != FP_PRINT_UNDEFINED)
if (print_type != FPI_PRINT_UNDEFINED)
{
g_warning ("Passed print template must be newly created and blank!");
g_task_return_error (task,
@ -746,7 +746,7 @@ fp_device_enroll (FpDevice *device,
return;
}
priv->current_action = FP_DEVICE_ACTION_ENROLL;
priv->current_action = FPI_DEVICE_ACTION_ENROLL;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (device, cancellable);
@ -822,7 +822,7 @@ fp_device_verify (FpDevice *device,
return;
}
priv->current_action = FP_DEVICE_ACTION_VERIFY;
priv->current_action = FPI_DEVICE_ACTION_VERIFY;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (device, cancellable);
@ -915,7 +915,7 @@ fp_device_identify (FpDevice *device,
return;
}
priv->current_action = FP_DEVICE_ACTION_IDENTIFY;
priv->current_action = FPI_DEVICE_ACTION_IDENTIFY;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (device, cancellable);
@ -1008,7 +1008,7 @@ fp_device_capture (FpDevice *device,
return;
}
priv->current_action = FP_DEVICE_ACTION_CAPTURE;
priv->current_action = FPI_DEVICE_ACTION_CAPTURE;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (device, cancellable);
@ -1089,7 +1089,7 @@ fp_device_delete_print (FpDevice *device,
return;
}
priv->current_action = FP_DEVICE_ACTION_DELETE;
priv->current_action = FPI_DEVICE_ACTION_DELETE;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (device, cancellable);
@ -1159,7 +1159,7 @@ fp_device_list_prints (FpDevice *device,
return;
}
priv->current_action = FP_DEVICE_ACTION_LIST;
priv->current_action = FPI_DEVICE_ACTION_LIST;
priv->current_task = g_steal_pointer (&task);
maybe_cancel_on_cancelled (device, cancellable);

View file

@ -25,7 +25,7 @@
typedef struct
{
FpImageDeviceState state;
FpiImageDeviceState state;
gboolean active;
gboolean cancelling;

View file

@ -106,7 +106,7 @@ fp_image_device_close (FpDevice *device)
if (!priv->active)
cls->img_close (self);
else if (priv->state != FP_IMAGE_DEVICE_STATE_INACTIVE)
else if (priv->state != FPI_IMAGE_DEVICE_STATE_INACTIVE)
fpi_image_device_deactivate (self);
}
@ -115,16 +115,16 @@ fp_image_device_cancel_action (FpDevice *device)
{
FpImageDevice *self = FP_IMAGE_DEVICE (device);
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
FpDeviceAction action;
FpiDeviceAction action;
action = fpi_device_get_current_action (device);
/* We can only cancel capture operations, in that case, deactivate and return
* an error immediately. */
if (action == FP_DEVICE_ACTION_ENROLL ||
action == FP_DEVICE_ACTION_VERIFY ||
action == FP_DEVICE_ACTION_IDENTIFY ||
action == FP_DEVICE_ACTION_CAPTURE)
if (action == FPI_DEVICE_ACTION_ENROLL ||
action == FPI_DEVICE_ACTION_VERIFY ||
action == FPI_DEVICE_ACTION_IDENTIFY ||
action == FPI_DEVICE_ACTION_CAPTURE)
{
priv->cancelling = TRUE;
fpi_image_device_deactivate (self);
@ -143,14 +143,14 @@ fp_image_device_start_capture_action (FpDevice *device)
{
FpImageDevice *self = FP_IMAGE_DEVICE (device);
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
FpDeviceAction action;
FpiDeviceAction action;
/* There is just one action that we cannot support out
* of the box, which is a capture without first waiting
* for a finger to be on the device.
*/
action = fpi_device_get_current_action (device);
if (action == FP_DEVICE_ACTION_CAPTURE)
if (action == FPI_DEVICE_ACTION_CAPTURE)
{
gboolean wait_for_finger;
@ -162,12 +162,12 @@ fp_image_device_start_capture_action (FpDevice *device)
return;
}
}
else if (action == FP_DEVICE_ACTION_ENROLL)
else if (action == FPI_DEVICE_ACTION_ENROLL)
{
FpPrint *enroll_print = NULL;
fpi_device_get_enroll_data (device, &enroll_print);
fpi_print_set_type (enroll_print, FP_PRINT_NBIS);
fpi_print_set_type (enroll_print, FPI_PRINT_NBIS);
}
priv->enroll_stage = 0;
@ -178,14 +178,14 @@ fp_image_device_start_capture_action (FpDevice *device)
* error (which will usually say that the user should remove the
* finger).
*/
if (priv->state != FP_IMAGE_DEVICE_STATE_INACTIVE || priv->active)
if (priv->state != FPI_IMAGE_DEVICE_STATE_INACTIVE || priv->active)
{
g_debug ("Got a new request while the device was still active");
g_assert (priv->pending_activation_timeout_id == 0);
priv->pending_activation_timeout_id =
g_timeout_add (100, pending_activation_timeout, device);
if (priv->state == FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF)
if (priv->state == FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF)
priv->pending_activation_timeout_waiting_finger_off = TRUE;
else
priv->pending_activation_timeout_waiting_finger_off = FALSE;
@ -271,8 +271,8 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
g_param_spec_enum ("fp-image-device-state",
"Image Device State",
"Private: The state of the image device",
FP_TYPE_IMAGE_DEVICE_STATE,
FP_IMAGE_DEVICE_STATE_INACTIVE,
FPI_TYPE_IMAGE_DEVICE_STATE,
FPI_IMAGE_DEVICE_STATE_INACTIVE,
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE);
signals[FPI_STATE_CHANGED] =
@ -281,7 +281,7 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (FpImageDeviceClass, change_state),
NULL, NULL, NULL,
G_TYPE_NONE, 1, FP_TYPE_IMAGE_DEVICE_STATE);
G_TYPE_NONE, 1, FPI_TYPE_IMAGE_DEVICE_STATE);
g_object_class_install_properties (object_class, N_PROPS, properties);
}

View file

@ -27,7 +27,7 @@ struct _FpPrint
{
GInitiallyUnowned parent_instance;
FpPrintType type;
FpiPrintType type;
gchar *driver;
gchar *device_id;

View file

@ -272,8 +272,8 @@ fp_print_class_init (FpPrintClass *klass)
g_param_spec_enum ("fp-type",
"Type",
"Private: The type of the print data",
FP_TYPE_PRINT_TYPE,
FP_PRINT_RAW,
FPI_TYPE_PRINT_TYPE,
FPI_PRINT_RAW,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_FPI_DATA] =
@ -555,8 +555,8 @@ fp_print_equal (FpPrint *self, FpPrint *other)
{
g_return_val_if_fail (FP_IS_PRINT (self), FALSE);
g_return_val_if_fail (FP_IS_PRINT (other), FALSE);
g_return_val_if_fail (self->type != FP_PRINT_UNDEFINED, FALSE);
g_return_val_if_fail (other->type != FP_PRINT_UNDEFINED, FALSE);
g_return_val_if_fail (self->type != FPI_PRINT_UNDEFINED, FALSE);
g_return_val_if_fail (other->type != FPI_PRINT_UNDEFINED, FALSE);
if (self->type != other->type)
return FALSE;
@ -567,11 +567,11 @@ fp_print_equal (FpPrint *self, FpPrint *other)
if (g_strcmp0 (self->device_id, other->device_id))
return FALSE;
if (self->type == FP_PRINT_RAW)
if (self->type == FPI_PRINT_RAW)
{
return g_variant_equal (self->data, other->data);
}
else if (self->type == FP_PRINT_NBIS)
else if (self->type == FPI_PRINT_NBIS)
{
gint i;
@ -595,7 +595,7 @@ fp_print_equal (FpPrint *self, FpPrint *other)
}
}
#define FP_PRINT_VARIANT_TYPE G_VARIANT_TYPE ("(issbymsmsia{sv}v)")
#define FPI_PRINT_VARIANT_TYPE G_VARIANT_TYPE ("(issbymsmsia{sv}v)")
G_STATIC_ASSERT (sizeof (((struct xyt_struct *) NULL)->xcol[0]) == 4);
@ -618,7 +618,7 @@ fp_print_serialize (FpPrint *print,
GError **error)
{
g_autoptr(GVariant) result = NULL;
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (FP_PRINT_VARIANT_TYPE);
GVariantBuilder builder = G_VARIANT_BUILDER_INIT (FPI_PRINT_VARIANT_TYPE);
gsize len;
g_assert (data);
@ -643,7 +643,7 @@ fp_print_serialize (FpPrint *print,
g_variant_builder_close (&builder);
/* Insert NBIS print data for type NBIS, otherwise the GVariant directly */
if (print->type == FP_PRINT_NBIS)
if (print->type == FPI_PRINT_NBIS)
{
GVariantBuilder nested = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("(a(aiaiai))"));
gint i;
@ -745,7 +745,7 @@ fp_print_deserialize (const guchar *data,
g_autofree gchar *username = NULL;
g_autofree gchar *description = NULL;
gint julian_date;
FpPrintType type;
FpiPrintType type;
const gchar *driver;
const gchar *device_id;
gboolean device_stored;
@ -766,7 +766,7 @@ fp_print_deserialize (const guchar *data,
* longer. */
aligned_data = g_malloc (length - 3);
memcpy (aligned_data, data + 3, length - 3);
raw_value = g_variant_new_from_data (FP_PRINT_VARIANT_TYPE,
raw_value = g_variant_new_from_data (FPI_PRINT_VARIANT_TYPE,
aligned_data, length - 3,
FALSE, g_free, aligned_data);
@ -794,7 +794,7 @@ fp_print_deserialize (const guchar *data,
finger = finger_int8;
/* Assume data is valid at this point if the values are somewhat sane. */
if (type == FP_PRINT_NBIS)
if (type == FPI_PRINT_NBIS)
{
g_autoptr(GVariant) prints = g_variant_get_child_value (print_data, 0);
gint i;
@ -804,7 +804,7 @@ fp_print_deserialize (const guchar *data,
"device-id", device_id,
"device-stored", device_stored,
NULL);
fpi_print_set_type (result, FP_PRINT_NBIS);
fpi_print_set_type (result, FPI_PRINT_NBIS);
for (i = 0; i < g_variant_n_children (prints); i++)
{
g_autofree struct xyt_struct *xyt = g_new0 (struct xyt_struct, 1);
@ -841,7 +841,7 @@ fp_print_deserialize (const guchar *data,
g_ptr_array_add (result->prints, g_steal_pointer (&xyt));
}
}
else if (type == FP_PRINT_RAW)
else if (type == FPI_PRINT_RAW)
{
g_autoptr(GVariant) fp_data = g_variant_get_child_value (print_data, 0);

View file

@ -350,21 +350,21 @@ fpi_device_get_virtual_env (FpDevice *device)
* fpi_device_get_current_action:
* @device: The #FpDevice
*
* Get the currently ongoing action or %FP_DEVICE_ACTION_NONE if there
* Get the currently ongoing action or %FPI_DEVICE_ACTION_NONE if there
* is no operation at this time.
*
* This is useful for drivers that might share code paths between different
* actions (e.g. verify and identify) and want to find out again later which
* action was started in the beginning.
*
* Returns: The ongoing #FpDeviceAction
* Returns: The ongoing #FpiDeviceAction
*/
FpDeviceAction
FpiDeviceAction
fpi_device_get_current_action (FpDevice *device)
{
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_val_if_fail (FP_IS_DEVICE (device), FP_DEVICE_ACTION_NONE);
g_return_val_if_fail (FP_IS_DEVICE (device), FPI_DEVICE_ACTION_NONE);
return priv->current_action;
}
@ -387,7 +387,7 @@ fpi_device_action_is_cancelled (FpDevice *device)
GCancellable *cancellable;
g_return_val_if_fail (FP_IS_DEVICE (device), TRUE);
g_return_val_if_fail (priv->current_action != FP_DEVICE_ACTION_NONE, TRUE);
g_return_val_if_fail (priv->current_action != FPI_DEVICE_ACTION_NONE, TRUE);
cancellable = g_task_get_cancellable (priv->current_task);
@ -435,7 +435,7 @@ fpi_device_get_enroll_data (FpDevice *device,
FpEnrollData *data;
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_ENROLL);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_ENROLL);
data = g_task_get_task_data (priv->current_task);
g_assert (data);
@ -458,7 +458,7 @@ fpi_device_get_capture_data (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_CAPTURE);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_CAPTURE);
if (wait_for_finger)
*wait_for_finger = priv->wait_for_finger;
@ -478,7 +478,7 @@ fpi_device_get_verify_data (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_VERIFY);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_VERIFY);
if (print)
*print = g_task_get_task_data (priv->current_task);
@ -498,7 +498,7 @@ fpi_device_get_identify_data (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_IDENTIFY);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_IDENTIFY);
if (prints)
*prints = g_task_get_task_data (priv->current_task);
@ -518,7 +518,7 @@ fpi_device_get_delete_data (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_DELETE);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_DELETE);
if (print)
*print = g_task_get_task_data (priv->current_task);
@ -542,7 +542,7 @@ fpi_device_get_cancellable (FpDevice *device)
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_val_if_fail (FP_IS_DEVICE (device), NULL);
g_return_val_if_fail (priv->current_action != FP_DEVICE_ACTION_NONE, NULL);
g_return_val_if_fail (priv->current_action != FPI_DEVICE_ACTION_NONE, NULL);
return g_task_get_cancellable (priv->current_task);
}
@ -564,7 +564,7 @@ fpi_device_action_error (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action != FP_DEVICE_ACTION_NONE);
g_return_if_fail (priv->current_action != FPI_DEVICE_ACTION_NONE);
if (error != NULL)
{
@ -579,44 +579,44 @@ fpi_device_action_error (FpDevice *device,
switch (priv->current_action)
{
case FP_DEVICE_ACTION_PROBE:
case FPI_DEVICE_ACTION_PROBE:
fpi_device_probe_complete (device, NULL, NULL, error);
break;
case FP_DEVICE_ACTION_OPEN:
case FPI_DEVICE_ACTION_OPEN:
fpi_device_open_complete (device, error);
break;
case FP_DEVICE_ACTION_CLOSE:
case FPI_DEVICE_ACTION_CLOSE:
fpi_device_close_complete (device, error);
break;
case FP_DEVICE_ACTION_ENROLL:
case FPI_DEVICE_ACTION_ENROLL:
fpi_device_enroll_complete (device, NULL, error);
break;
case FP_DEVICE_ACTION_VERIFY:
case FPI_DEVICE_ACTION_VERIFY:
fpi_device_verify_complete (device, FPI_MATCH_ERROR, NULL, error);
break;
case FP_DEVICE_ACTION_IDENTIFY:
case FPI_DEVICE_ACTION_IDENTIFY:
fpi_device_identify_complete (device, NULL, NULL, error);
break;
case FP_DEVICE_ACTION_CAPTURE:
case FPI_DEVICE_ACTION_CAPTURE:
fpi_device_capture_complete (device, NULL, error);
break;
case FP_DEVICE_ACTION_DELETE:
case FPI_DEVICE_ACTION_DELETE:
fpi_device_delete_complete (device, error);
break;
case FP_DEVICE_ACTION_LIST:
case FPI_DEVICE_ACTION_LIST:
fpi_device_list_complete (device, NULL, error);
break;
default:
case FP_DEVICE_ACTION_NONE:
case FPI_DEVICE_ACTION_NONE:
g_return_if_reached ();
break;
}
@ -663,7 +663,7 @@ fp_device_task_return_in_idle_cb (gpointer user_data)
g_debug ("Completing action %d in idle!", priv->current_action);
task = g_steal_pointer (&priv->current_task);
priv->current_action = FP_DEVICE_ACTION_NONE;
priv->current_action = FPI_DEVICE_ACTION_NONE;
priv->current_task_idle_return_source = NULL;
switch (data->type)
@ -746,7 +746,7 @@ fpi_device_probe_complete (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_PROBE);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_PROBE);
g_debug ("Device reported probe completion");
@ -788,7 +788,7 @@ fpi_device_open_complete (FpDevice *device, GError *error)
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_OPEN);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_OPEN);
g_debug ("Device reported open completion");
@ -821,7 +821,7 @@ fpi_device_close_complete (FpDevice *device, GError *error)
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_CLOSE);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_CLOSE);
g_debug ("Device reported close completion");
@ -873,7 +873,7 @@ fpi_device_enroll_complete (FpDevice *device, FpPrint *print, GError *error)
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_ENROLL);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_ENROLL);
g_debug ("Device reported enroll completion");
@ -923,7 +923,7 @@ fpi_device_verify_complete (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_VERIFY);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_VERIFY);
g_debug ("Device reported verify completion");
@ -980,7 +980,7 @@ fpi_device_identify_complete (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_IDENTIFY);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_IDENTIFY);
g_debug ("Device reported identify completion");
@ -1027,7 +1027,7 @@ fpi_device_capture_complete (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_CAPTURE);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_CAPTURE);
g_debug ("Device reported capture completion");
@ -1072,7 +1072,7 @@ fpi_device_delete_complete (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_DELETE);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_DELETE);
g_debug ("Device reported deletion completion");
@ -1106,7 +1106,7 @@ fpi_device_list_complete (FpDevice *device,
FpDevicePrivate *priv = fp_device_get_instance_private (device);
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_LIST);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_LIST);
g_debug ("Device reported listing completion");
@ -1150,7 +1150,7 @@ fpi_device_enroll_progress (FpDevice *device,
FpEnrollData *data;
g_return_if_fail (FP_IS_DEVICE (device));
g_return_if_fail (priv->current_action == FP_DEVICE_ACTION_ENROLL);
g_return_if_fail (priv->current_action == FPI_DEVICE_ACTION_ENROLL);
g_return_if_fail (error == NULL || error->domain == FP_DEVICE_RETRY);
g_debug ("Device reported enroll progress, reported %i of %i have been completed", completed_stages, priv->nr_enroll_stages);

View file

@ -142,39 +142,39 @@ typedef void (*FpTimeoutFunc) (FpDevice *device,
gpointer user_data);
/**
* FpDeviceAction:
* @FP_DEVICE_ACTION_NONE: No action is active.
* @FP_DEVICE_ACTION_PROBE: Probe device for support and information.
* @FP_DEVICE_ACTION_OPEN: Device is currently being opened.
* @FP_DEVICE_ACTION_CLOSE: Device is currently being closed.
* @FP_DEVICE_ACTION_ENROLL: Device is currently enrolling.
* @FP_DEVICE_ACTION_VERIFY: Device is currently verifying.
* @FP_DEVICE_ACTION_IDENTIFY: Device is currently identifying.
* @FP_DEVICE_ACTION_CAPTURE: Device is currently capturing an image.
* @FP_DEVICE_ACTION_LIST: Device stored prints are being queried.
* @FP_DEVICE_ACTION_DELETE: Device stored print is being deleted.
* FpiDeviceAction:
* @FPI_DEVICE_ACTION_NONE: No action is active.
* @FPI_DEVICE_ACTION_PROBE: Probe device for support and information.
* @FPI_DEVICE_ACTION_OPEN: Device is currently being opened.
* @FPI_DEVICE_ACTION_CLOSE: Device is currently being closed.
* @FPI_DEVICE_ACTION_ENROLL: Device is currently enrolling.
* @FPI_DEVICE_ACTION_VERIFY: Device is currently verifying.
* @FPI_DEVICE_ACTION_IDENTIFY: Device is currently identifying.
* @FPI_DEVICE_ACTION_CAPTURE: Device is currently capturing an image.
* @FPI_DEVICE_ACTION_LIST: Device stored prints are being queried.
* @FPI_DEVICE_ACTION_DELETE: Device stored print is being deleted.
*
* Current active action of the device. A driver can retrieve the action.
*/
typedef enum {
FP_DEVICE_ACTION_NONE = 0,
FP_DEVICE_ACTION_PROBE,
FP_DEVICE_ACTION_OPEN,
FP_DEVICE_ACTION_CLOSE,
FP_DEVICE_ACTION_ENROLL,
FP_DEVICE_ACTION_VERIFY,
FP_DEVICE_ACTION_IDENTIFY,
FP_DEVICE_ACTION_CAPTURE,
FP_DEVICE_ACTION_LIST,
FP_DEVICE_ACTION_DELETE,
} FpDeviceAction;
FPI_DEVICE_ACTION_NONE = 0,
FPI_DEVICE_ACTION_PROBE,
FPI_DEVICE_ACTION_OPEN,
FPI_DEVICE_ACTION_CLOSE,
FPI_DEVICE_ACTION_ENROLL,
FPI_DEVICE_ACTION_VERIFY,
FPI_DEVICE_ACTION_IDENTIFY,
FPI_DEVICE_ACTION_CAPTURE,
FPI_DEVICE_ACTION_LIST,
FPI_DEVICE_ACTION_DELETE,
} FpiDeviceAction;
GUsbDevice *fpi_device_get_usb_device (FpDevice *device);
const gchar *fpi_device_get_virtual_env (FpDevice *device);
//const gchar *fpi_device_get_spi_dev (FpDevice *device);
FpDeviceAction fpi_device_get_current_action (FpDevice *device);
FpiDeviceAction fpi_device_get_current_action (FpDevice *device);
gboolean fpi_device_action_is_cancelled (FpDevice *device);
GError * fpi_device_retry_new (FpDeviceRetry error);

View file

@ -54,7 +54,7 @@ fpi_image_device_activate (FpImageDevice *self)
/* We don't have a neutral ACTIVE state, but we always will
* go into WAIT_FINGER_ON afterwards. */
priv->state = FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON;
priv->state = FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON;
g_object_notify (G_OBJECT (self), "fp-image-device-state");
/* We might have been waiting for deactivation to finish before
@ -79,10 +79,10 @@ fpi_image_device_deactivate (FpImageDevice *self)
fp_dbg ("Already deactivated, ignoring request.");
return;
}
if (!priv->cancelling && priv->state == FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON)
if (!priv->cancelling && priv->state == FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON)
g_warning ("Deactivating image device while waiting for finger, this should not happen.");
priv->state = FP_IMAGE_DEVICE_STATE_INACTIVE;
priv->state = FPI_IMAGE_DEVICE_STATE_INACTIVE;
g_object_notify (G_OBJECT (self), "fp-image-device-state");
fp_dbg ("Deactivating image device\n");
@ -92,12 +92,12 @@ fpi_image_device_deactivate (FpImageDevice *self)
/* Static helper functions */
static void
fp_image_device_change_state (FpImageDevice *self, FpImageDeviceState state)
fp_image_device_change_state (FpImageDevice *self, FpiImageDeviceState state)
{
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
/* Cannot change to inactive using this function. */
g_assert (state != FP_IMAGE_DEVICE_STATE_INACTIVE);
g_assert (state != FPI_IMAGE_DEVICE_STATE_INACTIVE);
/* We might have been waiting for the finger to go OFF to start the
* next operation. */
@ -118,7 +118,7 @@ fp_image_device_enroll_maybe_await_finger_on (FpImageDevice *self)
if (priv->enroll_await_on_pending)
{
priv->enroll_await_on_pending = FALSE;
fp_image_device_change_state (self, FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON);
fp_image_device_change_state (self, FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON);
}
else
{
@ -135,7 +135,7 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
FpImageDevice *self = FP_IMAGE_DEVICE (user_data);
FpDevice *device = FP_DEVICE (self);
FpImageDevicePrivate *priv;
FpDeviceAction action;
FpiDeviceAction action;
/* Note: We rely on the device to not disappear during an operation. */
@ -159,7 +159,7 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
priv = fp_image_device_get_instance_private (FP_IMAGE_DEVICE (device));
action = fpi_device_get_current_action (device);
if (action == FP_DEVICE_ACTION_CAPTURE)
if (action == FPI_DEVICE_ACTION_CAPTURE)
{
fpi_device_capture_complete (device, g_steal_pointer (&image), error);
fpi_image_device_deactivate (self);
@ -169,12 +169,12 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
if (!error)
{
print = fp_print_new (device);
fpi_print_set_type (print, FP_PRINT_NBIS);
fpi_print_set_type (print, FPI_PRINT_NBIS);
if (!fpi_print_add_from_image (print, image, &error))
g_clear_object (&print);
}
if (action == FP_DEVICE_ACTION_ENROLL)
if (action == FPI_DEVICE_ACTION_ENROLL)
{
FpPrint *enroll_print;
fpi_device_get_enroll_data (device, &enroll_print);
@ -199,7 +199,7 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
fp_image_device_enroll_maybe_await_finger_on (FP_IMAGE_DEVICE (device));
}
}
else if (action == FP_DEVICE_ACTION_VERIFY)
else if (action == FPI_DEVICE_ACTION_VERIFY)
{
FpPrint *template;
FpiMatchResult result;
@ -213,7 +213,7 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
fpi_device_verify_complete (device, result, g_steal_pointer (&print), error);
fpi_image_device_deactivate (self);
}
else if (action == FP_DEVICE_ACTION_IDENTIFY)
else if (action == FPI_DEVICE_ACTION_IDENTIFY)
{
gint i;
GPtrArray *templates;
@ -285,9 +285,9 @@ fpi_image_device_report_finger_status (FpImageDevice *self,
{
FpDevice *device = FP_DEVICE (self);
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
FpDeviceAction action;
FpiDeviceAction action;
if (priv->state == FP_IMAGE_DEVICE_STATE_INACTIVE)
if (priv->state == FPI_IMAGE_DEVICE_STATE_INACTIVE)
{
/* Do we really want to always ignore such reports? We could
* also track the state in case the user had the finger on
@ -300,16 +300,16 @@ fpi_image_device_report_finger_status (FpImageDevice *self,
action = fpi_device_get_current_action (device);
g_assert (action != FP_DEVICE_ACTION_OPEN);
g_assert (action != FP_DEVICE_ACTION_CLOSE);
g_assert (action != FPI_DEVICE_ACTION_OPEN);
g_assert (action != FPI_DEVICE_ACTION_CLOSE);
g_debug ("Image device reported finger status: %s", present ? "on" : "off");
if (present && priv->state == FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON)
if (present && priv->state == FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON)
{
fp_image_device_change_state (self, FP_IMAGE_DEVICE_STATE_CAPTURE);
fp_image_device_change_state (self, FPI_IMAGE_DEVICE_STATE_CAPTURE);
}
else if (!present && priv->state == FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF)
else if (!present && priv->state == FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF)
{
/* We need to deactivate or continue to await finger */
@ -324,7 +324,7 @@ fpi_image_device_report_finger_status (FpImageDevice *self,
* minutiae detection to prevent deactivation (without cancellation)
* from the AWAIT_FINGER_ON state.
*/
if (action != FP_DEVICE_ACTION_ENROLL)
if (action != FPI_DEVICE_ACTION_ENROLL)
fpi_image_device_deactivate (self);
else
fp_image_device_enroll_maybe_await_finger_on (self);
@ -349,18 +349,18 @@ void
fpi_image_device_image_captured (FpImageDevice *self, FpImage *image)
{
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
FpDeviceAction action;
FpiDeviceAction action;
action = fpi_device_get_current_action (FP_DEVICE (self));
g_return_if_fail (image != NULL);
g_return_if_fail (priv->state == FP_IMAGE_DEVICE_STATE_CAPTURE);
g_return_if_fail (action == FP_DEVICE_ACTION_ENROLL ||
action == FP_DEVICE_ACTION_VERIFY ||
action == FP_DEVICE_ACTION_IDENTIFY ||
action == FP_DEVICE_ACTION_CAPTURE);
g_return_if_fail (priv->state == FPI_IMAGE_DEVICE_STATE_CAPTURE);
g_return_if_fail (action == FPI_DEVICE_ACTION_ENROLL ||
action == FPI_DEVICE_ACTION_VERIFY ||
action == FPI_DEVICE_ACTION_IDENTIFY ||
action == FPI_DEVICE_ACTION_CAPTURE);
fp_image_device_change_state (self, FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF);
fp_image_device_change_state (self, FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF);
g_debug ("Image device captured an image");
@ -385,22 +385,22 @@ void
fpi_image_device_retry_scan (FpImageDevice *self, FpDeviceRetry retry)
{
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
FpDeviceAction action;
FpiDeviceAction action;
GError *error;
action = fpi_device_get_current_action (FP_DEVICE (self));
/* We might be waiting for a finger at this point, so just accept
* all but INACTIVE */
g_return_if_fail (priv->state != FP_IMAGE_DEVICE_STATE_INACTIVE);
g_return_if_fail (action == FP_DEVICE_ACTION_ENROLL ||
action == FP_DEVICE_ACTION_VERIFY ||
action == FP_DEVICE_ACTION_IDENTIFY ||
action == FP_DEVICE_ACTION_CAPTURE);
g_return_if_fail (priv->state != FPI_IMAGE_DEVICE_STATE_INACTIVE);
g_return_if_fail (action == FPI_DEVICE_ACTION_ENROLL ||
action == FPI_DEVICE_ACTION_VERIFY ||
action == FPI_DEVICE_ACTION_IDENTIFY ||
action == FPI_DEVICE_ACTION_CAPTURE);
error = fpi_device_retry_new (retry);
if (action == FP_DEVICE_ACTION_ENROLL)
if (action == FPI_DEVICE_ACTION_ENROLL)
{
g_debug ("Reporting retry during enroll");
fpi_device_enroll_progress (FP_DEVICE (self), priv->enroll_stage, NULL, error);
@ -438,17 +438,17 @@ fpi_image_device_session_error (FpImageDevice *self, GError *error)
if (!priv->active)
{
FpDeviceAction action = fpi_device_get_current_action (FP_DEVICE (self));
FpiDeviceAction action = fpi_device_get_current_action (FP_DEVICE (self));
g_warning ("Driver reported session error, but device is inactive.");
if (action != FP_DEVICE_ACTION_NONE)
if (action != FPI_DEVICE_ACTION_NONE)
{
g_warning ("Translating to activation failure!");
fpi_image_device_activate_complete (self, error);
return;
}
}
else if (priv->state == FP_IMAGE_DEVICE_STATE_INACTIVE)
else if (priv->state == FPI_IMAGE_DEVICE_STATE_INACTIVE)
{
g_warning ("Driver reported session error; translating to deactivation failure.");
fpi_image_device_deactivate_complete (self, error);
@ -473,15 +473,15 @@ void
fpi_image_device_activate_complete (FpImageDevice *self, GError *error)
{
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
FpDeviceAction action;
FpiDeviceAction action;
action = fpi_device_get_current_action (FP_DEVICE (self));
g_return_if_fail (priv->active == FALSE);
g_return_if_fail (action == FP_DEVICE_ACTION_ENROLL ||
action == FP_DEVICE_ACTION_VERIFY ||
action == FP_DEVICE_ACTION_IDENTIFY ||
action == FP_DEVICE_ACTION_CAPTURE);
g_return_if_fail (action == FPI_DEVICE_ACTION_ENROLL ||
action == FPI_DEVICE_ACTION_VERIFY ||
action == FPI_DEVICE_ACTION_IDENTIFY ||
action == FPI_DEVICE_ACTION_CAPTURE);
if (error)
{
@ -496,7 +496,7 @@ fpi_image_device_activate_complete (FpImageDevice *self, GError *error)
/* We always want to capture at this point, move to AWAIT_FINGER
* state. */
fp_image_device_change_state (self, FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON);
fp_image_device_change_state (self, FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON);
}
/**
@ -511,10 +511,10 @@ fpi_image_device_deactivate_complete (FpImageDevice *self, GError *error)
{
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
FpImageDeviceClass *cls = FP_IMAGE_DEVICE_GET_CLASS (self);
FpDeviceAction action;
FpiDeviceAction action;
g_return_if_fail (priv->active == TRUE);
g_return_if_fail (priv->state == FP_IMAGE_DEVICE_STATE_INACTIVE);
g_return_if_fail (priv->state == FPI_IMAGE_DEVICE_STATE_INACTIVE);
g_debug ("Image device deactivation completed");
@ -527,7 +527,7 @@ fpi_image_device_deactivate_complete (FpImageDevice *self, GError *error)
/* Special case, if we should be closing, but didn't due to a running
* deactivation, then do so now. */
if (action == FP_DEVICE_ACTION_CLOSE)
if (action == FPI_DEVICE_ACTION_CLOSE)
{
cls->img_close (self);
return;
@ -553,16 +553,16 @@ void
fpi_image_device_open_complete (FpImageDevice *self, GError *error)
{
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
FpDeviceAction action;
FpiDeviceAction action;
action = fpi_device_get_current_action (FP_DEVICE (self));
g_return_if_fail (priv->active == FALSE);
g_return_if_fail (action == FP_DEVICE_ACTION_OPEN);
g_return_if_fail (action == FPI_DEVICE_ACTION_OPEN);
g_debug ("Image device open completed");
priv->state = FP_IMAGE_DEVICE_STATE_INACTIVE;
priv->state = FPI_IMAGE_DEVICE_STATE_INACTIVE;
g_object_notify (G_OBJECT (self), "fp-image-device-state");
fpi_device_open_complete (FP_DEVICE (self), error);
@ -579,16 +579,16 @@ void
fpi_image_device_close_complete (FpImageDevice *self, GError *error)
{
FpImageDevicePrivate *priv = fp_image_device_get_instance_private (self);
FpDeviceAction action;
FpiDeviceAction action;
action = fpi_device_get_current_action (FP_DEVICE (self));
g_debug ("Image device close completed");
g_return_if_fail (priv->active == FALSE);
g_return_if_fail (action == FP_DEVICE_ACTION_CLOSE);
g_return_if_fail (action == FPI_DEVICE_ACTION_CLOSE);
priv->state = FP_IMAGE_DEVICE_STATE_INACTIVE;
priv->state = FPI_IMAGE_DEVICE_STATE_INACTIVE;
g_object_notify (G_OBJECT (self), "fp-image-device-state");
fpi_device_close_complete (FP_DEVICE (self), error);

View file

@ -23,11 +23,11 @@
#include "fp-image-device.h"
/**
* FpImageDeviceState:
* @FP_IMAGE_DEVICE_STATE_INACTIVE: inactive
* @FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON: waiting for the finger to be pressed or swiped
* @FP_IMAGE_DEVICE_STATE_CAPTURE: capturing an image
* @FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF: waiting for the finger to be removed
* FpiImageDeviceState:
* @FPI_IMAGE_DEVICE_STATE_INACTIVE: inactive
* @FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON: waiting for the finger to be pressed or swiped
* @FPI_IMAGE_DEVICE_STATE_CAPTURE: capturing an image
* @FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF: waiting for the finger to be removed
*
* The state of an imaging device while doing a capture. The state is
* passed through to the driver using the ::activate() or ::change_state() vfuncs.
@ -37,11 +37,11 @@
* unconditionally if the device supports raw capturing.
*/
typedef enum {
FP_IMAGE_DEVICE_STATE_INACTIVE,
FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON,
FP_IMAGE_DEVICE_STATE_CAPTURE,
FP_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF,
} FpImageDeviceState;
FPI_IMAGE_DEVICE_STATE_INACTIVE,
FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON,
FPI_IMAGE_DEVICE_STATE_CAPTURE,
FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_OFF,
} FpiImageDeviceState;
/**
* FpImageDeviceClass:
@ -91,7 +91,7 @@ struct _FpImageDeviceClass
void (*img_close) (FpImageDevice *dev);
void (*activate) (FpImageDevice *dev);
void (*change_state) (FpImageDevice *dev,
FpImageDeviceState state);
FpiImageDeviceState state);
void (*deactivate) (FpImageDevice *dev);
};

View file

@ -38,15 +38,15 @@
* @print: A #FpPrint
* @add: Print to append to @print
*
* Appends the single #FP_PRINT_NBIS print from @add to the collection of
* prints in @print. Both print objects need to be of type #FP_PRINT_NBIS
* Appends the single #FPI_PRINT_NBIS print from @add to the collection of
* prints in @print. Both print objects need to be of type #FPI_PRINT_NBIS
* for this to work.
*/
void
fpi_print_add_print (FpPrint *print, FpPrint *add)
{
g_return_if_fail (print->type == FP_PRINT_NBIS);
g_return_if_fail (add->type == FP_PRINT_NBIS);
g_return_if_fail (print->type == FPI_PRINT_NBIS);
g_return_if_fail (add->type == FPI_PRINT_NBIS);
g_assert (add->prints->len == 1);
g_ptr_array_add (print->prints, g_memdup (add->prints->pdata[0], sizeof (struct xyt_struct)));
@ -63,14 +63,14 @@ fpi_print_add_print (FpPrint *print, FpPrint *add)
*/
void
fpi_print_set_type (FpPrint *print,
FpPrintType type)
FpiPrintType type)
{
g_return_if_fail (FP_IS_PRINT (print));
/* We only allow setting this once! */
g_return_if_fail (print->type == FP_PRINT_UNDEFINED);
g_return_if_fail (print->type == FPI_PRINT_UNDEFINED);
print->type = type;
if (print->type == FP_PRINT_NBIS)
if (print->type == FPI_PRINT_NBIS)
{
g_assert_null (print->prints);
print->prints = g_ptr_array_new_with_free_func (g_free);
@ -143,7 +143,7 @@ minutiae_to_xyt (struct fp_minutiae *minutiae,
* @error: Return location for error
*
* Extracts the minutiae from the given image and adds it to @print of
* type #FP_PRINT_NBIS.
* type #FPI_PRINT_NBIS.
*
* The @image will be kept so that API users can get retrieve it e.g.
* for debugging purposes.
@ -159,7 +159,7 @@ fpi_print_add_from_image (FpPrint *print,
struct fp_minutiae _minutiae;
struct xyt_struct *xyt;
if (print->type != FP_PRINT_NBIS || !image)
if (print->type != FPI_PRINT_NBIS || !image)
{
g_set_error (error,
G_IO_ERROR,
@ -203,7 +203,7 @@ fpi_print_add_from_image (FpPrint *print,
* Match the newly scanned @print (containing exactly one print) against the
* prints contained in @template which will have been stored during enrollment.
*
* Both @template and @print need to be of type #FP_PRINT_NBIS for this to
* Both @template and @print need to be of type #FPI_PRINT_NBIS for this to
* work.
*
* Returns: Whether the prints match, @error will be set if #FPI_MATCH_ERROR is returned
@ -216,7 +216,7 @@ fpi_print_bz3_match (FpPrint *template, FpPrint *print, gint bz3_threshold, GErr
gint i;
/* XXX: Use a different error type? */
if (template->type != FP_PRINT_NBIS || print->type != FP_PRINT_NBIS)
if (template->type != FPI_PRINT_NBIS || print->type != FPI_PRINT_NBIS)
{
*error = fpi_device_error_new_msg (FP_DEVICE_ERROR_NOT_SUPPORTED,
"It is only possible to match NBIS type print data");

View file

@ -7,16 +7,16 @@
G_BEGIN_DECLS
/**
* FpPrintType:
* @FP_PRINT_UNDEFINED: Undefined type, this happens prior to enrollment
* @FP_PRINT_RAW: A raw print where the data is directly compared
* @FP_PRINT_NBIS: NBIS minutiae comparison
* FpiPrintType:
* @FPI_PRINT_UNDEFINED: Undefined type, this happens prior to enrollment
* @FPI_PRINT_RAW: A raw print where the data is directly compared
* @FPI_PRINT_NBIS: NBIS minutiae comparison
*/
typedef enum {
FP_PRINT_UNDEFINED = 0,
FP_PRINT_RAW,
FP_PRINT_NBIS,
} FpPrintType;
FPI_PRINT_UNDEFINED = 0,
FPI_PRINT_RAW,
FPI_PRINT_NBIS,
} FpiPrintType;
/**
* FpiMatchResult:
@ -34,7 +34,7 @@ void fpi_print_add_print (FpPrint *print,
FpPrint *add);
void fpi_print_set_type (FpPrint *print,
FpPrintType type);
FpiPrintType type);
void fpi_print_set_device_stored (FpPrint *print,
gboolean device_stored);

View file

@ -35,7 +35,7 @@ fpi_device_fake_probe (FpDevice *device)
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_PROBE);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_PROBE);
fake_dev->last_called_function = fpi_device_fake_probe;
fpi_device_probe_complete (device, dev_class->id, dev_class->full_name,
@ -47,7 +47,7 @@ fpi_device_fake_open (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_OPEN);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN);
fake_dev->last_called_function = fpi_device_fake_open;
fpi_device_open_complete (device, fake_dev->ret_error);
@ -58,7 +58,7 @@ fpi_device_fake_close (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_CLOSE);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CLOSE);
fake_dev->last_called_function = fpi_device_fake_close;
fpi_device_close_complete (device, fake_dev->ret_error);
@ -70,7 +70,7 @@ fpi_device_fake_enroll (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *print = fake_dev->ret_print;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_ENROLL);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_ENROLL);
fpi_device_get_enroll_data (device, (FpPrint **) &fake_dev->action_data);
if (!print && !fake_dev->ret_error)
@ -86,7 +86,7 @@ fpi_device_fake_verify (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *print = fake_dev->ret_print;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_VERIFY);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_VERIFY);
fpi_device_get_verify_data (device, (FpPrint **) &fake_dev->action_data);
if (!print && !fake_dev->ret_error)
@ -103,7 +103,7 @@ fpi_device_fake_identify (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *match = fake_dev->ret_match;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_IDENTIFY);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_IDENTIFY);
fpi_device_get_identify_data (device, (GPtrArray **) &fake_dev->action_data);
if (!match && !fake_dev->ret_error)
@ -135,7 +135,7 @@ fpi_device_fake_capture (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_CAPTURE);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CAPTURE);
fpi_device_get_capture_data (device, (gboolean *) &fake_dev->action_data);
fake_dev->last_called_function = fpi_device_fake_capture;
@ -147,7 +147,7 @@ fpi_device_fake_list (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_LIST);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_LIST);
fake_dev->last_called_function = fpi_device_fake_list;
fpi_device_list_complete (device, fake_dev->ret_list, fake_dev->ret_error);
@ -158,7 +158,7 @@ fpi_device_fake_delete (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_DELETE);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_DELETE);
fpi_device_get_delete_data (device, (gpointer) & fake_dev->action_data);
fake_dev->last_called_function = fpi_device_fake_delete;
@ -170,7 +170,7 @@ fpi_device_fake_cancel (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), !=, FP_DEVICE_ACTION_NONE);
g_assert_cmpuint (fpi_device_get_current_action (device), !=, FPI_DEVICE_ACTION_NONE);
fake_dev->last_called_function = fpi_device_fake_cancel;
}

View file

@ -528,7 +528,7 @@ test_driver_enroll_progress (void)
device = auto_close_fake_device_new ();
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*assertion*current_action*FP_DEVICE_ACTION_ENROLL*failed");
"*assertion*current_action*FPI_DEVICE_ACTION_ENROLL*failed");
fpi_device_enroll_progress (device, 0, NULL, NULL);
g_test_assert_expected_messages ();
@ -989,7 +989,7 @@ test_driver_current_action (void)
{
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_assert_cmpint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_NONE);
g_assert_cmpint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_NONE);
}
static void
@ -997,7 +997,7 @@ test_driver_current_action_open_vfunc (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_OPEN);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN);
fake_dev->last_called_function = test_driver_current_action_open_vfunc;
fpi_device_open_complete (device, NULL);
@ -1015,7 +1015,7 @@ test_driver_current_action_open (void)
fake_dev = FPI_DEVICE_FAKE (device);
g_assert (fake_dev->last_called_function == test_driver_current_action_open_vfunc);
g_assert_cmpint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_NONE);
g_assert_cmpint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_NONE);
}
static void
@ -1023,7 +1023,7 @@ test_driver_action_get_cancellable_open_vfunc (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_OPEN);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN);
fake_dev->last_called_function = test_driver_action_get_cancellable_open_vfunc;
g_assert_true (G_IS_CANCELLABLE (fpi_device_get_cancellable (device)));
@ -1054,7 +1054,7 @@ test_driver_action_get_cancellable_open_fail_vfunc (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_OPEN);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN);
fake_dev->last_called_function = test_driver_action_get_cancellable_open_fail_vfunc;
g_assert_false (G_IS_CANCELLABLE (fpi_device_get_cancellable (device)));
@ -1084,7 +1084,7 @@ test_driver_action_get_cancellable_error (void)
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*assertion*current_action*FP_DEVICE_ACTION_NONE*failed");
"*assertion*current_action*FPI_DEVICE_ACTION_NONE*failed");
g_assert_null (fpi_device_get_cancellable (device));
g_test_assert_expected_messages ();
}
@ -1094,7 +1094,7 @@ test_driver_action_is_cancelled_open_vfunc (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FP_DEVICE_ACTION_OPEN);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN);
fake_dev->last_called_function = test_driver_action_is_cancelled_open_vfunc;
g_assert_true (G_IS_CANCELLABLE (fpi_device_get_cancellable (device)));
@ -1132,7 +1132,7 @@ test_driver_action_is_cancelled_error (void)
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*assertion*current_action*FP_DEVICE_ACTION_NONE*failed");
"*assertion*current_action*FPI_DEVICE_ACTION_NONE*failed");
g_assert_true (fpi_device_action_is_cancelled (device));
g_test_assert_expected_messages ();
}
@ -1194,7 +1194,7 @@ test_driver_action_error_error (void)
g_autoptr(FpDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*assertion*current_action*FP_DEVICE_ACTION_NONE*failed");
"*assertion*current_action*FPI_DEVICE_ACTION_NONE*failed");
fpi_device_action_error (device, NULL);
g_test_assert_expected_messages ();
}