vrpn
07.33
Virtual Reality Peripheral Network
|
#include <vrpn_HumanInterface.h>
Public Member Functions | |
vrpn_HidInterface (vrpn_HidAcceptor *acceptor) | |
virtual | ~vrpn_HidInterface () |
virtual bool | connected () const |
Returns true iff the last device I/O succeeded. More... | |
virtual void | update () |
Polls the device buffers and causes on_data_received callbacks if appropriate You NEED to call this frequently to ensure the OS doesn't drop data. More... | |
virtual bool | reconnect () |
Tries to reconnect to an acceptable device. Call this if you suspect a hotplug event has occurred. More... | |
vrpn_uint16 | vendor () const |
Returns USB vendor ID of connected device. More... | |
vrpn_uint16 | product () const |
Returns USB product ID of connected device. More... | |
int | interface_number () const |
Returns the USB interface number of connected device. More... | |
Protected Member Functions | |
virtual void | on_data_received (size_t bytes, vrpn_uint8 *buffer)=0 |
Derived class reimplements this callback. More... | |
void | send_data (size_t bytes, const vrpn_uint8 *buffer) |
Call this to send data to the device. More... | |
void | send_feature_report (size_t bytes, const vrpn_uint8 *buffer) |
Call this to send a feature report to the device - first byte must be Report ID (or 0x0 for devices without numbered reports) More... | |
int | get_feature_report (size_t bytes, vrpn_uint8 *buffer) |
Call this to get a feature report from the device - first byte must be Report ID (or 0x0 for devices without numbered reports) More... | |
Protected Attributes | |
vrpn_HidAcceptor * | _acceptor |
This is the HidAcceptor we use when reconnecting. More... | |
bool | _working |
vrpn_uint16 | _vendor |
vrpn_uint16 | _product |
int | _interface |
Definition at line 68 of file vrpn_HumanInterface.h.
vrpn_HidInterface::vrpn_HidInterface | ( | vrpn_HidAcceptor * | acceptor | ) |
Definition at line 25 of file vrpn_HumanInterface.C.
References _acceptor, reconnect(), and vrpn_HidAcceptor::reset().
|
virtual |
Definition at line 44 of file vrpn_HumanInterface.C.
|
virtual |
Returns true iff the last device I/O succeeded.
Definition at line 23 of file vrpn_HumanInterface.C.
References _working.
Referenced by vrpn_Analog_5dtUSB::mainloop(), vrpn_Tracker_OSVRHackerDevKit::mainloop(), vrpn_Tracker_SpacePoint::mainloop(), and vrpn_Tracker_Wintracker::mainloop().
|
protected |
Call this to get a feature report from the device - first byte must be Report ID (or 0x0 for devices without numbered reports)
Definition at line 229 of file vrpn_HumanInterface.C.
References _working.
int vrpn_HidInterface::interface_number | ( | ) | const |
Returns the USB interface number of connected device.
Definition at line 20 of file vrpn_HumanInterface.C.
References _interface.
|
protectedpure virtual |
Derived class reimplements this callback.
It is called whenever a read returns some data.
WARNING! The data returned by this function differs when the device sends multiple report types and when it only has one. When it can have more than one, the report type is sent as the first byte. When it only has one, the report type is NOT included. This is the behavior of the HIDAPI library we are using. It is surprising to me, but that's how it behaves.
Implemented in vrpn_Xkeys, vrpn_Tracker_Wintracker, vrpn_Tracker_SpacePoint, vrpn_Saitek_Controller_Raw, vrpn_Retrolink, vrpn_Microsoft_Controller_Raw, vrpn_Logitech_Controller_Raw, vrpn_Griffin, vrpn_Futaba, vrpn_DreamCheeky, vrpn_Contour, vrpn_CHProducts_Controller_Raw, vrpn_Analog_5dtUSB, and vrpn_3DConnexion.
Referenced by update().
vrpn_uint16 vrpn_HidInterface::product | ( | ) | const |
Returns USB product ID of connected device.
Definition at line 17 of file vrpn_HumanInterface.C.
References _product.
Referenced by vrpn_Analog_5dtUSB::get_description().
|
virtual |
Tries to reconnect to an acceptable device. Call this if you suspect a hotplug event has occurred.
Definition at line 55 of file vrpn_HumanInterface.C.
References _acceptor, _interface, _product, _vendor, _working, vrpn_HidAcceptor::accept(), vrpn_HIDDEVINFO::interface_number, vrpn_HIDDEVINFO::manufacturer_string, vrpn_HIDDEVINFO::product, vrpn_HIDDEVINFO::product_string, vrpn_HIDDEVINFO::serial_number, and vrpn_HIDDEVINFO::vendor.
Referenced by vrpn_Tracker_SpacePoint::on_data_received(), and vrpn_HidInterface().
|
protected |
Call this to send data to the device.
Definition at line 187 of file vrpn_HumanInterface.C.
References _working.
Referenced by vrpn_Xkeys::init_hid(), vrpn_Xkeys::on_connect(), vrpn_Xkeys::on_last_disconnect(), vrpn_Tracker_Wintracker::vrpn_Tracker_Wintracker(), and vrpn_Xkeys::~vrpn_Xkeys().
|
protected |
Call this to send a feature report to the device - first byte must be Report ID (or 0x0 for devices without numbered reports)
Definition at line 203 of file vrpn_HumanInterface.C.
References _working.
|
virtual |
Polls the device buffers and causes on_data_received callbacks if appropriate You NEED to call this frequently to ensure the OS doesn't drop data.
Definition at line 140 of file vrpn_HumanInterface.C.
References _working, and on_data_received().
Referenced by vrpn_3DConnexion::mainloop(), vrpn_Analog_5dtUSB::mainloop(), vrpn_DreamCheeky_Drum_Kit::mainloop(), vrpn_Tracker_OSVRHackerDevKit::mainloop(), vrpn_Tracker_SpacePoint::mainloop(), vrpn_Tracker_Wintracker::mainloop(), vrpn_Xkeys_Desktop::mainloop(), vrpn_Xkeys_Pro::mainloop(), vrpn_Xkeys_Joystick::mainloop(), vrpn_Xkeys_Jog_And_Shuttle::mainloop(), vrpn_Xkeys_XK3::mainloop(), vrpn_CHProducts_Fighterstick_USB::mainloop(), vrpn_Contour_ShuttleXpress::mainloop(), vrpn_Futaba_InterLink_Elite::mainloop(), vrpn_Griffin_PowerMate::mainloop(), vrpn_Logitech_Extreme_3D_Pro::mainloop(), vrpn_Microsoft_SideWinder_Precision_2::mainloop(), vrpn_Microsoft_SideWinder::mainloop(), vrpn_Microsoft_Controller_Raw_Xbox_S::mainloop(), vrpn_Microsoft_Controller_Raw_Xbox_360::mainloop(), vrpn_Retrolink_GameCube::mainloop(), and vrpn_Saitek_ST290_Pro::mainloop().
vrpn_uint16 vrpn_HidInterface::vendor | ( | ) | const |
Returns USB vendor ID of connected device.
Definition at line 14 of file vrpn_HumanInterface.C.
References _vendor.
|
protected |
This is the HidAcceptor we use when reconnecting.
We do not take ownership of the pointer; it is the user's responsibility. Using a stack-allocated acceptor is a really good way to get a segfault when calling reconnect()–there won't be an acceptor there any longer! Thus, always use "new" to make your acceptors.
Definition at line 127 of file vrpn_HumanInterface.h.
Referenced by reconnect(), vrpn_HidInterface(), vrpn_Analog_5dtUSB::~vrpn_Analog_5dtUSB(), and vrpn_Tracker_OSVRHackerDevKit::~vrpn_Tracker_OSVRHackerDevKit().
|
protected |
Definition at line 132 of file vrpn_HumanInterface.h.
Referenced by interface_number(), and reconnect().
|
protected |
Definition at line 131 of file vrpn_HumanInterface.h.
Referenced by product(), and reconnect().
|
protected |
Definition at line 130 of file vrpn_HumanInterface.h.
Referenced by reconnect(), and vendor().
|
protected |
Definition at line 129 of file vrpn_HumanInterface.h.
Referenced by connected(), get_feature_report(), reconnect(), send_data(), send_feature_report(), and update().