From e797ee2a2e607de1a285b227f8d07548f6ed67d7 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Mon, 27 Jan 2014 16:32:23 +0100 Subject: [PATCH] Add freefare_selected_tag_is_present() --- libfreefare/freefare.c | 8 ++++++++ libfreefare/freefare.h | 1 + 2 files changed, 9 insertions(+) diff --git a/libfreefare/freefare.c b/libfreefare/freefare.c index acccce6..4581a55 100644 --- a/libfreefare/freefare.c +++ b/libfreefare/freefare.c @@ -192,6 +192,14 @@ freefare_get_tag_uid (MifareTag tag) return res; } +/* + * Returns true if last selected tag is still present. + */ +bool freefare_selected_tag_is_present(nfc_device *device) +{ + return (nfc_initiator_target_is_present(device, NULL) == NFC_SUCCESS); +} + /* * Free the provided tag. */ diff --git a/libfreefare/freefare.h b/libfreefare/freefare.h index 2789968..85b79c6 100644 --- a/libfreefare/freefare.h +++ b/libfreefare/freefare.h @@ -59,6 +59,7 @@ const char *freefare_get_tag_friendly_name (MifareTag tag); char *freefare_get_tag_uid (MifareTag tag); void freefare_free_tag (MifareTag tag); void freefare_free_tags (MifareTag *tags); +bool freefare_selected_tag_is_present(nfc_device *device); const char *freefare_strerror (MifareTag tag); int freefare_strerror_r (MifareTag tag, char *buffer, size_t len);