leddevice refactoring. code style and extension of baseclass to avoid dups (#174)

This commit is contained in:
redPanther
2016-08-14 10:46:44 +02:00
committed by GitHub
parent bc0c9c469f
commit 97181fa83c
63 changed files with 483 additions and 533 deletions

View File

@@ -11,18 +11,17 @@
// hyperion local includes
#include "LedDeviceUdpRaw.h"
LedDeviceUdpRaw::LedDeviceUdpRaw(const std::string& outputDevice, const unsigned latchTime) :
LedUdpDevice(outputDevice, latchTime),
mLedCount(0)
LedDeviceUdpRaw::LedDeviceUdpRaw(const std::string& outputDevice, const unsigned latchTime)
: LedUdpDevice(outputDevice, latchTime)
{
// empty
}
int LedDeviceUdpRaw::write(const std::vector<ColorRgb> &ledValues)
{
mLedCount = ledValues.size();
_ledCount = ledValues.size();
const unsigned dataLen = ledValues.size() * sizeof(ColorRgb);
const unsigned dataLen = _ledCount * sizeof(ColorRgb);
const uint8_t * dataPtr = reinterpret_cast<const uint8_t *>(ledValues.data());
return writeBytes(dataLen, dataPtr);
@@ -30,5 +29,5 @@ int LedDeviceUdpRaw::write(const std::vector<ColorRgb> &ledValues)
int LedDeviceUdpRaw::switchOff()
{
return write(std::vector<ColorRgb>(mLedCount, ColorRgb{0,0,0}));
return write(std::vector<ColorRgb>(_ledCount, ColorRgb{0,0,0}));
}