7 #include "imstkVRPNDeviceClient.h" 11 #include "imstkLogger.h" 36 deviceClient->m_position << t.pos[0], t.pos[1], t.pos[2];
37 deviceClient->m_orientation = quat;
38 deviceClient->m_transformLock.unlock();
46 deviceClient->m_analogChannels.resize(a.num_channel);
47 for (
int i = 0; i < a.num_channel; i++)
49 deviceClient->m_analogChannels[i] = a.channel[i];
51 deviceClient->m_dataLock.unlock();
58 Quatd quat(v.vel_quat[1], v.vel_quat[2], v.vel_quat[3], v.vel_quat[0]);
60 deviceClient->m_transformLock.lock();
61 deviceClient->m_velocity << v.vel[0], v.vel[1], v.vel[2];
65 deviceClient->m_transformLock.unlock();
72 deviceClient->m_buttons[b.button] = (b.state == 1);
static void VRPN_CALLBACK trackerPositionChangeHandler(void *userData, const _vrpn_TRACKERCB t)
VRPN call back for position and orientation data.
The device client's represents the device and provides an interface to acquire data from a device...
static void VRPN_CALLBACK trackerVelocityChangeHandler(void *userData, const _vrpn_TRACKERVELCB v)
VRPN call back for velocity data.
bool m_analogicEnabled
Analogic enabled if true.
ParallelUtils::SpinLock m_dataLock
Used for button and analog data.
bool m_trackingEnabled
Tracking enabled if true.
ParallelUtils::SpinLock m_transformLock
Used for devices filling data from other threads.
static void VRPN_CALLBACK buttonChangeHandler(void *userData, const _vrpn_BUTTONCB b)
VRPN call back for button changed (pressed or released)
void lock()
Start a thread-safe region, where only one thread can execute at a time until a call to the unlock fu...
VRPNDeviceClient(const std::string &deviceName, VRPNDeviceType type, const std::string &ip="localhost")
Constructor.
bool m_buttonsEnabled
Buttons enabled if true.
static void VRPN_CALLBACK analogChangeHandler(void *userData, const _vrpn_ANALOGCB a)
VRPN call back analog data.
VRPNDeviceType getType() const
bool m_forceEnabled
Force enabled if true.
This class is the receiver of the updates sent by the vrpn_server.