Factorise code.

Avoid redundant code in PN53x usb and uart drivers.  Since it makes sense to
report errors at the nfc_device_t level, pass it directly to
pn53x_transceive().

Programs using the libnfc MAY use pn53x_transceive() to communicate with a NFC
device, and SHALL not use anymore pnd->pdc->transceive().  Code in the library
itself SHOULD avoid calling pnd->pdc->transceive(), so such construct have been
updated accordingly.
This commit is contained in:
Romain Tartiere 2010-07-31 14:20:15 +00:00
parent 301d692e8a
commit 79aeaa6287
15 changed files with 80 additions and 70 deletions

View file

@ -45,6 +45,7 @@
#include <nfc/nfc.h>
#include <nfc/nfc-messages.h>
#include "nfc-utils.h"
#include "chips/pn53x.h"
#define MAX_FRAME_LEN 264
#define TIMEOUT 60 // secs.
@ -80,7 +81,7 @@ bool sam_connection(nfc_device_t* pnd, int mode)
break;
}
if (!pnd->pdc->transceive(pnd->nds,pncmd_sam_config,szCmd,abtRx,&szRxLen)) {
if (!pn53x_transceive(pnd,pncmd_sam_config,szCmd,abtRx,&szRxLen)) {
ERR("%s %d", "Unable to execute SAMConfiguration command with mode byte:", mode);
return false;
}