mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
317a903b14
* rework structure of leddevice source tree * fix data type vor v4l sig detection value in webui * automate leddevicefactory.cpp
45 lines
761 B
C++
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;
|
|
}
|