hyperion.ng/libsrc/leddevice/dev_other/LedDeviceFile.cpp
redPanther 317a903b14 Leddevices source tree refactoring (#461)
* rework structure of leddevice source tree

* fix data type vor v4l sig detection value in webui

* automate leddevicefactory.cpp
2017-08-07 10:05:46 +02:00

45 lines
761 B
C++

#include "LedDeviceFile.h"
LedDeviceFile::LedDeviceFile(const QJsonObject &deviceConfig)
: LedDevice()
{
init(deviceConfig);
}
LedDeviceFile::~LedDeviceFile()
{
}
LedDevice* LedDeviceFile::construct(const QJsonObject &deviceConfig)
{
return new LedDeviceFile(deviceConfig);
}
bool LedDeviceFile::init(const QJsonObject &deviceConfig)
{
if ( _ofs.is_open() )
{
_ofs.close();
}
_refresh_timer_interval = 0;
LedDevice::init(deviceConfig);
QString fileName = deviceConfig["output"].toString("/dev/null");
_ofs.open( QSTRING_CSTR(fileName) );
return true;
}
int LedDeviceFile::write(const std::vector<ColorRgb> & ledValues)
{
_ofs << "[";
for (const ColorRgb& color : ledValues)
{
_ofs << color;
}
_ofs << "]" << std::endl;
return 0;
}