XnStatus XnStreamReaderDevice::ReadNewStream()
{
	XnStatus nRetVal = XN_STATUS_OK;
	
	XnChar strType[XN_DEVICE_MAX_STRING_LENGTH];
	XnChar strName[XN_DEVICE_MAX_STRING_LENGTH];

	// create property set
	XnPropertySet* pPropertySet = NULL;
	nRetVal = XnPropertySetCreate(&pPropertySet);
	XN_IS_STATUS_OK(nRetVal);

	// read from stream
	nRetVal = GetDataPacker()->ReadNewStream(strType, strName, pPropertySet);

	if (nRetVal == XN_STATUS_OK)
	{
		nRetVal = ValidateOnlyModule(pPropertySet, strName);
	}

	if (nRetVal == XN_STATUS_OK)
	{
		// create it
		nRetVal = HandleNewStream(strType, strName, pPropertySet->pData->begin().Value());
	}

	XnPropertySetDestroy(&pPropertySet);

	return (nRetVal);
}
Example #2
0
XnStatus XnDeviceBase::CreateStream(const XnChar* StreamType, const XnChar* StreamName /* = NULL */, const XnPropertySet* pInitialValues /* = NULL */)
{
	XnStatus nRetVal = XN_STATUS_OK;

	// check for name
	if (StreamName == NULL)
		StreamName = StreamType;

	XnActualPropertiesHash* pInitialValuesHash = NULL;

	if (pInitialValues != NULL)
	{
		// validate property set
		nRetVal = ValidateOnlyModule(pInitialValues, StreamName);
		XN_IS_STATUS_OK(nRetVal);

		pInitialValuesHash = pInitialValues->pData->begin().Value();
	}

	nRetVal = CreateStreamImpl(StreamType, StreamName, pInitialValuesHash);
	XN_IS_STATUS_OK(nRetVal);

	return (XN_STATUS_OK);
}