5 #include <IOKit/hid/IOHIDManager.h>
6 #include "errorstack.hh"
7 #include "radiointerface.hh"
40 unsigned char *rdata,
unsigned rlength,
48 static QList<USBDeviceDescriptor>
detect(uint16_t vid, uint16_t pid);
52 static void callback_input(
void *context, IOReturn result,
void *sender, IOHIDReportType type,
53 uint32_t reportID, uint8_t *data, CFIndex nbytes);
55 static void callback_open(
void *context, IOReturn result,
void *sender, IOHIDDeviceRef deviceRef);
57 static void callback_close(
void *ontext, IOReturn result,
void *sender, IOHIDDeviceRef deviceRef);
63 volatile IOHIDDeviceRef
_dev;
Implements a stack of error messages to provide a pretty formatted error traceback.
Definition: errorstack.hh:41
Descriptor(const USBDeviceInfo &info, uint8_t bus, uint8_t device)
Constructor from interface info, bus number and device address.
Definition: hid_libusb.cc:11
Implements the HID radio interface using libusb.
Definition: hid_libusb.hh:12
volatile IOHIDDeviceRef _dev
Device handle.
Definition: hid_macos.hh:63
unsigned char _receive_buf[42]
Receive buffer.
Definition: hid_libusb.hh:64
static void callback_open(void *context, IOReturn result, void *sender, IOHIDDeviceRef deviceRef)
Internal callback for device opend.
Definition: hid_macos.cc:266
static void callback_input(void *context, IOReturn result, void *sender, IOHIDReportType type, uint32_t reportID, uint8_t *data, CFIndex nbytes)
Internal callback for response data.
Definition: hid_macos.cc:236
IOHIDManagerRef _HIDManager
Device manager.
Definition: hid_macos.hh:61
HIDevice(const USBDeviceDescriptor &descr, const ErrorStack &err=ErrorStack(), QObject *parent=nullptr)
Opens a connection to the device with given vendor and product ID.
virtual ~HIDevice()
Destructor.
bool hid_send_recv(const unsigned char *data, unsigned nbytes, unsigned char *rdata, unsigned rlength, const ErrorStack &err=ErrorStack())
Send command/data to the device and store response in rdata.
static void callback_close(void *ontext, IOReturn result, void *sender, IOHIDDeviceRef deviceRef)
Internal callback for device closed.
Definition: hid_macos.cc:289
static QList< USBDeviceDescriptor > detect(uint16_t vid, uint16_t pid)
Finds all HID interfaces with the specified VID/PID combination.
bool isOpen() const
Returns true if the connection was established.
void close()
Close connection to device.
unsigned char _transfer_buf[42]
Device buffer.
Definition: hid_macos.hh:65
volatile int _nbytes_received
Receive result.
Definition: hid_libusb.hh:66
Base class for all radio interface descriptors representing a unique interface to a connected radio.
Definition: usbdevice.hh:197
const QVariant & device() const
Returns the device information identifying the interface uniquely.
Definition: usbdevice.cc:276
Generic information about a possible radio interface.
Definition: usbdevice.hh:121