-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (26 loc) · 946 Bytes
/
main.cpp
File metadata and controls
33 lines (26 loc) · 946 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
#include <iostream>
#include <vector>
#include "src/Prober.h"
#include "src/Command.h"
int main(int argc, char** argv)
{
Prober prober;
std::vector<std::string> cmdList;
for(int argCounter = 0; argCounter < argc; argCounter += 1) {
cmdList.emplace_back(std::string(argv[argCounter]));
}
for(auto const& deviceItem : prober.discoverDevices()) {
auto const& device = deviceItem.second;
std::cout << "Found a device at " << device.location << ", ID: " << device.id << std::endl;
if(argc > 1) {
Command command(device.location);
std::string method(argv[1]);
std::cout << "Sending command " << method << " to this device..." << std::endl;
command.sendCommand(method, cmdList);
command.receiveResult();
} else {
std::cout << "No action required on this YeeLight lamp" << std::endl;
}
}
return 0;
}