mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-04-21 22:16:16 +00:00
astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 --brackets=linux --pad-oper --unpad-paren --pad-header --align-pointer=name
This commit is contained in:
@@ -85,19 +85,19 @@ target_thread(void *arg)
|
||||
size_t szRx = sizeof(abtRx);
|
||||
int res = nfc_target_init(device, &nt, abtRx, sizeof(abtRx), 0);
|
||||
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; }
|
||||
if (res < 0) { thread_res = -1; return (void *) thread_res; }
|
||||
|
||||
res = nfc_target_receive_bytes(device, abtRx, sizeof(abtRx), 500);
|
||||
cut_assert_operator_int(res, > , 0, cut_message("Can't receive bytes from initiator: %s", nfc_strerror(device)));
|
||||
szRx = (size_t) res;
|
||||
const uint8_t abtAttRx[] = "Hello DEP target!";
|
||||
cut_assert_equal_memory(abtAttRx, sizeof(abtAttRx), abtRx, szRx, cut_message("Invalid received data"));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
if (res <= 0) { thread_res = -1; return (void *) thread_res; }
|
||||
|
||||
const uint8_t abtTx[] = "Hello DEP initiator!";
|
||||
res = nfc_target_send_bytes(device, abtTx, sizeof(abtTx), 500);
|
||||
cut_assert_operator_int(res, > , 0, cut_message("Can't send bytes to initiator: %s", nfc_strerror(device)));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
if (res <= 0) { thread_res = -1; return (void *) thread_res; }
|
||||
|
||||
return (void *) thread_res;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ initiator_thread(void *arg)
|
||||
printf("=========== INITIATOR %s =========\n", nfc_device_get_name(device));
|
||||
int res = nfc_initiator_init(device);
|
||||
cut_assert_equal_int(0, res, cut_message("Can't initialize NFC device as initiator: %s", nfc_strerror(device)));
|
||||
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
||||
if (res < 0) { thread_res = -1; return (void *) thread_res; }
|
||||
|
||||
nfc_target nt;
|
||||
|
||||
@@ -130,7 +130,7 @@ initiator_thread(void *arg)
|
||||
cut_assert_equal_memory("\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA", 10, nt.nti.ndi.abtNFCID3, 10, cut_message("Invalid target NFCID3"));
|
||||
cut_assert_equal_int(NDM_ACTIVE, nt.nti.ndi.ndm, cut_message("Invalid target DEP mode"));
|
||||
cut_assert_equal_memory("\x12\x34\x56\x78", 4, nt.nti.ndi.abtGB, nt.nti.ndi.szGB, cut_message("Invalid target general bytes"));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
if (res <= 0) { thread_res = -1; return (void *) thread_res; }
|
||||
|
||||
const uint8_t abtTx[] = "Hello DEP target!";
|
||||
uint8_t abtRx[1024];
|
||||
@@ -140,10 +140,10 @@ initiator_thread(void *arg)
|
||||
|
||||
const uint8_t abtAttRx[] = "Hello DEP initiator!";
|
||||
cut_assert_equal_memory(abtAttRx, sizeof(abtAttRx), abtRx, szRx, cut_message("Invalid received data"));
|
||||
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
||||
if (res < 0) { thread_res = -1; return (void *) thread_res; }
|
||||
res = nfc_initiator_deselect_target(device);
|
||||
cut_assert_operator_int(res, >= , 0, cut_message("Can't deselect target: %s", nfc_strerror(device)));
|
||||
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
||||
if (res < 0) { thread_res = -1; return (void *) thread_res; }
|
||||
|
||||
return (void *) thread_res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user