Enhance error handeling.
- New API functions: nfc_strerror(), nfc_strerror_r() and nfc_perror(); - Drivers now have a reference to chips callback methods; - Rename -pn53x_err2string to pn53x_strerror and add it to pn53x_callbacks_list.
This commit is contained in:
parent
30e715cff0
commit
daa178b18f
7 changed files with 96 additions and 63 deletions
|
|
@ -93,6 +93,15 @@ typedef struct {
|
|||
uint32_t uiBusIndex;
|
||||
} nfc_device_desc_t;
|
||||
|
||||
/**
|
||||
* @struct chip_callbacks
|
||||
* @brief Functions for chip specific functions.
|
||||
*/
|
||||
struct chip_callbacks {
|
||||
/** Error lookup */
|
||||
const char* (*strerror) (const nfc_device_t *pnd);
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct driver_callbacks
|
||||
* @brief Generic structure to handle NFC device functions.
|
||||
|
|
@ -100,6 +109,8 @@ typedef struct {
|
|||
struct driver_callbacks {
|
||||
/** Driver name */
|
||||
const char* acDriver;
|
||||
/** Chip specific callback functions */
|
||||
const struct chip_callbacks *pcc;
|
||||
/** Pick devices callback */
|
||||
nfc_device_desc_t *(*pick_device)(void);
|
||||
/** List devices callback */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue