43 #endif // HAVE_CONFIG_H
53 #define MAX_FRAME_LEN 264
58 static void stop_dep_communication(
int sig)
70 main(
int argc,
const char *argv[])
72 uint8_t abtRx[MAX_FRAME_LEN];
74 uint8_t abtTx[] =
"Hello Mars!";
77 printf(
"Usage: %s\n", argv[0]);
82 if (context == NULL) {
83 ERR(
"Unable to init libnfc (malloc)");
86 #define MAX_DEVICE_COUNT 2
88 size_t szDeviceFound =
nfc_list_devices(context, connstrings, MAX_DEVICE_COUNT);
93 if (szDeviceFound == 1) {
94 pnd =
nfc_open(context, connstrings[0]);
95 }
else if (szDeviceFound > 1) {
96 pnd =
nfc_open(context, connstrings[1]);
98 printf(
"No device found.\n");
110 .abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 },
112 .abtGB = { 0x12, 0x34, 0x56, 0x78 },
113 .ndm = NDM_UNDEFINED,
125 printf(
"Unable to open NFC device.\n");
131 signal(SIGINT, stop_dep_communication);
133 printf(
"NFC device will now act as: ");
134 print_nfc_target(&nt,
false);
136 printf(
"Waiting for initiator request...\n");
144 printf(
"Initiator request received. Waiting for data...\n");
151 abtRx[(size_t) szRx] =
'\0';
152 printf(
"Received: %s\n", abtRx);
154 printf(
"Sending: %s\n", abtTx);
161 printf(
"Data sent.\n");