refactored input names and created facade

This commit is contained in:
Jonas Zeunert
2018-05-31 17:01:07 +02:00
parent 2bef8b6f2d
commit 2321f2997f
10 changed files with 36 additions and 17 deletions

View File

@@ -18,8 +18,8 @@
#include <map> #include <map>
#include "../utilities/InputGPIOInterface.h" #include "../utilities/InputGPIOInterface.h"
#include "InputEvent.hpp" #include "Event.hpp"
#include "InputEventNotifier.h" #include "EventNotifier.h"
#define SLEEP_DURATION_NANO 900 #define SLEEP_DURATION_NANO 900

View File

@@ -13,7 +13,7 @@
#define INPUTEVENTHANDLER_H_ #define INPUTEVENTHANDLER_H_
#include "Detector.h" #include "Detector.h"
#include "InputEvent.hpp" #include "Event.hpp"
namespace Input namespace Input
{ {

View File

@@ -5,7 +5,7 @@
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/ */
#include "InputEventNotifier.h" #include "EventNotifier.h"
namespace Input namespace Input
{ {

View File

@@ -5,16 +5,16 @@
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/ */
#ifndef SRC_INPUT_INPUTEVENTNOTIFIER_H_ #ifndef SRC_INPUT_EVENTNOTIFIER_H_
#define SRC_INPUT_INPUTEVENTNOTIFIER_H_ #define SRC_INPUT_EVENTNOTIFIER_H_
#include <set> #include <set>
#include <thread> #include <thread>
#include <mutex> #include <mutex>
#include "../utilities/BlockingQueue.hpp" #include "../utilities/BlockingQueue.hpp"
#include "InputEvent.hpp" #include "Event.hpp"
#include "InputEventHandler.hpp" #include "EventHandler.hpp"
namespace Input namespace Input
{ {
@@ -44,4 +44,4 @@ private:
#endif /* SRC_INPUT_INPUTEVENTNOTIFIER_H_ */ #endif /* SRC_INPUT_EVENTNOTIFIER_H_ */

View File

@@ -0,0 +1,15 @@
/*
* InputDriver.hpp
*
* Created on: May 31, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/
#ifndef SRC_INPUT_INPUTDRIVER_HPP_
#define SRC_INPUT_INPUTDRIVER_HPP_
#endif /* SRC_INPUT_INPUTDRIVER_HPP_ */

View File

@@ -13,9 +13,8 @@
#include "Detector.h" #include "Detector.h"
#include "../utilities/InputGPIOInterface.h" #include "../utilities/InputGPIOInterface.h"
#include "InputEventNotifier.h"
#include "../lib/json/json.hpp" #include "../lib/json/json.hpp"
#include "EventNotifier.h"
using namespace nlohmann; using namespace nlohmann;
@@ -32,9 +31,6 @@ public:
json input_config; json input_config;
input_config << input_config_stream; input_config << input_config_stream;
std::ifstream matrix_config_stream(input_config_path);
json matrix_config;
matrix_config << matrix_config_stream;
auto input_gpio_interface = new InputGPIOInterface(); auto input_gpio_interface = new InputGPIOInterface();
auto input_notifier = new InputEventNotifier(); auto input_notifier = new InputEventNotifier();

View File

@@ -2,7 +2,7 @@
#include "Detector.h" #include "Detector.h"
#include <iostream> #include <iostream>
#include "InputEvent.hpp" #include "Event.hpp"
int main() int main()
{ {
return 0; return 0;

View File

@@ -4,8 +4,10 @@
* Created on: May 31, 2018 * Created on: May 31, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht * Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
*/ */
#include "InputGPIOInterface.h"
#include <fstream>
#include "InputGPIOInterface.h"
bool InputGPIOInterface::read_input_data(char pin) bool InputGPIOInterface::read_input_data(char pin)
{ {
@@ -31,6 +33,9 @@ void InputGPIOInterface::write_input_col(char data)
} }
InputGPIOInterface() InputGPIOInterface::InputGPIOInterface()
{ {
std::ifstream matrix_config_stream(matrix_config_path);
json matrix_config;
matrix_config << matrix_config_stream;
} }

View File

@@ -10,7 +10,10 @@
#include "GPIOInterface.hpp" #include "GPIOInterface.hpp"
#include <exception>
#define MATRIX_SIZE 8 #define MATRIX_SIZE 8
class InputGPIOInterface : GPIOInterface class InputGPIOInterface : GPIOInterface
{ {
public: public: