mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
96e8c29582
* refresh for all :-) remove dups * - integrate refresh leds for all devices - fix schemas for led devices * add minimum for rewrite time * rewriteTime: add missing info in config examples
45 lines
773 B
C++
45 lines
773 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);
|
|
|
|
std::string fileName = deviceConfig["output"].toString("/dev/null").toStdString();
|
|
_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;
|
|
}
|