XnStatus XnExportedFileDevice::EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors)
{
	XnStatus nRetVal = XN_STATUS_OK;
	
	XnProductionNodeDescription Description;
	GetDescription(&Description);
	nRetVal = TreesList.Add(Description, NULL, NULL);
	XN_IS_STATUS_OK(nRetVal);

	return (XN_STATUS_OK);
}
Beispiel #2
0
XnStatus ExportedRecorder::EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors)
{
	XnProductionNodeDescription description;
	XnStatus nRetVal = XN_STATUS_OK;
	
	GetDescription(&description);
	nRetVal = TreesList.Add(description, CREATION_INFO, NULL);
	XN_IS_STATUS_OK(nRetVal);
		
	return XN_STATUS_OK;
}
XnStatus ExportedSampleDepth::EnumerateProductionTrees( xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors )
{
	XnStatus nRetVal = XN_STATUS_OK;

	// return one option
	XnProductionNodeDescription desc;
	GetDescription(&desc);

	nRetVal = TreesList.Add(desc, NULL, NULL);
	XN_IS_STATUS_OK(nRetVal);

	return (XN_STATUS_OK);
}
XnStatus XnExportedSensorDevice::EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* /*pErrors*/)
{
	XnStatus nRetVal = XN_STATUS_OK;

	// enumerate connected sensors
	XnUInt32 nCount = 0;

	// check if sensor is connected
	nRetVal = XnSensor::Enumerate(NULL, &nCount);
	if (nRetVal != XN_STATUS_OUTPUT_BUFFER_OVERFLOW)
	{
		// no sensor connected
		return XN_STATUS_DEVICE_NOT_CONNECTED;
	}

	// allocate according to count
	XnConnectionString* pConnStrings;
	XN_VALIDATE_CALLOC(pConnStrings, XnConnectionString, nCount);

	nRetVal = XnSensor::Enumerate(pConnStrings, &nCount);
	if (nRetVal != XN_STATUS_OK)
	{
		xnOSFree(pConnStrings);
		return (nRetVal);
	}

	XnProductionNodeDescription Description;
	GetDescription(&Description);

	for (XnUInt32 i = 0; i < nCount; ++i)
	{
		// Each connection string is a sensor. Return it if it wasn't created already.
		if (FindCreatedDevice(context.GetUnderlyingObject(), pConnStrings[i]) == m_createdDevices.End())
		{
			nRetVal = TreesList.Add(Description, pConnStrings[i], NULL);
			if (nRetVal != XN_STATUS_OK)
			{
				xnOSFree(pConnStrings);
				return (nRetVal);
			}
		}
	}

	xnOSFree(pConnStrings);
	return (XN_STATUS_OK);
}
XnStatus XnExportedSensorDevice::EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors)
{
	XnStatus nRetVal = XN_STATUS_OK;

	// enumerate connected sensors
	XnUInt32 nCount = 0;

	// check if sensor is connected
	nRetVal = XnSensor::Enumerate(NULL, &nCount);
	if (nRetVal != XN_STATUS_OUTPUT_BUFFER_OVERFLOW)
	{
		// no sensor connected
		XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_NOT_CONNECTED, XN_MASK_DEVICE_SENSOR, "No PS sensor is connected!");
	}

	// allocate according to count
	XnConnectionString* pConnStrings;
	XN_VALIDATE_CALLOC(pConnStrings, XnConnectionString, nCount);

	nRetVal = XnSensor::Enumerate(pConnStrings, &nCount);
	if (nRetVal != XN_STATUS_OK)
	{
		xnOSFree(pConnStrings);
		return (nRetVal);
	}

	XnProductionNodeDescription Description;
	GetDescription(&Description);

	// each connection string is a sensor. return it
	for (XnUInt32 i = 0; i < nCount; ++i)
	{
		nRetVal = TreesList.Add(Description, pConnStrings[i], NULL);
		if (nRetVal != XN_STATUS_OK)
		{
			xnOSFree(pConnStrings);
			return (nRetVal);
		}
	}

	xnOSFree(pConnStrings);

	return (XN_STATUS_OK);
}