2016-05-30 23:58:31 +02:00
|
|
|
#include "LedDeviceUdpRaw.h"
|
|
|
|
|
2016-10-13 21:59:58 +02:00
|
|
|
LedDeviceUdpRaw::LedDeviceUdpRaw(const QJsonObject &deviceConfig)
|
2016-09-22 09:19:31 +02:00
|
|
|
: ProviderUdp()
|
2016-05-30 23:58:31 +02:00
|
|
|
{
|
2020-02-10 15:21:58 +01:00
|
|
|
_devConfig = deviceConfig;
|
|
|
|
_deviceReady = false;
|
2016-08-23 20:07:12 +02:00
|
|
|
}
|
|
|
|
|
2016-10-13 21:59:58 +02:00
|
|
|
LedDevice* LedDeviceUdpRaw::construct(const QJsonObject &deviceConfig)
|
2016-08-23 20:07:12 +02:00
|
|
|
{
|
|
|
|
return new LedDeviceUdpRaw(deviceConfig);
|
2016-05-30 23:58:31 +02:00
|
|
|
}
|
|
|
|
|
2020-02-10 15:21:58 +01:00
|
|
|
bool LedDeviceUdpRaw::init(const QJsonObject &deviceConfig)
|
|
|
|
{
|
|
|
|
_port = RAW_DEFAULT_PORT;
|
|
|
|
bool isInitOK = ProviderUdp::init(deviceConfig);
|
|
|
|
return isInitOK;
|
|
|
|
}
|
|
|
|
|
2016-05-30 23:58:31 +02:00
|
|
|
int LedDeviceUdpRaw::write(const std::vector<ColorRgb> &ledValues)
|
|
|
|
{
|
|
|
|
const uint8_t * dataPtr = reinterpret_cast<const uint8_t *>(ledValues.data());
|
|
|
|
|
2016-10-08 08:14:36 +02:00
|
|
|
return writeBytes((unsigned)_ledRGBCount, dataPtr);
|
2016-05-30 23:58:31 +02:00
|
|
|
}
|