From d90a36d91189a48ff568e92efdc38a2d9f75c453 Mon Sep 17 00:00:00 2001 From: penfold42 Date: Sat, 6 Aug 2016 16:58:41 +1000 Subject: [PATCH] chealup of udp device. (#153) left over unneeded spi include variable cleanup --- libsrc/leddevice/LedUdpDevice.cpp | 14 +++++++------- libsrc/leddevice/LedUdpDevice.h | 15 +++++---------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/libsrc/leddevice/LedUdpDevice.cpp b/libsrc/leddevice/LedUdpDevice.cpp index 39717b5e..fe63e3fa 100644 --- a/libsrc/leddevice/LedUdpDevice.cpp +++ b/libsrc/leddevice/LedUdpDevice.cpp @@ -15,13 +15,13 @@ // Local Hyperion includes #include "LedUdpDevice.h" -LedUdpDevice::LedUdpDevice(const std::string& outputDevice, const unsigned baudrate, const int latchTime_ns) : - mDeviceName(outputDevice), - mBaudRate_Hz(baudrate), - mLatchTime_ns(latchTime_ns) +LedUdpDevice::LedUdpDevice(const std::string& output, const unsigned baudrate, const int latchTime_ns) : + _target(output), + _BaudRate_Hz(baudrate), + _LatchTime_ns(latchTime_ns) { udpSocket = new QUdpSocket(); - QString str = QString::fromStdString(mDeviceName); + QString str = QString::fromStdString(_target); QStringList _list = str.split(":"); if (_list.size() != 2) { Error( _log, "Error parsing hostname:port"); @@ -56,12 +56,12 @@ int LedUdpDevice::writeBytes(const unsigned size, const uint8_t * data) qint64 retVal = udpSocket->writeDatagram((const char *)data,size,_address,_port); - if (retVal >= 0 && mLatchTime_ns > 0) + if (retVal >= 0 && _LatchTime_ns > 0) { // The 'latch' time for latching the shifted-value into the leds timespec latchTime; latchTime.tv_sec = 0; - latchTime.tv_nsec = mLatchTime_ns; + latchTime.tv_nsec = _LatchTime_ns; // Sleep to latch the leds (only if write succesfull) nanosleep(&latchTime, NULL); diff --git a/libsrc/leddevice/LedUdpDevice.h b/libsrc/leddevice/LedUdpDevice.h index 9afec475..8c6e024e 100644 --- a/libsrc/leddevice/LedUdpDevice.h +++ b/libsrc/leddevice/LedUdpDevice.h @@ -2,9 +2,6 @@ #include -// Linux-SPI includes -#include - // Hyperion includes #include #include @@ -50,15 +47,13 @@ protected: int writeBytes(const unsigned size, const uint8_t *data); private: - /// The name of the output device - const std::string mDeviceName; - /// The used baudrate of the output device - const int mBaudRate_Hz; + /// The UDP destination as "host:port" + const std::string _target; + /// The used baudrate of the output device for rate limiting + const int _BaudRate_Hz; /// The time which the device should be untouched after a write - const int mLatchTime_ns; + const int _LatchTime_ns; - /// The File Identifier of the opened output device (or -1 if not opened) - int mFid; /// QUdpSocket *udpSocket; QHostAddress _address;