15 #include "vrpnButton.h" 16 #include "vrpnButtonDevice.h" 17 #include "vrpnClient.h" 18 #include "config_vrpn.h" 30 VrpnButton(
const string &button_name, vrpn_Connection *connection) :
31 _button_name(button_name)
33 _button =
new vrpn_Button_Remote(_button_name.c_str(), connection);
35 _button->register_change_handler((
void*)
this, &vrpn_button_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 VrpnButton::
112 vrpn_button_callback(
void *userdata,
const vrpn_BUTTONCB info) {
114 if (vrpn_cat.is_debug()) {
116 << *
self <<
" got button " << info.button <<
" = " << info.state <<
"\n";
119 Devices::iterator di;
120 for (di = self->_devices.begin(); di !=
self->_devices.end(); ++di) {
void unlock()
Releases the mutex associated with this particular device.
void acquire()
Grabs the mutex associated with this particular device.