none
Kinect beta 2 Status Change C++ RRS feed

  • Question

  • Any examples or helpful tips on Using the new status change code in C++? the only example is in the shape game in C#?

     

    thanks,

    -ross

    Friday, November 4, 2011 4:43 PM

Answers

  • As far as other managed samples besides ShapeGame, managed SkeletalViewer sample also showcases handling status change in Kinects_StatusChanged function implementation in MainWindow.xaml.cs.

    As far as C++, you should look at CSkeletalViewerApp::Nui_StatusProc in NuiImpl.cpp for native SkeletalViewer sample. Also look at call to

    NuiSetDeviceStatusCallback( &CSkeletalViewerApp::Nui_StatusProcThunk );

    In SkeletalViewer.cpp in same sample. Basically, you register a status proc callback function and then you handle status change notifications as your callback receives them.

    Eddy


    I'm here to help
    Friday, November 4, 2011 9:35 PM

All replies

  • As far as other managed samples besides ShapeGame, managed SkeletalViewer sample also showcases handling status change in Kinects_StatusChanged function implementation in MainWindow.xaml.cs.

    As far as C++, you should look at CSkeletalViewerApp::Nui_StatusProc in NuiImpl.cpp for native SkeletalViewer sample. Also look at call to

    NuiSetDeviceStatusCallback( &CSkeletalViewerApp::Nui_StatusProcThunk );

    In SkeletalViewer.cpp in same sample. Basically, you register a status proc callback function and then you handle status change notifications as your callback receives them.

    Eddy


    I'm here to help
    Friday, November 4, 2011 9:35 PM
  • Eddy, 

    Thanks for the reply. that works great. I am wondering how i determine what caused the disruption in c++ though. Currently i am able to tell if the status change is a disconnect or a reconnect, but not why is disconnected. 

    I am seeing the following values for pStatusData->hrStatus

    Pulled USB = 2197880852

    Pulled Power = 2197881471

    Should i simply be checking those values or is there a better way to test for the disconnect reason.

     

    Using the following

    //Set Callback

    MSR_NuiSetDeviceStatusCallback(&onDeviceStatus);

    //Static Callback Function

    void CALLBACK onDeviceStatus(const NuiStatusData *pStatusData) {

    OutputDebugString( "Device Status\n" );

    g_AIRKinectAdapter.onDeviceStatus(pStatusData);

    }

    //Device status Responder

    void AIRKinectAdapter::onDeviceStatus(const NuiStatusData *pStatusData){

    const uint8_t* statusCode = (const uint8_t*) "deviceStatus";

    const uint8_t* level = (const uint8_t*) "unknown";

    if (SUCCEEDED(pStatusData->hrStatus)) {

    level = (const uint8_t*) "connected";

    }else{

    dispose();

    level = (const uint8_t*) "disconnected";

    }

    FREDispatchStatusEventAsync(context, statusCode, level);

    }

    Tuesday, November 8, 2011 11:43 PM