27VrpnAnalog(
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()) {
86output(std::ostream &out)
const {
94write(std::ostream &out,
int indent_level)
const {
97 << _devices.size() <<
" devices)\n";
104void VRPN_CALLBACK VrpnAnalog::
105vrpn_analog_callback(
void *userdata,
const vrpn_ANALOGCB info) {
108 Devices::iterator di;
109 for (di = self->_devices.begin(); di != self->_devices.end(); ++di) {
111 for (
int i = 0; i < info.num_channel; i++) {
112 device->set_axis_value(i, info.channel[i]);
The Panda interface to a VRPN analog device.
This is the actual interface to a particular VRPN analog device, and all of its numbered controls.
const std::string & get_analog_name() const
Returns the name of the analog device that was used to create this VrpnAnalog.
void unmark(VrpnAnalogDevice *device)
Removes the indicated VrpnAnalogDevice from the list of devices that are sharing this VrpnAnalog.
void mark(VrpnAnalogDevice *device)
Adds the indicated VrpnAnalogDevice to the list of devices that are sharing this VrpnAnalog.
void poll()
Polls the connected device.
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.