alles was wir bis dahin haben

This commit is contained in:
Jonas Zeunert
2018-09-26 23:43:37 +02:00
parent b970dd3c80
commit fc7cdb2a7a
6 changed files with 39 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ void FlippR_Driver::Input::DistributingEvent::distribute()
std::chrono::milliseconds elapsed_time = std::chrono::duration_cast<std::chrono::milliseconds>(now - last_activation);
if(elapsed_time > deactivation_time)
{
event_notifier->distribute_event(*this); // todo why new shared ptr?
event_notifier->distribute_event(*this);
this->last_activation = now;
}
}

View File

@@ -9,6 +9,13 @@
#define _SRC_OUTPUT_OUTPUTDRIVER_H_
#include "IOutputDriver.h"
#include <vector>
#include <map>
#include <memory>
#include "ICabinetItem.h"
#include "IDisplay.h"
#include "ISound.h"
namespace output {
@@ -16,6 +23,19 @@ class OutputDriver: public IOutputDriver {
public:
OutputDriver();
virtual ~OutputDriver();
std::vector<std::shared_ptr<ICabinetItem>> get_cabinet_items();
std::vector<std::shared_ptr<ISound>> get_sounds();
std::vector<std::shared_ptr<IDisplay>> get_displays();
std::shared_ptr<ICabinetItem> get_cabinet_item(std::string name);
std::shared_ptr<ISound> get_sound(std::string name);
std::shared_ptr<IDisplay> get_display(char number);
private:
std::map<std::string, std::shared_ptr<ICabinetItem>> cabinet_items;
std::map<char, std::shared_ptr<IDisplay>> displays;
std::map<std::string, std::shared_ptr<ISound>> sounds;
};
} /* namespace output */

View File

@@ -12,29 +12,32 @@ INITIALIZE_EASYLOGGINGPP
#endif
namespace LoggerFactory
{
void CreateInputTestLogger()
void CreateInputTestLogger(el::Level level)
{
el::Loggers::getLogger(INPUT_LOGGER);
el::Configurations conf;
conf.setToDefault();
conf.set(el::Level::Global, el::ConfigurationType::ToFile, "false");
conf.set(el::Level::Global, el::ConfigurationType::Format, "%datetime [%level] [%func] : %msg");
conf.set(level, el::ConfigurationType::ToFile, "false");
conf.set(level, el::ConfigurationType::Format, "%datetime [%level] [%func] : %msg");
el::Loggers::reconfigureAllLoggers(conf);
}
void CreateInputLogger()
void CreateInputLogger(el::Level level)
{
el::Loggers::getLogger(INPUT_LOGGER);
el::Configurations conf;
conf.setToDefault();
conf.set(el::Level::Global, el::ConfigurationType::ToFile, "true");
conf.set(el::Level::Global, el::ConfigurationType::Filename, LOGGER_FILE);
conf.set(el::Level::Global, el::ConfigurationType::Format, "%datetime [%level] [%func] : %msg");
conf.setGlobally(el::ConfigurationType::ToStandardOutput, "false");
conf.set(level, el::ConfigurationType::ToStandardOutput, "true");
conf.set(level, el::ConfigurationType::ToFile, "true");
conf.set(level, el::ConfigurationType::Filename, LOGGER_FILE);
conf.set(level, el::ConfigurationType::Format, "%datetime [%level] [%func] : %msg");
el::Loggers::reconfigureLogger(INPUT_LOGGER, conf);
}

View File

@@ -8,11 +8,13 @@
#ifndef SRC_UTILITIES_LOGGERFACTORY_HPP_
#define SRC_UTILITIES_LOGGERFACTORY_HPP_
#include "config.h"
namespace LoggerFactory
{
void CreateInputTestLogger();
void CreateInputTestLogger(el::Level level = el::Level::Global);
void CreateInputLogger();
void CreateInputLogger(el::Level level = el::Level::Info);
};
#endif

View File

@@ -9,10 +9,14 @@
#define SRC_UTILITIES_OUTPUTGPIOINTERFACE_H_
#include "GPIOInterface.h"
#include <mcp23017.h>
class OutputGPIOInterface : GPIOInterface
{
private:
IBlockingQueue<std::tuple<int, int, bool>>
};

View File

@@ -7,8 +7,6 @@
#include "easylogging++.h"
// initialize easylogging once
#define INPUT_LOGGER "driver_logger"
#define OUTPUT_LOGGER "output_logger"
@@ -22,8 +20,6 @@
#define INPUT_MATRIX_SIZE 8
#define INPUT_SLEEP_DURATION_NANO 800
#define NUMBER_OF_DISPLAYS 5
#define PULLDOWN false
#define HIGHEST_INPUT_EVENT_PRIORITY 0