nfc_initiator_init returns now error code and nfc_initiator_list_passive_targets returns now the number of targets found or error code.
This commit is contained in:
parent
a615d969fd
commit
98355d36a7
11 changed files with 91 additions and 94 deletions
|
|
@ -15,8 +15,8 @@ test_access_storm (void)
|
|||
{
|
||||
int n = NTESTS;
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
size_t device_count, ref_device_count, target_count;
|
||||
bool res;
|
||||
size_t device_count, ref_device_count;
|
||||
int res = 0;
|
||||
|
||||
nfc_list_devices (connstrings, MAX_DEVICE_COUNT, &ref_device_count);
|
||||
if (!ref_device_count)
|
||||
|
|
@ -36,14 +36,14 @@ test_access_storm (void)
|
|||
cut_assert_not_null (device, cut_message ("nfc_connect"));
|
||||
|
||||
res = nfc_initiator_init(device);
|
||||
cut_assert_true (res, cut_message ("nfc_initiator_init"));
|
||||
cut_assert_equal_int (0, res, cut_message ("nfc_initiator_init"));
|
||||
|
||||
const nfc_modulation nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_106,
|
||||
};
|
||||
res = nfc_initiator_list_passive_targets(device, nm, ant, MAX_TARGET_COUNT, &target_count);
|
||||
cut_assert_true (res, cut_message ("nfc_initiator_list_passive_targets"));
|
||||
res = nfc_initiator_list_passive_targets(device, nm, ant, MAX_TARGET_COUNT);
|
||||
cut_assert_operator_int (res, >=, 0, cut_message ("nfc_initiator_list_passive_targets"));
|
||||
|
||||
nfc_disconnect (device);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ initiator_thread (void *arg)
|
|||
sleep (1);
|
||||
printf ("=========== INITIATOR %s =========\n", nfc_device_name (device));
|
||||
bool res = nfc_initiator_init (device);
|
||||
cut_assert_true (res, cut_message ("Can't initialize NFC device as initiator: %s", nfc_strerror (device)));
|
||||
cut_assert_equal_int (0, res, cut_message ("Can't initialize NFC device as initiator: %s", nfc_strerror (device)));
|
||||
if (!res) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
nfc_target nt;
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ initiator_thread (void *arg)
|
|||
printf ("=========== INITIATOR %s =========\n", nfc_device_name (device));
|
||||
|
||||
bool res = nfc_initiator_init (device);
|
||||
cut_assert_true (res, cut_message ("Can't initialize NFC device as initiator: %s", nfc_strerror (device)));
|
||||
cut_assert_equal_int (0, res, cut_message ("Can't initialize NFC device as initiator: %s", nfc_strerror (device)));
|
||||
if (!res) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
nfc_target nt;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue