check result of nfc_initiator_init() function in examples/ and utils/

This commit is contained in:
Audrey Diacre 2012-01-05 10:33:50 +00:00
parent 331234713d
commit 5a1f0c2115
11 changed files with 45 additions and 11 deletions

View file

@ -26,7 +26,10 @@ main (int argc, const char *argv[])
return EXIT_FAILURE;
}
// Set connected NFC device to initiator mode
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd));

View file

@ -157,7 +157,10 @@ main (int argc, char *argv[])
}
// Initialise NFC device as "initiator"
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
// Configure the CRC
if (nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false) < 0) {

View file

@ -110,7 +110,10 @@ main (int argc, const char *argv[])
exit (EXIT_FAILURE);
}
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd));
printf ("NFC device will poll during %ld ms (%u pollings of %lu ms for %zd modulations)\n", (unsigned long) uiPollNr * szModulations * uiPeriod * 150, uiPollNr, (unsigned long) uiPeriod * 150, szModulations);

View file

@ -164,7 +164,11 @@ main (int argc, char *argv[])
printf ("Connected to the NFC reader device: %s", nfc_device_get_name (pndReader));
printf ("%s", "Configuring NFC reader settings...");
nfc_initiator_init (pndReader);
if (nfc_initiator_init (pndReader) < 0) {
nfc_perror (pndReader, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
if ((nfc_device_set_property_bool (pndReader, NP_HANDLE_CRC, false) < 0) ||
(nfc_device_set_property_bool (pndReader, NP_HANDLE_PARITY, false) < 0) ||
(nfc_device_set_property_bool (pndReader, NP_ACCEPT_INVALID_FRAMES, true)) < 0) {

View file

@ -128,7 +128,10 @@ main (int argc, const char *argv[])
nfc_target nt;
// Set connected NFC device to initiator mode
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
// Let the reader only try once to find a tag
if (nfc_device_set_property_bool (pnd, NP_INFINITE_SELECT, false) < 0) {

View file

@ -95,7 +95,10 @@ int main(int argc, const char* argv[])
}
printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd));
nfc_initiator_init(pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
char *cmd;
char *prompt = "> ";

View file

@ -130,7 +130,10 @@ main (int argc, const char *argv[])
ERR ("%s", "Unable to connect to NFC device.");
return EXIT_FAILURE;
}
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));

View file

@ -544,7 +544,10 @@ main (int argc, const char *argv[])
exit (EXIT_FAILURE);
}
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
};
// Let the reader only try once to find a tag
if (nfc_device_set_property_bool (pnd, NP_INFINITE_SELECT, false) < 0) {

View file

@ -186,7 +186,10 @@ main (int argc, char *argv[])
}
// Initialise NFC device as "initiator"
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
// Configure the CRC
if (nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false) < 0) {

View file

@ -211,7 +211,10 @@ main (int argc, const char *argv[])
return 1;
}
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
// Let the device only try once to find a tag
if (nfc_device_set_property_bool (pnd, NP_INFINITE_SELECT, false) < 0) {

View file

@ -213,7 +213,10 @@ main(int argc, char *argv[])
nfc_target nt;
nfc_initiator_init(pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
fprintf (message_stream, "Place your NFC Forum Tag Type 3 in the field...\n");
int error = EXIT_SUCCESS;