27 VrpnAnalog(
const std::string &analog_name, vrpn_Connection *connection) :
28 _analog_name(analog_name)
30 _analog =
new vrpn_Analog_Remote(_analog_name.c_str(), connection);
32 _analog->register_change_handler((
void*)
this, &vrpn_analog_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 VrpnAnalog::
96 vrpn_analog_callback(
void *userdata,
const vrpn_ANALOGCB info) {
100 for (di = self->_devices.begin(); di !=
self->_devices.end(); ++di) {
102 for (
int i = 0; i < info.num_channel; i++) {
103 device->set_axis_value(i, info.channel[i]);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void unmark(VrpnAnalogDevice *device)
Removes the indicated VrpnAnalogDevice from the list of devices that are sharing this VrpnAnalog.
The Panda interface to a VRPN analog device.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const std::string & get_analog_name() const
Returns the name of the analog device that was used to create this VrpnAnalog.
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.
void mark(VrpnAnalogDevice *device)
Adds the indicated VrpnAnalogDevice to the list of devices that are sharing this VrpnAnalog.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the actual interface to a particular VRPN analog device, and all of its numbered controls.