343
fp_verify_identify_cb (FpiDeviceGoodixMoc *self,
344
gxfp_cmd_response_t *resp,
349
fp_verify_cb (FpiDeviceGoodixMoc *self,
350
gxfp_cmd_response_t *resp,
347
353
FpDevice *device = FP_DEVICE (self);
354
FpPrint *print = NULL;
355
GPtrArray *templates = NULL;
357
gboolean find = false;
351
361
fpi_ssm_mark_failed (self->task_ssm, error);
354
if (!resp->verify.match)
356
fpi_device_verify_report (device, FPI_MATCH_FAIL, NULL, error);
358
else if (memcmp (&resp->verify.template.tid, &self->template_id, TEMPLATE_ID_SIZE) != 0)
360
fpi_device_verify_report (device, FPI_MATCH_FAIL, NULL, error);
364
fp_info ("Verify successful! for user: %s finger: %d",
365
resp->verify.template.payload.data, resp->verify.template.finger_index);
366
fpi_device_verify_report (device, FPI_MATCH_SUCCESS, NULL, NULL);
364
if (resp->verify.match)
366
if (fpi_device_get_current_action (device) == FPI_DEVICE_ACTION_VERIFY)
369
templates = g_ptr_array_new_with_free_func (g_object_unref);
370
fpi_device_get_verify_data (device, &print);
371
g_ptr_array_add (templates, g_object_ref_sink (print));
376
fpi_device_get_identify_data (device, &templates);
378
for (cnt = 0; cnt < templates->len; cnt++)
380
g_autoptr(GVariant) data = NULL;
382
const guint8 *user_id;
383
gsize user_id_len = 0;
386
print = g_ptr_array_index (templates, cnt);
387
g_object_get (print, "fpi-data", &data, NULL);
388
if (!parse_print_data (data, &finger, &tid, &tid_len, &user_id, &user_id_len))
390
fpi_ssm_mark_failed (self->task_ssm,
391
fpi_device_error_new_msg (FP_DEVICE_ERROR_DATA_INVALID,
392
"Parse print error"));
395
if (memcmp (&resp->verify.template.tid, tid, TEMPLATE_ID_SIZE) == 0)
404
if (fpi_device_get_current_action (device) == FPI_DEVICE_ACTION_VERIFY)
405
fpi_device_verify_report (device, FPI_MATCH_SUCCESS, NULL, error);
407
fpi_device_identify_report (device, print, print, error);
413
if (fpi_device_get_current_action (device) == FPI_DEVICE_ACTION_VERIFY)
414
fpi_device_verify_report (device, FPI_MATCH_FAIL, NULL, error);
416
fpi_device_identify_report (device, NULL, NULL, error);
369
419
fpi_ssm_mark_completed (self->task_ssm);
409
460
fp_info ("Verify complete!");
411
462
if (error && error->domain == FP_DEVICE_RETRY)
412
fpi_device_verify_report (dev, FPI_MATCH_ERROR, NULL, error);
414
fpi_device_verify_complete (dev, error);
464
if (fpi_device_get_current_action (dev) == FPI_DEVICE_ACTION_VERIFY)
465
fpi_device_verify_report (dev, FPI_MATCH_ERROR, NULL, error);
467
fpi_device_identify_report (dev, NULL, NULL, error);
470
if (fpi_device_get_current_action (dev) == FPI_DEVICE_ACTION_VERIFY)
471
fpi_device_verify_complete (dev, error);
474
fpi_device_identify_complete (dev, error);
416
476
self->task_ssm = NULL;
1255
gx_fp_verify (FpDevice *device)
1315
gx_fp_verify_identify (FpDevice *device)
1258
1317
FpiDeviceGoodixMoc *self = FPI_DEVICE_GOODIXMOC (device);
1259
FpPrint *print = NULL;
1261
g_autoptr(GVariant) data = NULL;
1263
const guint8 *user_id;
1264
gsize user_id_len = 0;
1268
fpi_device_get_verify_data (device, &print);
1270
g_object_get (print, "fpi-data", &data, NULL);
1272
if (!parse_print_data (data, &finger, &tid, &tid_len, &user_id, &user_id_len))
1274
fpi_device_verify_complete (device,
1275
fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID));
1278
memcpy (&self->template_id, tid, tid_len);
1280
1319
self->task_ssm = fpi_ssm_new (device, fp_verify_sm_run_state,
1281
1320
FP_VERIFY_NUM_STATES);
1405
1444
dev_class->open = gx_fp_init;
1406
1445
dev_class->close = gx_fp_exit;
1407
1446
dev_class->probe = gx_fp_probe;
1408
dev_class->verify = gx_fp_verify;
1409
1447
dev_class->enroll = gx_fp_enroll;
1410
1448
dev_class->delete = gx_fp_template_delete;
1411
1449
dev_class->list = gx_fp_template_list;
1412
1450
dev_class->cancel = gx_fp_cancel;
1451
dev_class->verify = gx_fp_verify_identify;
1452
dev_class->identify = gx_fp_verify_identify;