![]() |
RflySimSDK v3.05
RflySimSDK说明文档
|
Public 成员函数 | |
vrpn_HidInterface (vrpn_HidAcceptor *acceptor, vrpn_uint16 vendor=0, vrpn_uint16 product=0, hid_device *device=NULL) | |
vrpn_HidInterface (vrpn_HidAcceptor *acceptor, hid_device *device) | |
vrpn_HidInterface (const char *device_path, vrpn_HidAcceptor *acceptor, vrpn_uint16 vendor=0, vrpn_uint16 product=0) | |
virtual bool | connected () const |
Returns true iff the last device I/O succeeded | |
virtual void | update () |
virtual bool | reconnect () |
vrpn_uint16 | vendor () const |
vrpn_uint16 | product () const |
int | interface_number () const |
Protected 成员函数 | |
virtual void | on_data_received (size_t bytes, vrpn_uint8 *buffer)=0 |
Derived class reimplements this callback. It is called whenever a read returns some data. | |
void | send_data (size_t bytes, const vrpn_uint8 *buffer) |
Call this to send data to the device | |
void | send_feature_report (size_t bytes, const vrpn_uint8 *buffer) |
int | get_feature_report (size_t bytes, vrpn_uint8 *buffer) |
Protected 属性 | |
vrpn_HidAcceptor * | m_acceptor |
This is the HidAcceptor we use when reconnecting. | |
bool | m_working |
vrpn_uint16 | m_vendor |
vrpn_uint16 | m_product |
int | m_interface |
vrpn_uint16 | m_vendor_sought |
What vendor we want | |
vrpn_uint16 | m_product_sought |
What product we want | |
vrpn_HidInterface | ( | vrpn_HidAcceptor * | acceptor, |
vrpn_uint16 | vendor = 0, | ||
vrpn_uint16 | product = 0, | ||
hid_device * | device = NULL ) |
Constructor If we already have a HID device from some other source, it can be passed and we'll take ownership: still need the acceptor for reconnect, we just won't do it right away.
acceptor | Determines which device we want |
vendor | Default vendor is "any" |
product | Default product is "any" |
device | Optional underlying HID device to manage and take ownership of |
vrpn_HidInterface | ( | vrpn_HidAcceptor * | acceptor, |
hid_device * | device ) |
Simplified constructor that just takes an acceptor and an underlying HID device (both non-optional).
Designed for passing in a device (May look at you funny if you pass a NULL device, but will work just as if you had called the other constructor with a null device) but handles NULL devices just fine.
acceptor | Determines which device we want |
device | Underlying HID device to manage and take ownership of |
vrpn_HidInterface | ( | const char * | device_path, |
vrpn_HidAcceptor * | acceptor, | ||
vrpn_uint16 | vendor = 0, | ||
vrpn_uint16 | product = 0 ) |
Constructor If we already know the path to the device we want, we can pass it in and open it directly: still need the acceptor for reconnect enumeration, we just won't do it right away.
device_path | Platform-specific device path, suitable to be passed to HIDAPI's hid_open_path |
acceptor | Determines which device we want |
vendor | Default vendor is "any" |
product | Default product is "any" |
|
virtual |
Returns true iff the last device I/O succeeded
|
protected |
Call this to get a feature report from the device - first byte must be Report ID (or 0x0 for devices without numbered reports)
int interface_number | ( | ) | const |
Returns the USB interface number of connected device May not contain valid information on all platforms or if an already-open device was provided to the constructor.
|
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.
在 vrpn_3DConnexion, vrpn_Analog_5dtUSB, vrpn_CHProducts_Controller_Raw, vrpn_Contour, vrpn_DreamCheeky, vrpn_Futaba, vrpn_Griffin, vrpn_Logitech_Controller_Raw, vrpn_Microsoft_Controller_Raw, vrpn_nVidia_shield, vrpn_Retrolink, vrpn_Saitek_Controller_Raw, vrpn_Tracker_SpacePoint, vrpn_Tracker_Wintracker, vrpn_Vality , 以及 vrpn_Xkeys 内被实现.
vrpn_uint16 product | ( | ) | const |
Returns USB product ID of connected device May not contain valid if an already-open device was provided to the constructor.
|
virtual |
Tries to reconnect to an acceptable device. Call this if you suspect a hotplug event has occurred.
|
protected |
Call this to send data to the device
|
protected |
Call this to send a feature report to the device - first byte must be Report ID (or 0x0 for devices without numbered reports)
|
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
vrpn_uint16 vendor | ( | ) | const |
Returns USB vendor ID of connected device May not contain valid if an already-open device was provided to the constructor.
|
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.
|
protected |
What product we want
|
protected |
What vendor we want