diff --git a/src/examples/nfc-list.c b/src/examples/nfc-list.c index 3046ecd..abd48c1 100644 --- a/src/examples/nfc-list.c +++ b/src/examples/nfc-list.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see - * + * * * @file nfc-list.c * @brief @@ -31,12 +31,9 @@ #include #include #include - #include #include - - #include #include "bitutils.h" @@ -62,21 +59,21 @@ int main(int argc, const char* argv[]) #endif #endif - // Lazy way to open an NFC device - - //pnd = nfc_connect(NULL); - //nfc_disconnect(pnd); - //return 1; + /* Lazy way to open an NFC device */ +#if 0 + pnd = nfc_connect(NULL); +#endif - // If specific device is wanted, i.e. an ARYGON device on /dev/ttyUSB0 - /* + /* If specific device is wanted, i.e. an ARYGON device on /dev/ttyUSB0 */ +#if 0 nfc_device_desc_t ndd; ndd.pcDriver = "ARYGON"; ndd.pcPort = "/dev/ttyUSB0"; ndd.uiSpeed = 115200; pnd = nfc_connect(&ndd); - */ +#endif + if (!(pnddDevices = malloc (MAX_DEVICE_COUNT * sizeof (*pnddDevices)))) { fprintf (stderr, "malloc() failed\n"); diff --git a/src/include/nfc/nfc.h b/src/include/nfc/nfc.h index 8051617..b4de9a2 100644 --- a/src/include/nfc/nfc.h +++ b/src/include/nfc/nfc.h @@ -1,4 +1,4 @@ -/** +/*- * Public platform independent Near Field Communication (NFC) library * * Copyright (C) 2009, Roel Verdult @@ -15,10 +15,11 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see - * - * + */ + +/** * @file nfc.h - * @brief nfc interface + * @brief libnfc interface * * Provide all usefull functions (API) to handle NFC devices. */ @@ -36,26 +37,23 @@ extern "C" { #endif // __cplusplus +/* NFC Device/Hardware manipulation */ void nfc_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, size_t *pszDeviceFound); - nfc_device_t* nfc_connect(nfc_device_desc_t* pndd); - void nfc_disconnect(nfc_device_t* pnd); - bool nfc_configure(nfc_device_t* pnd, const nfc_device_option_t ndo, const bool bEnable); + +/* NFC initiator: act as "reader" */ bool nfc_initiator_init(const nfc_device_t* pnd); - bool nfc_initiator_select_tag(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t* pbtInitData, const size_t szInitDataLen, nfc_target_info_t* pti); - bool nfc_initiator_select_dep_target(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t* pbtPidData, const size_t szPidDataLen, const byte_t* pbtNFCID3i, const size_t szNFCID3iDataLen, const byte_t *pbtGbData, const size_t szGbDataLen, nfc_target_info_t* pti); bool nfc_initiator_deselect_tag(const nfc_device_t* pnd); - bool nfc_initiator_transceive_bits(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxBits, const byte_t* pbtTxPar, byte_t* pbtRx, size_t* pszRxBits, byte_t* pbtRxPar); - bool nfc_initiator_transceive_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen); bool nfc_initiator_transceive_dep_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen); - bool nfc_initiator_mifare_cmd(const nfc_device_t* pnd, const mifare_cmd mc, const uint8_t ui8Block, mifare_param* pmp); + +/* NFC target: act as tag (i.e. MIFARE Classic) or NFC target device. */ bool nfc_target_init(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxBits); bool nfc_target_receive_bits(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxBits, byte_t* pbtRxPar); bool nfc_target_receive_bytes(const nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxLen);