refactoring
This commit is contained in:
@@ -10,41 +10,38 @@
|
||||
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <set>
|
||||
#include <map>
|
||||
|
||||
#include "InputEvent.h"
|
||||
#include "InputEventHandler.h"
|
||||
|
||||
#define SLEEP_DURATION 10
|
||||
#define SLEEP_DURATION_NANO 900
|
||||
|
||||
namespace Input
|
||||
{
|
||||
|
||||
class Detector
|
||||
{
|
||||
|
||||
public:
|
||||
Detector(std::map<std::string, char> input_config, std::set<InputEvent> events);
|
||||
Detector(std::map<std::string, char> input_config, std::map<char, InputEvent> events);
|
||||
~Detector();
|
||||
|
||||
void detect();
|
||||
|
||||
void register_input_event_handler(InputEventHandler* handler);
|
||||
void unregister_input_event_handler(InputEventHandler* handler);
|
||||
|
||||
private:
|
||||
void detect();
|
||||
|
||||
bool check_inputs(char& address);
|
||||
void notify_handlers(InputEvent& event);
|
||||
InputEvent& find_event(char address);
|
||||
|
||||
private:
|
||||
std::map<std::string, char> gpio;
|
||||
|
||||
std::set<InputEvent> input_events;
|
||||
std::map<char, InputEvent> input_events;
|
||||
std::set<InputEventHandler*> event_handler;
|
||||
|
||||
std::thread detect_thread;
|
||||
bool is_running;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user