weis nimmer
This commit is contained in:
@@ -14,19 +14,16 @@
|
||||
#ifndef DETECTOR_H_
|
||||
#define DETECTOR_H_
|
||||
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
#include "../utilities/GPIOInterface.h"
|
||||
|
||||
#include "InputEvent.h"
|
||||
|
||||
#define LOCK_EVENT_HANDLER() std::lock_guard<std::mutex> event_handler_guard(event_handler_mutex)
|
||||
#include "InputEventNotifier.h"
|
||||
|
||||
#define SLEEP_DURATION_NANO 900
|
||||
|
||||
|
||||
namespace Input
|
||||
{
|
||||
|
||||
@@ -40,30 +37,22 @@ class Detector
|
||||
{
|
||||
|
||||
public:
|
||||
Detector(std::map<std::string, char> input_config, std::map<char, InputEvent> events);
|
||||
Detector(GPIOInterface& gpio_interface, std::map<char, InputEvent> events, InputEventNotifier& input_event_notifier);
|
||||
~Detector();
|
||||
|
||||
void register_input_event_handler(InputEventHandler* handler);
|
||||
void unregister_input_event_handler(InputEventHandler* handler);
|
||||
|
||||
private:
|
||||
void notify_handlers();
|
||||
|
||||
void detect();
|
||||
bool check_inputs(char& address);
|
||||
|
||||
private:
|
||||
std::map<std::string, char> gpio;
|
||||
GPIOInterface& gpio_interface;
|
||||
|
||||
std::map<char, InputEvent> input_events;
|
||||
|
||||
std::queue<InputEvent> event_queue;
|
||||
std::set<InputEventHandler*> event_handler;
|
||||
InputEventNotifier& input_event_notifier;
|
||||
|
||||
bool is_running;
|
||||
std::thread detect_thread;
|
||||
std::thread notify_thread;
|
||||
std::mutex event_handler_mutex;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user