how can get Haptic device Buttons event.
i want to get to use the haptic device's button.
now i can control a object with Haptic device , here is the core code. referenced the example “ObjectController”
`auto server = std::make_shared();
auto client = server->makeDeviceClient(phantomOmni1Name);
auto controller = std::make_shared(object, client);
scene->addController(controller);
viewer->addChildThread(server);`
but when i want to get button's event. i read some source code about imstk like "imstkHapticDeviceManager.cpp" "imstkHapticeDeviceClient.cpp"
besides, i also read example code about HDAPI Graphics Examples, HDAPI Console Examples.
in my openion, i need to write HDcallback function to get the button event. like this
` HDCallbackCode HDCALLBACK CallbackFunction(void* pData){*******}
`
in main function
` hdStartScheduler();
hdScheduleAsynchronous(releaseHotFieldCallback, 0, HD_MAX_SCHEDULER_PRIORITY); `
here is the thing, if i want to run with out error, i need to initialize the haptic device whit this line code
HHD hHD = hdInitDevice(HD_DEFAULT_DEVICE);
but it's conflict with client code , Cannot exist together
auto client = server->makeDeviceClient(phantomOmni1Name);
also i noticed that in "imstkHapticDeviceManager.cpp" there has function "initialize()" to initialize the client which called
"imstkHapticDeviceClient.cpp" m_handle = hdInitDevice(this->getDeviceName().c_str());
but when i add this line "server->initialize()" to my code, the application will crashed.
what should i do to solve this problem, thank for any adcice.