00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00027 #ifndef _LIBNFC_H_
00028 # define _LIBNFC_H_
00029
00030 # include <stdint.h>
00031 # include <stdbool.h>
00032
00033 # ifdef _WIN32
00034
00035 # ifndef _WINDLL
00036
00037 # ifdef nfc_EXPORTS
00038 # define NFC_EXPORT __declspec(dllexport)
00039 # else
00040
00041 # define NFC_EXPORT __declspec(dllimport)
00042 # endif
00043
00044 # else
00045
00046
00047 # define NFC_EXPORT
00048 # endif
00049
00050 # else
00051
00052 # define NFC_EXPORT
00053 # endif
00054
00055
00056 # include <nfc/nfc-types.h>
00057
00058 # ifdef __cplusplus
00059 extern "C" {
00060 # endif // __cplusplus
00061
00062
00063 NFC_EXPORT void nfc_list_devices (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * pszDeviceFound);
00064 NFC_EXPORT nfc_device_t *nfc_connect (nfc_device_desc_t * pndd);
00065 NFC_EXPORT void nfc_disconnect (nfc_device_t * pnd);
00066 NFC_EXPORT bool nfc_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool bEnable);
00067
00068
00069 NFC_EXPORT bool nfc_initiator_init (nfc_device_t * pnd);
00070 NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation,
00071 const byte_t * pbtInitData, const size_t szInitDataLen,
00072 nfc_target_info_t * pti);
00073 NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation,
00074 nfc_target_info_t anti[], const size_t szTargets,
00075 size_t * pszTargetFound);
00076 NFC_EXPORT bool nfc_initiator_poll_targets (nfc_device_t * pnd, const nfc_target_type_t * pnttTargetTypes,
00077 const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod,
00078 nfc_target_t * pntTargets, size_t * pszTargetFound);
00079 NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation,
00080 const byte_t * pbtPidData, const size_t szPidDataLen,
00081 const byte_t * pbtNFCID3i, const size_t szNFCID3iDataLen,
00082 const byte_t * pbtGbData, const size_t szGbDataLen,
00083 nfc_target_info_t * pti);
00084 NFC_EXPORT bool nfc_initiator_deselect_target (nfc_device_t * pnd);
00085 NFC_EXPORT bool nfc_initiator_transceive_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits,
00086 const byte_t * pbtTxPar, byte_t * pbtRx, size_t * pszRxBits,
00087 byte_t * pbtRxPar);
00088 NFC_EXPORT bool nfc_initiator_transceive_bytes (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxLen,
00089 byte_t * pbtRx, size_t * pszRxLen);
00090
00091
00092 NFC_EXPORT bool nfc_target_init (nfc_device_t * pnd, byte_t * pbtRx, size_t * pszRxBits);
00093 NFC_EXPORT bool nfc_target_receive_bits (nfc_device_t * pnd, byte_t * pbtRx, size_t * pszRxBits, byte_t * pbtRxPar);
00094 NFC_EXPORT bool nfc_target_receive_bytes (nfc_device_t * pnd, byte_t * pbtRx, size_t * pszRxLen);
00095 NFC_EXPORT bool nfc_target_send_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits,
00096 const byte_t * pbtTxPar);
00097 NFC_EXPORT bool nfc_target_send_bytes (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxLen);
00098
00099
00100 NFC_EXPORT const char *nfc_strerror (const nfc_device_t * pnd);
00101 NFC_EXPORT int nfc_strerror_r (const nfc_device_t * pnd, char *pcStrErrBuf, size_t szBufLen);
00102 NFC_EXPORT void nfc_perror (const nfc_device_t * pnd, const char *pcString);
00103
00104
00105 NFC_EXPORT const char *nfc_device_name (nfc_device_t * pnd);
00106
00107
00108 NFC_EXPORT void iso14443a_crc (byte_t * pbtData, size_t szLen, byte_t * pbtCrc);
00109 NFC_EXPORT void append_iso14443a_crc (byte_t * pbtData, size_t szLen);
00110 NFC_EXPORT const char *nfc_version (void);
00111
00112
00113 # define DEIO 0x1000
00114 # define DEINVAL 0x2000
00115 # define DETIMEOUT 0x3000
00116
00117 # ifdef __cplusplus
00118 }
00119 # endif // __cplusplus
00120 #endif // _LIBNFC_H_