diff --git a/examples/Makefile.am b/examples/Makefile.am index d912c7b..c5e4108 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -8,8 +8,13 @@ nfcincludedir = $(includedir)/nfc AM_CFLAGS = -I$(top_srcdir)/libnfc +noinst_LIBRARIES = libnfcutils.a + +libnfcutils_a_SOURCES = nfc-utils.c + nfc_poll_SOURCES = nfc-poll.c -nfc_poll_LDADD = $(top_builddir)/libnfc/libnfc.la +nfc_poll_LDADD = $(top_builddir)/libnfc/libnfc.la \ + $(top_builddir)/examples/libnfcutils.a nfc_anticol_SOURCES = nfc-anticol.c nfc_anticol_LDADD = $(top_builddir)/libnfc/libnfc.la diff --git a/examples/nfc-poll.c b/examples/nfc-poll.c index 499a63a..75a270a 100644 --- a/examples/nfc-poll.c +++ b/examples/nfc-poll.c @@ -35,6 +35,7 @@ #include #include #include "bitutils.h" +#include "nfc-utils.h" #define MAX_DEVICE_COUNT 16 diff --git a/examples/nfc-utils.c b/examples/nfc-utils.c new file mode 100644 index 0000000..264e5f3 --- /dev/null +++ b/examples/nfc-utils.c @@ -0,0 +1,15 @@ +#include + +#include "bitutils.h" +#include "nfc-utils.h" + +void print_nfc_iso14443a_info(const nfc_iso14443a_info_t nai) +{ + printf(" ATQA (SENS_RES): "); print_hex(nai.abtAtqa,2); + printf(" UID (NFCID%c): ",(nai.abtUid[0]==0x08?'3':'1')); print_hex(nai.abtUid, nai.szUidLen); + printf(" SAK (SEL_RES): "); print_hex(&nai.btSak,1); + if (nai.szAtsLen) { + printf(" ATS (ATR): "); + print_hex(nai.abtAts, nai.szAtsLen); + } +} diff --git a/examples/nfc-utils.h b/examples/nfc-utils.h new file mode 100644 index 0000000..020b470 --- /dev/null +++ b/examples/nfc-utils.h @@ -0,0 +1,29 @@ +/** + * Public platform independent Near Field Communication (NFC) library + * + * Copyright (C) 2010, Romuald Conty + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see + * + * + * @file nfc-utils.h + * @brief + */ + +#ifndef _EXAMPLES_NFC_UTILS_H_ +#define _EXAMPLES_NFC_UTILS_H_ + +void print_nfc_iso14443a_info(const nfc_iso14443a_info_t nai); + +#endif diff --git a/libnfc/bitutils.c b/libnfc/bitutils.c index 61fe1d6..197a8a2 100644 --- a/libnfc/bitutils.c +++ b/libnfc/bitutils.c @@ -211,14 +211,3 @@ void print_hex_par(const byte_t* pbtData, const size_t szBits, const byte_t* pbt } printf("\n"); } - -void print_nfc_iso14443a_info(const nfc_iso14443a_info_t nai) -{ - printf(" ATQA (SENS_RES): "); print_hex(nai.abtAtqa,2); - printf(" UID (NFCID%c): ",(nai.abtUid[0]==0x08?'3':'1')); print_hex(nai.abtUid, nai.szUidLen); - printf(" SAK (SEL_RES): "); print_hex(&nai.btSak,1); - if (nai.szAtsLen) { - printf(" ATS (ATR): "); - print_hex(nai.abtAts, nai.szAtsLen); - } -} diff --git a/libnfc/bitutils.h b/libnfc/bitutils.h index 37f0341..1a9eea1 100644 --- a/libnfc/bitutils.h +++ b/libnfc/bitutils.h @@ -65,7 +65,5 @@ NFC_EXPORT void print_hex(const byte_t* pbtData, const size_t szLen); NFC_EXPORT void print_hex_bits(const byte_t* pbtData, const size_t szBits); NFC_EXPORT void print_hex_par(const byte_t* pbtData, const size_t szBits, const byte_t* pbtDataPar); -NFC_EXPORT void print_nfc_iso14443a_info(const nfc_iso14443a_info_t nai); - #endif // _LIBNFC_BITUTILS_H_