Proposed NuiStatus not returning S_OK

  • Tuesday, March 27, 2012 11:02 AM
     
     

    I'm in the process of adding some robustness to my C++ code was attempting to use NuiStatus() to gracefully handle the 'loss' of the sensor.

    According to the documentation this NuiStatus() should return S_OK if all is well and E_NUI_DEVICE_NOT_CONNECTED if not.

    I'm getting a return value of -2097086443 instead of S_OK.  Curiously E_NUI_DEVICE_NOT_CONNECTED is -2097086444.

    I can reverse my logic and test for E_NUI_DEVICE_NOT_CONNECTED instead, but that isn't the point, the call should return S_OK as documented.

    I was also wondering why there appears to be no equivalent C++ for the C# (or VB) KinectStatus property which gives much more detail on the connected Kinect sensor?

All Replies

  • Tuesday, March 27, 2012 7:05 PM
     
     
    what version of the SDK are you using? There are a lot of different status that can be returned.
  • Wednesday, March 28, 2012 12:04 AM
     
     
    Sorry, should have put that in, the Microsoft Kinect SDK v1.
  • Wednesday, March 28, 2012 5:46 AM
    Owner
     
     Proposed

    All of the error codes are defined in NuiApi.h. -2097086443 is E_NUI_NOTREADY, which generally means the device is in the process of initializing.

    In C++, use the NuiSetDeviceStatusCallback API to register a status callback function. The Kinect runtime will invoke your callback function every time the status of a Kinect sensor changes. The device's status (HRESULT) is passed as one of the arguments to the callback.

    John
    K4W Dev

  • Friday, March 30, 2012 12:12 AM
     
     

    The callback is useful (and I have incorporated it into my code) and should serve my purpose.

    Curious that the documentation does not  list E_NUI_NOTREADY as a potential return code from NuiStatus(), only E_NUI_NOTCONNECTED is listed ...

         INuiSensor::NuiStatus Method

          Return Value

          Type: HRESULT
          Returns S_OK if successful; otherwise, returns one of the following failure codes: E_NUI_NOTCONNECTED.

    My apologies for getting the codes (E_NUI_DEVICE_NOT_CONNECTED and E_NUI_NOTCONNECTED) confused in my initial post. 

  • Saturday, April 07, 2012 6:47 AM
     
     
    Thanks - this is a documentation error, thanks for bringing it to our attention.  You may also get E_NUI_NOTPOWERED.

    -Adam Smith [MSFT]