XnStatus XnDeviceBase::OpenAllStreams() { XnStatus nRetVal = XN_STATUS_OK; xnLogVerbose(XN_MASK_DDK, "Opening all streams..."); // go over modules list, and look for closed streams for (XnStringsHash::Iterator it = m_Modules.begin(); it != m_Modules.end(); ++it) { XnDeviceModuleHolder* pModuleHolder = (XnDeviceModuleHolder*)it.Value(); if (IsStream(pModuleHolder->GetModule())) { XnDeviceStream* pStream = (XnDeviceStream*)pModuleHolder->GetModule(); if (!pStream->IsOpen()) { nRetVal = pStream->Open(); XN_IS_STATUS_OK(nRetVal); } } } xnLogInfo(XN_MASK_DDK, "All streams are open."); return XN_STATUS_OK; }
XnStatus XN_CALLBACK_TYPE XnDeviceStream::SetIsOpenCallback(XnActualIntProperty* /*pSender*/, XnUInt64 nValue, void* pCookie) { XnDeviceStream* pStream = (XnDeviceStream*)pCookie; if (nValue == TRUE) { return pStream->Open(); } else { return pStream->Close(); } }
XnStatus XnDeviceBase::OpenStream(const XnChar* StreamName) { XnStatus nRetVal = XN_STATUS_OK; XN_VALIDATE_INPUT_PTR(StreamName); xnLogVerbose(XN_MASK_DDK, "Opening stream %s...", StreamName); // find this stream XnDeviceStream* pStream; nRetVal = FindStream(StreamName, &pStream); XN_IS_STATUS_OK(nRetVal); // open it nRetVal = pStream->Open(); XN_IS_STATUS_OK(nRetVal); xnLogInfo(XN_MASK_DDK, "Stream %s is open.", StreamName); return (XN_STATUS_OK); }