Implement raw DeviceMonitor

Multiple things have been done in this commit; the base of the new
backend has effectively been created. This branch currently has many
vital parts commented out. Therefore, this branch is currently only
intended for debugging.
This commit is contained in:
pixl
2020-06-16 19:53:38 -04:00
parent 526ffec61a
commit ec4ae56bc4
20 changed files with 797 additions and 78 deletions
+32
View File
@@ -0,0 +1,32 @@
#ifndef LOGID_BACKEND_RAW_DEVICEMONITOR_H
#define LOGID_BACKEND_RAW_DEVICEMONITOR_H
#include <string>
#include <mutex>
extern "C"
{
#include <libudev.h>
}
namespace logid::backend::raw
{
class DeviceMonitor
{
public:
void enumerate();
void run();
void stop();
protected:
DeviceMonitor();
~DeviceMonitor();
virtual void addDevice(std::string device) = 0;
virtual void removeDevice(std::string device) = 0;
private:
struct udev* udev_context;
int monitor_pipe[2];
std::mutex running;
};
}
#endif //LOGID_BACKEND_RAW_DEVICEMONITOR_H