nfc-messages.h   nfc-messages.h 
skipping to change at line 20 skipping to change at line 20
* *
* This program is distributed in the hope that it will be useful, but WITH OUT * This program is distributed in the hope that it will be useful, but WITH OUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License fo r * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License fo r
* more details. * more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/> * along with this program. If not, see <http://www.gnu.org/licenses/>
* *
* *
* @file messages.h * @file nfc-messages.h
* @brief * @brief Printing macros
*/ */
// TODO remove this file from installed headers.
#ifndef _LIBNFC_MESSAGES_H_ #ifndef _LIBNFC_MESSAGES_H_
# define _LIBNFC_MESSAGES_H_ # define _LIBNFC_MESSAGES_H_
# include <err.h> # include <err.h>
// #define DEBUG /* DEBUG flag can also be enabled using ./configure --en able-debug */ // #define DEBUG /* DEBUG flag can also be enabled using ./configure --en able-debug */
// Useful macros // Useful macros
# ifdef DEBUG # ifdef DEBUG
// #define DBG(x, args...) printf("DBG %s:%d: " x "\n", __FILE__, __LINE_ _,## args ) // #define DBG(x, args...) printf("DBG %s:%d: " x "\n", __FILE__, __LINE_ _,## args )
# define DBG(...) do { \ # define DBG(...) do { \
warnx ("DBG %s:%d", __FILE__, __LINE__); \ warnx ("DBG %s:%d", __FILE__, __LINE__); \
warnx (" " __VA_ARGS__ ); \ warnx (" " __VA_ARGS__ ); \
} while (0) } while (0)
# else # else
# define DBG(...) {} # define DBG(...) {}
# endif # endif
# define INFO(...) warnx ("INFO: " __VA_ARGS__ )
# define WARN(...) warnx ("WARNING: " __VA_ARGS__ ) # define WARN(...) warnx ("WARNING: " __VA_ARGS__ )
# define ERR(...) warnx ("ERROR: " __VA_ARGS__ ) # define ERR(...) warnx ("ERROR: " __VA_ARGS__ )
#endif // _LIBNFC_MESSAGES_H_ #endif // _LIBNFC_MESSAGES_H_
 End of changes. 3 change blocks. 
4 lines changed or deleted 3 lines changed or added


 nfc-types.h   nfc-types.h 
