parent
6bfa52e5c1
commit
c04408c2dd
6 changed files with 154 additions and 30 deletions
@ -0,0 +1,30 @@ |
||||
#include "ReceiverMonitor.h" |
||||
|
||||
#include <utility> |
||||
|
||||
using namespace logid::backend::dj; |
||||
|
||||
ReceiverMonitor::ReceiverMonitor(std::string path) : _reciever (std::move(path)) |
||||
{ |
||||
Receiver::notification_flags notification_flags{ |
||||
true, |
||||
true, |
||||
true}; |
||||
_reciever.enableHidppNotifications(notification_flags); |
||||
} |
||||
|
||||
void ReceiverMonitor::run() |
||||
{ |
||||
_reciever.listen(); |
||||
enumerate(); |
||||
} |
||||
|
||||
void ReceiverMonitor::stop() |
||||
{ |
||||
_reciever.stopListening(); |
||||
} |
||||
|
||||
void ReceiverMonitor::enumerate() |
||||
{ |
||||
_reciever.enumerate(); |
||||
} |
@ -1,6 +1,38 @@ |
||||
#ifndef LOGID_BACKEND_DJ_RECEIVERMONITOR_H |
||||
#define LOGID_BACKEND_DJ_RECEIVERMONITOR_H |
||||
|
||||
#include <cstdint> |
||||
#include <string> |
||||
#include "Receiver.h" |
||||
#include "../hidpp/defs.h" |
||||
|
||||
namespace logid { |
||||
namespace backend { |
||||
namespace dj |
||||
{ |
||||
// This class will run on the RawDevice thread,
|
||||
class ReceiverMonitor |
||||
{ |
||||
public: |
||||
ReceiverMonitor(std::string path); |
||||
|
||||
void enumerate(); |
||||
void run(); |
||||
void stop(); |
||||
|
||||
protected: |
||||
virtual void addDevice(hidpp::DeviceIndex index, uint16_t pid) = 0; |
||||
virtual void removeDevice(hidpp::DeviceIndex index) = 0; |
||||
|
||||
// Internal methods for derived class
|
||||
void _pair(uint8_t timeout = 0); |
||||
void _stopPairing(); |
||||
|
||||
void _unpair(); |
||||
private: |
||||
Receiver _reciever; |
||||
}; |
||||
|
||||
}}} |
||||
|
||||
#endif //LOGID_BACKEND_DJ_RECEIVERMONITOR_H
|
Loading…
Reference in new issue