iMSTK
Interactive Medical Simulation Toolkit
imstkOpenHapticDeviceClient.cpp
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #include "imstkOpenHapticDeviceClient.h"
8 #include "imstkLogger.h"
9 
10 namespace imstk
11 {
12 void
14 {
15  m_trackingEnabled = true;
16 }
17 
18 void
20 {
21  std::vector<std::pair<int, int>> localEvents;
22  m_dataLock.lock();
23  std::swap(m_events, localEvents);
25 
26  for (const auto& item : localEvents)
27  {
28  postEvent(ButtonEvent(OpenHapticDeviceClient::buttonStateChanged(), item.first, item.second));
29  }
30 }
31 
32 void
34 {
35 }
36 } // namespace imstk
void unlock()
End a thread-safe region.
Definition: imstkSpinLock.h:53
void initialize()
Initialize the phantom omni device.
ParallelUtils::SpinLock m_dataLock
Used for button and analog data.
void update() override
Use callback to get tracking data from phantom omni.
Compound Geometry.
bool m_trackingEnabled
Tracking enabled if true.
void lock()
Start a thread-safe region, where only one thread can execute at a time until a call to the unlock fu...
Definition: imstkSpinLock.h:45
void disable()
Disables the phantom omni device.
void postEvent(const T &e)
Emits the event Direct observers will be immediately called, in sync Queued observers will receive th...