nfc_properties replace now nfc_options and nfc_configure is replaced by nfc_device_set_property_bool which returns error code.

This commit is contained in:
Audrey Diacre 2011-12-14 16:01:00 +00:00
parent c181cb35ec
commit a615d969fd
20 changed files with 292 additions and 298 deletions

View file

@ -95,8 +95,8 @@ nfc_initiator_mifare_cmd (nfc_device *pnd, const mifare_cmd mc, const uint8_t ui
memcpy (abtCmd + 2, (uint8_t *) pmp, szParamLen);
bEasyFraming = pnd->bEasyFraming;
if (!nfc_configure (pnd, NDO_EASY_FRAMING, true)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, true) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
return false;
}
// Fire the mifare command
@ -109,11 +109,11 @@ nfc_initiator_mifare_cmd (nfc_device *pnd, const mifare_cmd mc, const uint8_t ui
} else {
nfc_perror (pnd, "nfc_initiator_transceive_bytes");
}
nfc_configure (pnd, NDO_EASY_FRAMING, bEasyFraming);
nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, bEasyFraming);
return false;
}
if (!nfc_configure (pnd, NDO_EASY_FRAMING, bEasyFraming)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, bEasyFraming) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
return false;
}

View file

@ -219,12 +219,12 @@ unlock_card()
printf ("Unlocking card\n");
// Configure the CRC
if (!nfc_configure (pnd, NDO_HANDLE_CRC, false)) {
if (nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false) < 0) {
nfc_perror (pnd, "nfc_configure");
exit (EXIT_FAILURE);
}
// Use raw send/receive methods
if (!nfc_configure (pnd, NDO_EASY_FRAMING, false)) {
if (nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, false) < 0) {
nfc_perror (pnd, "nfc_configure");
exit (EXIT_FAILURE);
}
@ -243,13 +243,13 @@ unlock_card()
// reset reader
// Configure the CRC
if (!nfc_configure (pnd, NDO_HANDLE_CRC, true)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, true) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
// Switch off raw send/receive methods
if (!nfc_configure (pnd, NDO_EASY_FRAMING, true)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, true) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
return true;
@ -547,12 +547,12 @@ main (int argc, const char *argv[])
nfc_initiator_init (pnd);
// Let the reader only try once to find a tag
if (!nfc_configure (pnd, NDO_INFINITE_SELECT, false)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_INFINITE_SELECT, false) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
// Disable ISO14443-4 switching in order to read devices that emulate Mifare Classic with ISO14443-4 compliance.
nfc_configure (pnd, NDO_AUTO_ISO14443_4, false);
nfc_device_set_property_bool (pnd, NP_AUTO_ISO14443_4, false);
printf ("Connected to NFC reader: %s\n", pnd->acName);

View file

@ -189,18 +189,18 @@ main (int argc, char *argv[])
nfc_initiator_init (pnd);
// Configure the CRC
if (!nfc_configure (pnd, NDO_HANDLE_CRC, false)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
// Use raw send/receive methods
if (!nfc_configure (pnd, NDO_EASY_FRAMING, false)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, false) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}
// Disable 14443-4 autoswitching
if (!nfc_configure (pnd, NDO_AUTO_ISO14443_4, false)) {
nfc_perror (pnd, "nfc_configure");
if (nfc_device_set_property_bool (pnd, NP_AUTO_ISO14443_4, false) < 0) {
nfc_perror (pnd, "nfc_device_set_property_bool");
exit (EXIT_FAILURE);
}

View file

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

View file

@ -245,8 +245,8 @@ main(int argc, char *argv[])
//print_nfc_felica_info(nt.nti.nfi, true);
if (!nfc_configure (pnd, NDO_EASY_FRAMING, false) || !nfc_configure (pnd, NDO_INFINITE_SELECT, false)) {
nfc_perror (pnd, "nfc_configure");
if ((nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, false) < 0) || (nfc_device_set_property_bool (pnd, NP_INFINITE_SELECT, false) < 0)) {
nfc_perror (pnd, "nfc_device_set_property_bool");
error = EXIT_FAILURE;
goto error;
}