Revision: 65d9d6290c3a
Author: Philippe Teuwen <
yob...@gmail.com>
Date: Fri Jan 17 10:46:05 2014 UTC
Log: Add freefare_tag_is_present() and nfc_target into MifareTag struct
nfc_initiator_target_is_present() is available in libnfc but it was
not possible to use it on top of libfreefare because nfc_target structure
was not available anymore.
http://code.google.com/p/libfreefare/source/detail?r=65d9d6290c3a
Modified:
/libfreefare/freefare.c
/libfreefare/freefare.h
/libfreefare/freefare_internal.h
/libfreefare/mifare_classic.c
/libfreefare/mifare_desfire.c
/libfreefare/mifare_ultralight.c
=======================================
--- /libfreefare/freefare.c Wed Dec 18 15:14:50 2013 UTC
+++ /libfreefare/freefare.c Fri Jan 17 10:46:05 2014 UTC
@@ -192,6 +192,11 @@
snprintf (res + 2*i, 3, "%02x", tag->info.abtUid[i]);
return res;
}
+
+bool freefare_tag_is_present(nfc_device *device, MifareTag tag)
+{
+ return (nfc_initiator_target_is_present(device, &(tag->target)) ==
NFC_SUCCESS);
+}
/*
* Free the provided tag.
=======================================
--- /libfreefare/freefare.h Sun Jul 14 19:18:22 2013 UTC
+++ /libfreefare/freefare.h Fri Jan 17 10:46:05 2014 UTC
@@ -59,6 +59,7 @@
char *freefare_get_tag_uid (MifareTag tag);
void freefare_free_tag (MifareTag tag);
void freefare_free_tags (MifareTag *tags);
+bool freefare_tag_is_present(nfc_device *device, MifareTag tag);
const char *freefare_strerror (MifareTag tag);
int freefare_strerror_r (MifareTag tag, char *buffer, size_t len);
=======================================
--- /libfreefare/freefare_internal.h Wed Jun 19 22:00:55 2013 UTC
+++ /libfreefare/freefare_internal.h Fri Jan 17 10:46:05 2014 UTC
@@ -188,6 +188,7 @@
nfc_iso14443a_info info;
const struct supported_tag *tag_info;
int active;
+ nfc_target target;
};
struct mifare_classic_tag {
=======================================
--- /libfreefare/mifare_classic.c Wed Jun 5 16:30:39 2013 UTC
+++ /libfreefare/mifare_classic.c Fri Jan 17 10:46:05 2014 UTC
@@ -240,6 +240,7 @@
};
if (nfc_initiator_select_passive_target (tag->device, modulation,
tag->info.abtUid, tag->info.szUidLen, &pnti) >= 0) {
tag->active = 1;
+ tag->target = pnti;
} else {
errno = EIO;
return -1;
=======================================
--- /libfreefare/mifare_desfire.c Tue Jan 29 10:45:40 2013 UTC
+++ /libfreefare/mifare_desfire.c Fri Jan 17 10:46:05 2014 UTC
@@ -300,6 +300,7 @@
};
if (nfc_initiator_select_passive_target (tag->device, modulation,
tag->info.abtUid, tag->info.szUidLen, &pnti) >= 0) {
tag->active = 1;
+ tag->target = pnti;
free (MIFARE_DESFIRE (tag)->session_key);
MIFARE_DESFIRE (tag)->session_key = NULL;
MIFARE_DESFIRE (tag)->last_picc_error = OPERATION_OK;
=======================================
--- /libfreefare/mifare_ultralight.c Tue Nov 13 23:36:01 2012 UTC
+++ /libfreefare/mifare_ultralight.c Fri Jan 17 10:46:05 2014 UTC
@@ -142,6 +142,7 @@
};
if (nfc_initiator_select_passive_target (tag->device, modulation,
tag->info.abtUid, tag->info.szUidLen, &pnti) >= 0) {
tag->active = 1;
+ tag->target = pnti;
for (int i = 0; i < MIFARE_ULTRALIGHT_MAX_PAGE_COUNT; i++)
MIFARE_ULTRALIGHT(tag)->cached_pages[i] = 0;
} else {