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:
Philippe Teuwen 2012-05-29 15:55:35 +00:00
parent 01303fab0d
commit 568317929d
21 changed files with 94 additions and 94 deletions

View file

@ -84,7 +84,7 @@ target_thread(void *arg)
size_t szRx = sizeof(abtRx);
int res = nfc_target_init(device, &nt, abtRx, szRx, 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; }
// First pass
res = nfc_target_receive_bytes(device, abtRx, sizeof(abtRx), 500);
@ -93,12 +93,12 @@ target_thread(void *arg)
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; }
// Second pass
res = nfc_target_receive_bytes(device, abtRx, sizeof(abtRx), 500);
@ -106,11 +106,11 @@ target_thread(void *arg)
szRx = (size_t) res;
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_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; }
// Third pass
res = nfc_target_receive_bytes(device, abtRx, sizeof(abtRx), 500);
@ -118,11 +118,11 @@ target_thread(void *arg)
szRx = (size_t) res;
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_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; }
// Fourth pass
res = nfc_target_receive_bytes(device, abtRx, sizeof(abtRx), 500);
@ -130,11 +130,11 @@ target_thread(void *arg)
szRx = (size_t) res;
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_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;
}
@ -154,7 +154,7 @@ initiator_thread(void *arg)
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;
@ -167,7 +167,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_PASSIVE, 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];
@ -177,11 +177,11 @@ 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; }
// Passive mode / 212Kbps (second pass)
printf("=========== INITIATOR %s (Passive mode / 212Kbps) =========\n", nfc_device_get_name(device));
@ -192,18 +192,18 @@ 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_PASSIVE, 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; }
szRx = sizeof(abtRx);
res = nfc_initiator_transceive_bytes(device, abtTx, sizeof(abtTx), abtRx, &szRx, 1000);
cut_assert_operator_int(res, >= , 0, cut_message("Can't transceive bytes to target: %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; }
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; }
// Passive mode / 212Kbps
printf("=========== INITIATOR %s (Passive mode / 212Kbps, second pass) =========\n", nfc_device_get_name(device));
@ -214,18 +214,18 @@ 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_PASSIVE, 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; }
szRx = sizeof(abtRx);
res = nfc_initiator_transceive_bytes(device, abtTx, sizeof(abtTx), abtRx, &szRx, 5000);
cut_assert_operator_int(res, >= , 0, cut_message("Can't transceive bytes to target: %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; }
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; }
// Passive mode / 424Kbps
printf("=========== INITIATOR %s (Passive mode / 424Kbps) =========\n", nfc_device_get_name(device));
@ -236,18 +236,18 @@ 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_PASSIVE, 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; }
szRx = sizeof(abtRx);
res = nfc_initiator_transceive_bytes(device, abtTx, sizeof(abtTx), abtRx, &szRx, 5000);
cut_assert_operator_int(res, >= , 0, cut_message("Can't transceive bytes to target: %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; }
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;
}