mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
leddevice refactoring. code style and extension of baseclass to avoid dups (#174)
This commit is contained in:
@@ -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}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user