new properties to tune timeouts:

- add nfc_properties (will replace nfc_options)
 - introduce some error codes
 - rework functions to use the new timeout_command value
This commit is contained in:
Romuald Conty 2011-12-14 13:27:11 +00:00
parent 8b76d55fdc
commit 26b9c28f48
10 changed files with 145 additions and 30 deletions

View file

@ -74,6 +74,30 @@ typedef struct {
*/
typedef char nfc_connstring[1024];
/**
* Properties
*/
typedef enum {
/**
* Default command processing timeout
* Property value's (duration) unit is ms and 0 means no timeout (infinite).
* Default value is set by driver layer
*/
NP_TIMEOUT_COMMAND,
/**
* Timeout between ATR_REQ and ATR_RES
* When the device is in initiator mode, a target is considered as mute if no
* valid ATR_RES is received within this timeout value.
* Default value for this property is 103 ms on PN53x based devices.
*/
NP_TIMEOUT_ATR,
/**
* Timeout value to give up reception from the target in case of no answer.
* Default value for this property is 52 ms).
*/
NP_TIMEOUT_COM,
} nfc_property;
// Compiler directive, set struct alignment to 1 uint8_t for compatibility
# pragma pack(1)

View file

@ -98,12 +98,22 @@ extern "C" {
/* Special data accessors */
NFC_EXPORT const char *nfc_device_name (nfc_device *pnd);
/* Properties accessors */
NFC_EXPORT int nfc_device_set_property_int (nfc_device *pnd, const nfc_property property, const int value);
// NFC_EXPORT int nfc_device_set_property_bool (nfc_device *pnd, const nfc_property property, const int value);
/* Misc. functions */
NFC_EXPORT void iso14443a_crc (uint8_t *pbtData, size_t szLen, uint8_t *pbtCrc);
NFC_EXPORT void iso14443a_crc_append (uint8_t *pbtData, size_t szLen);
NFC_EXPORT uint8_t *iso14443a_locate_historical_bytes (uint8_t *pbtAts, size_t szAts, size_t *pszTk);
NFC_EXPORT const char *nfc_version (void);
/* Error codes */
#define NFC_SUCCESS 0 // No error
#define NFC_EIO -1 // Input / output error, device will not be usable anymore
#define NFC_ENOTSUP -2 // Operation not supported
#define NFC_EINVARG -3 // Invalid argument(s)
/* PN53x specific errors */
// TODO: Be not PN53x-specific here
#define ETIMEOUT 0x01