Use events instead of continous pinging
This commit is contained in:
@@ -1,18 +1,39 @@
|
||||
#ifndef MASTEROPTIONS_DEVICEFINDER_H
|
||||
#define MASTEROPTIONS_DEVICEFINDER_H
|
||||
#ifndef DEVICEFINDER_H
|
||||
#define DEVICEFINDER_H
|
||||
|
||||
#include <hid/DeviceMonitor.h>
|
||||
#include <hidpp/SimpleDispatcher.h>
|
||||
#include <hidpp10/Device.h>
|
||||
#include <hidpp10/IReceiver.h>
|
||||
#include <hidpp20/IReprogControls.h>
|
||||
#include <map>
|
||||
#include <thread>
|
||||
#include "Device.h"
|
||||
|
||||
struct handler_pair;
|
||||
class Device;
|
||||
|
||||
class DeviceFinder : public HID::DeviceMonitor
|
||||
{
|
||||
public:
|
||||
std::map<Device*, std::thread> devices;
|
||||
static constexpr uint16_t UnifyingReceivers[] =
|
||||
{
|
||||
0xc52b, 0xc532, // Official Unifying receivers
|
||||
0xc52f, 0xc526, // Nano receivers
|
||||
0xc52e, 0xc51b,
|
||||
0xc531, 0xc517,
|
||||
0xc518, 0xc51a,
|
||||
0xc521, 0xc525,
|
||||
0xc534,
|
||||
0xc539, 0xc53a, // Lightspeed receivers
|
||||
0xc53f,
|
||||
0x17ef, // Lenovo nano receivers
|
||||
};
|
||||
protected:
|
||||
void addDevice(const char* path);
|
||||
void removeDevice(const char* path);
|
||||
std::map<Device*, std::future<void>> handlers;
|
||||
};
|
||||
|
||||
void find_device();
|
||||
extern DeviceFinder* finder;
|
||||
|
||||
#endif //MASTEROPTIONS_DEVICEFINDER_H
|
||||
#endif //DEVICEFINDER_H
|
||||
Reference in New Issue
Block a user