27 VrpnDial(
const std::string &dial_name, vrpn_Connection *connection) :
30 _dial =
new vrpn_Dial_Remote(_dial_name.c_str(), connection);
32 _dial->register_change_handler((
void*)
this, &vrpn_dial_callback);
49 if (vrpn_cat.is_debug()) {
50 vrpn_cat.debug() << *
this <<
" marking " << *device <<
"\n";
52 _devices.push_back(device);
61 if (vrpn_cat.is_debug()) {
62 vrpn_cat.debug() << *
this <<
" unmarking " << *device <<
"\n";
65 Devices::iterator di =
66 find(_devices.begin(), _devices.end(), device);
68 if (di != _devices.end()) {
86 output(std::ostream &out)
const {
94 write(std::ostream &out,
int indent_level)
const {
97 << _devices.size() <<
" devices)\n";
104 void VRPN_CALLBACK VrpnDial::
105 vrpn_dial_callback(
void *userdata,
const vrpn_DIALCB info) {
108 if (vrpn_cat.is_debug()) {
110 << *
self <<
" got dial " << info.dial <<
" = " << info.change <<
"\n";
113 Devices::iterator di;
114 for (di = self->_devices.begin(); di !=
self->_devices.end(); ++di) {
116 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.
The Panda interface to a VRPN dial device.
This is the actual interface to a particular VRPN dial device, and all of its numbered dials.
void mark(VrpnDialDevice *device)
Adds the indicated VrpnDialDevice to the list of devices that are sharing this VrpnDial.
void poll()
Polls the connected device.
void unmark(VrpnDialDevice *device)
Removes the indicated VrpnDialDevice from the list of devices that are sharing this VrpnDial.
const std::string & get_dial_name() const
Returns the name of the dial device that was used to create this VrpnDial.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.