mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
d6a34edfb2
* add general switchOff * refactoring of leddevices regarding ledcount and switchoff * remove obsolete includes
42 lines
712 B
C++
42 lines
712 B
C++
#include "LedDeviceFile.h"
|
|
|
|
LedDeviceFile::LedDeviceFile(const Json::Value &deviceConfig)
|
|
: LedDevice()
|
|
{
|
|
setConfig(deviceConfig);
|
|
}
|
|
|
|
LedDeviceFile::~LedDeviceFile()
|
|
{
|
|
}
|
|
|
|
LedDevice* LedDeviceFile::construct(const Json::Value &deviceConfig)
|
|
{
|
|
return new LedDeviceFile(deviceConfig);
|
|
}
|
|
|
|
bool LedDeviceFile::setConfig(const Json::Value &deviceConfig)
|
|
{
|
|
if ( _ofs.is_open() )
|
|
{
|
|
_ofs.close();
|
|
}
|
|
|
|
std::string fileName = deviceConfig.get("output","/dev/null").asString();
|
|
_ofs.open( fileName.c_str() );
|
|
|
|
return true;
|
|
}
|
|
|
|
int LedDeviceFile::write(const std::vector<ColorRgb> & ledValues)
|
|
{
|
|
_ofs << "[";
|
|
for (const ColorRgb& color : ledValues)
|
|
{
|
|
_ofs << color;
|
|
}
|
|
_ofs << "]" << std::endl;
|
|
|
|
return 0;
|
|
}
|