mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
5aac2be702
* switch rs232 provider to completly async transfer * start of implementing a seperate init function for leddevices * rename setconfig to init * more fixes * implement missing code * fix code style * remove debug code * remove debug stuff * set loglevel to original state
42 lines
702 B
C++
42 lines
702 B
C++
#include "LedDeviceFile.h"
|
|
|
|
LedDeviceFile::LedDeviceFile(const Json::Value &deviceConfig)
|
|
: LedDevice()
|
|
{
|
|
init(deviceConfig);
|
|
}
|
|
|
|
LedDeviceFile::~LedDeviceFile()
|
|
{
|
|
}
|
|
|
|
LedDevice* LedDeviceFile::construct(const Json::Value &deviceConfig)
|
|
{
|
|
return new LedDeviceFile(deviceConfig);
|
|
}
|
|
|
|
bool LedDeviceFile::init(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;
|
|
}
|