diff --git a/include/effectengine/Effect.h b/include/effectengine/Effect.h index bfd7f72e..229593b7 100644 --- a/include/effectengine/Effect.h +++ b/include/effectengine/Effect.h @@ -12,7 +12,6 @@ #include #include #include -#include // Hyperion includes #include diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index ce54731a..44ce26d7 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -1,14 +1,9 @@ // project includes #include -// stl includes -#include -#include - // Qt includes #include #include -#include #include #include #include @@ -18,7 +13,6 @@ // hyperion includes #include - #include #include @@ -49,33 +43,13 @@ using namespace hyperion; JsonAPI::JsonAPI(QString peerAddress, Logger *log, bool localConnection, QObject *parent, bool noListener) : API(log, localConnection, parent) -/* , _authManager(AuthManager::getInstance()) // moved to API - , _authorized(false) - , _adminAuthorized(false) - , _apiAuthRequired(_authManager->isAuthRequired()) - , _noListener(noListener) - , _peerAddress(peerAddress) - , _log(log) // moved to API - , _localConnection(localConnection) - , _instanceManager(HyperionIManager::getInstance()) - , _hyperion(nullptr) // moved - , _jsonCB(new JsonCB(this)) - , _streaming_logging_activated(false) - , _ledStreamTimer(new QTimer(this)) */ { - //_authManager = AuthManager::getInstance(); // moved to API init - //_authorized = false; // moved INIT api - //_adminAuthorized = false; // moved INIT api - //_apiAuthRequired = _authManager->isAuthRequired(); _noListener = noListener; _peerAddress = peerAddress; - //_log = log; // moved to API - // _localConnection = localConnection; moved init ti api - //_instanceManager = HyperionIManager::getInstance(); - //_hyperion = nullptr; // moved _jsonCB = new JsonCB(this); _streaming_logging_activated = false; _ledStreamTimer = new QTimer(this); + Q_INIT_RESOURCE(JSONRPC_schemas); } @@ -199,7 +173,7 @@ proceed: else if (command == "leddevice") handleLedDeviceCommand(message, command, tan); - // BEGIN | The following commands are derecated but used to ensure backward compatibility with hyperion Classic remote control + // BEGIN | The following commands are deprecated but used to ensure backward compatibility with hyperion Classic remote control else if (command == "clearall") handleClearallCommand(message, command, tan); else if (command == "transform" || command == "correction" || command == "temperature") @@ -330,7 +304,7 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString activePriorities.removeAll(255); int currentPriority = _hyperion->getCurrentPriority(); - foreach (int priority, activePriorities) + for(int priority : activePriorities) { const Hyperion::InputInfo &priorityInfo = _hyperion->getPriorityInfo(priority); QJsonObject item; diff --git a/libsrc/effectengine/Effect.cpp b/libsrc/effectengine/Effect.cpp index 8598e029..80c85105 100644 --- a/libsrc/effectengine/Effect.cpp +++ b/libsrc/effectengine/Effect.cpp @@ -1,17 +1,6 @@ -// stl includes -#include -#include -#include - // Qt includes #include #include -#include -#include -#include -#include -#include -#include #include // effect engin eincludes @@ -20,11 +9,8 @@ #include #include -// python utils/ global mainthread +// python utils #include -#include -//impl -PyThreadState* mainThreadState; Effect::Effect(Hyperion *hyperion, int priority, int timeout, const QString &script, const QString &name, const QJsonObject &args, const QString &imageData) : QThread() @@ -100,19 +86,13 @@ void Effect::run() // Run the effect script QFile file (_script); - QByteArray python_code; if (file.open(QIODevice::ReadOnly)) { - python_code = file.readAll(); + program.execute(file.readAll()); } else { Error(_log, "Unable to open script file %s.", QSTRING_CSTR(_script)); } file.close(); - - if (!python_code.isEmpty()) - { - program.execute(python_code); - } } diff --git a/libsrc/effectengine/EffectEngine.cpp b/libsrc/effectengine/EffectEngine.cpp index ea404903..e4a4bb06 100644 --- a/libsrc/effectengine/EffectEngine.cpp +++ b/libsrc/effectengine/EffectEngine.cpp @@ -4,10 +4,6 @@ // Qt includes #include -#include -#include -#include -#include // hyperion util includes #include diff --git a/libsrc/leddevice/dev_hid/deactivated/LedDeviceLightpack-hidapi.cpp b/libsrc/leddevice/dev_hid/deactivated/LedDeviceLightpack-hidapi.cpp index 2bacc1c1..a988bdd5 100644 --- a/libsrc/leddevice/dev_hid/deactivated/LedDeviceLightpack-hidapi.cpp +++ b/libsrc/leddevice/dev_hid/deactivated/LedDeviceLightpack-hidapi.cpp @@ -53,7 +53,7 @@ LedDeviceLightpackHidapi::~LedDeviceLightpackHidapi() _deviceHandle = nullptr; } - // TODO: Should be called to avoid memory loss, but only at the end of the application + // TODO: Should be called to avoid memory leak, but only at the end of the application //hid_exit(); } diff --git a/libsrc/python/PythonProgram.cpp b/libsrc/python/PythonProgram.cpp index 678e4f72..e2cb925e 100644 --- a/libsrc/python/PythonProgram.cpp +++ b/libsrc/python/PythonProgram.cpp @@ -4,6 +4,8 @@ #include +PyThreadState* mainThreadState; + PythonProgram::PythonProgram(const QString & name, Logger * log) : _name(name), _log(log), _tstate(nullptr) { diff --git a/libsrc/ssdp/SSDPServer.cpp b/libsrc/ssdp/SSDPServer.cpp index c214a6b5..29652550 100644 --- a/libsrc/ssdp/SSDPServer.cpp +++ b/libsrc/ssdp/SSDPServer.cpp @@ -27,9 +27,9 @@ static const QString UPNP_ALIVE_MESSAGE = "NOTIFY * HTTP/1.1\r\n" "NTS: ssdp:alive\r\n" "SERVER: %4\r\n" "USN: uuid:%5\r\n" - "HYPERION-FBS-PORT: %6\r\n" - "HYPERION-JSS-PORT: %7\r\n" - "HYPERION-NAME: %8\r\n" + "HYPERION-FBS-PORT: %6\r\n" + "HYPERION-JSS-PORT: %7\r\n" + "HYPERION-NAME: %8\r\n" "\r\n"; // Implement ssdp:update as per spec 1.1, section 1.2.4 @@ -45,7 +45,7 @@ static const QString UPNP_UPDATE_MESSAGE = "NOTIFY * HTTP/1.1\r\n" /* "CONFIGID.UPNP.ORG: %4\r\n" UPNP spec = 1.1 "NEXTBOOTID.UPNP.ORG: %5\r\n" "SEARCHPORT.UPNP.ORG: %6\r\n" -*/ "\r\n"; +*/ "\r\n"; // TODO: Add this two fields commented below in the BYEBYE MESSAGE // as per upnp spec 1.1, section 1.2.2 and 1.2.3. @@ -72,9 +72,9 @@ static const QString UPNP_MSEARCH_RESPONSE = "HTTP/1.1 200 OK\r\n" "SERVER: %4\r\n" "ST: %5\r\n" "USN: uuid:%6\r\n" - "HYPERION-FBS-PORT: %7\r\n" - "HYPERION-JSS-PORT: %8\r\n" - "HYPERION-NAME: %9\r\n" + "HYPERION-FBS-PORT: %7\r\n" + "HYPERION-JSS-PORT: %8\r\n" + "HYPERION-NAME: %9\r\n" "\r\n"; SSDPServer::SSDPServer(QObject * parent) @@ -99,7 +99,8 @@ void SSDPServer::initServer() SysInfo::HyperionSysInfo data = SysInfo::get(); // create SERVER String - _serverHeader = data.prettyName+"/"+data.productVersion+" UPnP/1.0 Hyperion/"+QString(HYPERION_VERSION); + _serverHeader = QString("%1/%2 UPnP/1.0 Hyperion/%3") + .arg(data.prettyName, data.productVersion, HYPERION_VERSION); connect(_udpSocket, &QUdpSocket::readyRead, this, &SSDPServer::readPendingDatagrams); }