add context to nfc_init(), nfc_exit(), nfc_open() and nfc_list_devices() functions.
This commit is contained in:
parent
86c8ce536b
commit
4c011279ff
29 changed files with 142 additions and 138 deletions
|
|
@ -109,17 +109,17 @@ main (int argc, char *argv[])
|
|||
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
// List available devices
|
||||
size_t szFound = nfc_list_devices (connstrings, MAX_DEVICE_COUNT);
|
||||
size_t szFound = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
|
||||
if (szFound < 2) {
|
||||
ERR ("%zd device found but two opened devices are needed to relay NFC.", szFound);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
nfc_init ();
|
||||
nfc_init (NULL);
|
||||
|
||||
// Try to open the NFC emulator device
|
||||
pndTag = nfc_open (connstrings[0]);
|
||||
pndTag = nfc_open (NULL, connstrings[0]);
|
||||
if (pndTag == NULL) {
|
||||
printf ("Error opening NFC emulator device\n");
|
||||
return EXIT_FAILURE;
|
||||
|
|
@ -151,7 +151,7 @@ main (int argc, char *argv[])
|
|||
if ((szReaderRxBits = nfc_target_init (pndTag, &nt, abtReaderRx, sizeof (abtReaderRx), 0)) < 0) {
|
||||
ERR ("%s", "Initialization of NFC emulator failed");
|
||||
nfc_close (pndTag);
|
||||
nfc_exit ();
|
||||
nfc_exit (NULL);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
printf ("%s", "Configuring emulator settings...");
|
||||
|
|
@ -163,7 +163,7 @@ main (int argc, char *argv[])
|
|||
printf ("%s", "Done, emulated tag is initialized");
|
||||
|
||||
// Try to open the NFC reader
|
||||
pndReader = nfc_open (connstrings[1]);
|
||||
pndReader = nfc_open (NULL, connstrings[1]);
|
||||
|
||||
printf ("NFC reader device: %s opened", nfc_device_get_name (pndReader));
|
||||
printf ("%s", "Configuring NFC reader settings...");
|
||||
|
|
@ -221,6 +221,6 @@ main (int argc, char *argv[])
|
|||
|
||||
nfc_close (pndTag);
|
||||
nfc_close (pndReader);
|
||||
nfc_exit ();
|
||||
nfc_exit (NULL);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue