added 2 output_tests + some add to output_driver

This commit is contained in:
Jonas Zeunert
2019-05-02 10:52:47 +02:00
parent 2ae71c2f53
commit 5e0517cf8a
8 changed files with 317 additions and 190 deletions

View File

@@ -7,6 +7,7 @@
#include <boost/range/adaptor/map.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <thread>
#include "OutputDriver.h"
@@ -37,6 +38,28 @@ void OutputDriver::deactivate_displays() const
display_controller->deactivate_displays();
}
void OutputDriver::deactivate_all_lamps() const
{
std::for_each(lamps.begin(), lamps.end(), [](items::Lamp& lamp){lamp.deactivate();});
}
void OutputDriver::activate_all_lamps() const
{
std::for_each(lamps.begin(), lamps.end(), [](items::Lamp& lamp){lamp.activate();});
}
void OutputDriver::rotate_all_lamps() const
{
for(auto lamp = lamps.begin(); lamp != lamps.end(); lamp++)
{
lamp->second->activate();
// ToDo sleep time + is this thread safe??
std::this_thread::sleep_for(std::chrono::milliseconds(10));
lamp->second->deactivate();
}
}
std::vector<std::shared_ptr<Sound>> OutputDriver::get_sounds() const
{
std::vector<std::shared_ptr<Sound>> sounds;
@@ -93,6 +116,7 @@ boost::optional<std::shared_ptr<items::Display>> OutputDriver::get_display(uint8
return this->displays.find(number)->second;
}
}
} /* namespace output */
}