forked from ttsuki/ProControllerHid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhidio.h
More file actions
39 lines (30 loc) · 885 Bytes
/
Copy pathhidio.h
File metadata and controls
39 lines (30 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <cstdint>
#include <memory>
#include <vector>
#include <string>
namespace hidio
{
struct device_info
{
std::string device_path;
std::wstring manufacture_string;
std::wstring product_string;
std::wstring serial_number;
};
std::vector<device_info> enumerate_devices(uint16_t vendorId, uint16_t productId);
struct device
{
// open device
static std::unique_ptr<device> open(const char* device_path);
// returns device path.
[[nodiscard]] virtual const char* device_path() const = 0;
// returns written bytes, or -1 on error.
[[nodiscard]] virtual int write(const void* data, size_t length) = 0;
// returns read bytes, or -1 on error.
[[nodiscard]] virtual int read(void* buffer, size_t length, int timeout_milliseconds = -1) = 0;
// close device.
virtual ~device() = default;
};
void set_thread_priority_to_realtime();
}