Treehopper C++ API
WinUsbConnection.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Treehopper.h"
4 #include "UsbConnection.h"
5 #include <string>
6 
7 #define WIN32_LEAN_AND_MEAN
8 
9 #include <windows.h>
10 #include <SDKDDKVer.h>
11 #include <winusb.h>
12 
13 using namespace std;
14 
15 namespace Treehopper {
17  public:
18  WinUsbConnection(wstring devicePath, wstring friendlyName, wstring serialNumber, int rev);
19 
20  ~WinUsbConnection() override;
21 
22  bool open() override;
23 
24  void close() override;
25 
26  void sendDataPinConfigChannel(uint8_t *data, size_t len) override;
27 
28  void sendDataPeripheralChannel(uint8_t *data, size_t len) override;
29 
30  wstring serialNumber() override;
31 
32  wstring name() override;
33 
34  wstring devicePath() override;
35 
36  bool receivePinReportPacket(uint8_t *data) override;
37 
38  bool receiveDataPeripheralChannel(uint8_t *data, size_t len) override;
39 
40  static void debugPrintLastError();
41 
42  private:
43  typedef struct _DEVICE_DATA {
44 
45  BOOL HandlesOpen;
46  WINUSB_INTERFACE_HANDLE WinusbHandle;
47  HANDLE DeviceHandle;
48  TCHAR DevicePath[MAX_PATH];
49 
50  } DEVICE_DATA, *PDEVICE_DATA;
51  DEVICE_DATA deviceData;
52  };
53 }
Definition: WinUsbConnection.h:16
Definition: AdcPin.h:3
#define TREEHOPPER_API
Definition: Treehopper.h:17
Definition: UsbConnection.h:9