finished detector
This commit is contained in:
54
FlippR-Driver/src/input/Detector.h
Normal file
54
FlippR-Driver/src/input/Detector.h
Normal 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_ */
|
||||
Reference in New Issue
Block a user