add context to nfc_init(), nfc_exit(), nfc_open() and nfc_list_devices() functions.
This commit is contained in:
parent
86c8ce536b
commit
4c011279ff
29 changed files with 142 additions and 138 deletions
|
|
@ -17,23 +17,23 @@ test_access_storm (void)
|
|||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
|
||||
nfc_init ();
|
||||
nfc_init (NULL);
|
||||
|
||||
size_t ref_device_count = nfc_list_devices (connstrings, MAX_DEVICE_COUNT);
|
||||
size_t ref_device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!ref_device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
||||
while (n) {
|
||||
size_t i;
|
||||
|
||||
size_t device_count = nfc_list_devices (connstrings, MAX_DEVICE_COUNT);
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
cut_assert_equal_int (ref_device_count, device_count, cut_message ("device count"));
|
||||
|
||||
for (i = 0; i < device_count; i++) {
|
||||
nfc_device *device;
|
||||
nfc_target ant[MAX_TARGET_COUNT];
|
||||
|
||||
device = nfc_open (connstrings[i]);
|
||||
device = nfc_open (NULL, connstrings[i]);
|
||||
cut_assert_not_null (device, cut_message ("nfc_open"));
|
||||
|
||||
res = nfc_initiator_init(device);
|
||||
|
|
@ -51,5 +51,5 @@ test_access_storm (void)
|
|||
|
||||
n--;
|
||||
}
|
||||
nfc_exit ();
|
||||
nfc_exit (NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,13 +27,13 @@ abort_test_by_keypress (int sig)
|
|||
void
|
||||
cut_setup (void)
|
||||
{
|
||||
size_t n = nfc_list_devices (connstrings, 2);
|
||||
size_t n = nfc_list_devices (NULL, connstrings, 2);
|
||||
if (n < 2) {
|
||||
cut_omit ("At least two NFC devices must be plugged-in to run this test");
|
||||
}
|
||||
nfc_init ();
|
||||
devices[TARGET] = nfc_open (connstrings[TARGET]);
|
||||
devices[INITIATOR] = nfc_open (connstrings[INITIATOR]);
|
||||
nfc_init (NULL);
|
||||
devices[TARGET] = nfc_open (NULL, connstrings[TARGET]);
|
||||
devices[INITIATOR] = nfc_open (NULL, connstrings[INITIATOR]);
|
||||
|
||||
signal (SIGINT, abort_test_by_keypress);
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ cut_teardown (void)
|
|||
{
|
||||
nfc_close (devices[TARGET]);
|
||||
nfc_close (devices[INITIATOR]);
|
||||
nfc_exit ();
|
||||
nfc_exit (NULL);
|
||||
}
|
||||
|
||||
struct thread_data {
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@ abort_test_by_keypress (int sig)
|
|||
void
|
||||
cut_setup (void)
|
||||
{
|
||||
size_t n = nfc_list_devices (connstrings, 2);
|
||||
size_t n = nfc_list_devices (NULL, connstrings, 2);
|
||||
if (n < 2) {
|
||||
cut_omit ("At least two NFC devices must be plugged-in to run this test");
|
||||
}
|
||||
|
||||
nfc_init ();
|
||||
devices[TARGET] = nfc_open (connstrings[TARGET]);
|
||||
devices[INITIATOR] = nfc_open (connstrings[INITIATOR]);
|
||||
nfc_init (NULL);
|
||||
devices[TARGET] = nfc_open (NULL, connstrings[TARGET]);
|
||||
devices[INITIATOR] = nfc_open (NULL, connstrings[INITIATOR]);
|
||||
|
||||
signal (SIGINT, abort_test_by_keypress);
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ cut_teardown (void)
|
|||
{
|
||||
nfc_close (devices[TARGET]);
|
||||
nfc_close (devices[INITIATOR]);
|
||||
nfc_exit ();
|
||||
nfc_exit (NULL);
|
||||
}
|
||||
|
||||
struct thread_data {
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ abort_test_by_keypress (int sig)
|
|||
void
|
||||
cut_setup (void)
|
||||
{
|
||||
size_t n = nfc_list_devices (connstrings, 2);
|
||||
size_t n = nfc_list_devices (NULL, connstrings, 2);
|
||||
if (n < 2) {
|
||||
cut_omit ("At least two NFC devices must be plugged-in to run this test");
|
||||
}
|
||||
|
||||
nfc_init ();
|
||||
second_device = nfc_open (connstrings[0]);
|
||||
first_device = nfc_open (connstrings[1]);
|
||||
nfc_init (NULL);
|
||||
second_device = nfc_open (NULL, connstrings[0]);
|
||||
first_device = nfc_open (NULL, connstrings[1]);
|
||||
|
||||
signal (SIGINT, abort_test_by_keypress);
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ cut_teardown (void)
|
|||
{
|
||||
nfc_close (second_device);
|
||||
nfc_close (first_device);
|
||||
nfc_exit ();
|
||||
nfc_exit (NULL);
|
||||
}
|
||||
|
||||
struct thread_data {
|
||||
|
|
|
|||
|
|
@ -12,15 +12,15 @@ test_register_endianness (void)
|
|||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
|
||||
nfc_init ();
|
||||
nfc_init (NULL);
|
||||
|
||||
size_t device_count = nfc_list_devices (connstrings, MAX_DEVICE_COUNT);
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
||||
nfc_device *device;
|
||||
|
||||
device = nfc_open (connstrings[0]);
|
||||
device = nfc_open (NULL, connstrings[0]);
|
||||
cut_assert_not_null (device, cut_message ("nfc_open"));
|
||||
|
||||
uint8_t value;
|
||||
|
|
@ -44,5 +44,5 @@ test_register_endianness (void)
|
|||
cut_assert_equal_uint (0x55, value, cut_message ("check register value"));
|
||||
|
||||
nfc_close (device);
|
||||
nfc_exit ();
|
||||
nfc_exit (NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@ test_register_endianness (void)
|
|||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
|
||||
nfc_init ();
|
||||
nfc_init (NULL);
|
||||
|
||||
size_t device_count = nfc_list_devices (connstrings, MAX_DEVICE_COUNT);
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
||||
nfc_device *device;
|
||||
|
||||
device = nfc_open (connstrings[0]);
|
||||
device = nfc_open (NULL, connstrings[0]);
|
||||
cut_assert_not_null (device, cut_message ("nfc_open"));
|
||||
|
||||
uint8_t value;
|
||||
|
|
@ -35,5 +35,5 @@ test_register_endianness (void)
|
|||
cut_assert_equal_int (0, res, cut_message ("read register 0xFFF0"));
|
||||
|
||||
nfc_close (device);
|
||||
nfc_exit ();
|
||||
nfc_exit (NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue