diff --git a/examples/Makefile.am b/examples/Makefile.am index db402e5..c0eda51 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -17,6 +17,9 @@ bin_PROGRAMS += \ pn53x-tamashell endif +check_PROGRAMS = \ + quick_start_example1 + # set the include path found by configure INCLUDES = $(all_includes) $(LIBNFC_CFLAGS) @@ -67,6 +70,11 @@ pn53x_tamashell_LDADD = $(top_builddir)/libnfc/libnfc.la \ $(top_builddir)/utils/libnfcutils.la pn53x_tamashell_LDFLAGS = @READLINE_LIBS@ +quick_start_example1_SOURCES = doc/quick_start_example1.c +quick_start_example1_LDADD = $(top_builddir)/libnfc/libnfc.la \ + $(top_builddir)/utils/libnfcutils.la + + dist_man_MANS = \ nfc-anticol.1 \ nfc-dep-initiator.1 \ diff --git a/examples/doc/quick_start_example1.c b/examples/doc/quick_start_example1.c index d828bd0..073fe02 100644 --- a/examples/doc/quick_start_example1.c +++ b/examples/doc/quick_start_example1.c @@ -5,13 +5,14 @@ #include #include -#include "nfc-utils.h" +#include "utils/nfc-utils.h" +#include "libnfc/chips/pn53x.h" int main (int argc, const char *argv[]) { nfc_device *pnd; - nfc_target_info nti; + nfc_target nt; // Display libnfc version const char *acLibnfcVersion = nfc_version (); @@ -34,17 +35,17 @@ main (int argc, const char *argv[]) .nmt = NMT_ISO14443A, .nbr = NBR_106, }; - if (nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { + if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt)) { printf ("The following (NFC) ISO14443A tag was found:\n"); printf (" ATQA (SENS_RES): "); - print_hex (nti.nai.abtAtqa, 2); - printf (" UID (NFCID%c): ", (nti.nai.abtUid[0] == 0x08 ? '3' : '1')); - print_hex (nti.nai.abtUid, nti.nai.szUidLen); + print_hex (nt.nti.nai.abtAtqa, 2); + printf (" UID (NFCID%c): ", (nt.nti.nai.abtUid[0] == 0x08 ? '3' : '1')); + print_hex (nt.nti.nai.abtUid, nt.nti.nai.szUidLen); printf (" SAK (SEL_RES): "); - print_hex (&nti.nai.btSak, 1); - if (nti.nai.szAtsLen) { + print_hex (&nt.nti.nai.btSak, 1); + if (nt.nti.nai.szAtsLen) { printf (" ATS (ATR): "); - print_hex (nti.nai.abtAts, nti.nai.szAtsLen); + print_hex (nt.nti.nai.abtAts, nt.nti.nai.szAtsLen); } } // Disconnect from NFC device