This commit is contained in:
Jonas Zeunert
2018-05-31 16:11:58 +02:00
3 changed files with 11 additions and 5 deletions

View File

@@ -13,7 +13,7 @@
namespace Input namespace Input
{ {
Detector::Detector(GPIOInterface* in_gpio_interface, std::map<char, InputEvent> events, InputEventNotifier* input_event_notifier) : Detector::Detector(InputGPIOInterface* in_gpio_interface, std::map<char, InputEvent> events, InputEventNotifier* input_event_notifier) :
in_gpio_interface(in_gpio_interface), input_events(events), is_running(true), input_event_notifier(input_event_notifier) in_gpio_interface(in_gpio_interface), input_events(events), is_running(true), input_event_notifier(input_event_notifier)
{ {
detect_thread = std::thread(&Detector::detect, this); detect_thread = std::thread(&Detector::detect, this);

View File

@@ -17,7 +17,7 @@
#include <thread> #include <thread>
#include <map> #include <map>
#include "../utilities/GPIOInterface.hpp" #include "../utilities/InputGPIOInterface.h"
#include "InputEvent.h" #include "InputEvent.h"
#include "InputEventNotifier.h" #include "InputEventNotifier.h"
@@ -36,7 +36,7 @@ class Detector
{ {
public: public:
Detector(GPIOInterface* in_gpio_interface, std::map<char, InputEvent> events, InputEventNotifier* input_event_notifier); Detector(InputGPIOInterface* in_gpio_interface, std::map<char, InputEvent> events, InputEventNotifier* input_event_notifier);
~Detector(); ~Detector();
private: private:
@@ -44,7 +44,7 @@ private:
bool check_inputs(char& address); bool check_inputs(char& address);
private: private:
GPIOInterface* in_gpio_interface; InputGPIOInterface* in_gpio_interface;
std::map<char, InputEvent> input_events; std::map<char, InputEvent> input_events;

View File

@@ -12,6 +12,9 @@
#include "Detector.h" #include "Detector.h"
#include "../utilities/InputGPIOInterface.h"
#include "InputEventNotifier.h"
#include "../lib/json/json.hpp" #include "../lib/json/json.hpp"
using namespace nlohmann; using namespace nlohmann;
@@ -33,9 +36,12 @@ public:
json matrix_config; json matrix_config;
matrix_config << matrix_config_stream; matrix_config << matrix_config_stream;
auto input_gpio_interface = new InputGPIOInterface();
auto input_notifier = new InputEventNotifier();
std::map<char, InputEvent> input_events = create_input_events(matrix_config); std::map<char, InputEvent> input_events = create_input_events(matrix_config);
return std::shared_ptr<Detector*>(new Detector(input_config, input_events)); return std::shared_ptr<Detector*>(new Detector(input_gpio_interface, input_events, input_notifier));
} }
private: private: