Detect errors in examples.

This commit is contained in:
Romain Tartiere 2010-08-18 17:22:13 +00:00
parent 076fa3686c
commit eb90b92c12
9 changed files with 157 additions and 44 deletions

View file

@ -143,14 +143,28 @@ int main(int argc,char* argv[])
nfc_initiator_init(pnd);
// Drop the field for a while
nfc_configure(pnd,NDO_ACTIVATE_FIELD,false);
if (!nfc_configure(pnd,NDO_ACTIVATE_FIELD,false)) {
nfc_perror (pnd, "nfc_configure");
exit (EXIT_FAILURE);
}
// Configure the CRC and Parity settings
nfc_configure(pnd,NDO_HANDLE_CRC,false);
nfc_configure(pnd,NDO_HANDLE_PARITY,true);
// Configure the CRC
if (!nfc_configure(pnd,NDO_HANDLE_CRC,false)) {
nfc_perror (pnd, "nfc_configure");
exit (EXIT_FAILURE);
}
// Configure parity settings
if (!nfc_configure(pnd,NDO_HANDLE_PARITY,true)) {
nfc_perror (pnd, "nfc_configure");
exit (EXIT_FAILURE);
}
// Enable field so more power consuming cards can power themselves up
nfc_configure(pnd,NDO_ACTIVATE_FIELD,true);
if (!nfc_configure(pnd,NDO_ACTIVATE_FIELD,true)) {
nfc_perror (pnd, "nfc_configure");
exit (EXIT_FAILURE);
}
printf("\nConnected to NFC reader: %s\n\n",pnd->acName);