mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Leddevices source tree refactoring (#461)
* rework structure of leddevice source tree * fix data type vor v4l sig detection value in webui * automate leddevicefactory.cpp
This commit is contained in:
44
libsrc/leddevice/dev_other/LedDeviceFile.cpp
Normal file
44
libsrc/leddevice/dev_other/LedDeviceFile.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#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;
|
||||
}
|
Reference in New Issue
Block a user