New internal API function: pn53x_target_send_dep_bytes().
This commit is contained in:
parent
3d69c8b694
commit
7f698431b7
3 changed files with 24 additions and 18 deletions
|
@ -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
|
// Everyting seems ok, return true
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
|
@ -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_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_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);
|
const char *pn53x_strerror (const nfc_device_t *pnd);
|
||||||
|
|
||||||
|
|
20
libnfc/nfc.c
20
libnfc/nfc.c
|
@ -69,7 +69,7 @@ nfc_device_desc_t * nfc_pick_device (void);
|
||||||
//
|
//
|
||||||
// // 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];
|
||||||
extern const byte_t pncmd_target_receive [ 2];
|
extern const byte_t pncmd_target_receive [ 2];
|
||||||
|
@ -740,23 +740,7 @@ bool nfc_target_send_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const size_t
|
||||||
*/
|
*/
|
||||||
bool nfc_target_send_dep_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen)
|
bool nfc_target_send_dep_bytes(nfc_device_t* pnd, const byte_t* pbtTx, const size_t szTxLen)
|
||||||
{
|
{
|
||||||
byte_t abtCmd[sizeof(pncmd_target_set_data)];
|
return pn53x_target_send_dep_bytes(pnd, pbtTx, szTxLen);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue