Rename nfc_target_type_t as pn53x_target_type_t

This commit is contained in:
Romuald Conty 2010-10-13 15:31:48 +00:00
parent c53c512831
commit 695e5c2f37
14 changed files with 99 additions and 99 deletions

View file

@ -66,7 +66,7 @@ main (int argc, const char *argv[])
} }
const nfc_target_t nt = { const nfc_target_t nt = {
.ntt = NTT_DEP_PASSIVE_106, .ptt = PTT_DEP_PASSIVE_106,
.nti.ndi.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 }, .nti.ndi.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 },
.nti.ndi.szGB = 4, .nti.ndi.szGB = 4,
.nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 }, .nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 },

View file

@ -112,7 +112,7 @@ main (int argc, char *argv[])
printf ("Emulating NDEF tag now, please touch it with a second NFC device\n"); printf ("Emulating NDEF tag now, please touch it with a second NFC device\n");
nfc_target_t nt = { nfc_target_t nt = {
.ntt = NTT_MIFARE, .ptt = PTT_MIFARE,
.nti.nai.abtAtqa = { 0x00, 0x04 }, .nti.nai.abtAtqa = { 0x00, 0x04 },
.nti.nai.abtUid = { 0x08, 0x00, 0xb0, 0x0b }, .nti.nai.abtUid = { 0x08, 0x00, 0xb0, 0x0b },
.nti.nai.btSak = 0x20, .nti.nai.btSak = 0x20,

View file

@ -173,7 +173,7 @@ main (int argc, char *argv[])
// Example of a Mifare Classic Mini // Example of a Mifare Classic Mini
// Note that crypto1 is not implemented in this example // Note that crypto1 is not implemented in this example
nfc_target_t nt = { nfc_target_t nt = {
.ntt = NTT_MIFARE, .ptt = PTT_MIFARE,
.nti.nai.abtAtqa = { 0x00, 0x04 }, .nti.nai.abtAtqa = { 0x00, 0x04 },
.nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef }, .nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef },
.nti.nai.btSak = 0x09, .nti.nai.btSak = 0x09,
@ -183,7 +183,7 @@ main (int argc, char *argv[])
/* /*
// Example of a FeliCa // Example of a FeliCa
nfc_target_t nt = { nfc_target_t nt = {
.ntt = NTT_FELICA_212, .ptt = PTT_FELICA_212,
.nti.nfi.abtId = { 0x01, 0xFE, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF }, .nti.nfi.abtId = { 0x01, 0xFE, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF },
.nti.nfi.abtPad = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF }, .nti.nfi.abtPad = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF },
.nti.nfi.abtSysCode = { 0xFF, 0xFF }, .nti.nfi.abtSysCode = { 0xFF, 0xFF },
@ -192,7 +192,7 @@ main (int argc, char *argv[])
/* /*
// Example of a ISO14443-4 (DESfire) // Example of a ISO14443-4 (DESfire)
nfc_target_t nt = { nfc_target_t nt = {
.ntt = NTT_MIFARE, .ptt = PTT_MIFARE,
.nti.nai.abtAtqa = { 0x03, 0x44 }, .nti.nai.abtAtqa = { 0x03, 0x44 },
.nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef }, .nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef },
.nti.nai.btSak = 0x20, .nti.nai.btSak = 0x20,

View file

@ -132,7 +132,7 @@ main (int argc, char *argv[])
// Note: We have to build a "fake" nfc_target_t in order to do exactly the same that was done before the new nfc_target_init() was introduced. // Note: We have to build a "fake" nfc_target_t in order to do exactly the same that was done before the new nfc_target_init() was introduced.
nfc_target_t nt = { nfc_target_t nt = {
.ntt = NTT_MIFARE, .ptt = PTT_MIFARE,
.nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtAtqa = { 0x04, 0x00 },
.nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xaf }, .nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xaf },
.nti.nai.btSak = 0x20, .nti.nai.btSak = 0x20,

View file

@ -72,7 +72,7 @@ main (int argc, const char *argv[])
const byte_t btPollNr = 20; const byte_t btPollNr = 20;
const byte_t btPeriod = 2; const byte_t btPeriod = 2;
const nfc_target_type_t nttArray[5] = {NTT_GENERIC_PASSIVE_106, NTT_GENERIC_PASSIVE_212, NTT_GENERIC_PASSIVE_424, NTT_ISO14443_4B_106, NTT_JEWEL_106}; const pn53x_target_type_t pttArray[5] = {PTT_GENERIC_PASSIVE_106, PTT_GENERIC_PASSIVE_212, PTT_GENERIC_PASSIVE_424, PTT_ISO14443_4B_106, PTT_JEWEL_106};
const size_t szTargetTypes = 5; const size_t szTargetTypes = 5;
nfc_target_t antTargets[2]; nfc_target_t antTargets[2];
@ -106,53 +106,53 @@ main (int argc, const char *argv[])
printf ("Connected to NFC reader: %s\n", pnd->acName); printf ("Connected to NFC reader: %s\n", pnd->acName);
printf ("PN532 will poll during %ld ms\n", (unsigned long) btPollNr * szTargetTypes * btPeriod * 150); printf ("PN532 will poll during %ld ms\n", (unsigned long) btPollNr * szTargetTypes * btPeriod * 150);
res = nfc_initiator_poll_targets (pnd, nttArray, szTargetTypes, btPollNr, btPeriod, antTargets, &szTargetFound); res = nfc_initiator_poll_targets (pnd, pttArray, szTargetTypes, btPollNr, btPeriod, antTargets, &szTargetFound);
if (res) { if (res) {
uint8_t n; uint8_t n;
printf ("%ld target(s) have been found.\n", (unsigned long) szTargetFound); printf ("%ld target(s) have been found.\n", (unsigned long) szTargetFound);
for (n = 0; n < szTargetFound; n++) { for (n = 0; n < szTargetFound; n++) {
printf ("T%d: targetType=%02x ", n + 1, antTargets[n].ntt); printf ("T%d: targetType=%02x ", n + 1, antTargets[n].ptt);
switch(antTargets[n].ntt) { switch(antTargets[n].ptt) {
case NTT_JEWEL_106: case PTT_JEWEL_106:
printf ("(Innovision Jewel tag), targetData:\n"); printf ("(Innovision Jewel tag), targetData:\n");
print_nfc_jewel_info (antTargets[n].nti.nji); print_nfc_jewel_info (antTargets[n].nti.nji);
break; break;
case NTT_MIFARE: case PTT_MIFARE:
printf ("(Mifare card), targetData:\n"); printf ("(Mifare card), targetData:\n");
print_nfc_iso14443a_info (antTargets[n].nti.nai); print_nfc_iso14443a_info (antTargets[n].nti.nai);
break; break;
case NTT_FELICA_212: case PTT_FELICA_212:
printf ("(FeliCa 212 kbps card), targetData:\n"); printf ("(FeliCa 212 kbps card), targetData:\n");
print_nfc_felica_info (antTargets[n].nti.nfi); print_nfc_felica_info (antTargets[n].nti.nfi);
break; break;
case NTT_FELICA_424: case PTT_FELICA_424:
printf ("(FeliCa 212 kbps card), targetData:\n"); printf ("(FeliCa 212 kbps card), targetData:\n");
print_nfc_felica_info (antTargets[n].nti.nfi); print_nfc_felica_info (antTargets[n].nti.nfi);
break; break;
case NTT_ISO14443_4A_106: case PTT_ISO14443_4A_106:
printf ("(Passive 106 kbps ISO/IEC 14443-4A card), targetData:\n"); printf ("(Passive 106 kbps ISO/IEC 14443-4A card), targetData:\n");
print_nfc_iso14443a_info (antTargets[n].nti.nai); print_nfc_iso14443a_info (antTargets[n].nti.nai);
break; break;
case NTT_ISO14443_4B_TCL_106: case PTT_ISO14443_4B_TCL_106:
printf ("(Passive 106 kbps ISO/IEC 14443-4B card), targetData:\n"); printf ("(Passive 106 kbps ISO/IEC 14443-4B card), targetData:\n");
print_nfc_iso14443b_info (antTargets[n].nti.nbi); print_nfc_iso14443b_info (antTargets[n].nti.nbi);
break; break;
case NTT_DEP_PASSIVE_106: case PTT_DEP_PASSIVE_106:
printf ("(DEP passive 106 kbps)\n"); printf ("(DEP passive 106 kbps)\n");
break; break;
case NTT_DEP_PASSIVE_212: case PTT_DEP_PASSIVE_212:
printf ("(DEP passive 212 kbps)\n"); printf ("(DEP passive 212 kbps)\n");
break; break;
case NTT_DEP_PASSIVE_424: case PTT_DEP_PASSIVE_424:
printf ("(DEP passive 424 kbps)\n"); printf ("(DEP passive 424 kbps)\n");
break; break;
case NTT_DEP_ACTIVE_106: case PTT_DEP_ACTIVE_106:
printf ("(DEP active 106 kbps)\n"); printf ("(DEP active 106 kbps)\n");
break; break;
case NTT_DEP_ACTIVE_212: case PTT_DEP_ACTIVE_212:
printf ("(DEP active 212 kbps)\n"); printf ("(DEP active 212 kbps)\n");
break; break;
case NTT_DEP_ACTIVE_424: case PTT_DEP_ACTIVE_424:
printf ("(DEP active 424 kbps)\n"); printf ("(DEP active 424 kbps)\n");
break; break;
}; };

View file

@ -127,7 +127,7 @@ main (int argc, char *argv[])
printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n"); printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n");
nfc_target_t nt = { nfc_target_t nt = {
.ntt = NTT_MIFARE, .ptt = PTT_MIFARE,
.nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtAtqa = { 0x04, 0x00 },
.nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xef }, .nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xef },
.nti.nai.btSak = 0x20, .nti.nai.btSak = 0x20,

View file

@ -212,55 +212,55 @@ print_nfc_dep_info (const nfc_dep_info_t ndi)
} }
} }
void print_nfc_target_type( const nfc_target_type_t ntt ) void print_nfc_target_type( const pn53x_target_type_t ptt )
{ {
switch (ntt) { switch (ptt) {
case NTT_GENERIC_PASSIVE_106: case PTT_GENERIC_PASSIVE_106:
printf ("Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP)\n"); printf ("Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP)\n");
break; break;
case NTT_GENERIC_PASSIVE_212: case PTT_GENERIC_PASSIVE_212:
printf ("Generic passive 212 kbps (FeliCa, DEP)\n"); printf ("Generic passive 212 kbps (FeliCa, DEP)\n");
break; break;
case NTT_GENERIC_PASSIVE_424: case PTT_GENERIC_PASSIVE_424:
printf ("Generic passive 424 kbps (FeliCa, DEP)\n"); printf ("Generic passive 424 kbps (FeliCa, DEP)\n");
break; break;
case NTT_ISO14443_4B_106: case PTT_ISO14443_4B_106:
printf ("Passive 106 kbps ISO/IEC14443-4B\n"); printf ("Passive 106 kbps ISO/IEC14443-4B\n");
break; break;
case NTT_JEWEL_106: case PTT_JEWEL_106:
printf ("Innovision Jewel tag\n"); printf ("Innovision Jewel tag\n");
break; break;
case NTT_MIFARE: case PTT_MIFARE:
printf ("mifare card\n"); printf ("mifare card\n");
break; break;
case NTT_FELICA_212: case PTT_FELICA_212:
printf ("FeliCa 212 kbps card\n"); printf ("FeliCa 212 kbps card\n");
break; break;
case NTT_FELICA_424: case PTT_FELICA_424:
printf ("FeliCa 424 kbps card\n"); printf ("FeliCa 424 kbps card\n");
break; break;
case NTT_ISO14443_4A_106: case PTT_ISO14443_4A_106:
printf ("Passive 106 kbps ISO/IEC14443-4A\n"); printf ("Passive 106 kbps ISO/IEC14443-4A\n");
break; break;
case NTT_ISO14443_4B_TCL_106: case PTT_ISO14443_4B_TCL_106:
printf ("Passive 106 kbps ISO/IEC14443-4B with TCL flag\n"); printf ("Passive 106 kbps ISO/IEC14443-4B with TCL flag\n");
break; break;
case NTT_DEP_PASSIVE_106: case PTT_DEP_PASSIVE_106:
printf ("DEP passive 106 kbps\n"); printf ("DEP passive 106 kbps\n");
break; break;
case NTT_DEP_PASSIVE_212: case PTT_DEP_PASSIVE_212:
printf ("DEP passive 212 kbps\n"); printf ("DEP passive 212 kbps\n");
break; break;
case NTT_DEP_PASSIVE_424: case PTT_DEP_PASSIVE_424:
printf ("DEP passive 424 kbps\n"); printf ("DEP passive 424 kbps\n");
break; break;
case NTT_DEP_ACTIVE_106: case PTT_DEP_ACTIVE_106:
printf ("DEP active 106 kbps\n"); printf ("DEP active 106 kbps\n");
break; break;
case NTT_DEP_ACTIVE_212: case PTT_DEP_ACTIVE_212:
printf ("DEP active 212 kbps\n"); printf ("DEP active 212 kbps\n");
break; break;
case NTT_DEP_ACTIVE_424: case PTT_DEP_ACTIVE_424:
printf ("DEP active 424 kbps\n"); printf ("DEP active 424 kbps\n");
break; break;
} }

View file

@ -40,7 +40,7 @@ void print_nfc_felica_info (const nfc_felica_info_t nfi);
void print_nfc_jewel_info (const nfc_jewel_info_t nji); void print_nfc_jewel_info (const nfc_jewel_info_t nji);
void print_nfc_dep_info (const nfc_dep_info_t ndi); void print_nfc_dep_info (const nfc_dep_info_t ndi);
void print_nfc_target_type( const nfc_target_type_t ntt ); void print_nfc_target_type( const pn53x_target_type_t ptt );
nfc_device_desc_t *parse_device_desc (int argc, const char *argv[], size_t * szFound); nfc_device_desc_t *parse_device_desc (int argc, const char *argv[], size_t * szFound);

View file

@ -198,7 +198,7 @@ main (int argc, const char *argv[])
size_t szRx; size_t szRx;
nfc_target_t nt = { nfc_target_t nt = {
.ntt = NTT_MIFARE, .ptt = PTT_MIFARE,
.nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtAtqa = { 0x04, 0x00 },
.nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xaf }, .nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xaf },
.nti.nai.btSak = 0x20, .nti.nai.btSak = 0x20,

View file

@ -291,43 +291,43 @@ typedef enum {
} nfc_target_mode_t; } nfc_target_mode_t;
/** /**
* @enum nfc_target_type_t * @enum pn53x_target_type_t
* @brief NFC target type enumeration * @brief NFC target type enumeration
*/ */
typedef enum { typedef enum {
/** Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP) */ /** Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP) */
NTT_GENERIC_PASSIVE_106 = 0x00, PTT_GENERIC_PASSIVE_106 = 0x00,
/** Generic passive 212 kbps (FeliCa, DEP) */ /** Generic passive 212 kbps (FeliCa, DEP) */
NTT_GENERIC_PASSIVE_212 = 0x01, PTT_GENERIC_PASSIVE_212 = 0x01,
/** Generic passive 424 kbps (FeliCa, DEP) */ /** Generic passive 424 kbps (FeliCa, DEP) */
NTT_GENERIC_PASSIVE_424 = 0x02, PTT_GENERIC_PASSIVE_424 = 0x02,
/** Passive 106 kbps ISO/IEC14443-4B */ /** Passive 106 kbps ISO/IEC14443-4B */
NTT_ISO14443_4B_106 = 0x03, PTT_ISO14443_4B_106 = 0x03,
/** Innovision Jewel tag */ /** Innovision Jewel tag */
NTT_JEWEL_106 = 0x04, PTT_JEWEL_106 = 0x04,
/** Mifare card */ /** Mifare card */
NTT_MIFARE = 0x10, PTT_MIFARE = 0x10,
/** FeliCa 212 kbps card */ /** FeliCa 212 kbps card */
NTT_FELICA_212 = 0x11, PTT_FELICA_212 = 0x11,
/** FeliCa 424 kbps card */ /** FeliCa 424 kbps card */
NTT_FELICA_424 = 0x12, PTT_FELICA_424 = 0x12,
/** Passive 106 kbps ISO/IEC 14443-4A */ /** Passive 106 kbps ISO/IEC 14443-4A */
NTT_ISO14443_4A_106 = 0x20, PTT_ISO14443_4A_106 = 0x20,
/** Passive 106 kbps ISO/IEC 14443-4B with TCL flag */ /** Passive 106 kbps ISO/IEC 14443-4B with TCL flag */
NTT_ISO14443_4B_TCL_106 = 0x23, PTT_ISO14443_4B_TCL_106 = 0x23,
/** DEP passive 106 kbps */ /** DEP passive 106 kbps */
NTT_DEP_PASSIVE_106 = 0x40, PTT_DEP_PASSIVE_106 = 0x40,
/** DEP passive 212 kbps */ /** DEP passive 212 kbps */
NTT_DEP_PASSIVE_212 = 0x41, PTT_DEP_PASSIVE_212 = 0x41,
/** DEP passive 424 kbps */ /** DEP passive 424 kbps */
NTT_DEP_PASSIVE_424 = 0x42, PTT_DEP_PASSIVE_424 = 0x42,
/** DEP active 106 kbps */ /** DEP active 106 kbps */
NTT_DEP_ACTIVE_106 = 0x80, PTT_DEP_ACTIVE_106 = 0x80,
/** DEP active 212 kbps */ /** DEP active 212 kbps */
NTT_DEP_ACTIVE_212 = 0x81, PTT_DEP_ACTIVE_212 = 0x81,
/** DEP active 424 kbps */ /** DEP active 424 kbps */
NTT_DEP_ACTIVE_424 = 0x82, PTT_DEP_ACTIVE_424 = 0x82,
} nfc_target_type_t; } pn53x_target_type_t;
/** /**
* @struct nfc_target_t * @struct nfc_target_t
@ -335,7 +335,7 @@ typedef enum {
*/ */
typedef struct { typedef struct {
nfc_target_info_t nti; nfc_target_info_t nti;
nfc_target_type_t ntt; pn53x_target_type_t ptt;
} nfc_target_t; } nfc_target_t;
// Reset struct alignment to default // Reset struct alignment to default

View file

@ -74,7 +74,7 @@ extern "C" {
NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation,
nfc_target_info_t anti[], const size_t szTargets, nfc_target_info_t anti[], const size_t szTargets,
size_t * pszTargetFound); size_t * pszTargetFound);
NFC_EXPORT bool nfc_initiator_poll_targets (nfc_device_t * pnd, const nfc_target_type_t * pnttTargetTypes, NFC_EXPORT bool nfc_initiator_poll_targets (nfc_device_t * pnd, const pn53x_target_type_t * ppttTargetTypes,
const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod,
nfc_target_t * pntTargets, size_t * pszTargetFound); nfc_target_t * pntTargets, size_t * pszTargetFound);
NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation,

View file

@ -369,15 +369,15 @@ pn53x_unwrap_frame (const byte_t * pbtFrame, const size_t szFrameBits, byte_t *
} }
bool bool
pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, nfc_target_type_t ntt, pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, pn53x_target_type_t ptt,
nfc_target_info_t * pnti) nfc_target_info_t * pnti)
{ {
uint8_t szAttribRes; uint8_t szAttribRes;
switch (ntt) { switch (ptt) {
case NTT_MIFARE: case PTT_MIFARE:
case NTT_GENERIC_PASSIVE_106: case PTT_GENERIC_PASSIVE_106:
case NTT_ISO14443_4A_106: case PTT_ISO14443_4A_106:
// We skip the first byte: its the target number (Tg) // We skip the first byte: its the target number (Tg)
pbtRawData++; pbtRawData++;
@ -415,8 +415,8 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_
} }
break; break;
case NTT_ISO14443_4B_106: case PTT_ISO14443_4B_106:
case NTT_ISO14443_4B_TCL_106: case PTT_ISO14443_4B_TCL_106:
// We skip the first byte: its the target number (Tg) // We skip the first byte: its the target number (Tg)
pbtRawData++; pbtRawData++;
@ -442,8 +442,8 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_
} }
break; break;
case NTT_FELICA_212: case PTT_FELICA_212:
case NTT_FELICA_424: case PTT_FELICA_424:
// We skip the first byte: its the target number (Tg) // We skip the first byte: its the target number (Tg)
pbtRawData++; pbtRawData++;
@ -461,7 +461,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_
memcpy (pnti->nfi.abtSysCode, pbtRawData, 2); memcpy (pnti->nfi.abtSysCode, pbtRawData, 2);
} }
break; break;
case NTT_JEWEL_106: case PTT_JEWEL_106:
// We skip the first byte: its the target number (Tg) // We skip the first byte: its the target number (Tg)
pbtRawData++; pbtRawData++;
@ -569,7 +569,7 @@ pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target)
bool bool
pn53x_InAutoPoll (nfc_device_t * pnd, pn53x_InAutoPoll (nfc_device_t * pnd,
const nfc_target_type_t * pnttTargetTypes, const size_t szTargetTypes, const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes,
const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound) const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound)
{ {
size_t szTxInAutoPoll, size_t szTxInAutoPoll,
@ -592,7 +592,7 @@ pn53x_InAutoPoll (nfc_device_t * pnd,
pbtTxInAutoPoll[2] = btPollNr; pbtTxInAutoPoll[2] = btPollNr;
pbtTxInAutoPoll[3] = btPeriod; pbtTxInAutoPoll[3] = btPeriod;
for (n = 0; n < szTargetTypes; n++) { for (n = 0; n < szTargetTypes; n++) {
pbtTxInAutoPoll[4 + n] = pnttTargetTypes[n]; pbtTxInAutoPoll[4 + n] = ppttTargetTypes[n];
} }
szRx = MAX_FRAME_LEN; szRx = MAX_FRAME_LEN;
@ -607,19 +607,19 @@ pn53x_InAutoPoll (nfc_device_t * pnd,
byte_t *pbt = abtRx + 1; byte_t *pbt = abtRx + 1;
/* 1st target */ /* 1st target */
// Target type // Target type
pntTargets[0].ntt = *(pbt++); pntTargets[0].ptt = *(pbt++);
// AutoPollTargetData length // AutoPollTargetData length
ln = *(pbt++); ln = *(pbt++);
pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[0].ntt, &(pntTargets[0].nti)); pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[0].ptt, &(pntTargets[0].nti));
pbt += ln; pbt += ln;
if (abtRx[0] > 1) { if (abtRx[0] > 1) {
/* 2nd target */ /* 2nd target */
// Target type // Target type
pntTargets[1].ntt = *(pbt++); pntTargets[1].ptt = *(pbt++);
// AutoPollTargetData length // AutoPollTargetData length
ln = *(pbt++); ln = *(pbt++);
pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[1].ntt, &(pntTargets[1].nti)); pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[1].ptt, &(pntTargets[1].nti));
} }
} }
} }
@ -1070,10 +1070,10 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta
const byte_t * pbtGB = NULL; const byte_t * pbtGB = NULL;
size_t szGB = 0; size_t szGB = 0;
switch(nt.ntt) { switch(nt.ptt) {
case NTT_MIFARE: case PTT_MIFARE:
case NTT_GENERIC_PASSIVE_106: case PTT_GENERIC_PASSIVE_106:
case NTT_ISO14443_4A_106: { case PTT_ISO14443_4A_106: {
// Set ATQA (SENS_RES) // Set ATQA (SENS_RES)
abtMifareParams[0] = nt.nti.nai.abtAtqa[1]; abtMifareParams[0] = nt.nti.nai.abtAtqa[1];
abtMifareParams[1] = nt.nti.nai.abtAtqa[0]; abtMifareParams[1] = nt.nti.nai.abtAtqa[0];
@ -1089,8 +1089,8 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta
} }
break; break;
case NTT_FELICA_212: case PTT_FELICA_212:
case NTT_FELICA_424: case PTT_FELICA_424:
// Set NFCID2t // Set NFCID2t
memcpy(abtFeliCaParams, nt.nti.nfi.abtId, 8); memcpy(abtFeliCaParams, nt.nti.nfi.abtId, 8);
// Set PAD // Set PAD
@ -1100,9 +1100,9 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta
pbtFeliCaParams = abtFeliCaParams; pbtFeliCaParams = abtFeliCaParams;
break; break;
case NTT_DEP_PASSIVE_106: case PTT_DEP_PASSIVE_106:
case NTT_DEP_PASSIVE_212: case PTT_DEP_PASSIVE_212:
case NTT_DEP_PASSIVE_424: case PTT_DEP_PASSIVE_424:
pbtNFCID3t = nt.nti.ndi.abtNFCID3; pbtNFCID3t = nt.nti.ndi.abtNFCID3;
szGB = nt.nti.ndi.szGB; szGB = nt.nti.ndi.szGB;
if (szGB) pbtGB = nt.nti.ndi.abtGB; if (szGB) pbtGB = nt.nti.ndi.abtGB;

View file

@ -105,7 +105,7 @@ bool pn53x_wrap_frame (const byte_t * pbtTx, const size_t szTxBits, const byt
size_t * pszFrameBits); size_t * pszFrameBits);
bool pn53x_unwrap_frame (const byte_t * pbtFrame, const size_t szFrameBits, byte_t * pbtRx, size_t * pszRxBits, bool pn53x_unwrap_frame (const byte_t * pbtFrame, const size_t szFrameBits, byte_t * pbtRx, size_t * pszRxBits,
byte_t * pbtRxPar); byte_t * pbtRxPar);
bool pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, nfc_target_type_t ntt, bool pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, pn53x_target_type_t ptt,
nfc_target_info_t * pnti); nfc_target_info_t * pnti);
bool pn53x_get_firmware_version (nfc_device_t * pnd); bool pn53x_get_firmware_version (nfc_device_t * pnd);
@ -140,7 +140,7 @@ bool pn53x_InListPassiveTarget (nfc_device_t * pnd, const nfc_modulation_t nm
const size_t szInitiatorDataLen, byte_t * pbtTargetsData, size_t * pszTargetsData); const size_t szInitiatorDataLen, byte_t * pbtTargetsData, size_t * pszTargetsData);
bool pn53x_InDeselect (nfc_device_t * pnd, const uint8_t ui8Target); bool pn53x_InDeselect (nfc_device_t * pnd, const uint8_t ui8Target);
bool pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target); bool pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target);
bool pn53x_InAutoPoll (nfc_device_t * pnd, const nfc_target_type_t * pnttTargetTypes, const size_t szTargetTypes, bool pn53x_InAutoPoll (nfc_device_t * pnd, const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes,
const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets,
size_t * pszTargetFound); size_t * pszTargetFound);
bool pn53x_InJumpForDEP (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, bool pn53x_InJumpForDEP (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation,

View file

@ -333,30 +333,30 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd,
// Fill the tag info struct with the values corresponding to this init modulation // Fill the tag info struct with the values corresponding to this init modulation
switch (nmInitModulation) { switch (nmInitModulation) {
case NM_ISO14443A_106: case NM_ISO14443A_106:
if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_GENERIC_PASSIVE_106, pnti)) { if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_GENERIC_PASSIVE_106, pnti)) {
return false; return false;
} }
break; break;
case NM_FELICA_212: case NM_FELICA_212:
if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_FELICA_212, pnti)) { if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_212, pnti)) {
return false; return false;
} }
break; break;
case NM_FELICA_424: case NM_FELICA_424:
if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_FELICA_424, pnti)) { if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_424, pnti)) {
return false; return false;
} }
break; break;
case NM_ISO14443B_106: case NM_ISO14443B_106:
if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_ISO14443_4B_106, pnti)) { if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_ISO14443_4B_106, pnti)) {
return false; return false;
} }
break; break;
case NM_JEWEL_106: case NM_JEWEL_106:
if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_JEWEL_106, pnti)) { if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_JEWEL_106, pnti)) {
return false; return false;
} }
break; break;
@ -431,8 +431,8 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t n
* @return Returns \c true if action was successfully performed; otherwise returns \c false. * @return Returns \c true if action was successfully performed; otherwise returns \c false.
* *
* @param pnd \a nfc_device_t struct pointer that represent currently used device * @param pnd \a nfc_device_t struct pointer that represent currently used device
* @param pnttTargetTypes array of desired target types * @param ppttTargetTypes array of desired target types
* @param szTargetTypes pnttTargetTypes count * @param szTargetTypes ppttTargetTypes count
* @param btPollNr specifies the number of polling * @param btPollNr specifies the number of polling
* @note one polling is a polling for each desired target type * @note one polling is a polling for each desired target type
* @param btPeriod indicates the polling period in units of 150 ms * @param btPeriod indicates the polling period in units of 150 ms
@ -441,13 +441,13 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t n
*/ */
bool bool
nfc_initiator_poll_targets (nfc_device_t * pnd, nfc_initiator_poll_targets (nfc_device_t * pnd,
const nfc_target_type_t * pnttTargetTypes, const size_t szTargetTypes, const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes,
const byte_t btPollNr, const byte_t btPeriod, const byte_t btPollNr, const byte_t btPeriod,
nfc_target_t * pntTargets, size_t * pszTargetFound) nfc_target_t * pntTargets, size_t * pszTargetFound)
{ {
pnd->iLastError = 0; pnd->iLastError = 0;
return pn53x_InAutoPoll (pnd, pnttTargetTypes, szTargetTypes, btPollNr, btPeriod, pntTargets, pszTargetFound); return pn53x_InAutoPoll (pnd, ppttTargetTypes, szTargetTypes, btPollNr, btPeriod, pntTargets, pszTargetFound);
} }
/** /**