当前位置: 首页>>代码示例>>C++>>正文


C++ SyncEvent类代码示例

本文整理汇总了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;
}
开发者ID:Heart-travel,项目名称:platform_packages_apps_Nfc,代码行数:36,代码来源:NativeNfcTag.cpp

示例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 ();
}
开发者ID:Heart-travel,项目名称:platform_packages_apps_Nfc,代码行数:16,代码来源:NativeNfcTag.cpp

示例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 ();
    }
}
开发者ID:apuyam,项目名称:linux_libnfc-nci,代码行数:25,代码来源:nativeNfcSnep.cpp

示例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 ();
}
开发者ID:NXPNFCLinux,项目名称:linux_libnfc-nci,代码行数:8,代码来源:nativeNfcLlcp.cpp

示例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 ();
}
开发者ID:apuyam,项目名称:linux_libnfc-nci,代码行数:8,代码来源:nativeNfcSnep.cpp

示例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__);
}
开发者ID:apuyam,项目名称:linux_libnfc-nci,代码行数:18,代码来源:nativeNfcSnep.cpp

示例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 ();
    }
}
开发者ID:Heart-travel,项目名称:platform_packages_apps_Nfc,代码行数:20,代码来源:NativeNfcTag.cpp

示例8: nativeNfcLlcp_abortClientWaits

void nativeNfcLlcp_abortClientWaits()
{
    NXPLOG_API_D ("%s", __FUNCTION__);
    sLlcpConnLessClientHandle = 0;
    {
        SyncEventGuard g (sNfaLlcpClientRegEvent);
        sNfaLlcpClientRegEvent.notifyOne ();
    }

    NXPLOG_API_D ("%s exit", __FUNCTION__);
}
开发者ID:NXPNFCLinux,项目名称:linux_libnfc-nci,代码行数:11,代码来源:nativeNfcLlcp.cpp

示例9: nativeNfcTag_notifyRfTimeout

void nativeNfcTag_notifyRfTimeout ()
{
    SyncEventGuard g (sTransceiveEvent);
    ALOGD ("%s: waiting for transceive: %d", __FUNCTION__, sWaitingForTransceive);
    if (!sWaitingForTransceive)
        return;

    sTransceiveRfTimeout = true;

    sTransceiveEvent.notifyOne ();
}
开发者ID:Heart-travel,项目名称:platform_packages_apps_Nfc,代码行数:11,代码来源:NativeNfcTag.cpp

示例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();
    }
}
开发者ID:apuyam,项目名称:linux_libnfc-nci,代码行数:20,代码来源:nativeNfcSnep.cpp

示例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 ();
}
开发者ID:NXPNFCLinux,项目名称:linux_libnfc-nci,代码行数:14,代码来源:nativeNfcLlcp.cpp

示例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;
}
开发者ID:Heart-travel,项目名称:platform_packages_apps_Nfc,代码行数:60,代码来源:NativeNfcTag.cpp

示例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;
    }
}
开发者ID:Heart-travel,项目名称:platform_packages_apps_Nfc,代码行数:48,代码来源:RoutingManager.cpp

示例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 ();
}
开发者ID:Heart-travel,项目名称:platform_packages_apps_Nfc,代码行数:28,代码来源:NativeNfcTag.cpp

示例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 ();
}
开发者ID:Heart-travel,项目名称:platform_packages_apps_Nfc,代码行数:28,代码来源:NativeNfcTag.cpp


注:本文中的SyncEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。