15 #include "vrpnAnalog.h" 16 #include "vrpnAnalogDevice.h" 17 #include "vrpnClient.h" 18 #include "config_vrpn.h" 30 VrpnAnalog(
const string &analog_name, vrpn_Connection *connection) :
31 _analog_name(analog_name)
33 _analog =
new vrpn_Analog_Remote(_analog_name.c_str(), connection);
35 _analog->register_change_handler((
void*)
this, &vrpn_analog_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 VrpnAnalog::
112 vrpn_analog_callback(
void *userdata,
const vrpn_ANALOGCB info) {
115 Devices::iterator di;
116 for (di = self->_devices.begin(); di !=
self->_devices.end(); ++di) {
119 for (
int i = 0; i < info.num_channel; i++) {
120 if (vrpn_cat.is_debug()) {
123 << *
self <<
" got analog " << i <<
" = " << info.channel[i] <<
"\n";
double get_control_state(int index) const
Returns the current position of indicated analog control (identified by its index number)...
void set_control_state(int index, double state)
Sets the state of the indicated analog index.
void unmark(VrpnAnalogDevice *device)
Removes the indicated VrpnAnalogDevice from the list of devices that are sharing this VrpnAnalog...
void unlock()
Releases the mutex associated with this particular device.
The Panda interface to a VRPN analog device.
void acquire()
Grabs the mutex associated with this particular device.
const string & get_analog_name() const
Returns the name of the analog device that was used to create this VrpnAnalog.
void mark(VrpnAnalogDevice *device)
Adds the indicated VrpnAnalogDevice to the list of devices that are sharing this VrpnAnalog.
This is the actual interface to a particular VRPN analog device, and all of its numbered controls...