From 3feb905a00505b5bad434733249c3f6ab9ea02f7 Mon Sep 17 00:00:00 2001 From: Rick van Hattem Date: Wed, 21 Sep 2016 23:32:17 +0200 Subject: [PATCH] reformatted code and added the new defaults from @redpanther --- libsrc/leddevice/LedDeviceUdpH801.cpp | 11 ++++++----- libsrc/leddevice/LedDeviceUdpH801.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libsrc/leddevice/LedDeviceUdpH801.cpp b/libsrc/leddevice/LedDeviceUdpH801.cpp index f18ee646..966f3bb9 100644 --- a/libsrc/leddevice/LedDeviceUdpH801.cpp +++ b/libsrc/leddevice/LedDeviceUdpH801.cpp @@ -8,7 +8,8 @@ // hyperion local includes #include "LedDeviceUdpH801.h" -LedDeviceUdpH801::LedDeviceUdpH801(const Json::Value &deviceConfig) : ProviderUdp(deviceConfig) +LedDeviceUdpH801::LedDeviceUdpH801(const Json::Value &deviceConfig) + : ProviderUdp(deviceConfig) { setConfig(deviceConfig); } @@ -16,7 +17,7 @@ LedDeviceUdpH801::LedDeviceUdpH801(const Json::Value &deviceConfig) : ProviderUd bool LedDeviceUdpH801::setConfig(const Json::Value &deviceConfig) { /* The H801 port is fixed */ - _port = 30977; + ProviderUdp::setConfig(deviceConfig, 30977, "255.255.255.255"); /* 10ms seems to be a safe default for the wait time */ _LatchTime_ns = deviceConfig.get("latchtime", 10000000).asInt(); @@ -30,13 +31,13 @@ bool LedDeviceUdpH801::setConfig(const Json::Value &deviceConfig) _message[0] = 0xFB; _message[1] = 0xEB; - for(int i=0; i<_ids.length(); i++){ + for (int i = 0; i < _ids.length(); i++) { _message[_prefix_size + _colors + i * _id_size + 0] = (_ids[i] >> 0x00) & 0xFF; _message[_prefix_size + _colors + i * _id_size + 1] = (_ids[i] >> 0x08) & 0xFF; _message[_prefix_size + _colors + i * _id_size + 2] = (_ids[i] >> 0x10) & 0xFF; } - Debug( _log, "H801 using %s:%d", _address.toString().toStdString().c_str() , _port ); + Debug(_log, "H801 using %s:%d", _address.toString().toStdString().c_str(), _port); return true; } @@ -58,6 +59,6 @@ int LedDeviceUdpH801::write(const std::vector &ledValues) int LedDeviceUdpH801::switchOff() { - return write(std::vector(_ledCount, ColorRgb{0,0,0})); + return write(std::vector(_ledCount, ColorRgb{0, 0, 0})); } diff --git a/libsrc/leddevice/LedDeviceUdpH801.h b/libsrc/leddevice/LedDeviceUdpH801.h index 78bcd162..c5f4c87a 100644 --- a/libsrc/leddevice/LedDeviceUdpH801.h +++ b/libsrc/leddevice/LedDeviceUdpH801.h @@ -13,7 +13,7 @@ /// /// Implementation of the LedDevice interface for sending led colors via udp. /// -class LedDeviceUdpH801 : public ProviderUdp +class LedDeviceUdpH801: public ProviderUdp { protected: QList _ids;