New internal API function: pn53x_target_send_dep_bytes().

This commit is contained in:
Romain Tartiere 2010-08-24 10:13:09 +00:00
parent 3d69c8b694
commit 7f698431b7
3 changed files with 24 additions and 18 deletions

View file

@ -891,3 +891,24 @@ bool pn53x_target_receive_dep_bytes(nfc_device_t* pnd, byte_t* pbtRx, size_t* ps
// Everyting seems ok, return true
return true;
}
bool pn53x_target_send_dep_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen)
{
byte_t abtCmd[sizeof(pncmd_target_set_data)];
pnd->iLastError = 0;
memcpy(abtCmd,pncmd_target_set_data,sizeof(pncmd_target_set_data));
// We can not just send bytes without parity if while the PN53X expects we handled them
if (!pnd->bPar) return false;
// Copy the data into the command frame
memcpy(abtCmd+2,pbtTx,szTxLen);
// Try to send the bits to the reader
if (!pn53x_transceive(pnd,abtCmd,szTxLen+2,NULL,NULL)) return false;
// Everyting seems ok, return true
return true;
}

View file

@ -102,6 +102,7 @@ bool pn53x_transceive_bits(nfc_device_t* pnd, const byte_t* pbtTx, const size_t
bool pn53x_transceive_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
bool pn53x_target_receive_dep_bytes(nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxLen);
bool pn53x_target_send_dep_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen);
const char *pn53x_strerror (const nfc_device_t *pnd);