-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenRGBTest.cpp
More file actions
33 lines (27 loc) · 1.03 KB
/
Copy pathOpenRGBTest.cpp
File metadata and controls
33 lines (27 loc) · 1.03 KB
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
#include <iostream>
#include <OpenRGB/Client.hpp>
using orgb::ConnectStatus;
using orgb::DeviceListResult;
using orgb::RequestStatus;
using orgb::DeviceType;
int main() {
orgb::Client client("OpenRGB Test Client");
ConnectStatus status = client.connect("127.0.0.1");
if (status != ConnectStatus::Success) {
std::cout << "OpenRGB SDK: Failed to connect: " << enumString(status) << " (error code: " << int(client.getLastSystemError()) << ")" << std::endl;
} else {
std::cout << "OpenRGB SDK: Connected" << std::endl;
}
DeviceListResult result = client.requestDeviceList();
if (result.status != RequestStatus::Success) {
std::cout << "OpenRGB SDK: Failed to get device list: " << enumString(status) << " (error code: " << int(client.getLastSystemError()) << ")" << std::endl;
return 2;
}
std::cout << "devices = [" << std::endl;
for (const orgb::Device & device : result.devices)
{
print(device, 1);
}
std::cout << "]" << std::endl;
return 0;
}