hyperion.ng
ProviderHID.h
1 #pragma once
2 
3 #include <QObject>
4 
5 // libusb include
6 #include <hidapi/hidapi.h>
7 
8 // Leddevice includes
9 #include <leddevice/LedDevice.h>
10 
14 class ProviderHID : public LedDevice
15 {
16  Q_OBJECT
17 
18 public:
22  ProviderHID();
23 
27  virtual ~ProviderHID();
28 
34  virtual bool init(const QJsonObject &deviceConfig);
35 
41  int open();
42 protected:
51  int writeBytes(const unsigned size, const uint8_t *data);
52 
53  // HID VID and PID
54  unsigned short _VendorId;
55  unsigned short _ProductId;
56  bool _useFeature;
57 
60 
63 
64  bool _blockedForDelay;
65 
66 private slots:
68  void unblockAfterDelay();
69 };
Interface (pure virtual base class) for LedDevices.
Definition: LedDevice.h:32
int _delayAfterConnect_ms
Sleep after the connect before continuing.
Definition: ProviderHID.h:62
The ProviderHID implements an abstract base-class for LedDevices using an HID-device.
Definition: ProviderHID.h:14
Definition: hid-libusb.c:82
int open()
Opens and configures the output device.
Definition: ProviderHID.cpp:45
virtual bool init(const QJsonObject &deviceConfig)
Sets configuration.
Definition: ProviderHID.cpp:30
ProviderHID()
Constructs specific LedDevice.
Definition: ProviderHID.cpp:12
virtual ~ProviderHID()
Destructor of the LedDevice; closes the output device if it is open.
Definition: ProviderHID.cpp:19
hid_device * _deviceHandle
libusb device handle
Definition: ProviderHID.h:59
int writeBytes(const unsigned size, const uint8_t *data)
Writes the given bytes to the HID-device and.
Definition: ProviderHID.cpp:101