/** /**
* Public platform independent Near Field Communication (NFC) library * Public platform independent Near Field Communication (NFC) library
* *
* Copyright (C) 2009, Roel Verdult * Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romain Tartière, Romuald Conty
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the * under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your * Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, but WITH OUT * This program is distributed in the hope that it will be useful, but WITH OUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License fo r * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License fo r
* more details. * more details.
skipping to change at line 72 skipping to change at line 73
/** Pointer to the device connection specification */ /** Pointer to the device connection specification */
nfc_device_spec_t nds; nfc_device_spec_t nds;
/** This represents if the PN53X device was initialized succesful */ /** This represents if the PN53X device was initialized succesful */
bool bActive; bool bActive;
/** Is the crc automaticly added, checked and removed from the frames */ /** Is the crc automaticly added, checked and removed from the frames */
bool bCrc; bool bCrc;
/** Does the PN53x chip handles parity bits, all parities are handled as da ta */ /** Does the PN53x chip handles parity bits, all parities are handled as da ta */
bool bPar; bool bPar;
/** Should the PN53x chip handle frames encapsulation and chaining */ /** Should the PN53x chip handle frames encapsulation and chaining */
bool bEasyFraming; bool bEasyFraming;
/** The last tx bits setting, we need to reset this if it does not apply an /** Should the PN53x chip switch automatically in ISO14443-4 when ISO14443
ymore */ */
bool bAutoIso14443_4;
/** Register cache for REG_CIU_BIT_FRAMING, SYMBOL_TX_LAST_BITS: The last T
X bits setting, we need to reset this if it does not apply anymore */
uint8_t ui8TxBits; uint8_t ui8TxBits;
/** Register cache for SetParameters function. */
uint8_t ui8Parameters;
/** Supported modulation encoded in a byte */
byte_t btSupportByte;
/** Last error reported by the PCD / encountered by the PCD driver /** Last error reported by the PCD / encountered by the PCD driver
* MSB LSB * MSB LSB
* | 00 | 00 | * | 00 | 00 |
* || || * || ||
* || ++----- Chip-level error (as reported by the PCD) * || ++----- Chip-level error (as reported by the PCD)
* |+---------- Driver-level specific error * |+---------- Driver-level specific error
* +----------- Driver-level general error (common to all drivers) * +----------- Driver-level general error (common to all drivers)
*/ */
int iLastError; int iLastError;
} nfc_device_t; } nfc_device_t;
skipping to change at line 125 skipping to change at line 132
* @brief Generic structure to handle NFC device functions. * @brief Generic structure to handle NFC device functions.
*/ */
struct driver_callbacks { struct driver_callbacks {
/** Driver name */ /** Driver name */
const char *acDriver; const char *acDriver;
/** Chip specific callback functions */ /** Chip specific callback functions */
const struct chip_callbacks *pcc; const struct chip_callbacks *pcc;
/** Pick devices callback */ /** Pick devices callback */
nfc_device_desc_t *(*pick_device) (void); nfc_device_desc_t *(*pick_device) (void);
/** List devices callback */ /** List devices callback */
bool (*list_devices) (nfc_device_desc_t pnddDevices[], size_t szD evices, size_t * pszDeviceFound); bool (*list_devices) (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * pszDeviceFound);
/** Connect callback */ /** Connect callback */
nfc_device_t *(*connect) (const nfc_device_desc_t * pndd); nfc_device_t *(*connect) (const nfc_device_desc_t * pndd);
/** Transceive callback */ /** Transceive callback */
bool (*transceive) (nfc_device_t * pnd, const byte_t * pbtTx, const size_
bool (*transceive) (nfc_device_t * pnd, const byte_t * pbtTx, const siz t szTx, byte_t * pbtRx, size_t * pszRx);
e_t szTxLen, byte_t * pbtRx,
size_t * pszRxLen);
/** Disconnect callback */ /** Disconnect callback */
void (*disconnect) (nfc_device_t * pnd); void (*disconnect) (nfc_device_t * pnd);
}; };
// Compiler directive, set struct alignment to 1 byte_t for compatibility // Compiler directive, set struct alignment to 1 byte_t for compatibility
# pragma pack(1) # pragma pack(1)
/** /**
* @enum nfc_device_option_t * @enum nfc_device_option_t
* @brief NFC device option * @brief NFC device option
*/ */
typedef enum { typedef enum {
/** Let the PN53X chip handle the CRC bytes. This means that the chip appen /** Let the PN53X chip handle the CRC bytes. This means that the chip appen
ds the CRC bytes to the frames that are transmitted. It will parse the last ds
bytes from received frames as incoming CRC bytes. They will be verified ag * the CRC bytes to the frames that are transmitted. It will parse the last
ainst the used modulation and protocol. If an frame is expected with incorr * bytes from received frames as incoming CRC bytes. They will be verified
ect CRC bytes this option should be disabled. Example frames where this is * against the used modulation and protocol. If an frame is expected with
useful are the ATQA and UID+BCC that are transmitted without CRC bytes duri * incorrect CRC bytes this option should be disabled. Example frames where
ng the anti-collision phase of the ISO14443-A protocol. */ * this is useful are the ATQA and UID+BCC that are transmitted without CRC
* bytes during the anti-collision phase of the ISO14443-A protocol. */
NDO_HANDLE_CRC = 0x00, NDO_HANDLE_CRC = 0x00,
/** Parity bits in the network layer of ISO14443-A are by default generated /** Parity bits in the network layer of ISO14443-A are by default generated
and validated in the PN53X chip. This is a very convenient feature. On cer and
tain times though it is useful to get full control of the transmitted data. * validated in the PN53X chip. This is a very convenient feature. On certa
The proprietary MIFARE Classic protocol uses for example custom (encrypted in
) parity bits. For interoperability it is required to be completely compati * times though it is useful to get full control of the transmitted data. T
ble, including the arbitrary parity bits. When this option is disabled, the he
functions to communicating bits should be used. */ * proprietary MIFARE Classic protocol uses for example custom (encrypted)
* parity bits. For interoperability it is required to be completely
* compatible, including the arbitrary parity bits. When this option is
* disabled, the functions to communicating bits should be used. */
NDO_HANDLE_PARITY = 0x01, NDO_HANDLE_PARITY = 0x01,
/** This option can be used to enable or disable the electronic field of th /** This option can be used to enable or disable the electronic field of th
e NFC device. */ e
* NFC device. */
NDO_ACTIVATE_FIELD = 0x10, NDO_ACTIVATE_FIELD = 0x10,
/** The internal CRYPTO1 co-processor can be used to transmit messages encr /** The internal CRYPTO1 co-processor can be used to transmit messages
ypted. This option is automatically activated after a successful MIFARE Cla * encrypted. This option is automatically activated after a successful MIF
ssic authentication. */ ARE
* Classic authentication. */
NDO_ACTIVATE_CRYPTO1 = 0x11, NDO_ACTIVATE_CRYPTO1 = 0x11,
/** The default configuration defines that the PN53X chip will try indefini /** The default configuration defines that the PN53X chip will try indefini
tely to invite a tag in the field to respond. This could be desired when it tely
is certain a tag will enter the field. On the other hand, when this is unc * to invite a tag in the field to respond. This could be desired when it i
ertain, it will block the application. This option could best be compared t s
o the (NON)BLOCKING option used by (socket)network programming. */ * certain a tag will enter the field. On the other hand, when this is
* uncertain, it will block the application. This option could best be comp
ared
* to the (NON)BLOCKING option used by (socket)network programming. */
NDO_INFINITE_SELECT = 0x20, NDO_INFINITE_SELECT = 0x20,
/** If this option is enabled, frames that carry less than 4 bits are allow /** If this option is enabled, frames that carry less than 4 bits are allow
ed. According to the standards these frames should normally be handles as i ed.
nvalid frames. */ * According to the standards these frames should normally be handles as
* invalid frames. */
NDO_ACCEPT_INVALID_FRAMES = 0x30, NDO_ACCEPT_INVALID_FRAMES = 0x30,
/** If the NFC device should only listen to frames, it could be useful to l /** If the NFC device should only listen to frames, it could be useful to l
et it gather multiple frames in a sequence. They will be stored in the inte et
rnal FIFO of the PN53X chip. This could be retrieved by using the receive d * it gather multiple frames in a sequence. They will be stored in the inte
ata functions. Note that if the chip runs out of bytes (FIFO = 64 bytes lon rnal
g), it will overwrite the first received frames, so quick retrieving of the * FIFO of the PN53X chip. This could be retrieved by using the receive dat
received data is desirable. */ a
* functions. Note that if the chip runs out of bytes (FIFO = 64 bytes long
),
* it will overwrite the first received frames, so quick retrieving of the
* received data is desirable. */
NDO_ACCEPT_MULTIPLE_FRAMES = 0x31, NDO_ACCEPT_MULTIPLE_FRAMES = 0x31,
/** This option can be used to enable or disable the auto-switching mode to /** This option can be used to enable or disable the auto-switching mode to
ISO14443-4 is device is compliant */ * ISO14443-4 is device is compliant.
* In initiator mode, it means that NFC chip will send RATS automatically w
hen
* select and it will automatically poll for ISO14443-4 card when ISO14443A
is
* requested.
* In target mode, with a NFC chip compiliant (ie. PN532), the chip will
* emulate a 14443-4 PICC using hardware capability */
NDO_AUTO_ISO14443_4 = 0x40, NDO_AUTO_ISO14443_4 = 0x40,
/** Use automatic frames encapsulation and chaining. */ /** Use automatic frames encapsulation and chaining. */
NDO_EASY_FRAMING = 0x41, NDO_EASY_FRAMING = 0x41,
/** Force the chip to switch in ISO14443-A */
NDO_FORCE_ISO14443_A = 0x42,
} nfc_device_option_t; } nfc_device_option_t;
////////////////////////////////////////////////////////////////////
// nfc_reader_list_passive - using InListPassiveTarget
/** /**
* @enum nfc_modulation_t * @enum nfc_dep_mode_t
* @brief NFC modulation * @brief NFC D.E.P. (Data Exchange Protocol) active/passive mode
*/ */
typedef enum { typedef enum {
/** ISO14443-A (NXP MIFARE) http://en.wikipedia.org/wiki/MIFARE */ NDM_UNDEFINED = 0,
NM_ISO14443A_106 = 0x00, NDM_PASSIVE,
/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ NDM_ACTIVE,
NM_FELICA_212 = 0x01, } nfc_dep_mode_t;
/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */
NM_FELICA_424 = 0x02,
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 */
NM_ISO14443B_106 = 0x03,
/** Jewel Topaz (Innovision Research & Development) */
NM_JEWEL_106 = 0x04,
/** Active DEP */
NM_ACTIVE_DEP = 0x05,
/** Passive DEP */
NM_PASSIVE_DEP = 0x06
} nfc_modulation_t;
/** /**
* @struct nfc_dep_info_t * @struct nfc_dep_info_t
* @brief NFC tag information in Data Exchange Protocol * @brief NFC target information in D.E.P. (Data Exchange Protocol) see ISO /IEC 18092 (NFCIP-1)
*/ */
typedef struct { typedef struct {
byte_t NFCID3i[10]; /** NFCID3 */
byte_t abtNFCID3[10];
/** DID */
byte_t btDID; byte_t btDID;
byte_t btBSt; /** Supported send-bit rate */
byte_t btBRt; byte_t btBS;
/** Supported receive-bit rate */
byte_t btBR;
/** Timeout value */
byte_t btTO;
/** PP Parameters */
byte_t btPP;
/** General Bytes */
byte_t abtGB[48];
size_t szGB;
/** DEP mode */
nfc_dep_mode_t ndm;
} nfc_dep_info_t; } nfc_dep_info_t;
/** /**
* @struct nfc_iso14443a_info_t * @struct nfc_iso14443a_info_t
* @brief NFC ISO14443A tag (MIFARE) information * @brief NFC ISO14443A tag (MIFARE) information
*/ */
typedef struct { typedef struct {
byte_t abtAtqa[2]; byte_t abtAtqa[2];
byte_t btSak; byte_t btSak;
size_t szUidLen; size_t szUidLen;
byte_t abtUid[10]; byte_t abtUid[10];
size_t szAtsLen; size_t szAtsLen;
byte_t abtAts[36]; byte_t abtAts[254]; // Maximal theoretical ATS is FSD-2, FSD=256 for FSD I=8 in RATS
} nfc_iso14443a_info_t; } nfc_iso14443a_info_t;
/** /**
* @struct nfc_felica_info_t * @struct nfc_felica_info_t
* @brief NFC FeLiCa tag information * @brief NFC FeLiCa tag information
*/ */
typedef struct { typedef struct {
size_t szLen; size_t szLen;
byte_t btResCode; byte_t btResCode;
byte_t abtId[8]; byte_t abtId[8];
byte_t abtPad[8]; byte_t abtPad[8];
byte_t abtSysCode[2]; byte_t abtSysCode[2];
} nfc_felica_info_t; } nfc_felica_info_t;
/** /**
* @struct nfc_iso14443b_info_t * @struct nfc_iso14443b_info_t
* @brief NFC ISO14443B tag information * @brief NFC ISO14443B tag information
*/ */
typedef struct { typedef struct {
byte_t abtAtqb[12]; /** abtPupi store PUPI contained in ATQB (Answer To reQuest of type B) (see
byte_t abtId[4]; ISO14443-3) */
byte_t btParam1; byte_t abtPupi[4];
byte_t btParam2; /** abtApplicationData store Application Data contained in ATQB (see ISO144
byte_t btParam3; 43-3) */
byte_t btParam4; byte_t abtApplicationData[4];
byte_t btCid; /** abtProtocolInfo store Protocol Info contained in ATQB (see ISO14443-3)
size_t szInfLen; */
byte_t abtInf[64]; byte_t abtProtocolInfo[3];
/** ui8CardIdentifier store CID (Card Identifier) attributted by PCD to the
PICC */
uint8_t ui8CardIdentifier;
} nfc_iso14443b_info_t; } nfc_iso14443b_info_t;
/** /**
* @struct nfc_jewel_info_t * @struct nfc_jewel_info_t
* @brief NFC Jewel tag information * @brief NFC Jewel tag information
*/ */
typedef struct { typedef struct {
byte_t btSensRes[2]; byte_t btSensRes[2];
byte_t btId[4]; byte_t btId[4];
} nfc_jewel_info_t; } nfc_jewel_info_t;
skipping to change at line 262 skipping to change at line 299
*/ */
typedef union { typedef union {
nfc_iso14443a_info_t nai; nfc_iso14443a_info_t nai;
nfc_felica_info_t nfi; nfc_felica_info_t nfi;
nfc_iso14443b_info_t nbi; nfc_iso14443b_info_t nbi;
nfc_jewel_info_t nji; nfc_jewel_info_t nji;
nfc_dep_info_t ndi; nfc_dep_info_t ndi;
} nfc_target_info_t; } nfc_target_info_t;
/** /**
* @enum nfc_target_type_t * @enum nfc_baud_rate_t
* @brief NFC target type enumeration * @brief NFC baud rate enumeration
*/ */
typedef enum { typedef enum {
/** Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP) */ NBR_UNDEFINED = 0,
NTT_GENERIC_PASSIVE_106 = 0x00, NBR_106,
/** Generic passive 212 kbps (FeliCa, DEP) */ NBR_212,
NTT_GENERIC_PASSIVE_212 = 0x01, NBR_424,
/** Generic passive 424 kbps (FeliCa, DEP) */ NBR_847,
NTT_GENERIC_PASSIVE_424 = 0x02, } nfc_baud_rate_t;
/** Passive 106 kbps ISO/IEC14443-4B */
NTT_ISO14443B_106 = 0x03, /**
/** Innovision Jewel tag */ * @enum nfc_modulation_type_t
NTT_JEWEL_106 = 0x04, * @brief NFC modulation type enumeration
/** mifare card */ */
NTT_MIFARE = 0x10, typedef enum {
/** FeliCa 212 kbps card */ NMT_ISO14443A,
NTT_FELICA_212 = 0x11, NMT_ISO14443B,
/** FeliCa 424 kbps card */ NMT_FELICA,
NTT_FELICA_424 = 0x12, NMT_JEWEL,
/** Passive 106 kbps ISO/IEC14443-4A */ NMT_DEP,
NTT_ISO14443A_106 = 0x20, } nfc_modulation_type_t;
/** Passive 106 kbps ISO/IEC14443-4B with TCL flag */
NTT_ISO14443B_TCL_106 = 0x23, /**
/** DEP passive 106 kbps */ * @struct nfc_modulation_t
NTT_DEP_PASSIVE_106 = 0x40, * @brief NFC modulation structure
/** DEP passive 212 kbps */ */
NTT_DEP_PASSIVE_212 = 0x41, typedef struct {
/** DEP passive 424 kbps */ nfc_modulation_type_t nmt;
NTT_DEP_PASSIVE_424 = 0x42, nfc_baud_rate_t nbr;
/** DEP active 106 kbps */ } nfc_modulation_t;
NTT_DEP_ACTIVE_106 = 0x80,
/** DEP active 212 kbps */
NTT_DEP_ACTIVE_212 = 0x81,
/** DEP active 424 kbps */
NTT_DEP_ACTIVE_424 = 0x82,
} nfc_target_type_t;
/** /**
* @struct nfc_target_t * @struct nfc_target_t
* @brief NFC target structure * @brief NFC target structure
*/ */
typedef struct { typedef struct {
nfc_target_info_t nti; nfc_target_info_t nti;
nfc_target_type_t ntt; nfc_modulation_t nm;
} nfc_target_t; } nfc_target_t;
// Reset struct alignment to default // Reset struct alignment to default
# pragma pack() # pragma pack()
#endif // _LIBNFC_TYPES_H_ #endif // _LIBNFC_TYPES_H_
 End of changes. 25 change blocks. 
