chealup of udp device. (#153)

left over unneeded spi include
variable cleanup
This commit is contained in:
penfold42 2016-08-06 16:58:41 +10:00 committed by redPanther
parent 817dabae8c
commit d90a36d911
2 changed files with 12 additions and 17 deletions

View File

@ -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);

View File

@ -2,9 +2,6 @@
#include <QUdpSocket>
// Linux-SPI includes
#include <linux/spi/spidev.h>
// Hyperion includes
#include <leddevice/LedDevice.h>
#include <utils/Logger.h>
@ -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;