mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge remote-tracking branch 'refs/remotes/origin/Beta'
Former-commit-id: 5bdbda1406bb0ddb99440502584604b85b0f3063
This commit is contained in:
@@ -21,7 +21,7 @@ SET(Leddevice_QT_HEADERS
|
||||
${CURRENT_SOURCE_DIR}/LedDevicePhilipsHue.h
|
||||
${CURRENT_SOURCE_DIR}/LedHIDDevice.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceRawHID.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceTest.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceFile.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceFadeCandy.h
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ SET(Leddevice_HEADERS
|
||||
${CURRENT_SOURCE_DIR}/LedDevicePaintpack.h
|
||||
${CURRENT_SOURCE_DIR}/LedDevicePiBlaster.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceSedu.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceTest.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceFile.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceFadeCandy.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceUdp.h
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceHyperionUsbasp.h
|
||||
@@ -58,7 +58,7 @@ SET(Leddevice_SOURCES
|
||||
${CURRENT_SOURCE_DIR}/LedDevicePaintpack.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDevicePiBlaster.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceSedu.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceTest.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceFile.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceFadeCandy.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceUdp.cpp
|
||||
${CURRENT_SOURCE_DIR}/LedDeviceHyperionUsbasp.cpp
|
||||
|
@@ -29,7 +29,7 @@
|
||||
#include "LedDevicePaintpack.h"
|
||||
#include "LedDevicePiBlaster.h"
|
||||
#include "LedDeviceSedu.h"
|
||||
#include "LedDeviceTest.h"
|
||||
#include "LedDeviceFile.h"
|
||||
#include "LedDeviceFadeCandy.h"
|
||||
#include "LedDeviceUdp.h"
|
||||
#include "LedDeviceHyperionUsbasp.h"
|
||||
@@ -275,10 +275,10 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
||||
|
||||
device = new LedDeviceAtmoOrb(output, switchOffOnBlack, transitiontime, port, numLeds, orbIds);
|
||||
}
|
||||
else if (type == "test")
|
||||
else if (type == "file")
|
||||
{
|
||||
const std::string output = deviceConfig["output"].asString();
|
||||
device = new LedDeviceTest(output);
|
||||
const std::string output = deviceConfig.get("output", "/dev/null").asString();
|
||||
device = new LedDeviceFile(output);
|
||||
}
|
||||
else if (type == "fadecandy")
|
||||
{
|
||||
|
31
libsrc/leddevice/LedDeviceFile.cpp
Normal file
31
libsrc/leddevice/LedDeviceFile.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
// Local-Hyperion includes
|
||||
#include "LedDeviceFile.h"
|
||||
|
||||
LedDeviceFile::LedDeviceFile(const std::string& output) :
|
||||
_ofs(output.empty()?"/dev/null":output.c_str())
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
LedDeviceFile::~LedDeviceFile()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
int LedDeviceFile::write(const std::vector<ColorRgb> & ledValues)
|
||||
{
|
||||
_ofs << "[";
|
||||
for (const ColorRgb& color : ledValues)
|
||||
{
|
||||
_ofs << color;
|
||||
}
|
||||
_ofs << "]" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LedDeviceFile::switchOff()
|
||||
{
|
||||
return 0;
|
||||
}
|
@@ -10,18 +10,18 @@
|
||||
/// Implementation of the LedDevice that write the led-colors to an
|
||||
/// ASCII-textfile('/home/pi/LedDevice.out')
|
||||
///
|
||||
class LedDeviceTest : public LedDevice
|
||||
class LedDeviceFile : public LedDevice
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs the test-device, which opens an output stream to the file
|
||||
///
|
||||
LedDeviceTest(const std::string& output);
|
||||
LedDeviceFile(const std::string& output);
|
||||
|
||||
///
|
||||
/// Destructor of this test-device
|
||||
///
|
||||
virtual ~LedDeviceTest();
|
||||
virtual ~LedDeviceFile();
|
||||
|
||||
///
|
||||
/// Writes the given led-color values to the output stream
|
@@ -1,31 +0,0 @@
|
||||
|
||||
// Local-Hyperion includes
|
||||
#include "LedDeviceTest.h"
|
||||
|
||||
LedDeviceTest::LedDeviceTest(const std::string& output) :
|
||||
_ofs(output.empty()?"/home/pi/LedDevice.out":output.c_str())
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
LedDeviceTest::~LedDeviceTest()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
|
||||
int LedDeviceTest::write(const std::vector<ColorRgb> & ledValues)
|
||||
{
|
||||
_ofs << "[";
|
||||
for (const ColorRgb& color : ledValues)
|
||||
{
|
||||
_ofs << color;
|
||||
}
|
||||
_ofs << "]" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LedDeviceTest::switchOff()
|
||||
{
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user