112 lines changed or deleted 137 lines changed or added


 nfc.h   nfc.h 
/*- /*-
* Public platform independent Near Field Communication (NFC) library * Public platform independent Near Field Communication (NFC) library
* *
* Copyright (C) 2009, Roel Verdult * Copyright (C) 2009, Roel Verdult
* Copyright (C) 2010, Romuald Conty
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the * under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your * Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, but WITH OUT * This program is distributed in the hope that it will be useful, but WITH OUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License fo r * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License fo r
* more details. * more details.
skipping to change at line 63 skipping to change at line 64
# endif # endif
/* _WIN32 */ /* _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 */
NFC_EXPORT void nfc_list_devices (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * pszDeviceFound);
NFC_EXPORT nfc_device_t *nfc_connect (nfc_device_desc_t * pndd); NFC_EXPORT nfc_device_t *nfc_connect (nfc_device_desc_t * pndd);
NFC_EXPORT void nfc_disconnect (nfc_device_t * pnd); NFC_EXPORT void nfc_disconnect (nfc_device_t * pnd);
NFC_EXPORT void nfc_list_devices (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * pszDeviceFound);
NFC_EXPORT bool nfc_configure (nfc_device_t * pnd, const nfc_device_optio n_t ndo, const bool bEnable); NFC_EXPORT bool nfc_configure (nfc_device_t * pnd, const nfc_device_optio n_t ndo, const bool bEnable);
/* NFC initiator: act as "reader" */ /* NFC initiator: act as "reader" */
NFC_EXPORT bool nfc_initiator_init (nfc_device_t * pnd); NFC_EXPORT bool nfc_initiator_init (nfc_device_t * pnd);
NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd, NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd,
const nfc_modulation_t nmInitModulation, const nfc_modulation_t nm,
const byte_t * pbtIn const byte_t * pbtIn
itData, const size_t szInitDataLen, itData, const size_t szInitData,
nfc_target_info_t * nfc_target_t * pnt);
pti); NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, c
NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, c onst nfc_modulation_t nm,
onst nfc_modulation_t nmInitModulation, nfc_target_t ant[], c
nfc_target_info_t ant onst size_t szTargets,
i[], const size_t szTargets,
size_t * pszTargetFou nd); size_t * pszTargetFou nd);
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 nfc _modulation_t * pnmTargetTypes,
const size_t szTargetTypes, c onst byte_t btPollNr, const byte_t btPeriod, const size_t szTargetTypes, c onst byte_t btPollNr, const byte_t btPeriod,
nfc_target_t * pntTargets, si ze_t * pszTargetFound); nfc_target_t * pntTargets, si ze_t * pszTargetFound);
NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, cons NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd,
t nfc_modulation_t nmInitModulation, const nfc_dep_mode_t ndm
const byte_t * pbtPidDat , const nfc_baud_rate_t nbr,
a, const size_t szPidDataLen, const nfc_dep_info_t * p
const byte_t * pbtNFCID3 ndiInitiator,
i, const size_t szNFCID3iDataLen, nfc_target_t * pnt);
const byte_t * pbtGbData
, const size_t szGbDataLen,
nfc_target_info_t * pti)
;
NFC_EXPORT bool nfc_initiator_deselect_target (nfc_device_t * pnd); NFC_EXPORT bool nfc_initiator_deselect_target (nfc_device_t * pnd);
NFC_EXPORT bool nfc_initiator_transceive_bytes (nfc_device_t * pnd, const
byte_t * pbtTx, const size_t szTx,
byte_t * pbtRx, size_t *
pszRx);
NFC_EXPORT bool nfc_initiator_transceive_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits, NFC_EXPORT bool nfc_initiator_transceive_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits,
const byte_t * pbtTxPar, b yte_t * pbtRx, size_t * pszRxBits, const byte_t * pbtTxPar, b yte_t * pbtRx, size_t * pszRxBits,
byte_t * pbtRxPar); byte_t * pbtRxPar);
NFC_EXPORT bool nfc_initiator_transceive_bytes (nfc_device_t * pnd, const
byte_t * pbtTx, const size_t szTxLen,
byte_t * pbtRx, size_t *
pszRxLen);
/* 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. */
NFC_EXPORT bool nfc_target_init (nfc_device_t * pnd, byte_t * pbtRx, size NFC_EXPORT bool nfc_target_init (nfc_device_t * pnd, nfc_target_t * pnt,
_t * pszRxBits); byte_t * pbtRx, size_t * pszRx);
NFC_EXPORT bool nfc_target_receive_bits (nfc_device_t * pnd, byte_t * pbt NFC_EXPORT bool nfc_target_send_bytes (nfc_device_t * pnd, const byte_t *
Rx, size_t * pszRxBits, byte_t * pbtRxPar); pbtTx, const size_t szTx);
NFC_EXPORT bool nfc_target_receive_bytes (nfc_device_t * pnd, byte_t * pb NFC_EXPORT bool nfc_target_receive_bytes (nfc_device_t * pnd, byte_t * pb
tRx, size_t * pszRxLen); tRx, size_t * pszRx);
NFC_EXPORT bool nfc_target_send_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits, NFC_EXPORT bool nfc_target_send_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits,
const byte_t * pbtTxPar); const byte_t * pbtTxPar);
NFC_EXPORT bool nfc_target_send_bytes (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxLen); NFC_EXPORT bool nfc_target_receive_bits (nfc_device_t * pnd, byte_t * pbt Rx, size_t * pszRxBits, byte_t * pbtRxPar);
/* Error reporting */ /* Error reporting */
NFC_EXPORT const char *nfc_strerror (const nfc_device_t * pnd); NFC_EXPORT const char *nfc_strerror (const nfc_device_t * pnd);
NFC_EXPORT int nfc_strerror_r (const nfc_device_t * pnd, char *pcStrErrBu f, size_t szBufLen); NFC_EXPORT int nfc_strerror_r (const nfc_device_t * pnd, char *pcStrErrBu f, size_t szBufLen);
NFC_EXPORT void nfc_perror (const nfc_device_t * pnd, const char *pcStrin g); NFC_EXPORT void nfc_perror (const nfc_device_t * pnd, const char *pcStrin g);
/* Special data accessors */ /* Special data accessors */
NFC_EXPORT const char *nfc_device_name (nfc_device_t * pnd); NFC_EXPORT const char *nfc_device_name (nfc_device_t * pnd);
/* Misc. functions */ /* Misc. functions */
NFC_EXPORT void iso14443a_crc (byte_t * pbtData, size_t szLen, byte_t * p btCrc); NFC_EXPORT void iso14443a_crc (byte_t * pbtData, size_t szLen, byte_t * p btCrc);
NFC_EXPORT void append_iso14443a_crc (byte_t * pbtData, size_t szLen); NFC_EXPORT void iso14443a_crc_append (byte_t * pbtData, size_t szLen);
NFC_EXPORT byte_t * iso14443a_locate_historical_bytes (byte_t * pbtAts, s
ize_t szAts, size_t * pszTk);
NFC_EXPORT const char *nfc_version (void); NFC_EXPORT const char *nfc_version (void);
/* PN53x specific errors */
// TODO: Be not PN53x-specific here
#define ETIMEOUT 0x01
#define ECRC 0x02
#define EPARITY 0x03
#define EBITCOUNT 0x04
#define EFRAMING 0x05
#define EBITCOLL 0x06
#define ESMALLBUF 0x07
#define EBUFOVF 0x09
#define ERFTIMEOUT 0x0a
#define ERFPROTO 0x0b
#define EOVHEAT 0x0d
#define EINBUFOVF 0x0e
#define EINVPARAM 0x10
#define EDEPUNKCMD 0x12
#define EINVRXFRAM 0x13
#define EMFAUTH 0x14
#define ENSECNOTSUPP 0x18 // PN533
#define EBCC 0x23
#define EDEPINVSTATE 0x25
#define EOPNOTALL 0x26
#define ECMD 0x27
#define ETGREL 0x29
#define ECID 0x2a
#define ECDISCARDED 0x2b
#define ENFCID3 0x2c
#define EOVCURRENT 0x2d
#define ENAD 0x2e
/* Common device-level errors */ /* Common device-level errors */
# define DEIO 0x1000/* Input/output error */ # define DEIO 0x1000/* Input/output error */
# define DEINVAL 0x2000/* Invalid argument */ # define DEINVAL 0x2000/* Invalid argument */
# define DETIMEOUT 0x3000/* Operation timeout */ # define DETIMEOUT 0x3000/* Operation timeout */
# ifdef __cplusplus # ifdef __cplusplus
} }
# endif // __cplusplus # endif // __cplusplus
#endif // _LIBNFC_H_ #endif // _LIBNFC_H_
 End of changes. 12 change blocks. 
34 lines changed or deleted 62 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/