Improve API for target emulation, nfc_target_mode_t does not exist anymore (this mode is computed from nfc_target_t)
This commit is contained in:
parent
1e52e1dc9f
commit
1f62e9e2f2
12 changed files with 163 additions and 108 deletions
|
|
@ -89,7 +89,7 @@ main (int argc, const char *argv[])
|
|||
print_nfc_target (nt);
|
||||
|
||||
printf ("Waiting for initiator request...\n");
|
||||
if(!nfc_target_init (pnd, NTM_DEP_ONLY, &nt, abtRx, &szRx)) {
|
||||
if(!nfc_target_init (pnd, &nt, abtRx, &szRx)) {
|
||||
nfc_perror(pnd, "nfc_target_init");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ main (int argc, char *argv[])
|
|||
.nti.nai.szAtsLen = 0,
|
||||
};
|
||||
|
||||
if (!nfc_target_init (pnd, NTM_ISO14443_4_PICC_ONLY, &nt, abtRx, &szRx)) {
|
||||
if (!nfc_target_init (pnd, &nt, abtRx, &szRx)) {
|
||||
nfc_perror (pnd, "nfc_target_init");
|
||||
ERR("Could not come out of auto-emulation, no command was received");
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ nfc_target_emulate_tag(nfc_device_t* pnd, nfc_target_t * pnt)
|
|||
byte_t abtTx[MAX_FRAME_LEN];
|
||||
bool loop = true;
|
||||
|
||||
if (!nfc_target_init (pnd, NTM_PASSIVE_ONLY, pnt, abtRx, &szRx)) {
|
||||
if (!nfc_target_init (pnd, pnt, abtRx, &szRx)) {
|
||||
nfc_perror (pnd, "nfc_target_init");
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ main (int argc, char *argv[])
|
|||
.nti.nai.szUidLen = 4,
|
||||
.nti.nai.szAtsLen = 0,
|
||||
};
|
||||
if (!nfc_target_init (pnd, NTM_PASSIVE_ONLY, &nt, abtRecv, &szRecvBits)) {
|
||||
if (!nfc_target_init (pnd, &nt, abtRecv, &szRecvBits)) {
|
||||
ERR ("Could not come out of auto-emulation, no command was received");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ main (int argc, char *argv[])
|
|||
|
||||
printf ("Connected to the NFC emulator device: %s\n", pndTarget->acName);
|
||||
|
||||
if (!nfc_target_init (pndTarget, NTM_ISO14443_4_PICC_ONLY, &ntEmulatedTarget, abtCapdu, &szCapduLen)) {
|
||||
if (!nfc_target_init (pndTarget, &ntEmulatedTarget, abtCapdu, &szCapduLen)) {
|
||||
ERR ("%s", "Initialization of NFC emulator failed");
|
||||
if (!target_only_mode) {
|
||||
nfc_disconnect (pndInitiator);
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ main (int argc, char *argv[])
|
|||
.nti.nai.szAtsLen = 0,
|
||||
};
|
||||
|
||||
if (!nfc_target_init (pndTag, NTM_PASSIVE_ONLY, &nt, abtReaderRx, &szReaderRxBits)) {
|
||||
if (!nfc_target_init (pndTag, &nt, abtReaderRx, &szReaderRxBits)) {
|
||||
ERR ("%s", "Initialization of NFC emulator failed");
|
||||
nfc_disconnect (pndTag);
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ main (int argc, const char *argv[])
|
|||
};
|
||||
printf ("Now both, NFC device (configured as target) and SAM are readables from an external NFC initiator.\n");
|
||||
printf ("Please note that NFC device (configured as target) stay in target mode until it receive RATS, ATR_REQ or proprietary command.\n");
|
||||
if (!nfc_target_init (pnd, NTM_NORMAL, &nt, abtRx, &szRx)) {
|
||||
if (!nfc_target_init (pnd, &nt, abtRx, &szRx)) {
|
||||
nfc_perror(pnd, "nfc_target_init");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue