本文整理汇总了C++中XnProperty类的典型用法代码示例。如果您正苦于以下问题:C++ XnProperty类的具体用法?C++ XnProperty怎么用?C++ XnProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XnProperty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: XN_IS_STATUS_OK
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);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:28,代码来源:XnServerSensorInvoker.cpp
示例2: GetName
XnStatus XnDeviceModule::LoadConfigFromFile(const XnChar* csINIFilePath, const XnChar* strSectionName /* = NULL */)
{
XnStatus nRetVal = XN_STATUS_OK;
if (strSectionName == NULL)
{
strSectionName = GetName();
}
xnLogVerbose(XN_MASK_DDK, "Configuring module '%s' from section '%s' in file '%s'...", GetName(), strSectionName, csINIFilePath);
for (XnPropertiesHash::Iterator it = m_Properties.Begin(); it != m_Properties.End(); ++it)
{
XnProperty* pProp = it->Value();
// only read writable properties
if (!pProp->IsReadOnly())
{
nRetVal = pProp->ReadValueFromFile(csINIFilePath, strSectionName);
XN_IS_STATUS_OK(nRetVal);
}
}
xnLogInfo(XN_MASK_DDK, "Module '%s' configuration was loaded from file.", GetName());
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:27,代码来源:XnDeviceModule.cpp
示例3: UnsafeSetProperties
XnStatus XnDeviceModuleHolder::UnsafeSetProperties(const XnActualPropertiesHash& props)
{
XnStatus nRetVal = XN_STATUS_OK;
for (XnActualPropertiesHash::ConstIterator it = props.Begin(); it != props.End(); ++it)
{
XnProperty* pRequestProp = it->Value();
XnProperty* pProp = NULL;
// check if property already exist
nRetVal = m_pModule->GetProperty(pRequestProp->GetName(), &pProp);
if (nRetVal == XN_STATUS_DEVICE_PROPERTY_DONT_EXIST)
{
// property doesn't exist. create it now
nRetVal = CreateProperty(pRequestProp);
XN_IS_STATUS_OK(nRetVal);
}
else if (nRetVal == XN_STATUS_OK)
{
// property exists. Change its value
nRetVal = UnsafeSetProperty(pRequestProp, pProp);
XN_IS_STATUS_OK(nRetVal);
}
else
{
// error
return (nRetVal);
}
} // props loop
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:33,代码来源:XnDeviceModuleHolder.cpp
示例4: sizeof
XnStatus XnShiftToDepthStreamHelper::InitShiftToDepth()
{
XnStatus nRetVal = XN_STATUS_OK;
// register to any shift-to-depth property (so tables can be updated if needed)
const XnChar* propNames[] =
{
XN_STREAM_PROPERTY_MIN_DEPTH,
XN_STREAM_PROPERTY_MAX_DEPTH,
XN_STREAM_PROPERTY_CONST_SHIFT,
XN_STREAM_PROPERTY_PIXEL_SIZE_FACTOR,
XN_STREAM_PROPERTY_PARAM_COEFF,
XN_STREAM_PROPERTY_SHIFT_SCALE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE
};
XnUInt32 nPropCount = sizeof(propNames) / sizeof(const XnChar*);
XnCallbackHandle hDummy;
XnProperty* pProperty = NULL;
for (XnUInt32 i = 0; i < nPropCount; ++i)
{
nRetVal = m_pModule->GetProperty(propNames[i], &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(ShiftToDepthPropertyValueChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
}
// register for tables size properties
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_MAX_SHIFT, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_DEVICE_MAX_DEPTH, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
// now init the tables
XnShiftToDepthConfig Config;
nRetVal = GetShiftToDepthConfig(Config);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnShiftToDepthInit(&m_ShiftToDepthTables, &Config);
XN_IS_STATUS_OK(nRetVal);
// replace tables buffers
m_ShiftToDepthTable.ReplaceBuffer(m_ShiftToDepthTables.pShiftToDepthTable, m_ShiftToDepthTables.nShiftsCount * sizeof(XnDepthPixel));
m_DepthToShiftTable.ReplaceBuffer(m_ShiftToDepthTables.pDepthToShiftTable, m_ShiftToDepthTables.nDepthsCount * sizeof(XnUInt16));
return (XN_STATUS_OK);
}
开发者ID:02031991,项目名称:Sensor,代码行数:59,代码来源:XnShiftToDepthStreamHelper.cpp
示例5: GetPropertyType
XnStatus XnDeviceModule::GetPropertyType(const XnChar* strName, XnPropertyType* pnType) const
{
XnStatus nRetVal = XN_STATUS_OK;
XnProperty* pProp;
nRetVal = GetProperty(strName, &pProp);
XN_IS_STATUS_OK(nRetVal);
*pnType = pProp->GetType();
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:12,代码来源:XnDeviceModule.cpp
示例6: UnregisterFromOnPropertyValueChanged
XnStatus XnDeviceModule::UnregisterFromOnPropertyValueChanged(const XnChar* strName, XnCallbackHandle hCallback)
{
XnStatus nRetVal = XN_STATUS_OK;
XnProperty* pProp;
nRetVal = GetProperty(strName, &pProp);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProp->OnChangeEvent().Unregister(hCallback);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:13,代码来源:XnDeviceModule.cpp
示例7: RegisterForOnPropertyValueChanged
XnStatus XnDeviceModule::RegisterForOnPropertyValueChanged(const XnChar* strName, XnProperty::OnValueChangedHandler pFunc, void* pCookie, XnCallbackHandle& hCallback)
{
XnStatus nRetVal = XN_STATUS_OK;
XnProperty* pProp;
nRetVal = GetProperty(strName, &pProp);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProp->OnChangeEvent().Register(pFunc, pCookie, hCallback);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:13,代码来源:XnDeviceModule.cpp
示例8: XnPropertySetCloneModule
XN_DDK_API XnStatus XnPropertySetCloneModule(const XnPropertySet* pSource, XnPropertySet* pDest, const XnChar* strModule, const XnChar* strNewName)
{
XnStatus nRetVal = XN_STATUS_OK;
XnActualPropertiesHash* pModuleProps = NULL;
nRetVal = pSource->pData->Get(strModule, pModuleProps);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnPropertySetAddModule(pDest, strNewName);
XN_IS_STATUS_OK(nRetVal);
for (XnActualPropertiesHash::ConstIterator it = pModuleProps->Begin(); it != pModuleProps->End(); ++it)
{
XnProperty* pProp = it->Value();
switch (pProp->GetType())
{
case XN_PROPERTY_TYPE_INTEGER:
{
XnActualIntProperty* pIntProp = (XnActualIntProperty*)pProp;
nRetVal = XnPropertySetAddIntProperty(pDest, strNewName, pIntProp->GetName(), pIntProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_REAL:
{
XnActualRealProperty* pRealProp = (XnActualRealProperty*)pProp;
nRetVal = XnPropertySetAddRealProperty(pDest, strNewName, pRealProp->GetName(), pRealProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_STRING:
{
XnActualStringProperty* pStrProp = (XnActualStringProperty*)pProp;
nRetVal = XnPropertySetAddStringProperty(pDest, strNewName, pStrProp->GetName(), pStrProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_GENERAL:
{
XnActualGeneralProperty* pGenProp = (XnActualGeneralProperty*)pProp;
nRetVal = XnPropertySetAddGeneralProperty(pDest, strNewName, pGenProp->GetName(), &pGenProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d", pProp->GetType());
}
}
return (XN_STATUS_OK);
}
开发者ID:02031991,项目名称:Sensor,代码行数:51,代码来源:XnPropertySet.cpp
示例9: XnPropertySetEnumeratorGetCurrentPropertyInfo
XN_DDK_API XnStatus XnPropertySetEnumeratorGetCurrentPropertyInfo(const XnPropertySetEnumerator* pEnumerator, XnPropertyType* pnType, const XnChar** pstrModule, const XnChar** pstrProp)
{
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pnType);
XN_VALIDATE_OUTPUT_PTR(pstrModule);
XN_VALIDATE_OUTPUT_PTR(pstrProp);
XnProperty* pProp = pEnumerator->itProp->Value();
*pnType = pProp->GetType();
*pstrModule = pProp->GetModule();
*pstrProp = pProp->GetName();
return (XN_STATUS_OK);
}
开发者ID:02031991,项目名称:Sensor,代码行数:14,代码来源:XnPropertySet.cpp
示例10: XnPropertySetEnumeratorGetGeneralValue
XN_DDK_API XnStatus XnPropertySetEnumeratorGetGeneralValue(const XnPropertySetEnumerator* pEnumerator, XnGeneralBuffer* pgbValue)
{
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pgbValue);
XnProperty* pPropBase = pEnumerator->itProp->Value();
if (pPropBase->GetType() != XN_PROPERTY_TYPE_GENERAL)
{
return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
}
XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)pPropBase;
*pgbValue = pProp->GetValue();
return (XN_STATUS_OK);
}
开发者ID:02031991,项目名称:Sensor,代码行数:16,代码来源:XnPropertySet.cpp
示例11: XnPropertySetEnumeratorGetStringValue
XN_DDK_API XnStatus XnPropertySetEnumeratorGetStringValue(const XnPropertySetEnumerator* pEnumerator, const XnChar** pstrValue)
{
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pstrValue);
XnProperty* pPropBase = pEnumerator->itProp->Value();
if (pPropBase->GetType() != XN_PROPERTY_TYPE_STRING)
{
return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
}
XnActualStringProperty* pProp = (XnActualStringProperty*)pPropBase;
*pstrValue = pProp->GetValue();
return (XN_STATUS_OK);
}
开发者ID:02031991,项目名称:Sensor,代码行数:16,代码来源:XnPropertySet.cpp
示例12: XnPropertySetEnumeratorGetIntValue
XN_DDK_API XnStatus XnPropertySetEnumeratorGetIntValue(const XnPropertySetEnumerator* pEnumerator, XnUInt64* pnValue)
{
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pnValue);
XnProperty* pPropBase = pEnumerator->itProp->Value();
if (pPropBase->GetType() != XN_PROPERTY_TYPE_INTEGER)
{
return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
}
XnActualIntProperty* pProp = (XnActualIntProperty*)pPropBase;
*pnValue = pProp->GetValue();
return (XN_STATUS_OK);
}
开发者ID:02031991,项目名称:Sensor,代码行数:16,代码来源:XnPropertySet.cpp
示例13: XnPropertySetEnumeratorGetRealValue
XnStatus XnPropertySetEnumeratorGetRealValue(const XnPropertySetEnumerator* pEnumerator, XnDouble* pdValue)
{
XN_VALIDATE_INPUT_PTR(pEnumerator);
XN_VALIDATE_OUTPUT_PTR(pdValue);
XnProperty* pPropBase = pEnumerator->itProp->Value();
if (pPropBase->GetType() != XN_PROPERTY_TYPE_REAL)
{
return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
}
XnActualRealProperty* pProp = (XnActualRealProperty*)pPropBase;
*pdValue = pProp->GetValue();
return (XN_STATUS_OK);
}
开发者ID:1170390,项目名称:OpenNI2,代码行数:16,代码来源:XnPropertySet.cpp
示例14: GetPropertyImpl
XnStatus XnDeviceModule::GetPropertyImpl(const XnChar* Name, XnPropertyType Type, XnProperty** ppProperty) const
{
*ppProperty = NULL;
XnProperty* pProperty;
if (XN_STATUS_NO_MATCH == m_Properties.Get(Name, pProperty))
{
return XN_STATUS_DEVICE_PROPERTY_DONT_EXIST;
}
if (pProperty->GetType() != Type)
{
return XN_STATUS_DEVICE_PROPERTY_BAD_TYPE;
}
*ppProperty = pProperty;
return XN_STATUS_OK;
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:18,代码来源:XnDeviceModule.cpp
示例15: UnsafeBatchConfig
XnStatus XnDeviceModule::UnsafeBatchConfig(const XnActualPropertiesHash& props)
{
XnStatus nRetVal = XN_STATUS_OK;
for (XnActualPropertiesHash::ConstIterator it = props.Begin(); it != props.End(); ++it)
{
XnProperty* pRequestProp = it->Value();
switch (pRequestProp->GetType())
{
case XN_PROPERTY_TYPE_INTEGER:
{
XnActualIntProperty* pProp = (XnActualIntProperty*)pRequestProp;
nRetVal = UnsafeUpdateProperty(pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_REAL:
{
XnActualRealProperty* pProp = (XnActualRealProperty*)pRequestProp;
nRetVal = UnsafeUpdateProperty(pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_STRING:
{
XnActualStringProperty* pProp = (XnActualStringProperty*)pRequestProp;
nRetVal = UnsafeUpdateProperty(pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_GENERAL:
{
XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)pRequestProp;
nRetVal = UnsafeUpdateProperty(pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d\n", pRequestProp->GetType());
} // type switch
} // props loop
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:44,代码来源:XnDeviceModule.cpp
示例16: XnPropertySetAddModule
XnStatus XnDeviceModule::GetAllProperties(XnPropertySet* pSet) const
{
XnStatus nRetVal = XN_STATUS_OK;
// add the module
nRetVal = XnPropertySetAddModule(pSet, GetName());
XN_IS_STATUS_OK(nRetVal);
// now add all properties
for (XnPropertiesHash::ConstIterator it = m_Properties.Begin(); it != m_Properties.End(); ++it)
{
XnProperty* pProperty = it->Value();
if (pProperty->IsActual())
{
nRetVal = pProperty->AddToPropertySet(pSet);
XN_IS_STATUS_OK(nRetVal);
}
}
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:22,代码来源:XnDeviceModule.cpp
示例17: IsStream
XnBool XnDeviceBase::IsStream(XnDeviceModule* pModule)
{
XnProperty* pProperty;
XnStatus nRetVal = pModule->GetProperty(XN_STREAM_PROPERTY_IS_STREAM, &pProperty);
if (nRetVal != XN_STATUS_OK)
return FALSE;
if (pProperty->GetType() != XN_PROPERTY_TYPE_INTEGER)
return FALSE;
XnIntProperty* pIntProperty = (XnIntProperty*)pProperty;
XnUInt64 nValue;
nRetVal = pIntProperty->GetValue(&nValue);
if (nRetVal != XN_STATUS_OK)
{
xnLogError(XN_MASK_DDK, "Failed getting the value of the IsStream property: %s", xnGetStatusString(nRetVal));
return FALSE;
}
return (XnBool)nValue;
}
开发者ID:0pascal0,项目名称:SensorKinect,代码行数:22,代码来源:XnDeviceBase.cpp
示例18: xnLogVerbose
XnStatus XnShiftToDepthStreamHelper::InitShiftToDepth()
{
XnStatus nRetVal = XN_STATUS_OK;
xnLogVerbose("S2D", "test1");
// register to any shift-to-depth property (so tables can be updated if needed)
XnUInt32 propIds[] =
{
XN_STREAM_PROPERTY_MIN_DEPTH,
XN_STREAM_PROPERTY_MAX_DEPTH,
XN_STREAM_PROPERTY_CONST_SHIFT,
XN_STREAM_PROPERTY_PIXEL_SIZE_FACTOR,
XN_STREAM_PROPERTY_PARAM_COEFF,
XN_STREAM_PROPERTY_SHIFT_SCALE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE,
XN_STREAM_PROPERTY_EMITTER_DCMOS_DISTANCE,
XN_STREAM_PROPERTY_OUTPUT_FORMAT,
XN_STREAM_PROPERTY_CUSTOM_S2D_TABLE_ID
};
xnLogVerbose("S2D", "test2");
XnUInt32 nPropCount = sizeof(propIds) / sizeof(propIds[0]);
xnLogVerbose("S2D", "test3");
XnCallbackHandle hDummy;
XnProperty* pProperty = NULL;
for (XnUInt32 i = 0; i < nPropCount; ++i)
{
xnLogVerbose("S2D", "test4");
nRetVal = m_pModule->GetProperty(propIds[i], &pProperty);
xnLogVerbose("S2D", "test5 %s", xnGetStatusString(nRetVal));
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(ShiftToDepthPropertyValueChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
xnLogVerbose("S2D", "test6");
}
// XnUInt64 CustomTableID = ((XnActualIntProperty*)pProperty)->GetValue();
// xnLogVerbose("S2D", "S2D custom table ID: %d", CustomTableID);
// register for tables size properties
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_MAX_SHIFT, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_DEVICE_MAX_DEPTH, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
nRetVal = m_pModule->GetProperty(XN_STREAM_PROPERTY_OUTPUT_FORMAT, &pProperty);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pProperty->OnChangeEvent().Register(DeviceS2DTablesSizeChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
// now init the tables
XnShiftToDepthConfig Config;
nRetVal = GetShiftToDepthConfig(Config);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnShiftToDepthInit(&m_ShiftToDepthTables, &Config);
XN_IS_STATUS_OK(nRetVal);
// replace tables buffers
m_ShiftToDepthTable.ReplaceBuffer(m_ShiftToDepthTables.pShiftToDepthTable, m_ShiftToDepthTables.nShiftsCount * sizeof(OniDepthPixel));
m_DepthToShiftTable.ReplaceBuffer(m_ShiftToDepthTables.pDepthToShiftTable, m_ShiftToDepthTables.nDepthsCount * sizeof(XnUInt16));
return (XN_STATUS_OK);
}
开发者ID:jan-vitek,项目名称:OpenNI2,代码行数:80,代码来源:XnShiftToDepthStreamHelper.cpp
示例19: return
XnStatus XnFileDevice::HandleNewStream(const XnChar *strType, const XnChar *strName, const XnActualPropertiesHash *pInitialValues)
{
XnStatus nRetVal = XN_STATUS_OK;
// check if we need to ignore that (stream was not removed upon Rewind).
XnNodeInfoMap::Iterator it = m_ignoreNewNodes.End();
if (m_ignoreNewNodes.Find(strName, it) == XN_STATUS_OK)
{
// ignore
return (XN_STATUS_OK);
}
XnProductionNodeType type = GetNodeType(strType);
if (type == -1)
{
XN_LOG_WARNING_RETURN(XN_STATUS_CORRUPT_FILE, XN_MASK_FILE, "Invalid node type: %s", strType);
}
// find compression type
XnActualIntProperty* pComp = NULL;
nRetVal = pInitialValues->Get(XN_STREAM_PROPERTY_COMPRESSION, (XnProperty*&)pComp);
XN_IS_STATUS_OK(nRetVal);
XnCodecID codecID = XnCodec::GetCodecIDFromCompressionFormat((XnCompressionFormats)pComp->GetValue());
if (codecID == XN_CODEC_NULL)
{
XN_LOG_WARNING_RETURN(XN_STATUS_CORRUPT_FILE, XN_MASK_FILE, "Invalid compression type: %llu", pComp->GetValue());
}
// notify we have a new node
nRetVal = m_pNotifications->OnNodeAdded(m_pNotificationsCookie, strName, type, codecID);
XN_IS_STATUS_OK(nRetVal);
// we support the mirror capability
nRetVal = m_pNotifications->OnNodeIntPropChanged(m_pNotificationsCookie, strName, XN_CAPABILITY_MIRROR, 1);
XN_IS_STATUS_OK(nRetVal);
// we support the extended serialization capability
nRetVal = m_pNotifications->OnNodeIntPropChanged(m_pNotificationsCookie, strName, XN_CAPABILITY_EXTENDED_SERIALIZATION, 1);
XN_IS_STATUS_OK(nRetVal);
// now write state
for (XnActualPropertiesHash::ConstIterator it = pInitialValues->Begin(); it != pInitialValues->End(); ++it)
{
XnProperty* pProp = it->Value();
switch (pProp->GetType())
{
case XN_PROPERTY_TYPE_INTEGER:
{
XnActualIntProperty* pIntProp = (XnActualIntProperty*)pProp;
nRetVal = HandleIntProperty(strName, pProp->GetName(), pIntProp->GetValue());
}
break;
case XN_PROPERTY_TYPE_REAL:
{
XnActualRealProperty* pRealProp = (XnActualRealProperty*)pProp;
nRetVal = HandleRealProperty(strName, pProp->GetName(), pRealProp->GetValue());
}
break;
case XN_PROPERTY_TYPE_STRING:
{
XnActualStringProperty* pStrProp = (XnActualStringProperty*)pProp;
nRetVal = HandleStringProperty(strName, pProp->GetName(), pStrProp->GetValue());
}
break;
case XN_PROPERTY_TYPE_GENERAL:
{
XnActualGeneralProperty* pGenProp = (XnActualGeneralProperty*)pProp;
nRetVal = HandleGeneralProperty(strName, pProp->GetName(), pGenProp->GetValue());
}
break;
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_FILE, "Unknown property type: %d", pProp->GetType());
}
XN_IS_STATUS_OK(nRetVal);
}
// at this stage, a node should exist with this name
xn::ProductionNode node;
nRetVal = m_context.GetProductionNodeByName(strName, node);
XN_IS_STATUS_OK(nRetVal);
// S2D & RW
if (type == XN_NODE_TYPE_DEPTH)
{
nRetVal = UpdateS2DTables(xn::DepthGenerator(node));
XN_IS_STATUS_OK(nRetVal);
nRetVal = UpdateRWData(xn::DepthGenerator(node));
XN_IS_STATUS_OK(nRetVal);
}
// notify end-of-state
nRetVal = m_pNotifications->OnNodeStateReady(m_pNotificationsCookie, strName);
XN_IS_STATUS_OK(nRetVal);
// add it to the map
XnNodeInfo nodeInfo = {0};
//.........这里部分代码省略.........
开发者ID:RikeshThapa,项目名称:VirtueX,代码行数:101,代码来源:XnFileDevice.cpp
示例20: XN_PROPERTY_SET_CREATE_ON_STACK
XnStatus XnSensorProductionNode::NotifyExState(XnNodeNotifications* pNotifications, void* pCookie)
{
XnStatus nRetVal = XN_STATUS_OK;
// get all properties
XN_PROPERTY_SET_CREATE_ON_STACK(props);
nRetVal = m_pSensor->GetAllProperties(&props, FALSE, GetModuleName());
XN_IS_STATUS_OK(nRetVal);
XnActualPropertiesHash* pPropsHash = props.pData->begin().Value();
// filter properties (remove the ones already exposed as OpenNI interfaces)
FilterProperties(pPropsHash);
const XnChar* astrIntProps[200] = {0};
const XnChar* astrRealProps[200] = {0};
const XnChar* astrStringProps[200] = {0};
const XnChar* astrGeneralProps[200] = {0};
XnUInt32 nIntProps = 0;
XnUInt32 nRealProps = 0;
XnUInt32 nStringProps = 0;
XnUInt32 nGeneralProps = 0;
// enumerate over properties
for (XnActualPropertiesHash::Iterator it = pPropsHash->begin(); it != pPropsHash->end(); ++it)
{
XnProperty* pProp = it.Value();
switch (pProp->GetType())
{
case XN_PROPERTY_TYPE_INTEGER:
{
XnActualIntProperty* pIntProp = (XnActualIntProperty*)pProp;
pNotifications->OnNodeIntPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pIntProp->GetValue());
astrIntProps[nIntProps++] = pProp->GetName();
}
break;
case XN_PROPERTY_TYPE_REAL:
{
XnActualRealProperty* pRealProp = (XnActualRealProperty*)pProp;
pNotifications->OnNodeRealPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pRealProp->GetValue());
astrRealProps[nRealProps++] = pProp->GetName();
}
break;
case XN_PROPERTY_TYPE_STRING:
{
XnActualStringProperty* pStrProp = (XnActualStringProperty*)pProp;
pNotifications->OnNodeStringPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pStrProp->GetValue());
astrStringProps[nStringProps++] = pProp->GetName();
}
break;
case XN_PROPERTY_TYPE_GENERAL:
{
XnActualGeneralProperty* pGenProp = (XnActualGeneralProperty*)pProp;
pNotifications->OnNodeGeneralPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pGenProp->GetValue().nDataSize, pGenProp->GetValue().pData);
astrGeneralProps[nGeneralProps++] = pProp->GetName();
}
break;
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DEVICE_SENSOR, "Unknown property type: %d", pProp->GetType());
}
}
// TODO: also register to these properties, and if changed, notify.
// store notifications object
m_pNotifications = pNotifications;
m_pCookie = pCookie;
return (XN_STATUS_OK);
}
开发者ID:AlpinistPanda,项目名称:SensorKinect,代码行数:72,代码来源:XnSensorProductionNode.cpp
注:本文中的XnProperty类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论