Detect errors in examples.
This commit is contained in:
parent
076fa3686c
commit
eb90b92c12
9 changed files with 157 additions and 44 deletions
|
|
@ -167,18 +167,33 @@ int main(int argc, const 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);
|
||||
}
|
||||
|
||||
// Let the reader only try once to find a tag
|
||||
nfc_configure(pnd,NDO_INFINITE_SELECT,false);
|
||||
if (!nfc_configure(pnd,NDO_INFINITE_SELECT,false)) {
|
||||
nfc_perror(pnd, "nfc_configure");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Configure the CRC and Parity settings
|
||||
nfc_configure(pnd,NDO_HANDLE_CRC,true);
|
||||
nfc_configure(pnd,NDO_HANDLE_PARITY,true);
|
||||
if (!nfc_configure(pnd,NDO_HANDLE_CRC,true)) {
|
||||
nfc_perror(pnd, "nfc_configure");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
// Read the SAM's info
|
||||
if (!nfc_initiator_select_passive_target(pnd,NM_ISO14443A_106,NULL,0,&nti)) {
|
||||
ERR("%s", "Reading of SAM info failed.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue