Treehopper C++ API
LibUsbConnection.h
Go to the documentation of this file.
1 //
2 // Created by jay on 4/18/17.
3 //
4 
5 #pragma once
6 
7 #include "Treehopper.h"
8 
9 #include <libusb-1.0/libusb.h>
10 #include "UsbConnection.h"
11 
12 namespace Treehopper {
14  public:
15  LibUsbConnection(libusb_device *device);
16 
18 
19  bool open();
20 
21  void close();
22 
23  std::wstring serialNumber();
24 
25  wstring name();
26 
27  wstring devicePath();
28 
29  void sendDataPinConfigChannel(uint8_t *data, size_t len);
30 
31  void sendDataPeripheralChannel(uint8_t *data, size_t len);
32 
33  bool receiveDataPeripheralChannel(uint8_t *data, size_t len);
34 
35  bool receivePinReportPacket(uint8_t *data);
36 
37  protected:
38  wstring _serialNumber;
39  wstring _name;
40  wstring _devicePath;
41  bool _isOpen = false;
42  uint8_t pinReportEndpoint = 0x81;
43  uint8_t peripheralResponseEndpoint = 0x82;
44  uint8_t pinConfigEndpoint = 0x01;
45  uint8_t peripheralConfigEndpoint = 0x02;
46 
47  libusb_device *deviceProfile;
48  libusb_device_handle *deviceHandle = NULL;
49  };
50 
51 }
Definition: LibUsbConnection.h:13
Definition: AdcPin.h:3
#define TREEHOPPER_API
Definition: Treehopper.h:17
Definition: UsbConnection.h:9