| nfc.h | | nfc.h | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| * | | * | |
| * Provide all usefull functions (API) to handle NFC devices. | | * Provide all usefull functions (API) to handle NFC devices. | |
| */ | | */ | |
| | | | |
| #ifndef _LIBNFC_H_ | | #ifndef _LIBNFC_H_ | |
| #define _LIBNFC_H_ | | #define _LIBNFC_H_ | |
| | | | |
| #include <stdint.h> | | #include <stdint.h> | |
| #include <stdbool.h> | | #include <stdbool.h> | |
| | | | |
|
| | | #ifdef _WIN32 | |
| | | /* Windows platform */ | |
| | | #ifndef _WINDLL | |
| | | /* CMake compilation */ | |
| | | #ifdef nfc_EXPORTS | |
| | | #define NFC_EXPORT __declspec(dllexport) | |
| | | #else /* nfc_EXPORTS */ | |
| | | #define NFC_EXPORT __declspec(dllimport) | |
| | | #endif /* nfc_EXPORTS */ | |
| | | #else /* _WINDLL */ | |
| | | /* Manual makefile */ | |
| | | #define NFC_EXPORT | |
| | | #endif /* _WINDLL */ | |
| | | #else /* _WIN32 */ | |
| | | #define NFC_EXPORT | |
| | | #endif /* _WIN32 */ | |
| | | | |
| #include <nfc/nfc-types.h> | | #include <nfc/nfc-types.h> | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif // __cplusplus | | #endif // __cplusplus | |
| | | | |
| /* NFC Device/Hardware manipulation */ | | /* NFC Device/Hardware manipulation */ | |
|
| void nfc_list_devices(nfc_device_desc_t pnddDevices[], size_t szDevices, si | | NFC_EXPORT void nfc_list_devices(nfc_device_desc_t pnddDevices[], size_t sz | |
| ze_t *pszDeviceFound); | | Devices, size_t *pszDeviceFound); | |
| nfc_device_t* nfc_connect(nfc_device_desc_t* pndd); | | NFC_EXPORT nfc_device_t* nfc_connect(nfc_device_desc_t* pndd); | |
| void nfc_disconnect(nfc_device_t* pnd); | | NFC_EXPORT void nfc_disconnect(nfc_device_t* pnd); | |
| bool nfc_configure(nfc_device_t* pnd, const nfc_device_option_t ndo, const | | NFC_EXPORT bool nfc_configure(nfc_device_t* pnd, const nfc_device_option_t | |
| bool bEnable); | | ndo, const bool bEnable); | |
| | | | |
| /* NFC initiator: act as "reader" */ | | /* NFC initiator: act as "reader" */ | |
|
| bool nfc_initiator_init(const nfc_device_t* pnd); | | NFC_EXPORT bool nfc_initiator_init(const nfc_device_t* pnd); | |
| bool nfc_initiator_select_tag(const nfc_device_t* pnd, const nfc_modulation | | NFC_EXPORT bool nfc_initiator_select_tag(const nfc_device_t* pnd, const nfc | |
| _t nmInitModulation, const byte_t* pbtInitData, const size_t szInitDataLen, | | _modulation_t nmInitModulation, const byte_t* pbtInitData, const size_t szI | |
| nfc_target_info_t* pti); | | nitDataLen, nfc_target_info_t* pti); | |
| bool nfc_initiator_select_dep_target(const nfc_device_t* pnd, const nfc_mod | | NFC_EXPORT bool nfc_initiator_select_dep_target(const nfc_device_t* pnd, co | |
| ulation_t nmInitModulation, const byte_t* pbtPidData, const size_t szPidDat | | nst nfc_modulation_t nmInitModulation, const byte_t* pbtPidData, const size | |
| aLen, const byte_t* pbtNFCID3i, const size_t szNFCID3iDataLen, const byte_t | | _t szPidDataLen, const byte_t* pbtNFCID3i, const size_t szNFCID3iDataLen, c | |
| *pbtGbData, const size_t szGbDataLen, nfc_target_info_t* pti); | | onst byte_t *pbtGbData, const size_t szGbDataLen, nfc_target_info_t* pti); | |
| bool nfc_initiator_deselect_tag(const nfc_device_t* pnd); | | NFC_EXPORT bool nfc_initiator_deselect_tag(const nfc_device_t* pnd); | |
| bool nfc_initiator_transceive_bits(const nfc_device_t* pnd, const byte_t* p | | NFC_EXPORT bool nfc_initiator_transceive_bits(const nfc_device_t* pnd, cons | |
| btTx, const size_t szTxBits, const byte_t* pbtTxPar, byte_t* pbtRx, size_t* | | t byte_t* pbtTx, const size_t szTxBits, const byte_t* pbtTxPar, byte_t* pbt | |
| pszRxBits, byte_t* pbtRxPar); | | Rx, size_t* pszRxBits, byte_t* pbtRxPar); | |
| bool nfc_initiator_transceive_bytes(const nfc_device_t* pnd, const byte_t* | | NFC_EXPORT bool nfc_initiator_transceive_bytes(const nfc_device_t* pnd, con | |
| pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen); | | st 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 | | NFC_EXPORT bool nfc_initiator_transceive_dep_bytes(const nfc_device_t* pnd, | |
| _t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen); | | 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_EXPORT bool nfc_initiator_mifare_cmd(const nfc_device_t* pnd, const mif | |
| | | are_cmd mc, const uint8_t ui8Block, mifare_param* pmp); | |
| | | | |
| /* NFC target: act as tag (i.e. MIFARE Classic) or NFC target device. */ | | /* 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* pszRxB | | NFC_EXPORT bool nfc_target_init(const nfc_device_t* pnd, byte_t* pbtRx, siz | |
| its); | | e_t* pszRxBits); | |
| bool nfc_target_receive_bits(const nfc_device_t* pnd, byte_t* pbtRx, size_t | | NFC_EXPORT bool nfc_target_receive_bits(const nfc_device_t* pnd, byte_t* pb | |
| * pszRxBits, byte_t* pbtRxPar); | | tRx, size_t* pszRxBits, byte_t* pbtRxPar); | |
| bool nfc_target_receive_bytes(const nfc_device_t* pnd, byte_t* pbtRx, size_ | | NFC_EXPORT bool nfc_target_receive_bytes(const nfc_device_t* pnd, byte_t* p | |
| t* pszRxLen); | | btRx, size_t* pszRxLen); | |
| bool nfc_target_receive_dep_bytes(const nfc_device_t* pnd, byte_t* pbtRx, s | | NFC_EXPORT bool nfc_target_receive_dep_bytes(const nfc_device_t* pnd, byte_ | |
| ize_t* pszRxLen); | | t* pbtRx, size_t* pszRxLen); | |
| bool nfc_target_send_bits(const nfc_device_t* pnd, const byte_t* pbtTx, con | | NFC_EXPORT bool nfc_target_send_bits(const nfc_device_t* pnd, const byte_t* | |
| st size_t szTxBits, const byte_t* pbtTxPar); | | pbtTx, const size_t szTxBits, const byte_t* pbtTxPar); | |
| bool nfc_target_send_bytes(const nfc_device_t* pnd, const byte_t* pbtTx, co | | NFC_EXPORT bool nfc_target_send_bytes(const nfc_device_t* pnd, const byte_t | |
| nst size_t szTxLen); | | * pbtTx, const size_t szTxLen); | |
| bool nfc_target_send_dep_bytes(const nfc_device_t* pnd, const byte_t* pbtTx | | NFC_EXPORT bool nfc_target_send_dep_bytes(const nfc_device_t* pnd, const by | |
| , const size_t szTxLen); | | te_t* pbtTx, const size_t szTxLen); | |
| | | | |
| /* Special data accessors */ | | /* Special data accessors */ | |
|
| const char* nfc_device_name(nfc_device_t* pnd); | | NFC_EXPORT const char* nfc_device_name(nfc_device_t* pnd); | |
| | | | |
| /* Misc. functions */ | | /* Misc. functions */ | |
|
| const char* nfc_version(void); | | NFC_EXPORT void iso14443a_crc(byte_t* pbtData, size_t szLen, byte_t* pbtCrc | |
| | | ); | |
| | | NFC_EXPORT const char* nfc_version(void); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif // __cplusplus | | #endif // __cplusplus | |
| | | | |
| #endif // _LIBNFC_H_ | | #endif // _LIBNFC_H_ | |
| | | | |
End of changes. 6 change blocks. |
| 40 lines changed or deleted | | 60 lines changed or added | |
|