diff --git a/libsrc/leddevice/dev_net/LedDeviceAurora.cpp b/libsrc/leddevice/dev_net/LedDeviceAurora.cpp index 02d05103..9e13599a 100644 --- a/libsrc/leddevice/dev_net/LedDeviceAurora.cpp +++ b/libsrc/leddevice/dev_net/LedDeviceAurora.cpp @@ -1,15 +1,6 @@ // Local-Hyperion includes #include "LedDeviceAurora.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include // qt includes @@ -17,6 +8,8 @@ #include #include +#define ll ss + struct addrinfo vints, *serverinfo, *pt; //char udpbuffer[1024]; int sockfp; @@ -50,10 +43,6 @@ bool LedDeviceAurora::init(const QJsonObject &deviceConfig) { QJsonObject json = doc.object(); - //Debug - //Json::FastWriter fastWriter; - //std::cout << fastWriter.write(json); - panelCount = json["numPanels"].toInt(); std::cout << panelCount << std::endl; QJsonObject positionDataJson = doc.object()["positionData"].toObject(); @@ -75,28 +64,32 @@ bool LedDeviceAurora::init(const QJsonObject &deviceConfig) { // Set Aurora to UDP Mode QByteArray modeResponse = changeMode(hostname, key, "effects"); QJsonDocument configDoc = QJsonDocument::fromJson(modeResponse, &error); + + //Debug + //QString strConf(configDoc.toJson(QJsonDocument::Compact)); + //std::cout << strConf.toUtf8().constData() << std::endl; + if (error.error != QJsonParseError::NoError) { throw std::runtime_error("Could not change mode"); } - QJsonObject configJson = doc.object(); // Get UDP port - port = configJson["streamControlPort"].toString(); + port = QString::number(configDoc.object()["streamControlPort"].toInt()); std::cout << "hostname " << hostname.toStdString() << " port " << port.toStdString() << std::endl; - /* + int rv; memset(&vints, 0, sizeof vints); vints.ai_family = AF_UNSPEC; vints.ai_socktype = SOCK_DGRAM; - if ((rv = getaddrinfo(hostname.c_str() , port.c_str(), &vints, &serverinfo)) != 0) { + if ((rv = getaddrinfo(hostname.toUtf8().constData() , port.toUtf8().constData(), &vints, &serverinfo)) != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); assert(rv==0); } - + // loop through all the results and make a socket for(pt = serverinfo; pt != NULL; pt = pt->ai_next) { if ((sockfp = socket(pt->ai_family, pt->ai_socktype, @@ -111,7 +104,7 @@ bool LedDeviceAurora::init(const QJsonObject &deviceConfig) { if (pt == NULL) { fprintf(stderr, "talker: failed to create socket\n"); assert(pt!=NULL); - }*/ + } std::cout << "Started successfully "; return true; } diff --git a/libsrc/leddevice/dev_net/LedDeviceAurora.h b/libsrc/leddevice/dev_net/LedDeviceAurora.h index 57b9c495..dad09a64 100644 --- a/libsrc/leddevice/dev_net/LedDeviceAurora.h +++ b/libsrc/leddevice/dev_net/LedDeviceAurora.h @@ -1,8 +1,4 @@ #pragma once -// STL includes -#include -#include -#include // Leddevice includes #include