TestEventNotifier is working now

This commit is contained in:
Neeflix
2018-07-11 22:17:49 +02:00
parent 8b9ec68662
commit 9e3231f037
4 changed files with 32 additions and 16 deletions

View File

@@ -14,13 +14,12 @@
namespace Input
{
EventNotifier::EventNotifier() :
is_running(true)
EventNotifier::EventNotifier(IBlockingQueue<Event>* queue) :
is_running(true),
event_queue(queue)
{
this->notify_thread = std::thread(&EventNotifier::notify, this);
this->event_queue = new BlockingQueue<Event>();
CLOG(INFO, INPUT_LOGGER) << "Created EventNotifier and started thread";
}

View File

@@ -28,7 +28,7 @@ class EventNotifier : public IEventNotifier
{
public:
EventNotifier();
EventNotifier(IBlockingQueue<Event>* queue);
~EventNotifier();
void register_event_handler(IEventHandler* handler);

View File

@@ -22,7 +22,9 @@ std::shared_ptr<InputDriver> InputDriverFactory::get_InputDriver(std::istream& i
{
ConfigureLogger();
std::shared_ptr<IEventNotifier> event_notifier = std::make_shared<EventNotifier>();
IBlockingQueue<Event>* event_queue = new BlockingQueue<Event>;
std::shared_ptr<IEventNotifier> event_notifier = std::make_shared<EventNotifier>(event_queue);
std::unique_ptr<IInputGPIOInterface> input_gpio_interface = std::make_unique<InputGPIOInterface>(input_config_stream);