16 #include "vrpnDialDevice.h" 17 #include "vrpnClient.h" 18 #include "config_vrpn.h" 30 VrpnDial(
const string &dial_name, vrpn_Connection *connection) :
33 _dial =
new vrpn_Dial_Remote(_dial_name.c_str(), connection);
35 _dial->register_change_handler((
void*)
this, &vrpn_dial_callback);
56 if (vrpn_cat.is_debug()) {
57 vrpn_cat.debug() << *
this <<
" marking " << *device <<
"\n";
59 _devices.push_back(device);
70 if (vrpn_cat.is_debug()) {
71 vrpn_cat.debug() << *
this <<
" unmarking " << *device <<
"\n";
74 Devices::iterator di =
75 find(_devices.begin(), _devices.end(), device);
77 if (di != _devices.end()) {
88 output(ostream &out)
const {
98 write(ostream &out,
int indent_level)
const {
99 indent(out, indent_level)
101 << _devices.size() <<
" devices)\n";
111 void VRPN_CALLBACK VrpnDial::
112 vrpn_dial_callback(
void *userdata,
const vrpn_DIALCB info) {
115 if (vrpn_cat.is_debug()) {
117 << *
self <<
" got dial " << info.dial <<
" = " << info.change <<
"\n";
120 Devices::iterator di;
121 for (di = self->_devices.begin(); di !=
self->_devices.end(); ++di) {
124 device->
push_dial(info.dial, info.change);
void push_dial(int index, double offset)
Marks that the dial has been offset by the indicated amount.
void unlock()
Releases the mutex associated with this particular device.
The Panda interface to a VRPN dial device.
const string & get_dial_name() const
Returns the name of the dial device that was used to create this VrpnDial.
void mark(VrpnDialDevice *device)
Adds the indicated VrpnDialDevice to the list of devices that are sharing this VrpnDial.
void acquire()
Grabs the mutex associated with this particular device.
This is the actual interface to a particular VRPN dial device, and all of its numbered dials...
void unmark(VrpnDialDevice *device)
Removes the indicated VrpnDialDevice from the list of devices that are sharing this VrpnDial...