New internal API function: pn53x_target_receive_dep_bytes().
This commit is contained in:
parent
7a231cfb03
commit
3d69c8b694
3 changed files with 25 additions and 18 deletions
|
@ -870,3 +870,24 @@ bool pn53x_transceive_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const size_t
|
||||||
// Everything went successful
|
// Everything went successful
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool pn53x_target_receive_dep_bytes(nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxLen)
|
||||||
|
{
|
||||||
|
byte_t abtRx[MAX_FRAME_LEN];
|
||||||
|
size_t szRxLen;
|
||||||
|
|
||||||
|
pnd->iLastError = 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Try to gather a received frame from the reader
|
||||||
|
if (!pn53x_transceive(pnd,pncmd_target_get_data,2,abtRx,&szRxLen)) return false;
|
||||||
|
|
||||||
|
// Save the received byte count
|
||||||
|
*pszRxLen = szRxLen-1;
|
||||||
|
|
||||||
|
// Copy the received bytes
|
||||||
|
memcpy(pbtRx,abtRx+1,*pszRxLen);
|
||||||
|
|
||||||
|
// Everyting seems ok, return true
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -101,6 +101,8 @@ bool pn53x_transceive_dep_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const si
|
||||||
bool pn53x_transceive_bits(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxBits, const byte_t* pbtTxPar, byte_t* pbtRx, size_t* pszRxBits, byte_t* pbtRxPar);
|
bool pn53x_transceive_bits(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxBits, const byte_t* pbtTxPar, byte_t* pbtRx, size_t* pszRxBits, byte_t* pbtRxPar);
|
||||||
bool pn53x_transceive_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen, byte_t* pbtRx, size_t* pszRxLen);
|
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);
|
||||||
|
|
||||||
const char *pn53x_strerror (const nfc_device_t *pnd);
|
const char *pn53x_strerror (const nfc_device_t *pnd);
|
||||||
|
|
||||||
static const struct chip_callbacks pn53x_callbacks_list = {
|
static const struct chip_callbacks pn53x_callbacks_list = {
|
||||||
|
|
20
libnfc/nfc.c
20
libnfc/nfc.c
|
@ -68,7 +68,7 @@ nfc_device_desc_t * nfc_pick_device (void);
|
||||||
// extern const byte_t pncmd_initiator_auto_poll [ 5];
|
// extern const byte_t pncmd_initiator_auto_poll [ 5];
|
||||||
//
|
//
|
||||||
// // Target
|
// // Target
|
||||||
extern const byte_t pncmd_target_get_data [ 2];
|
// extern const byte_t pncmd_target_get_data [ 2];
|
||||||
extern const byte_t pncmd_target_set_data [264];
|
extern const byte_t pncmd_target_set_data [264];
|
||||||
extern const byte_t pncmd_target_init [ 39];
|
extern const byte_t pncmd_target_init [ 39];
|
||||||
// extern const byte_t pncmd_target_virtual_card [ 4];
|
// extern const byte_t pncmd_target_virtual_card [ 4];
|
||||||
|
@ -629,23 +629,7 @@ bool nfc_target_receive_bits(nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxBits
|
||||||
*/
|
*/
|
||||||
bool nfc_target_receive_dep_bytes(nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxLen)
|
bool nfc_target_receive_dep_bytes(nfc_device_t* pnd, byte_t* pbtRx, size_t* pszRxLen)
|
||||||
{
|
{
|
||||||
byte_t abtRx[MAX_FRAME_LEN];
|
return pn53x_target_receive_dep_bytes (pnd, pbtRx, pszRxLen);
|
||||||
size_t szRxLen;
|
|
||||||
|
|
||||||
pnd->iLastError = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Try to gather a received frame from the reader
|
|
||||||
if (!pn53x_transceive(pnd,pncmd_target_get_data,2,abtRx,&szRxLen)) return false;
|
|
||||||
|
|
||||||
// Save the received byte count
|
|
||||||
*pszRxLen = szRxLen-1;
|
|
||||||
|
|
||||||
// Copy the received bytes
|
|
||||||
memcpy(pbtRx,abtRx+1,*pszRxLen);
|
|
||||||
|
|
||||||
// Everyting seems ok, return true
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue