wrote display stuff and refactored thousend things
This commit is contained in:
@@ -10,14 +10,14 @@
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
|
||||
#include "utilities/config.h"
|
||||
#include "utility/config.h"
|
||||
|
||||
namespace FlippR_Driver
|
||||
{
|
||||
namespace Input
|
||||
{
|
||||
|
||||
Detector::Detector(std::unique_ptr<IInputGPIOInterface> input_gpio_interface, std::vector<std::shared_ptr<DistributingEvent>> events) :
|
||||
Detector::Detector(std::unique_ptr<utility::IInputGPIOInterface> input_gpio_interface, std::vector<std::shared_ptr<DistributingEvent>> events) :
|
||||
input_gpio_interface(std::move(input_gpio_interface)), events(events), is_running(true)
|
||||
{
|
||||
this->detect_thread = std::thread(&Detector::detect, this);
|
||||
@@ -49,4 +49,4 @@ void Detector::check_inputs()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "utilities/IInputGPIOInterface.h"
|
||||
#include "utility/IInputGPIOInterface.h"
|
||||
|
||||
#include "IDetector.h"
|
||||
#include "DistributingEvent.h"
|
||||
@@ -34,7 +34,7 @@ class Detector : public IDetector
|
||||
{
|
||||
|
||||
public:
|
||||
Detector(std::unique_ptr<IInputGPIOInterface> input_gpio_interface, std::vector<std::shared_ptr<DistributingEvent>> events);
|
||||
Detector(std::unique_ptr<utility::IInputGPIOInterface> input_gpio_interface, std::vector<std::shared_ptr<DistributingEvent>> events);
|
||||
~Detector();
|
||||
|
||||
private:
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
void check_inputs();
|
||||
|
||||
private:
|
||||
std::unique_ptr<IInputGPIOInterface> input_gpio_interface;
|
||||
std::unique_ptr<utility::IInputGPIOInterface> input_gpio_interface;
|
||||
|
||||
std::vector<std::shared_ptr<DistributingEvent>> events;
|
||||
|
||||
@@ -52,4 +52,4 @@ private:
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -11,14 +11,15 @@
|
||||
#include "Event.h"
|
||||
|
||||
namespace FlippR_Driver {
|
||||
namespace Input {
|
||||
namespace Input {
|
||||
|
||||
class ErrorEvent : public Event {
|
||||
public:
|
||||
ErrorEvent() :
|
||||
Event(0, 0, "ERROR") {}
|
||||
};
|
||||
}
|
||||
class ErrorEvent : public Event
|
||||
{
|
||||
public:
|
||||
ErrorEvent() : Event(0, 0, "ERROR") {}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
#include "Event.h"
|
||||
|
||||
#include "utilities/config.h"
|
||||
#include "utility/config.h"
|
||||
|
||||
namespace FlippR_Driver
|
||||
{
|
||||
@@ -26,4 +26,4 @@ bool operator==(const Event& left, const Event& right)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,32 +5,32 @@
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
||||
*/
|
||||
#include "EventHandler.h"
|
||||
#include "utilities/config.h"
|
||||
#include "utility/config.h"
|
||||
|
||||
namespace FlippR_Driver
|
||||
{
|
||||
namespace Input
|
||||
{
|
||||
|
||||
EventHandler::EventHandler(std::shared_ptr<IInputDriver> input_driver) :
|
||||
input_driver(input_driver)
|
||||
{
|
||||
this->input_driver->register_event_handler(this);
|
||||
EventHandler::EventHandler(std::shared_ptr<IInputDriver> input_driver) :
|
||||
input_driver(input_driver)
|
||||
{
|
||||
this->input_driver->register_event_handler(this);
|
||||
|
||||
CLOG(INFO, INPUT_LOGGER) << "Created EventHandler";
|
||||
}
|
||||
CLOG(INFO, INPUT_LOGGER) << "Created EventHandler";
|
||||
}
|
||||
|
||||
EventHandler::~EventHandler()
|
||||
{
|
||||
this->input_driver->unregister_event_handler(this);
|
||||
this->input_driver = NULL;
|
||||
}
|
||||
EventHandler::~EventHandler()
|
||||
{
|
||||
this->input_driver->unregister_event_handler(this);
|
||||
this->input_driver = NULL;
|
||||
}
|
||||
|
||||
// This function is intended to be non pure, if it is called when the derived class doesn't exist anymore
|
||||
void EventHandler::handle(Event& event)
|
||||
{
|
||||
CLOG(WARNING, INPUT_LOGGER) << "Called EventHandler parent class";
|
||||
}
|
||||
// This function is intended to be non pure, if it is called when the derived class doesn't exist anymore
|
||||
void EventHandler::handle(Event& event)
|
||||
{
|
||||
CLOG(WARNING, INPUT_LOGGER) << "Called EventHandler parent class";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include "utilities/config.h"
|
||||
#include "utility/config.h"
|
||||
|
||||
#include "EventNotifier.h"
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace FlippR_Driver
|
||||
namespace Input
|
||||
{
|
||||
|
||||
EventNotifier::EventNotifier(IBlockingQueue<Event>* queue) :
|
||||
EventNotifier::EventNotifier(utility::IBlockingQueue<Event>* queue) :
|
||||
is_running(true),
|
||||
event_queue(queue)
|
||||
{
|
||||
@@ -82,4 +82,4 @@ void EventNotifier::notify()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
#include "utilities/BlockingQueue.hpp"
|
||||
#include "utilities/IBlockingQueue.h"
|
||||
#include "utility/BlockingQueue.hpp"
|
||||
#include "utility/IBlockingQueue.h"
|
||||
#include "Event.h"
|
||||
#include "EventHandler.h"
|
||||
|
||||
@@ -30,7 +30,7 @@ class EventNotifier : public IEventNotifier
|
||||
{
|
||||
|
||||
public:
|
||||
EventNotifier(IBlockingQueue<Event>* queue);
|
||||
EventNotifier(utility::IBlockingQueue<Event>* queue);
|
||||
~EventNotifier();
|
||||
|
||||
void register_event_handler(IEventHandler* handler);
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
void notify();
|
||||
|
||||
private:
|
||||
IBlockingQueue<Event>* event_queue;
|
||||
utility::IBlockingQueue<Event>* event_queue;
|
||||
std::set<IEventHandler*> event_handlers;
|
||||
|
||||
bool is_running;
|
||||
@@ -54,4 +54,4 @@ private:
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
#include "InputDriver.h"
|
||||
|
||||
#include "utilities/config.h"
|
||||
#include "utility/config.h"
|
||||
|
||||
#include <input/ErrorEvent.hpp>
|
||||
|
||||
@@ -42,9 +42,8 @@ std::shared_ptr<Event> InputDriver::get_event(std::string name)
|
||||
catch(std::out_of_range &e)
|
||||
{
|
||||
CLOG_N_TIMES(1, WARNING, OUTPUT_LOGGER) << "Did not found event " << name << " please check config file!";
|
||||
|
||||
return event;
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,15 +8,15 @@
|
||||
|
||||
#include "InputDriverFactory.h"
|
||||
|
||||
#include "utilities/config.h"
|
||||
#include "utility/config.h"
|
||||
|
||||
#include "utilities/LoggerFactory.h"
|
||||
#include "utility/LoggerFactory.h"
|
||||
|
||||
#include "InputDriver.h"
|
||||
#include "EventNotifier.h"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
using namespace FlippR_Driver::utility;
|
||||
|
||||
namespace FlippR_Driver
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "Detector.h"
|
||||
#include "IInputDriver.h"
|
||||
|
||||
#include "utilities/InputGPIOInterface.h"
|
||||
#include "utility/InputGPIOInterface.h"
|
||||
#include "json/json.hpp"
|
||||
#include "IEventNotifier.h"
|
||||
|
||||
@@ -36,4 +36,4 @@ private:
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user