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()) {
77 output(std::ostream &out)
const {
85 write(std::ostream &out,
int indent_level)
const {
88 << _devices.size() <<
" devices)\n";
95 void VRPN_CALLBACK VrpnDial::
96 vrpn_dial_callback(
void *userdata,
const vrpn_DIALCB info) {
99 if (vrpn_cat.is_debug()) {
101 << *
self <<
" got dial " << info.dial <<
" = " << info.change <<
"\n";
104 Devices::iterator di;
105 for (di = self->_devices.begin(); di !=
self->_devices.end(); ++di) {
107 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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The Panda interface to a VRPN dial device.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
void mark(VrpnDialDevice *device)
Adds the indicated VrpnDialDevice to 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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.