Mostly revert r521.
It was obviously an April joke: iErrorCode which was renamed iPICCError is indeed a PCD Error, so I renamed it to iLastError since communications errors are also to handle at the device driver level (read chip level), although I guess that some errors would be common to distinct devices. PICC error are irrelevant because they can either be transmission error detection (in which case the libnfc should retry the transmission) or application-level errors the libnfc cannot be aware of.
This commit is contained in:
parent
0502401a29
commit
f4bc39bf41
3 changed files with 9 additions and 9 deletions
|
@ -69,8 +69,8 @@ typedef struct {
|
|||
bool bPar;
|
||||
/** The last tx bits setting, we need to reset this if it does not apply anymore */
|
||||
uint8_t ui8TxBits;
|
||||
/** Last error reported by the PICC */
|
||||
int iPICCError;
|
||||
/** Last error reported by the PCD / encountered by the PCD driver */
|
||||
int iLastError;
|
||||
} nfc_device_t;
|
||||
|
||||
|
||||
|
|
|
@ -121,13 +121,13 @@ bool pn53x_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxL
|
|||
case 0x90: // TgResponseToInitiator
|
||||
case 0x92: // TgSetGeneralBytes
|
||||
case 0x94: // TgSetMetaData
|
||||
pnd->iPICCError = pbtRx[0] & 0x3f;
|
||||
pnd->iLastError = pbtRx[0] & 0x3f;
|
||||
break;
|
||||
default:
|
||||
pnd->iPICCError = 0;
|
||||
pnd->iLastError = 0;
|
||||
}
|
||||
|
||||
return (0 == pnd->iPICCError);
|
||||
return (0 == pnd->iLastError);
|
||||
}
|
||||
|
||||
byte_t pn53x_get_reg(nfc_device_t* pnd, uint16_t ui16Reg)
|
||||
|
@ -421,7 +421,7 @@ pn53x_strerror (const nfc_device_t *pnd)
|
|||
size_t i;
|
||||
|
||||
for (i=0; i < (sizeof (sErrorMessages) / sizeof (struct sErrorMessage)); i++) {
|
||||
if (sErrorMessages[i].iErrorCode == pnd->iPICCError) {
|
||||
if (sErrorMessages[i].iErrorCode == pnd->iLastError) {
|
||||
pcRes = sErrorMessages[i].pcErrorMsg;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1088,7 +1088,7 @@ bool nfc_target_send_dep_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const siz
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Return the PICC/PCD error string
|
||||
* @brief Return the PCD error string
|
||||
* @return Returns a string
|
||||
*/
|
||||
const char *nfc_strerror (const nfc_device_t *pnd)
|
||||
|
@ -1097,7 +1097,7 @@ const char *nfc_strerror (const nfc_device_t *pnd)
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Renders the PICC/PCD error in pcStrErrBuf for a maximum size of szBufLen caracters
|
||||
* @brief Renders the PCD error in pcStrErrBuf for a maximum size of szBufLen caracters
|
||||
* @return Returns 0 upon success
|
||||
*/
|
||||
int nfc_strerror_r (const nfc_device_t *pnd, char *pcStrErrBuf, size_t szBufLen)
|
||||
|
@ -1106,7 +1106,7 @@ int nfc_strerror_r (const nfc_device_t *pnd, char *pcStrErrBuf, size_t szBufLen)
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Display the PICC/PCD error a-la perror
|
||||
* @brief Display the PCD error a-la perror
|
||||
*/
|
||||
void nfc_perror (const nfc_device_t *pnd, const char *pcString)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue