author | sl |
Thu, 22 May 2014 07:50:02 +0200 | |
changeset 14 | 4a5538e0ccbf |
child 15 | e5b84f315be7 |
permissions | -rw-r--r-- |
1 //
2 //
3 //
5 #ifndef HID_DEVICE_H
6 #define HID_DEVICE_H
8 #include "HidReport.h"
9 #include "hidapi.h"
12 /**
13 TODO: move to another header
14 */
15 class HidDevice
16 {
17 public:
18 int Open(const char* aPath);
19 int Open(unsigned short aVendorId, unsigned short aProductId, const wchar_t* aSerialNumber);
20 void Close();
21 bool IsOpen();
22 //
23 int SetNonBlocking(int aNonBlocking);
24 //
25 template<int S>
26 int Write(const HidReport<S>& aOutputReport);
27 //
28 const wchar_t* Error();
30 private:
31 ///Our USB HID device
32 hid_device* iHidDevice;
33 };
36 /**
37 */
38 template<int S>
39 int HidDevice::Write(const HidReport<S>& aOutputReport)
40 {
41 return hid_write(iHidDevice,aOutputReport.Buffer(),S);
42 }
45 #endif