nfc_target_receive_bytes() function does not now use pszRx as parameter because this function returns it.

This commit is contained in:
Audrey Diacre 2012-01-05 16:33:55 +00:00
parent 7e7ee3299e
commit 642f9a38f7
11 changed files with 25 additions and 26 deletions

View file

@ -85,11 +85,11 @@ target_thread (void *arg)
uint8_t abtRx[1024];
size_t szRx = sizeof (abtRx);
int res = nfc_target_init (device, &nt, abtRx, &szRx, 0);
cut_assert_equal_int (0, res, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
cut_assert_operator_int (res, >, 0, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
if (res < 0) { thread_res = -1; return (void*) thread_res; }
res = nfc_target_receive_bytes (device, abtRx, &szRx, 500);
cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
szRx = (size_t) nfc_target_receive_bytes (device, abtRx, 500);
cut_assert_operator_int (szRx, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
const uint8_t abtAttRx[] = "Hello DEP target!";
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));

View file

@ -83,12 +83,12 @@ target_thread (void *arg)
uint8_t abtRx[1024];
size_t szRx = sizeof (abtRx);
int res = nfc_target_init (device, &nt, abtRx, &szRx, 0);
cut_assert_equal_int (0, res, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
cut_assert_operator_int (res, >, 0, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
if (res < 0) { thread_res = -1; return (void*) thread_res; }
// First pass
res = nfc_target_receive_bytes (device, abtRx, &szRx, 500);
cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
szRx = (size_t) nfc_target_receive_bytes (device, abtRx, 500);
cut_assert_operator_int ((int) szRx, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
const uint8_t abtAttRx[] = "Hello DEP target!";
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
@ -100,8 +100,8 @@ target_thread (void *arg)
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
// Second pass
res = nfc_target_receive_bytes (device, abtRx, &szRx, 500);
cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
szRx = (size_t) nfc_target_receive_bytes (device, abtRx, 500);
cut_assert_operator_int ((int) szRx, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
@ -111,8 +111,8 @@ target_thread (void *arg)
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
// Third pass
res = nfc_target_receive_bytes (device, abtRx, &szRx, 500);
cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
szRx = (size_t) nfc_target_receive_bytes (device, abtRx, 500);
cut_assert_operator_int ((int) szRx, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
@ -122,8 +122,8 @@ target_thread (void *arg)
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
// Fourth pass
res = nfc_target_receive_bytes (device, abtRx, &szRx, 500);
cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
szRx = (size_t) nfc_target_receive_bytes (device, abtRx, 500);
cut_assert_operator_int ((int)szRx, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
if (res <= 0) { thread_res = -1; return (void*) thread_res; }