XnStatus XnServerSensorInvoker::RegisterToProps(XnPropertySet* pProps) { XnStatus nRetVal = XN_STATUS_OK; XnCallbackHandle hDummy = NULL; for (XnPropertySetData::Iterator itMod = pProps->pData->Begin(); itMod != pProps->pData->End(); ++itMod) { XnActualPropertiesHash* pHash = itMod->Value(); XnDeviceModule* pModule; nRetVal = m_sensor.FindModule(itMod->Key(), &pModule); XN_IS_STATUS_OK(nRetVal); for (XnActualPropertiesHash::Iterator itProp = pHash->Begin(); itProp != pHash->End(); ++itProp) { XnProperty* pProp; nRetVal = pModule->GetProperty(itProp->Key(), &pProp); XN_IS_STATUS_OK(nRetVal); // no need to keep the handle. We only want to unregister when the stream is destroyed, and then // it happens anyway. nRetVal = pProp->OnChangeEvent().Register(PropertyChangedCallback, this, hDummy); XN_IS_STATUS_OK(nRetVal); } } return (XN_STATUS_OK); }
XnStatus XnServerSession::BatchConfigImpl(const XnPropertySet* pProps) { XnStatus nRetVal = XN_STATUS_OK; xnLogVerbose(XN_MASK_SENSOR_SERVER, "Client %u requested a batch config", m_nID); XN_PROPERTY_SET_CREATE_ON_STACK(serverProps); for (XnPropertySetData::Iterator it = pProps->pData->Begin(); it != pProps->pData->End(); ++it) { SessionStream* pStream = NULL; nRetVal = m_streamsHash.Get(it->Key(), pStream); XN_IS_STATUS_OK(nRetVal); nRetVal = XnPropertySetCloneModule(pProps, &serverProps, it->Key(), pStream->strStreamName); XN_IS_STATUS_OK(nRetVal); } nRetVal = m_pSensor->BatchConfig(&serverProps); XN_IS_STATUS_OK(nRetVal); return (XN_STATUS_OK); }
XnStatus XnDataPacker::WritePropertySetImpl(const XnPropertySet* pPropertySet) { XnStatus nRetVal = XN_STATUS_OK; StartWritingIntenalObject(XN_PACKED_PROPERTY_SET); // Write module names for (XnPropertySetData::Iterator it = pPropertySet->pData->Begin(); it != pPropertySet->pData->End(); ++it) { nRetVal = WriteString(it->Key()); XN_IS_STATUS_OK(nRetVal); } StartWritingIntenalObject(XN_PACKED_PROPERTY_SET_MODULES_END_MARKER); EndWritingInternalObject(); // write properties nRetVal = WritePropertySetProperties(pPropertySet); XN_IS_STATUS_OK(nRetVal); return (XN_STATUS_OK); }
XnStatus XnDeviceFileReader::Rewind() { XnStatus nRetVal = XN_STATUS_OK; // go back to start of stream nRetVal = GetIOStream()->Seek(XN_DEVICE_FILE_MAGIC_LEN); XN_IS_STATUS_OK(nRetVal); // read initial state XN_PROPERTY_SET_CREATE_ON_STACK(state); nRetVal = ReadInitialState(&state); XN_IS_STATUS_OK(nRetVal); // first handle current streams. remove or reset them XnDeviceModuleHolderList streams; nRetVal = GetStreamsList(streams); XN_IS_STATUS_OK(nRetVal); for (XnDeviceModuleHolderList::Iterator it = streams.Begin(); it != streams.End(); ++it) { XnDeviceModuleHolder* pHolder = *it; if (m_bStreamsCollectionChanged) { // we need to destroy all streams, and recreate them later nRetVal = DestroyStream(pHolder->GetModule()->GetName()); XN_IS_STATUS_OK(nRetVal); } else { // just reset frame ID XnStreamReaderStream* pStream = (XnStreamReaderStream*)pHolder->GetModule(); pStream->Reset(); } } // if we need, recreate streams if (m_bStreamsCollectionChanged) { nRetVal = CreateStreams(&state); XN_IS_STATUS_OK(nRetVal); } // now set state. for (XnPropertySetData::Iterator it = state.pData->Begin(); it != state.pData->End(); ++it) { const XnChar* strName = it->Key(); XnActualPropertiesHash* pHash = it->Value(); // fix it first if (strcmp(strName, XN_MODULE_NAME_DEVICE) == 0) { pHash->Remove(XN_MODULE_PROPERTY_READ_WRITE_MODE); pHash->Remove(XN_MODULE_PROPERTY_PRIMARY_STREAM); } XnDeviceModule* pModule; nRetVal = FindModule(strName, &pModule); XN_IS_STATUS_OK(nRetVal); nRetVal = pModule->UnsafeBatchConfig(*pHash); XN_IS_STATUS_OK(nRetVal); } ResetLastTimestampAndFrame(); m_nReferenceTimestamp = 0; m_nReferenceTime = 0; m_bStreamsCollectionChanged = FALSE; return (XN_STATUS_OK); }