diff --git a/examples/doc/quick_start_example1.c b/examples/doc/quick_start_example1.c index f8dd379..22c4cc9 100644 --- a/examples/doc/quick_start_example1.c +++ b/examples/doc/quick_start_example1.c @@ -32,7 +32,7 @@ main (int argc, const char *argv[]) printf ("Connected to NFC reader: %s\n", pnd->acName); // Poll for a ISO14443A (MIFARE) tag - if (nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { printf ("The following (NFC) ISO14443A tag was found:\n"); printf (" ATQA (SENS_RES): "); print_hex (nti.nai.abtAtqa, 2); diff --git a/examples/nfc-dep-initiator.c b/examples/nfc-dep-initiator.c index eb5f34a..b8d63b9 100644 --- a/examples/nfc-dep-initiator.c +++ b/examples/nfc-dep-initiator.c @@ -62,7 +62,7 @@ main (int argc, const char *argv[]) return EXIT_FAILURE; } - if(!nfc_initiator_select_dep_target (pnd, NM_PASSIVE_DEP, NULL, &nti)) { + if(!nfc_initiator_select_dep_target (pnd, PM_PASSIVE_DEP, NULL, &nti)) { nfc_perror(pnd, "nfc_initiator_select_dep_target"); return EXIT_FAILURE; } diff --git a/examples/nfc-list.c b/examples/nfc-list.c index e20c16c..9304cbd 100644 --- a/examples/nfc-list.c +++ b/examples/nfc-list.c @@ -142,7 +142,7 @@ main (int argc, const char *argv[]) printf ("Connected to NFC device: %s\n", pnd->acName); // List ISO14443A targets - if (nfc_initiator_list_passive_targets (pnd, NM_ISO14443A_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, PM_ISO14443A_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d ISO14443A passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); for (n = 0; n < szTargetFound; n++) { @@ -151,7 +151,7 @@ main (int argc, const char *argv[]) } } // List Felica tags - if (nfc_initiator_list_passive_targets (pnd, NM_FELICA_212, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, PM_FELICA_212, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d Felica (212 kbps) passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); @@ -160,7 +160,7 @@ main (int argc, const char *argv[]) printf ("\n"); } } - if (nfc_initiator_list_passive_targets (pnd, NM_FELICA_424, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, PM_FELICA_424, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d Felica (424 kbps) passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); @@ -170,7 +170,7 @@ main (int argc, const char *argv[]) } } // List ISO14443B targets - if (nfc_initiator_list_passive_targets (pnd, NM_ISO14443B_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, PM_ISO14443B_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d ISO14443B passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); for (n = 0; n < szTargetFound; n++) { @@ -180,7 +180,7 @@ main (int argc, const char *argv[]) } // List Jewel targets - if (nfc_initiator_list_passive_targets(pnd, NM_JEWEL_106, anti, MAX_TARGET_COUNT, &szTargetFound )) { + if (nfc_initiator_list_passive_targets(pnd, PM_JEWEL_106, anti, MAX_TARGET_COUNT, &szTargetFound )) { size_t n; printf("%d Jewel passive target(s) was found%s\n", (int)szTargetFound, (szTargetFound==0)?".\n":":"); for(n=0; nacName); // Try to find a MIFARE Classic tag - if (!nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { printf ("Error: no tag was found\n"); nfc_disconnect (pnd); exit (EXIT_FAILURE); diff --git a/examples/nfc-mfultralight.c b/examples/nfc-mfultralight.c index 3ef4db1..9076d7e 100644 --- a/examples/nfc-mfultralight.c +++ b/examples/nfc-mfultralight.c @@ -116,7 +116,7 @@ write_card (void) // Show if the readout went well if (bFailure) { // When a failure occured we need to redo the anti-collision - if (!nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { ERR ("tag was removed"); return false; } @@ -216,7 +216,7 @@ main (int argc, const char *argv[]) printf ("Connected to NFC device: %s\n", pnd->acName); // Try to find a MIFARE Ultralight tag - if (!nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { ERR ("no tag was found\n"); nfc_disconnect (pnd); return 1; diff --git a/examples/pn53x-sam.c b/examples/pn53x-sam.c index 750e4f2..85241ec 100644 --- a/examples/pn53x-sam.c +++ b/examples/pn53x-sam.c @@ -181,7 +181,7 @@ main (int argc, const char *argv[]) exit (EXIT_FAILURE); } // Read the SAM's info - if (!nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { nfc_perror (pnd, "nfc_initiator_select_passive_target"); ERR ("%s", "Reading of SAM info failed."); return EXIT_FAILURE; diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index a51dbfd..eed268f 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -166,31 +166,31 @@ typedef enum { } nfc_device_option_t; /** - * @enum nfc_modulation_t + * @enum pn53x_modulation_t * @brief NFC modulation */ typedef enum { /** ISO14443-A (NXP MIFARE) http://en.wikipedia.org/wiki/MIFARE */ - NM_ISO14443A_106 = 0x00, + PM_ISO14443A_106 = 0x00, /** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ - NM_FELICA_212 = 0x01, + PM_FELICA_212 = 0x01, /** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ - NM_FELICA_424 = 0x02, + PM_FELICA_424 = 0x02, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */ - NM_ISO14443B_106 = 0x03, + PM_ISO14443B_106 = 0x03, /** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */ - NM_JEWEL_106 = 0x04, + PM_JEWEL_106 = 0x04, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ - NM_ISO14443B_212 = 0x06, + PM_ISO14443B_212 = 0x06, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ - NM_ISO14443B_424 = 0x07, + PM_ISO14443B_424 = 0x07, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ - NM_ISO14443B_847 = 0x08, + PM_ISO14443B_847 = 0x08, /** Active DEP */ - NM_ACTIVE_DEP, + PM_ACTIVE_DEP, /** Passive DEP */ - NM_PASSIVE_DEP -} nfc_modulation_t; + PM_PASSIVE_DEP +} pn53x_modulation_t; /** * @struct nfc_dep_info_t diff --git a/include/nfc/nfc.h b/include/nfc/nfc.h index 6c5e6ba..6932465 100644 --- a/include/nfc/nfc.h +++ b/include/nfc/nfc.h @@ -68,16 +68,16 @@ extern "C" { /* NFC initiator: act as "reader" */ NFC_EXPORT bool nfc_initiator_init (nfc_device_t * pnd); - NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, + NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const byte_t * pbtInitData, const size_t szInitDataLen, nfc_target_info_t * pti); - 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 pn53x_modulation_t pmInitModulation, nfc_target_info_t anti[], const size_t szTargets, size_t * pszTargetFound); 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, 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 pn53x_modulation_t pmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pti); NFC_EXPORT bool nfc_initiator_deselect_target (nfc_device_t * pnd); diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 95a6069..32bac36 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -482,7 +482,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ * @return true if command is successfully sent * * @param pnd nfc_device_t struct pointer that represent currently used device - * @param nmInitModulation Desired modulation + * @param pmInitModulation Desired modulation * @param pbtInitiatorData Optional initiator data used for Felica, ISO14443B, Topaz Polling or for ISO14443A selecting a specific UID * @param szInitiatorDataLen Length of initiator data \a pbtInitiatorData * @param pbtTargetsData pointer on a pre-allocated byte array to receive TargetData[n] as described in pn53x user manual @@ -493,7 +493,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ */ bool pn53x_InListPassiveTarget (nfc_device_t * pnd, - const nfc_modulation_t nmInitModulation, const byte_t szMaxTargets, + const pn53x_modulation_t pmInitModulation, const byte_t szMaxTargets, const byte_t * pbtInitiatorData, const size_t szInitiatorDataLen, byte_t * pbtTargetsData, size_t * pszTargetsData) { @@ -504,23 +504,23 @@ pn53x_InListPassiveTarget (nfc_device_t * pnd, abtCmd[2] = szMaxTargets; // MaxTg // XXX Is there is a better way to do this ? - switch(nmInitModulation) { - case NM_ISO14443A_106: - case NM_FELICA_212: - case NM_FELICA_424: + switch(pmInitModulation) { + case PM_ISO14443A_106: + case PM_FELICA_212: + case PM_FELICA_424: // all gone fine. break; - case NM_ISO14443B_106: - case NM_JEWEL_106: + case PM_ISO14443B_106: + case PM_JEWEL_106: if(pnd->nc == NC_PN531) { // These modulations are not supported by pn531 pnd->iLastError = DENOTSUP; return false; } break; - case NM_ISO14443B_212: - case NM_ISO14443B_424: - case NM_ISO14443B_847: + case PM_ISO14443B_212: + case PM_ISO14443B_424: + case PM_ISO14443B_847: if(pnd->nc != NC_PN533) { // These modulations are not supported by pn531 neither pn532 pnd->iLastError = DENOTSUP; @@ -531,7 +531,7 @@ pn53x_InListPassiveTarget (nfc_device_t * pnd, pnd->iLastError = DENOTSUP; return false; } - abtCmd[3] = nmInitModulation; // BrTy, the type of init modulation used for polling a passive tag + abtCmd[3] = pmInitModulation; // BrTy, the type of init modulation used for polling a passive tag // Set the optional initiator data (used for Felica, ISO14443B, Topaz Polling or for ISO14443A selecting a specific UID). if (pbtInitiatorData) @@ -821,20 +821,20 @@ pn53x_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool b } bool -pn53x_initiator_select_dep_target(nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +pn53x_initiator_select_dep_target(nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) { if (pndiInitiator) { - return pn53x_InJumpForDEP (pnd, nmInitModulation, NULL, 0, pndiInitiator->abtNFCID3, pndiInitiator->abtGB, pndiInitiator->szGB, pnti); + return pn53x_InJumpForDEP (pnd, pmInitModulation, NULL, 0, pndiInitiator->abtNFCID3, pndiInitiator->abtGB, pndiInitiator->szGB, pnti); } else { - return pn53x_InJumpForDEP (pnd, nmInitModulation, NULL, 0, NULL, NULL, 0, pnti); + return pn53x_InJumpForDEP (pnd, pmInitModulation, NULL, 0, NULL, NULL, 0, pnti); } } /** * @brief Wrapper for InJumpForDEP command - * @param nmInitModulation desired initial modulation + * @param pmInitModulation desired initial modulation * @param pbtPassiveInitiatorData NFCID1 at 106kbps (see NFCIP-1: 11.2.1.26) or Polling Request Frame's payload at 212/424kbps (see NFCIP-1: 11.2.2.5) * @param szPassiveInitiatorData size of pbtPassiveInitiatorData content * @param pbtNFCID3i NFCID3 of the initiator @@ -843,7 +843,7 @@ pn53x_initiator_select_dep_target(nfc_device_t * pnd, const nfc_modulation_t nmI * @param[out] pnti nfc_target_info_t which will be filled by this function */ bool -pn53x_InJumpForDEP (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +pn53x_InJumpForDEP (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const byte_t * pbtPassiveInitiatorData, const size_t szPassiveInitiatorData, const byte_t * pbtNFCID3i, const byte_t * pbtGB, const size_t szGB, @@ -856,14 +856,14 @@ pn53x_InJumpForDEP (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, memcpy (abtCmd, pncmd_initiator_jump_for_dep, sizeof (pncmd_initiator_jump_for_dep)); - if (nmInitModulation == NM_ACTIVE_DEP) { + if (pmInitModulation == PM_ACTIVE_DEP) { abtCmd[2] = 0x01; /* active DEP */ } // FIXME Baud rate in D.E.P. mode is hard-wired as 106kbps abtCmd[3] = 0x00; /* baud rate = 106kbps */ offset = 5; - if (pbtPassiveInitiatorData && (nmInitModulation != NM_ACTIVE_DEP)) { /* can't have passive initiator data when using active mode */ + if (pbtPassiveInitiatorData && (pmInitModulation != PM_ACTIVE_DEP)) { /* can't have passive initiator data when using active mode */ abtCmd[4] |= 0x01; memcpy (abtCmd + offset, pbtPassiveInitiatorData, szPassiveInitiatorData); offset += szPassiveInitiatorData; diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index 346fdaf..e2ad140 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -112,7 +112,7 @@ bool pn53x_get_firmware_version (nfc_device_t * pnd); bool pn53x_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool bEnable); // NFC device as Initiator functions -bool pn53x_initiator_select_dep_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +bool pn53x_initiator_select_dep_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti); bool pn53x_initiator_transceive_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits, @@ -135,7 +135,7 @@ static const struct chip_callbacks pn53x_callbacks_list = { // C wrappers for PN53x commands bool pn53x_SetParameters (nfc_device_t * pnd, const uint8_t ui8Value); -bool pn53x_InListPassiveTarget (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +bool pn53x_InListPassiveTarget (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const byte_t szMaxTargets, const byte_t * pbtInitiatorData, const size_t szInitiatorDataLen, byte_t * pbtTargetsData, size_t * pszTargetsData); bool pn53x_InDeselect (nfc_device_t * pnd, const uint8_t ui8Target); @@ -143,7 +143,7 @@ bool pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target); 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, size_t * pszTargetFound); -bool pn53x_InJumpForDEP (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +bool pn53x_InJumpForDEP (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const byte_t * pbtPassiveInitiatorData, const size_t szPassiveInitiatorData, const byte_t * pbtNFCID3i, const byte_t * pbtGB, const size_t szGB, diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 82e70d7..dc38322 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -262,7 +262,7 @@ nfc_initiator_init (nfc_device_t * pnd) * @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 nmInitModulation Desired modulation + * @param pmInitModulation Desired modulation * @param pbtInitData Optional initiator data used for Felica, ISO14443B, Topaz polling or to select a specific UID in ISO14443A. * @param szInitDataLen Length of initiator data \a pbtInitData. * @param[out] pnti nfc_target_info_t struct pointer which will filled if available @@ -275,7 +275,7 @@ nfc_initiator_init (nfc_device_t * pnd) */ bool nfc_initiator_select_passive_target (nfc_device_t * pnd, - const nfc_modulation_t nmInitModulation, + const pn53x_modulation_t pmInitModulation, const byte_t * pbtInitData, const size_t szInitDataLen, nfc_target_info_t * pnti) { byte_t abtInit[MAX_FRAME_LEN]; @@ -290,8 +290,8 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, if (!pnd->bActive) return false; // TODO Put this in a function: this part is defined by ISO14443-3 (UID and Cascade levels) - switch (nmInitModulation) { - case NM_ISO14443A_106: + switch (pmInitModulation) { + case PM_ISO14443A_106: switch (szInitDataLen) { case 7: abtInit[0] = 0x88; @@ -321,7 +321,7 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, break; } - if (!pn53x_InListPassiveTarget (pnd, nmInitModulation, 1, abtInit, szInitLen, abtTargetsData, &szTargetsData)) + if (!pn53x_InListPassiveTarget (pnd, pmInitModulation, 1, abtInit, szInitLen, abtTargetsData, &szTargetsData)) return false; // Make sure one tag has been found, the PN53X returns 0x00 if none was available @@ -331,31 +331,31 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, // Is a tag info struct available if (pnti) { // Fill the tag info struct with the values corresponding to this init modulation - switch (nmInitModulation) { - case NM_ISO14443A_106: + switch (pmInitModulation) { + case PM_ISO14443A_106: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_GENERIC_PASSIVE_106, pnti)) { return false; } break; - case NM_FELICA_212: + case PM_FELICA_212: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_212, pnti)) { return false; } break; - case NM_FELICA_424: + case PM_FELICA_424: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_424, pnti)) { return false; } break; - case NM_ISO14443B_106: + case PM_ISO14443B_106: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_ISO14443_4B_106, pnti)) { return false; } break; - case NM_JEWEL_106: + case PM_JEWEL_106: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_JEWEL_106, pnti)) { return false; } @@ -375,7 +375,7 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, * @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 nmInitModulation Desired modulation + * @param pmInitModulation Desired modulation * @param[out] anti array of \a nfc_target_info_t that will be filled with targets info * @param szTargets Size of \a anti (will be the max targets listed) * @param[out] pszTargetFound Pointer where target found counter will be stored @@ -384,7 +384,7 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, * @note For every initial modulation type there is a different collection of information returned (in \a nfc_target_info_t pointer pti) They all fit in the data-type which is called nfc_target_info_t. This is a union which contains the tag information that belongs to the according initial modulation type. */ bool -nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +nfc_initiator_list_passive_targets (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, nfc_target_info_t anti[], const size_t szTargets, size_t * pszTargetFound) { nfc_target_info_t nti; @@ -397,17 +397,17 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t n // Let the reader only try once to find a target nfc_configure (pnd, NDO_INFINITE_SELECT, false); - if (nmInitModulation == NM_ISO14443B_106) { + if (pmInitModulation == PM_ISO14443B_106) { // Application Family Identifier (AFI) must equals 0x00 in order to wakeup all ISO14443-B PICCs (see ISO/IEC 14443-3) pbtInitData = (byte_t *) "\x00"; szInitDataLen = 1; - } else if (nmInitModulation == NM_FELICA_212 || nmInitModulation == NM_FELICA_424) { + } else if (pmInitModulation == PM_FELICA_212 || pmInitModulation == PM_FELICA_424) { // polling payload must be present (see ISO/IEC 18092 11.2.2.5) pbtInitData = (byte_t *) "\x00\xff\xff\x01\x00"; szInitDataLen = 5; } - while (nfc_initiator_select_passive_target (pnd, nmInitModulation, pbtInitData, szInitDataLen, &nti)) { + while (nfc_initiator_select_passive_target (pnd, pmInitModulation, pbtInitData, szInitDataLen, &nti)) { nfc_initiator_deselect_target (pnd); if (szTargets > szTargetFound) { @@ -417,7 +417,7 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t n } szTargetFound++; // deselect has no effect on FeliCa and Jewel cards so we'll stop after one... - if (nmInitModulation == NM_FELICA_212 || nmInitModulation == NM_FELICA_424 || nmInitModulation == NM_JEWEL_106) { + if (pmInitModulation == PM_FELICA_212 || pmInitModulation == PM_FELICA_424 || pmInitModulation == PM_JEWEL_106) { break; } } @@ -455,7 +455,7 @@ nfc_initiator_poll_targets (nfc_device_t * pnd, * @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 nmInitModulation desired modulation (\a NM_ACTIVE_DEP or \a NM_PASSIVE_DEP for active, respectively passive mode) + * @param pmInitModulation desired modulation (\a PM_ACTIVE_DEP or \a PM_PASSIVE_DEP for active, respectively passive mode) * @param ndiInitiator \a nfc_dep_info_t struct that contains NFCID3 and General Bytes to set to the initiator device * @param[out] pnti is a \a nfc_target_info_t struct pointer where target information will be put. * @@ -466,11 +466,11 @@ nfc_initiator_poll_targets (nfc_device_t * pnd, * @note \a nfc_dep_info_t will be returned when the target was acquired successfully. */ bool -nfc_initiator_select_dep_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) +nfc_initiator_select_dep_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) { pnd->iLastError = 0; - return pn53x_initiator_select_dep_target (pnd, nmInitModulation, pndiInitiator, pnti); + return pn53x_initiator_select_dep_target (pnd, pmInitModulation, pndiInitiator, pnti); } /** diff --git a/test/test_access_storm.c b/test/test_access_storm.c index de1e715..ddc95f8 100644 --- a/test/test_access_storm.c +++ b/test/test_access_storm.c @@ -56,7 +56,7 @@ test_access_storm (void) res = nfc_configure(device,NDO_ACTIVATE_FIELD,true); cut_assert_true (res, cut_message ("nfc_configure")); - res = nfc_initiator_list_passive_targets(device, NM_ISO14443A_106, anti, MAX_TARGET_COUNT, &target_count); + res = nfc_initiator_list_passive_targets(device, PM_ISO14443A_106, anti, MAX_TARGET_COUNT, &target_count); cut_assert_true (res, cut_message ("nfc_initiator_list_passive_targets")); nfc_disconnect (device);