Attempt to provide clean types for API
This commit is contained in:
parent
9020014160
commit
d289eabc36
19 changed files with 437 additions and 311 deletions
|
|
@ -165,33 +165,6 @@ typedef enum {
|
|||
NDO_FORCE_ISO14443_A = 0x42,
|
||||
} nfc_device_option_t;
|
||||
|
||||
/**
|
||||
* @enum pn53x_modulation_t
|
||||
* @brief NFC modulation
|
||||
*/
|
||||
typedef enum {
|
||||
/** ISO14443-A (NXP MIFARE) http://en.wikipedia.org/wiki/MIFARE */
|
||||
PM_ISO14443A_106 = 0x00,
|
||||
/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */
|
||||
PM_FELICA_212 = 0x01,
|
||||
/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */
|
||||
PM_FELICA_424 = 0x02,
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */
|
||||
PM_ISO14443B_106 = 0x03,
|
||||
/** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */
|
||||
PM_JEWEL_106 = 0x04,
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
|
||||
PM_ISO14443B_212 = 0x06,
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
|
||||
PM_ISO14443B_424 = 0x07,
|
||||
/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */
|
||||
PM_ISO14443B_847 = 0x08,
|
||||
/** Active DEP */
|
||||
PM_ACTIVE_DEP,
|
||||
/** Passive DEP */
|
||||
PM_PASSIVE_DEP
|
||||
} pn53x_modulation_t;
|
||||
|
||||
/**
|
||||
* @struct nfc_dep_info_t
|
||||
* @brief NFC tag information in D.E.P. (Data Exchange Protocol) see ISO/IEC 18092
|
||||
|
|
@ -291,43 +264,36 @@ typedef enum {
|
|||
} nfc_target_mode_t;
|
||||
|
||||
/**
|
||||
* @enum pn53x_target_type_t
|
||||
* @brief NFC target type enumeration
|
||||
* @enum nfc_baud_rate_t
|
||||
* @brief NFC baud rate enumeration
|
||||
*/
|
||||
typedef enum {
|
||||
/** Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP) */
|
||||
PTT_GENERIC_PASSIVE_106 = 0x00,
|
||||
/** Generic passive 212 kbps (FeliCa, DEP) */
|
||||
PTT_GENERIC_PASSIVE_212 = 0x01,
|
||||
/** Generic passive 424 kbps (FeliCa, DEP) */
|
||||
PTT_GENERIC_PASSIVE_424 = 0x02,
|
||||
/** Passive 106 kbps ISO/IEC14443-4B */
|
||||
PTT_ISO14443_4B_106 = 0x03,
|
||||
/** Innovision Jewel tag */
|
||||
PTT_JEWEL_106 = 0x04,
|
||||
/** Mifare card */
|
||||
PTT_MIFARE = 0x10,
|
||||
/** FeliCa 212 kbps card */
|
||||
PTT_FELICA_212 = 0x11,
|
||||
/** FeliCa 424 kbps card */
|
||||
PTT_FELICA_424 = 0x12,
|
||||
/** Passive 106 kbps ISO/IEC 14443-4A */
|
||||
PTT_ISO14443_4A_106 = 0x20,
|
||||
/** Passive 106 kbps ISO/IEC 14443-4B with TCL flag */
|
||||
PTT_ISO14443_4B_TCL_106 = 0x23,
|
||||
/** DEP passive 106 kbps */
|
||||
PTT_DEP_PASSIVE_106 = 0x40,
|
||||
/** DEP passive 212 kbps */
|
||||
PTT_DEP_PASSIVE_212 = 0x41,
|
||||
/** DEP passive 424 kbps */
|
||||
PTT_DEP_PASSIVE_424 = 0x42,
|
||||
/** DEP active 106 kbps */
|
||||
PTT_DEP_ACTIVE_106 = 0x80,
|
||||
/** DEP active 212 kbps */
|
||||
PTT_DEP_ACTIVE_212 = 0x81,
|
||||
/** DEP active 424 kbps */
|
||||
PTT_DEP_ACTIVE_424 = 0x82,
|
||||
} pn53x_target_type_t;
|
||||
NBR_106,
|
||||
NBR_212,
|
||||
NBR_424,
|
||||
} nfc_baud_rate_t;
|
||||
|
||||
/**
|
||||
* @enum nfc_modulation_type_t
|
||||
* @brief NFC modulation type enumeration
|
||||
*/
|
||||
typedef enum {
|
||||
NMT_UNKNOWN,
|
||||
NMT_ISO14443A,
|
||||
NMT_ISO14443B,
|
||||
NMT_FELICA,
|
||||
NMT_JEWEL,
|
||||
NMT_DEP,
|
||||
} nfc_modulation_type_t;
|
||||
|
||||
/**
|
||||
* @struct nfc_modulation_t
|
||||
* @brief NFC modulation structure
|
||||
*/
|
||||
typedef struct {
|
||||
nfc_modulation_type_t nmt;
|
||||
nfc_baud_rate_t nbr;
|
||||
} nfc_modulation_t;
|
||||
|
||||
/**
|
||||
* @struct nfc_target_t
|
||||
|
|
@ -335,7 +301,7 @@ typedef enum {
|
|||
*/
|
||||
typedef struct {
|
||||
nfc_target_info_t nti;
|
||||
pn53x_target_type_t ptt;
|
||||
nfc_modulation_type_t nmt;
|
||||
} nfc_target_t;
|
||||
|
||||
// Reset struct alignment to default
|
||||
|
|
|
|||
|
|
@ -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 pn53x_modulation_t pmInitModulation,
|
||||
const byte_t * pbtInitData, const size_t szInitDataLen,
|
||||
NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd, const nfc_modulation_t nm,
|
||||
const byte_t * pbtInitData, const size_t szInitData,
|
||||
nfc_target_info_t * pti);
|
||||
NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation,
|
||||
NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nm,
|
||||
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,
|
||||
NFC_EXPORT bool nfc_initiator_poll_targets (nfc_device_t * pnd, const nfc_modulation_t * pnmTargetTypes,
|
||||
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 pn53x_modulation_t pmInitModulation,
|
||||
NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, const bool bActiveDep,
|
||||
const nfc_dep_info_t * pndiInitiator,
|
||||
nfc_target_info_t * pti);
|
||||
NFC_EXPORT bool nfc_initiator_deselect_target (nfc_device_t * pnd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue