mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-04-20 13:36:19 +00:00
nfc_target_init() function returns now 0 on succes and libnfc error code on failure.
This commit is contained in:
@@ -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!";
|
||||
|
||||
Reference in New Issue
Block a user