Files
flippr-code/FlippR-Driver/src/output/items/detail/Lamp.cpp
2019-05-06 21:41:05 +02:00

49 lines
954 B
C++

/*
* Lamp.cpp
*
* Created on: Aug 2, 2018
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
*/
#include "Lamp.h"
#include <output/DriverBoardPinController.h>
#include "utility/config.h"
namespace flippR_driver
{
namespace output
{
namespace items
{
namespace detail
{
Lamp::Lamp(std::shared_ptr<DriverBoardPinController> pin_controller, uint8_t address, std::string name) :
detail::Item(std::move(name)), DriverBoardItem(address), pin_controller(std::move(pin_controller)), activated(false)
{
CLOG(INFO, OUTPUT_LOGGER) << "Created lamp " << name << " with address " << address;
}
void Lamp::activate()
{
CLOG(INFO, OUTPUT_LOGGER) << "Activate lamp " << name;
this->pin_controller->activate(*this);
}
void Lamp::deactivate()
{
CLOG(INFO, OUTPUT_LOGGER) << "Deactivate lamp " << name;
this->pin_controller->deactivate(*this);
}
bool Lamp::is_activated()
{
return this->activated;
}
}
}
} /* namespace output */
}