| 52 | public: |
| 53 | typedef util::ValueOrRange<int> RangeType; |
| 54 | VRPNButtonHandler(vrpn_ConnectionPtr const &conn, const char *src, |
| 55 | boost::optional<int> sensor, |
| 56 | common::InterfaceList &ifaces) |
| 57 | : m_remote(new vrpn_Button_Remote(src, conn.get())), |
| 58 | m_interfaces(ifaces), m_all(!sensor.is_initialized()) { |
| 59 | m_remote->register_change_handler(this, &VRPNButtonHandler::handle); |
| 60 | m_remote->register_states_handler( |
| 61 | this, &VRPNButtonHandler::handle_states); |
| 62 | OSVR_DEV_VERBOSE("Constructed a ButtonHandler for " << src); |
| 63 | |
| 64 | if (sensor.is_initialized()) { |
| 65 | m_sensors.setValue(*sensor); |
| 66 | } |
| 67 | } |
| 68 | virtual ~VRPNButtonHandler() { |
| 69 | m_remote->unregister_change_handler(this, |
| 70 | &VRPNButtonHandler::handle); |