44 #endif // HAVE_CONFIG_H
54 #define MAX_FRAME_LEN 264
59 static void stop_dep_communication(
int sig)
71 main(
int argc,
const char *argv[])
73 uint8_t abtRx[MAX_FRAME_LEN];
75 uint8_t abtTx[] =
"Hello Mars!";
78 printf(
"Usage: %s\n", argv[0]);
83 if (context == NULL) {
84 ERR(
"Unable to init libnfc (malloc)");
87 #define MAX_DEVICE_COUNT 2
89 size_t szDeviceFound =
nfc_list_devices(context, connstrings, MAX_DEVICE_COUNT);
94 if (szDeviceFound == 1) {
95 pnd =
nfc_open(context, connstrings[0]);
96 }
else if (szDeviceFound > 1) {
97 pnd =
nfc_open(context, connstrings[1]);
99 printf(
"No device found.\n");
111 .abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 },
113 .abtGB = { 0x12, 0x34, 0x56, 0x78 },
114 .ndm = NDM_UNDEFINED,
126 printf(
"Unable to open NFC device.\n");
132 signal(SIGINT, stop_dep_communication);
134 printf(
"NFC device will now act as: ");
135 print_nfc_target(&nt,
false);
137 printf(
"Waiting for initiator request...\n");
145 printf(
"Initiator request received. Waiting for data...\n");
152 abtRx[(size_t) szRx] =
'\0';
153 printf(
"Received: %s\n", abtRx);
155 printf(
"Sending: %s\n", abtTx);
162 printf(
"Data sent.\n");