finished detector

This commit is contained in:
Jonas Zeunert
2018-04-27 00:50:54 +02:00
parent a181f12d20
commit 65bf3e5958
77 changed files with 10430 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
/*
* Detector.h
*
* Created on: Apr 5, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/
#ifndef DETECTOR_H_
#define DETECTOR_H_
#include <vector>
#include <thread>
#include <set>
#include <map>
#include "InputEvent.h"
#include "InputEventHandler.h"
#define SLEEP_DURATION 0.1f
namespace Input
{
class Detector
{
public:
Detector(std::set<InputEvent*> events);
~Detector();
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::set<InputEventHandler*> event_handler;
std::thread detect_thread;
bool is_running;
};
}
#endif /* DETECTOR_H_ */