Пример #1
0
XnStatus XnSensorIO::EnumerateSensors(XnConnectionString* aConnectionStrings, XnUInt32* pnCount)
{
    XnStatus nRetVal = XN_STATUS_OK;

    nRetVal = xnUSBInit();
    if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_USB_ALREADY_INIT)
        return nRetVal;

// Temporary patch: "Cache" the devices since running USB enum on the MacOSX platform takes several seconds due to problems in libusb!
#if (XN_PLATFORM == XN_PLATFORM_MACOSX)
    static XnStringsHash devicesSet;

    if (devicesSet.Size() == 0)
    {
        // search for a v6.0.1 device
        nRetVal = Enumerate(XN_SENSOR_6_0_1_PRODUCT_ID, devicesSet);
        XN_IS_STATUS_OK(nRetVal);

        // search for a v6.0 device
        nRetVal = Enumerate(XN_SENSOR_6_0_PRODUCT_ID, devicesSet);
        XN_IS_STATUS_OK(nRetVal);
    }
#else
    XnStringsHash devicesSet;

    // search for a v6.0.1 device
    nRetVal = Enumerate(XN_SENSOR_6_0_1_PRODUCT_ID, devicesSet);
    XN_IS_STATUS_OK(nRetVal);

    // search for a v6.0 device
    nRetVal = Enumerate(XN_SENSOR_6_0_PRODUCT_ID, devicesSet);
    XN_IS_STATUS_OK(nRetVal);

    // search for a v5.0 device
    nRetVal = Enumerate(XN_SENSOR_5_0_PRODUCT_ID, devicesSet);
    XN_IS_STATUS_OK(nRetVal);
#endif

    // now copy back
    XnUInt32 nCount = 0;
    for (XnStringsHash::ConstIterator it = devicesSet.begin(); it != devicesSet.end(); ++it, ++nCount)
    {
        if (nCount < *pnCount)
        {
            strcpy(aConnectionStrings[nCount], it.Key());
        }
    }

    if (nCount > *pnCount)
    {
        *pnCount = nCount;
        return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
    }

    // All is good...
    *pnCount = nCount;
    return (XN_STATUS_OK);
}
Пример #2
0
void XnVBuiltInGesture::StartGesture(XnBoundingBox3D* pbbArea)
{
	xnLogVerbose(XNV_NITE_MASK_SESSION, "Start Focus Module\n");

	for (XnStringsHash::ConstIterator iter = m_AvailableGestures.begin(); iter != m_AvailableGestures.end(); ++iter)
	{
		m_GestureGenerator.AddGesture(iter.Key(), pbbArea);
	}
	m_bActive = true;
} // XnVBuiltInGesture::StartGesture
Пример #3
0
void XnVBuiltInGesture::StopGesture()
{
	if (!m_bActive)
		return;

	xnLogVerbose(XNV_NITE_MASK_SESSION, "Stop Focus Module");
	
	for (XnStringsHash::ConstIterator iter = m_AvailableGestures.begin(); iter != m_AvailableGestures.end(); ++iter)
	{
		m_GestureGenerator.RemoveGesture(iter.Key());
	}
	m_bActive = false;
} // XnVBuiltInGesture::StopGesture
Пример #4
0
XnStatus XnSensorIO::EnumerateSensors(XnConnectionString* aConnectionStrings, XnUInt32* pnCount)
{
	XnStatus nRetVal = XN_STATUS_OK;
	XnBool bIsPresent = FALSE;

	nRetVal = xnUSBInit();
	if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_USB_ALREADY_INIT)
		return nRetVal;

	XnStringsHash devicesSet;

	// --avin mod--
	// search for a kinect device
	nRetVal = Enumerate(XN_SENSOR_PRODUCT_ID_KINECT, devicesSet);
	XN_IS_STATUS_OK(nRetVal);

	// now copy back
	XnUInt32 nCount = 0;
	for (XnStringsHash::ConstIterator it = devicesSet.begin(); it != devicesSet.end(); ++it, ++nCount)
	{
		if (nCount < *pnCount)
		{
			strcpy(aConnectionStrings[nCount], it.Key());
		}
	}

	if (nCount > *pnCount)
	{
		*pnCount = nCount;
		return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
	}

	// All is good...
	*pnCount = nCount;
	return (XN_STATUS_OK);
}