nfc_target_init() function returns now 0 on succes and libnfc error code on failure.
This commit is contained in:
parent
145cc4b2ad
commit
ba2a7cfe2e
14 changed files with 36 additions and 36 deletions
|
|
@ -84,11 +84,11 @@ target_thread (void *arg)
|
|||
|
||||
uint8_t abtRx[1024];
|
||||
size_t szRx = sizeof (abtRx);
|
||||
bool res = nfc_target_init (device, &nt, abtRx, &szRx);
|
||||
cut_assert_true (res, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
|
||||
if (!res) { thread_res = -1; return (void*) thread_res; }
|
||||
int ires = nfc_target_init (device, &nt, abtRx, &szRx);
|
||||
cut_assert_equal_int (0, ires, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
|
||||
if (ires < 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
res = nfc_target_receive_bytes (device, abtRx, &szRx, 500);
|
||||
bool res = nfc_target_receive_bytes (device, abtRx, &szRx, 500);
|
||||
cut_assert_true (res, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
|
||||
|
||||
const uint8_t abtAttRx[] = "Hello DEP target!";
|
||||
|
|
|
|||
|
|
@ -82,13 +82,12 @@ target_thread (void *arg)
|
|||
|
||||
uint8_t abtRx[1024];
|
||||
size_t szRx = sizeof (abtRx);
|
||||
bool res = nfc_target_init (device, &nt, abtRx, &szRx);
|
||||
cut_assert_true (res, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
|
||||
|
||||
if (!res) { thread_res = -1; return (void*) thread_res; }
|
||||
int ires = nfc_target_init (device, &nt, abtRx, &szRx);
|
||||
cut_assert_equal_int (0, ires, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
|
||||
if (ires < 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
// First pass
|
||||
res = nfc_target_receive_bytes (device, abtRx, &szRx, 500);
|
||||
bool res = nfc_target_receive_bytes (device, abtRx, &szRx, 500);
|
||||
cut_assert_true (res, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
|
||||
|
||||
const uint8_t abtAttRx[] = "Hello DEP target!";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue