Merge remote-tracking branch 'refs/remotes/origin/Beta'

Former-commit-id: 5bdbda1406bb0ddb99440502584604b85b0f3063
This commit is contained in:
brindosch
2016-03-23 17:53:32 +01:00
8 changed files with 91 additions and 88 deletions

View File

@@ -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

View File

@@ -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")
{

View 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;
}

View File

@@ -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

View File

@@ -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;
}