30#ifndef VRPN_HUMANINTERFACE_H
31#define VRPN_HUMANINTERFACE_H
63#if defined(VRPN_USE_HID)
105 const char *device_path,
130 vrpn_uint16
vendor()
const;
156 void send_data(
size_t bytes,
const vrpn_uint8 *buffer);
198 void print_error(
const char *function,
const char *msg,
199 bool askHIDAPI =
true)
const;
201 void print_hidapi_error(
const char *function)
const;
226 return (device.
vendor == vendor) && (device.
product == product);
230 vrpn_uint16 product, vendor;
246 const wchar_t *devNum;
285 return delegate->accept(device) && (found++ == target);
294 size_t target, found;
312 bool p = first->accept(device);
313 bool q = second->accept(device);
342 bool p = first->accept(device);
343 bool q = second->accept(device);
A unique-ownership smart pointer, with the ability to transfer ownership, but only explicitly (aka,...
virtual ~vrpn_HidAcceptor()
virtual bool accept(const vrpn_HIDDEVINFO &device)=0
Always accepts the first device passed. Pointless by itself except for testing.
bool accept(const vrpn_HIDDEVINFO &)
vrpn_HidBooleanAndAcceptor(vrpn_HidAcceptor *p, vrpn_HidAcceptor *q)
virtual ~vrpn_HidBooleanAndAcceptor()
bool accept(const vrpn_HIDDEVINFO &device)
vrpn_HidBooleanOrAcceptor(vrpn_HidAcceptor *p, vrpn_HidAcceptor *q)
bool accept(const vrpn_HIDDEVINFO &device)
virtual ~vrpn_HidBooleanOrAcceptor()
bool accept(const vrpn_HIDDEVINFO &device)
vrpn_HidInterfaceNumberAcceptor(int iface)
vrpn_uint16 product() const
Returns USB product ID of connected device May not contain valid if an already-open device was provid...
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 ...
virtual bool reconnect()
Tries to reconnect to an acceptable device. Call this if you suspect a hotplug event has occurred.
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 o...
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 w...
vrpn_HidAcceptor * m_acceptor
This is the HidAcceptor we use when reconnecting.
virtual void update()
Polls the device buffers and causes on_data_received callbacks if appropriate You NEED to call this f...
virtual bool connected() const
Returns true iff the last device I/O succeeded.
virtual void on_data_received(size_t bytes, vrpn_uint8 *buffer)=0
Derived class reimplements this callback.
vrpn_uint16 m_vendor_sought
What vendor we want.
vrpn_uint16 vendor() const
Returns USB vendor ID of connected device May not contain valid if an already-open device was provide...
void send_data(size_t bytes, const vrpn_uint8 *buffer)
Call this to send data to the device.
int interface_number() const
Returns the USB interface number of connected device May not contain valid information on all platfor...
vrpn_HidNthMatchAcceptor(size_t index, vrpn_HidAcceptor *acceptor)
virtual ~vrpn_HidNthMatchAcceptor()
bool accept(const vrpn_HIDDEVINFO &device)
vrpn_HidProductAcceptor(vrpn_uint16 vendorId, vrpn_uint16 productId)
bool accept(const vrpn_HIDDEVINFO &device)
vrpn_HidSerialNumberAcceptor(const wchar_t *serial)
bool accept(const vrpn_HIDDEVINFO &device)
wchar_t * manufacturer_string
struct hid_device_ hid_device