2016-05-30 23:58:31 +02:00
|
|
|
#include "LedDeviceUdpRaw.h"
|
|
|
|
|
2016-08-23 20:07:12 +02:00
|
|
|
LedDeviceUdpRaw::LedDeviceUdpRaw(const Json::Value &deviceConfig)
|
2016-09-22 09:19:31 +02:00
|
|
|
: ProviderUdp()
|
2016-05-30 23:58:31 +02:00
|
|
|
{
|
2016-09-23 08:49:22 +02:00
|
|
|
setConfig(deviceConfig, 500000, 5568);
|
2016-08-23 20:07:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
LedDevice* LedDeviceUdpRaw::construct(const Json::Value &deviceConfig)
|
|
|
|
{
|
|
|
|
return new LedDeviceUdpRaw(deviceConfig);
|
2016-05-30 23:58:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int LedDeviceUdpRaw::write(const std::vector<ColorRgb> &ledValues)
|
|
|
|
{
|
2016-08-14 10:46:44 +02:00
|
|
|
const unsigned dataLen = _ledCount * sizeof(ColorRgb);
|
2016-05-30 23:58:31 +02:00
|
|
|
const uint8_t * dataPtr = reinterpret_cast<const uint8_t *>(ledValues.data());
|
|
|
|
|
|
|
|
return writeBytes(dataLen, dataPtr);
|
|
|
|
}
|