本文整理汇总了C++中SyncEvent类的典型用法代码示例。如果您正苦于以下问题:C++ SyncEvent类的具体用法?C++ SyncEvent怎么用?C++ SyncEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SyncEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nativeNfcTag_abortWaits
/*******************************************************************************
**
** Function: nativeNfcTag_abortWaits
**
** Description: Unblock all thread synchronization objects.
**
** Returns: None
**
*******************************************************************************/
void nativeNfcTag_abortWaits ()
{
ALOGD ("%s", __FUNCTION__);
{
SyncEventGuard g (sReadEvent);
sReadEvent.notifyOne ();
}
sem_post (&sWriteSem);
sem_post (&sFormatSem);
{
SyncEventGuard g (sTransceiveEvent);
sTransceiveEvent.notifyOne ();
}
{
SyncEventGuard g (sReconnectEvent);
sReconnectEvent.notifyOne ();
}
sem_post (&sCheckNdefSem);
{
SyncEventGuard guard (sPresenceCheckEvent);
sPresenceCheckEvent.notifyOne ();
}
sem_post (&sMakeReadonlySem);
sCurrentRfInterface = NFA_INTERFACE_ISO_DEP;
sCurrentConnectedTargetType = TARGET_TYPE_UNKNOWN;
}
示例2: nativeNfcTag_doDeactivateStatus
/*******************************************************************************
**
** Function: nativeNfcTag_doDeactivateStatus
**
** Description: Receive the completion status of deactivate operation.
**
** Returns: None
**
*******************************************************************************/
void nativeNfcTag_doDeactivateStatus (int status)
{
sGotDeactivate = (status == 0);
SyncEventGuard g (sReconnectEvent);
sReconnectEvent.notifyOne ();
}
示例3: nativeNfcSnep_doPutReceived
static void nativeNfcSnep_doPutReceived (tNFA_HANDLE handle, UINT8 *data, UINT32 length)
{
NXPLOG_API_D ("%s: handle=0x%X, msg length =%d", __FUNCTION__, handle, length);
if (!nativeNfcManager_isNfcActive())
{
return;
}
if((sSnepServerConnectionHandle == handle) &&
NULL != data && 0x00 != length)
{
if (sServerCallback&& (NULL != sServerCallback->onMessageReceived))
{
sServerCallback->onMessageReceived(data, length);
}
sNfaSnepRespCode = NFA_SNEP_RESP_CODE_SUCCESS;
}
else
{
sNfaSnepRespCode = NFA_SNEP_RESP_CODE_REJECT;
}
{
SyncEventGuard guard (sNfaSnepServerPutRspEvent);
sNfaSnepServerPutRspEvent.notifyOne ();
}
}
示例4: nativeNfcLlcp_doClientReadCompleted
static void nativeNfcLlcp_doClientReadCompleted (tNFA_STATUS status)
{
NXPLOG_API_D ("%s: status=0x%X", __FUNCTION__, status);
SyncEventGuard g (sNfaLlcpConnLessReadEvent);
bClientReadState = TRUE;
sNfaLlcpConnLessReadEvent.notifyOne ();
}
示例5: nativeNfcSnep_doPutCompleted
static void nativeNfcSnep_doPutCompleted (tNFA_STATUS status)
{
NXPLOG_API_D ("%s: status=0x%X", __FUNCTION__, status);
sSnepClientPutState = status;
SyncEventGuard g (sNfaSnepClientPutMsgEvent);
sNfaSnepClientPutMsgEvent.notifyOne ();
}
示例6: nativeNfcSnep_abortClientWaits
void nativeNfcSnep_abortClientWaits()
{
NXPLOG_API_D ("%s", __FUNCTION__);
sSnepClientConnectionHandle = 0;
{
SyncEventGuard g (sNfaSnepClientPutMsgEvent);
sNfaSnepClientPutMsgEvent.notifyOne ();
}
{
SyncEventGuard g (sNfaSnepClientConnEvent);
sNfaSnepClientConnEvent.notifyOne ();
}
{
SyncEventGuard g (sNfaSnepClientDisconnEvent);
sNfaSnepClientDisconnEvent.notifyOne ();
}
NXPLOG_API_D ("%s exit", __FUNCTION__);
}
示例7: nativeNfcTag_doConnectStatus
/*******************************************************************************
**
** Function: nativeNfcTag_doConnectStatus
**
** Description: Receive the completion status of connect operation.
** isConnectOk: Status of the operation.
**
** Returns: None
**
*******************************************************************************/
void nativeNfcTag_doConnectStatus (jboolean isConnectOk)
{
if (sConnectWaitingForComplete != JNI_FALSE)
{
sConnectWaitingForComplete = JNI_FALSE;
sConnectOk = isConnectOk;
SyncEventGuard g (sReconnectEvent);
sReconnectEvent.notifyOne ();
}
}
示例8: nativeNfcLlcp_abortClientWaits
void nativeNfcLlcp_abortClientWaits()
{
NXPLOG_API_D ("%s", __FUNCTION__);
sLlcpConnLessClientHandle = 0;
{
SyncEventGuard g (sNfaLlcpClientRegEvent);
sNfaLlcpClientRegEvent.notifyOne ();
}
NXPLOG_API_D ("%s exit", __FUNCTION__);
}
示例9: nativeNfcTag_notifyRfTimeout
void nativeNfcTag_notifyRfTimeout ()
{
SyncEventGuard g (sTransceiveEvent);
ALOGD ("%s: waiting for transceive: %d", __FUNCTION__, sWaitingForTransceive);
if (!sWaitingForTransceive)
return;
sTransceiveRfTimeout = true;
sTransceiveEvent.notifyOne ();
}
示例10: nativeNfcSnep_abortServerWaits
/*******************************************************************************
**
** Function: nativeNfcTag_abortWaits
**
** Description: Unblock all thread synchronization objects.
**
** Returns: None
**
*******************************************************************************/
void nativeNfcSnep_abortServerWaits ()
{
NXPLOG_API_D ("%s", __FUNCTION__);
if (sSnepServerState == SNEP_SERVER_STARTED)
{
SyncEventGuard g (sNfaSnepServerPutRspEvent);
sSnepServerState = SNEP_SERVER_IDLE;
sSnepServerConnectionHandle = 0;
sNfaSnepServerPutRspEvent.notifyOne();
}
}
示例11: nativeNfcLlcp_doServerReadCompleted
static void nativeNfcLlcp_doServerReadCompleted (tNFA_STATUS status)
{
NXPLOG_API_D ("%s: status=0x%X", __FUNCTION__, status);
if(nativeNfcManager_isNfcActive())
{
if(sServerCallback&& (NULL != sServerCallback->onMessageReceived))
{
sServerCallback->onMessageReceived();
}
}
SyncEventGuard g (sNfaLlcpConnLessReadEvent);
bServerReadState = TRUE;
sNfaLlcpConnLessReadEvent.notifyOne ();
}
示例12: nativeNfcTag_doRead
/*******************************************************************************
**
** Function: nativeNfcTag_doRead
**
** Description: Read the NDEF message on the tag.
** e: JVM environment.
** o: Java object.
**
** Returns: NDEF message.
**
*******************************************************************************/
static jbyteArray nativeNfcTag_doRead (JNIEnv* e, jobject)
{
ALOGD ("%s: enter", __FUNCTION__);
tNFA_STATUS status = NFA_STATUS_FAILED;
jbyteArray buf = NULL;
sReadDataLen = 0;
if (sReadData != NULL)
{
free (sReadData);
sReadData = NULL;
}
if (sCheckNdefCurrentSize > 0)
{
{
SyncEventGuard g (sReadEvent);
sIsReadingNdefMessage = true;
status = NFA_RwReadNDef ();
sReadEvent.wait (); //wait for NFA_READ_CPLT_EVT
}
sIsReadingNdefMessage = false;
if (sReadDataLen > 0) //if stack actually read data from the tag
{
ALOGD ("%s: read %u bytes", __FUNCTION__, sReadDataLen);
buf = e->NewByteArray (sReadDataLen);
e->SetByteArrayRegion (buf, 0, sReadDataLen, (jbyte*) sReadData);
}
}
else
{
ALOGD ("%s: create empty buffer", __FUNCTION__);
sReadDataLen = 0;
sReadData = (uint8_t*) malloc (1);
buf = e->NewByteArray (sReadDataLen);
e->SetByteArrayRegion (buf, 0, sReadDataLen, (jbyte*) sReadData);
}
if (sReadData)
{
free (sReadData);
sReadData = NULL;
}
sReadDataLen = 0;
ALOGD ("%s: exit", __FUNCTION__);
return buf;
}
示例13: ALOGD
void RoutingManager::stackCallback (UINT8 event, tNFA_CONN_EVT_DATA* eventData)
{
static const char fn [] = "RoutingManager::stackCallback";
ALOGD("%s: event=0x%X", fn, event);
RoutingManager& routingManager = RoutingManager::getInstance();
switch (event)
{
case NFA_CE_REGISTERED_EVT:
{
tNFA_CE_REGISTERED& ce_registered = eventData->ce_registered;
ALOGD("%s: NFA_CE_REGISTERED_EVT; status=0x%X; h=0x%X", fn, ce_registered.status, ce_registered.handle);
}
break;
case NFA_CE_DEREGISTERED_EVT:
{
tNFA_CE_DEREGISTERED& ce_deregistered = eventData->ce_deregistered;
ALOGD("%s: NFA_CE_DEREGISTERED_EVT; h=0x%X", fn, ce_deregistered.handle);
}
break;
case NFA_CE_ACTIVATED_EVT:
{
routingManager.notifyActivated();
}
break;
case NFA_DEACTIVATED_EVT:
case NFA_CE_DEACTIVATED_EVT:
{
ALOGD("%s: NFA_DEACTIVATED_EVT, NFA_CE_DEACTIVATED_EVT", fn);
routingManager.notifyDeactivated();
SyncEventGuard g (gDeactivatedEvent);
gActivated = false; //guard this variable from multi-threaded access
gDeactivatedEvent.notifyOne ();
}
break;
case NFA_CE_DATA_EVT:
{
tNFA_CE_DATA& ce_data = eventData->ce_data;
ALOGD("%s: NFA_CE_DATA_EVT; stat=0x%X; h=0x%X; data len=%u", fn, ce_data.status, ce_data.handle, ce_data.len);
getInstance().handleData(ce_data.p_data, ce_data.len, ce_data.status);
}
break;
}
}
示例14: nativeNfcTag_doTransceiveStatus
/*******************************************************************************
**
** Function: nativeNfcTag_doTransceiveStatus
**
** Description: Receive the completion status of transceive operation.
** status: operation status.
** buf: Contains tag's response.
** bufLen: Length of buffer.
**
** Returns: None
**
*******************************************************************************/
void nativeNfcTag_doTransceiveStatus (tNFA_STATUS status, uint8_t* buf, uint32_t bufLen)
{
SyncEventGuard g (sTransceiveEvent);
ALOGD ("%s: data len=%d", __FUNCTION__, bufLen);
if (!sWaitingForTransceive)
{
ALOGE ("%s: drop data", __FUNCTION__);
return;
}
sRxDataStatus = status;
if (sRxDataStatus == NFA_STATUS_OK || sRxDataStatus == NFA_STATUS_CONTINUE)
sRxDataBuffer.append (buf, bufLen);
if (sRxDataStatus == NFA_STATUS_OK)
sTransceiveEvent.notifyOne ();
}
示例15: nativeNfcTag_doReadCompleted
/*******************************************************************************
**
** Function: nativeNfcTag_doReadCompleted
**
** Description: Receive the completion status of read operation. Called by
** NFA_READ_CPLT_EVT.
** status: Status of operation.
**
** Returns: None
**
*******************************************************************************/
void nativeNfcTag_doReadCompleted (tNFA_STATUS status)
{
ALOGD ("%s: status=0x%X; is reading=%u", __FUNCTION__, status, sIsReadingNdefMessage);
if (sIsReadingNdefMessage == false)
return; //not reading NDEF message right now, so just return
if (status != NFA_STATUS_OK)
{
sReadDataLen = 0;
if (sReadData)
free (sReadData);
sReadData = NULL;
}
SyncEventGuard g (sReadEvent);
sReadEvent.notifyOne ();
}