MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / xnWaitForCondition

Function xnWaitForCondition

Source/OpenNI/XnOpenNI.cpp:2523–2559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2521}
2522
2523XnStatus xnWaitForCondition(XnContext* pContext, XnConditionFunc pConditionFunc, void* pConditionData)
2524{
2525 XnStatus nRetVal = XN_STATUS_OK;
2526
2527 xnMarkFPSFrame(pContext, &pContext->readFPS);
2528
2529 // check if we have players in this context
2530 // TODO: handle the case in which we have more than one player
2531 if (pContext->hPlayerNode != NULL)
2532 {
2533 // play until condition is met
2534 while (!pConditionFunc(pConditionData))
2535 {
2536 if (xnIsPlayerAtEOF(pContext->hPlayerNode))
2537 {
2538 return XN_STATUS_EOF;
2539 }
2540 else
2541 {
2542 nRetVal = xnPlayerReadNext(pContext->hPlayerNode);
2543 XN_IS_STATUS_OK(nRetVal);
2544 }
2545 }
2546 }
2547 else
2548 {
2549 // no players, just wait for the event
2550 nRetVal = xnOSWaitForCondition(pContext->hNewDataEvent, XN_NODE_WAIT_FOR_DATA_TIMEOUT, pConditionFunc, pConditionData);
2551 if (nRetVal == XN_STATUS_OS_EVENT_TIMEOUT)
2552 {
2553 return (XN_STATUS_WAIT_DATA_TIMEOUT);
2554 }
2555 XN_IS_STATUS_OK(nRetVal);
2556 }
2557
2558 return (XN_STATUS_OK);
2559}
2560
2561XN_C_API XnStatus xnWaitAndUpdateAll(XnContext* pContext)
2562{

Callers 4

xnWaitAndUpdateAllFunction · 0.85
xnWaitOneUpdateAllFunction · 0.85
xnWaitAnyUpdateAllFunction · 0.85
xnWaitAndUpdateDataFunction · 0.85

Calls 4

xnMarkFPSFrameFunction · 0.85
xnIsPlayerAtEOFFunction · 0.85
xnPlayerReadNextFunction · 0.85
xnOSWaitForConditionFunction · 0.85

Tested by

no test coverage detected