本文整理汇总了C++中phDal4Nfc_link_cbk_interface_t::write方法的典型用法代码示例。如果您正苦于以下问题:C++ phDal4Nfc_link_cbk_interface_t::write方法的具体用法?C++ phDal4Nfc_link_cbk_interface_t::write怎么用?C++ phDal4Nfc_link_cbk_interface_t::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phDal4Nfc_link_cbk_interface_t
的用法示例。
在下文中一共展示了phDal4Nfc_link_cbk_interface_t::write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: phDal4Nfc_DeferredCb
/**
* \ingroup grp_nfc_dal
*
* \brief DAL deferred callback function
* Generic handler function called by a client thread when reading a message from the queue.
* Will function will directly call the client function (same context). See phDal4Nfc_DeferredCall
*
* \param[in] params Parameter that will be passed to the client function.
*
*/
void phDal4Nfc_DeferredCb (void *params)
{
int* pParam=NULL;
int i;
phNfc_sTransactionInfo_t TransactionInfo;
pParam=(int*)params;
switch(*pParam)
{
case PHDAL4NFC_READ_MESSAGE:
DAL_PRINT(" Dal deferred read called \n");
TransactionInfo.buffer=gReadWriteContext.pReadBuffer;
TransactionInfo.length=(uint16_t)gReadWriteContext.nNbOfBytesRead;
TransactionInfo.status=NFCSTATUS_SUCCESS;
gReadWriteContext.nReadBusy = FALSE;
/* Reset flag so that another opertion can be issued.*/
gReadWriteContext.nWaitingOnRead = FALSE;
if ((NULL != pgDalContext) && (NULL != pgDalContext->cb_if.receive_complete))
{
pgDalContext->cb_if.receive_complete(pgDalContext->cb_if.pif_ctxt,
pgDalHwContext,&TransactionInfo);
}
break;
case PHDAL4NFC_WRITE_MESSAGE:
DAL_PRINT(" Dal deferred write called \n");
#ifdef LOW_LEVEL_TRACES
phOsalNfc_PrintData("Send buffer", (uint16_t)gReadWriteContext.nNbOfBytesToWrite, gReadWriteContext.pWriteBuffer);
#endif
/* DAL_DEBUG("dalMsg->transactInfo.length : %d\n", dalMsg->transactInfo.length); */
/* Make a Physical WRITE */
/* NOTE: need to usleep(3000) here if the write is for SWP */
usleep(500); /* NXP advise 500us sleep required between I2C writes */
gReadWriteContext.nNbOfBytesWritten = gLinkFunc.write(gReadWriteContext.pWriteBuffer, gReadWriteContext.nNbOfBytesToWrite);
if (gReadWriteContext.nNbOfBytesWritten != gReadWriteContext.nNbOfBytesToWrite)
{
/* controller may be in standby. do it again! */
usleep(10000); /* wait 10 ms */
gReadWriteContext.nNbOfBytesWritten = gLinkFunc.write(gReadWriteContext.pWriteBuffer, gReadWriteContext.nNbOfBytesToWrite);
}
if (gReadWriteContext.nNbOfBytesWritten != gReadWriteContext.nNbOfBytesToWrite)
{
/* Report write failure or timeout */
DAL_PRINT(" Physical Write Error !!! \n");
TransactionInfo.length=(uint16_t)gReadWriteContext.nNbOfBytesWritten;
TransactionInfo.status = PHNFCSTVAL(CID_NFC_DAL, NFCSTATUS_BOARD_COMMUNICATION_ERROR);
}
else
{
DAL_PRINT(" Physical Write Success \n");
TransactionInfo.length=(uint16_t)gReadWriteContext.nNbOfBytesWritten;
TransactionInfo.status=NFCSTATUS_SUCCESS;
DAL_PRINT("WriteBuff[]={ ");
for (i = 0; i < gReadWriteContext.nNbOfBytesWritten; i++)
{
DAL_DEBUG("0x%x ", gReadWriteContext.pWriteBuffer[i]);
}
DAL_PRINT("}\n");
// Free TempWriteBuffer
if(gReadWriteContext.pTempWriteBuffer != NULL)
{
free(gReadWriteContext.pTempWriteBuffer);
}
}
/* Reset Write context */
gReadWriteContext.nWriteBusy = FALSE;
gReadWriteContext.nWaitingOnWrite = FALSE;
/* call LLC callback */
if ((NULL != pgDalContext) && (NULL != pgDalContext->cb_if.send_complete))
{
pgDalContext->cb_if.send_complete(pgDalContext->cb_if.pif_ctxt,
pgDalHwContext,&TransactionInfo);
}
break;
default:
break;
}
}