enhance new error handling

- add accessor to last error occured
- add new public error NFC_ETGRELEASED (Target Released)
This commit is contained in:
Romuald Conty 2012-01-05 01:39:10 +00:00
parent 125553c72e
commit 93b34fa70b
3 changed files with 64 additions and 11 deletions

View file

@ -93,6 +93,7 @@ extern "C" {
NFC_EXPORT const char *nfc_strerror (const nfc_device *pnd);
NFC_EXPORT int nfc_strerror_r (const nfc_device *pnd, char *buf, size_t buflen);
NFC_EXPORT void nfc_perror (const nfc_device *pnd, const char *s);
NFC_EXPORT int nfc_device_get_last_error (const nfc_device *pnd);
/* Special data accessors */
NFC_EXPORT const char *nfc_device_get_name (nfc_device *pnd);
@ -111,14 +112,15 @@ extern "C" {
#define NFC_SUCCESS 0 // No error
#define NFC_EIO -1 // Input / output error, device will not be usable anymore
#define NFC_EINVARG -2 // Invalid argument(s)
#define NFC_ENOTSUCHDEV -3 // No such device
#define NFC_ETIMEOUT -4 // Operation timed out
#define NFC_EDEVNOTSUPP -3 // Operation not supported by device
#define NFC_ENOTSUCHDEV -4 // No such device
#define NFC_EOVFLOW -5 // Buffer overflow
#define NFC_EOPABORTED -6 // Operation aborted (by user)
#define NFC_ECHIP -7 // Device's internal chip error
#define NFC_ERFTRANS -8 // Error while RF transmission
#define NFC_EDEVNOTSUPP -9 // Operation not supported by device
#define NFC_ENOTIMPL -10 // Not (yet) implemented
#define NFC_ETIMEOUT -6 // Operation timed out
#define NFC_EOPABORTED -7 // Operation aborted (by user)
#define NFC_ENOTIMPL -8 // Not (yet) implemented
#define NFC_ETGRELEASED -10 // Target released
#define NFC_ERFTRANS -20 // Error while RF transmission
#define NFC_ECHIP -90 // Device's internal chip error
# ifdef __cplusplus
}