diff --git a/CHANGELOG.md b/CHANGELOG.md index 71a372a29..8f21a1be9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Restart correctly, if running as service (#1368) +- Hue-Wizard: In case auto discovery failed, port 80 was not used as default (#1544) +- Send only one reply per Start Instance request (#1551) +- Add instance# in JSON-API replies (aligning to Add instance in websocket response to a subscription #1504 behaviour) +- hyperion-remote: Extracting reply for a configGet request correctly (#1555) + +### Technical +- Add CodeQL for GitHub code scanning +- Update to Protocol Buffers 3.21.12 +- cmake support of libcec without version in lib-name +- Qt6 alignments +- Refactor for Python 3.11 deprecated functions ## Removed diff --git a/LICENSE b/LICENSE index 0a5f4ed4f..3968954ed 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2014-2022 Hyperion Project +Copyright (c) 2014-2023 Hyperion Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/assets/webconfig/js/content_index.js b/assets/webconfig/js/content_index.js index 2aea52bf4..5a5203ca9 100644 --- a/assets/webconfig/js/content_index.js +++ b/assets/webconfig/js/content_index.js @@ -278,8 +278,9 @@ $(document).ready(function () { if (getStorage('lastSelectedInstance')) removeStorage('lastSelectedInstance') - currentHyperionInstance = 0; - currentHyperionInstanceName = getInstanceNameByIndex(0); + window.currentHyperionInstance = 0; + window.currentHyperionInstanceName = getInstanceNameByIndex(0); + requestServerConfig(); setTimeout(requestServerInfo, 100) setTimeout(requestTokenInfo, 200) @@ -293,7 +294,7 @@ $(document).ready(function () { $('#btn_hypinstanceswitch').toggle(false) // update listing for button - updateUiOnInstance(currentHyperionInstance); + updateUiOnInstance(window.currentHyperionInstance); updateHyperionInstanceListing(); }); diff --git a/assets/webconfig/js/content_logging.js b/assets/webconfig/js/content_logging.js index ac77e9591..7a9c791da 100644 --- a/assets/webconfig/js/content_logging.js +++ b/assets/webconfig/js/content_logging.js @@ -35,7 +35,8 @@ $(document).ready(function () { function infoSummary() { var info = ""; - info += 'Hyperion System Summary Report (' + window.serverConfig.general.name + '), Reported instance: ' + window.currentHyperionInstanceName + '\n'; + info += 'Hyperion System Summary Report (' + window.serverConfig.general.name + ')\n'; + info += 'Reported instance: [' + window.currentHyperionInstance + '] - ' + window.currentHyperionInstanceName + '\n'; info += "\n< ----- System information -------------------- >\n"; info += getSystemInfo() + '\n'; @@ -43,22 +44,36 @@ $(document).ready(function () { info += "\n< ----- Configured Instances ------------------ >\n"; var instances = window.serverInfo.instance; for (var i = 0; i < instances.length; i++) { - info += instances[i].instance + ': ' + instances[i].friendly_name + ' Running: ' + instances[i].running + '\n'; + info += instances[i].instance + ': ' + instances[i].friendly_name + ', Running: ' + instances[i].running + '\n'; } info += "\n< ----- This instance's priorities ------------ >\n"; var prios = window.serverInfo.priorities; - for (var i = 0; i < prios.length; i++) { - info += prios[i].priority + ': '; - if (prios[i].visible) { - info += ' VISIBLE!'; - } - else { - info += ' '; + + if (prios.length > 0) { + + for (var i = 0; i < prios.length; i++) { + + var prio = prios[i].priority.toString().padStart(3, '0'); + + info += prio + ': '; + if (prios[i].visible) { + info += ' VISIBLE -'; + } + else { + info += ' INVISIBLE -'; + } + info += ' (' + prios[i].componentId + ')'; + if (prios[i].owner) { + info += ' (Owner: ' + prios[i].owner + ')'; + } + info += '\n'; + } - info += ' (' + prios[i].componentId + ') Owner: ' + prios[i].owner + '\n'; + } else { + info += 'The current priority list is empty!\n'; } - info += 'priorities_autoselect: ' + window.serverInfo.priorities_autoselect + '\n'; + info += 'Autoselect: ' + window.serverInfo.priorities_autoselect + '\n'; info += "\n< ----- This instance components' status ------->\n"; var comps = window.serverInfo.components; @@ -67,7 +82,7 @@ $(document).ready(function () { } info += "\n< ----- This instance's configuration --------- >\n"; - info += JSON.stringify(window.serverConfig) + '\n'; + info += JSON.stringify(window.serverConfig, null, 2) + '\n'; info += "\n< ----- Current Log --------------------------- >\n"; var logMsgs = document.getElementById("logmessages").textContent; @@ -193,18 +208,19 @@ $(document).ready(function () { }); // toggle fullscreen button in log output - $(".fullscreen-btn").mousedown(function(e) { + $(".fullscreen-btn").mousedown(function (e) { e.preventDefault(); }); - $(".fullscreen-btn").click(function(e) { + $(".fullscreen-btn").click(function (e) { e.preventDefault(); $(this).children('i') .toggleClass('fa-expand') .toggleClass('fa-compress'); $('#conf_cont').toggle(); - $('#logmessages').css('max-height', $('#logmessages').css('max-height') !== 'none' ? 'none' : '400px' ); + $('#logmessages').css('max-height', $('#logmessages').css('max-height') !== 'none' ? 'none' : '400px'); }); removeOverlay(); }); + diff --git a/assets/webconfig/js/ui_utils.js b/assets/webconfig/js/ui_utils.js index c20c5fc13..84dff5c57 100644 --- a/assets/webconfig/js/ui_utils.js +++ b/assets/webconfig/js/ui_utils.js @@ -171,6 +171,10 @@ function initLanguageSelection() { } function updateUiOnInstance(inst) { + + window.currentHyperionInstance = inst; + window.currentHyperionInstanceName = getInstanceNameByIndex(inst); + $("#active_instance_friendly_name").text(getInstanceNameByIndex(inst)); if (window.serverInfo.instance.filter(entry => entry.running).length > 1) { $('#btn_hypinstanceswitch').toggle(true); diff --git a/assets/webconfig/js/wizard.js b/assets/webconfig/js/wizard.js index dedd50edc..3f88f6dbd 100755 --- a/assets/webconfig/js/wizard.js +++ b/assets/webconfig/js/wizard.js @@ -854,11 +854,17 @@ function checkUserResult(reply, usr) { function useGroupId(id) { $('#groupId').val(id); - groupLights = hueGroups[id].lights; + + //Ensure ligthIDs are strings + groupLights = hueGroups[id].lights.map(num => { + return String(num); + }); + groupLightsLocations = hueGroups[id].locations; get_hue_lights(); } + async function discover_hue_bridges() { $('#wiz_hue_ipstate').html($.i18n('edt_dev_spec_devices_discovery_inprogress')); $('#wiz_hue_discovered').html("") @@ -1016,11 +1022,11 @@ function beginWizardHue() { $('#host').val(host); var port = eV("port"); - if (port > 0) { - $('#port').val(port); + if (port == 0) { + $('#port').val(80); } else { - $('#port').val(''); + $('#port').val(port); } hueIPs.unshift({ host: host, port: port }); @@ -1037,7 +1043,13 @@ function beginWizardHue() { hueIPs = []; hueIPsinc = 0; - hueIPs.push({ host: $('#host').val(), port: $('#port').val() }); + + var port = $('#port').val(); + if (isNaN(port) || port < 1 || port > 65535) { + port = 80; + $('#port').val(80); + } + hueIPs.push({ host: $('#host').val(), port: port }); } else { discover_hue_bridges(); diff --git a/cmake/FindWindowsSDK.cmake b/cmake/FindWindowsSDK.cmake index 747d9bc43..6db4225ef 100644 --- a/cmake/FindWindowsSDK.cmake +++ b/cmake/FindWindowsSDK.cmake @@ -1,4 +1,4 @@ -# - Find the Windows SDK aka Platform SDK +# - Find the Windows SDK aka Platform SDK (from https://github.com/rpavlik/cmake-modules) # # Relevant Wikipedia article: http://en.wikipedia.org/wiki/Microsoft_Windows_SDK # @@ -49,10 +49,11 @@ # http://academic.cleardefinition.com # Iowa State University HCI Graduate Program/VRAC # -# Copyright Iowa State University 2012. +# Copyright 2012, Iowa State University # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +# SPDX-License-Identifier: BSL-1.0 set(_preferred_sdk_dirs) # pre-output set(_win_sdk_dirs) # pre-output @@ -76,6 +77,9 @@ endmacro() # although version numbers listed on that page don't necessarily match the directory # used by the installer. set(_winsdk_win10vers + 10.0.22000.0 + 10.0.20348.0 + 10.0.19041.0 10.0.18362.0 # Win10 1903 "19H1" 10.0.17763.0 # Win10 1809 "October 2018 Update" 10.0.17134.0 # Redstone 4 aka Win10 1803 "April 2018 Update" diff --git a/cmake/packages.cmake b/cmake/packages.cmake index bc73057d3..1dd8f6a64 100644 --- a/cmake/packages.cmake +++ b/cmake/packages.cmake @@ -72,7 +72,7 @@ endif() # .deb files for apt # https://cmake.org/cmake/help/latest/cpack_gen/deb.html SET ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/package-scripts/preinst;${CMAKE_SOURCE_DIR}/cmake/package-scripts/postinst;${CMAKE_SOURCE_DIR}/cmake/package-scripts/prerm" ) -SET ( CPACK_DEBIAN_PACKAGE_DEPENDS "libcec6 | libcec4" ) +SET ( CPACK_DEBIAN_PACKAGE_DEPENDS "libcec6 | libcec4 | libcec (>= 4.0)" ) SET ( CPACK_DEBIAN_PACKAGE_SECTION "Miscellaneous" ) # .rpm for rpm diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index f64b0d38b..af2232abd 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -150,7 +150,7 @@ if(ENABLE_PROTOBUF_SERVER) set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Build protobuf static") endif() - add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf/cmake") + add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf") # define the include for the protobuf library set(PROTOBUF_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf/src") diff --git a/include/mdns/MdnsBrowser.h b/include/mdns/MdnsBrowser.h index b88a7f112..7ee8009f1 100644 --- a/include/mdns/MdnsBrowser.h +++ b/include/mdns/MdnsBrowser.h @@ -19,6 +19,7 @@ // Utility includes #include +#include namespace { constexpr std::chrono::milliseconds DEFAULT_DISCOVER_TIMEOUT{ 500 }; @@ -103,24 +104,6 @@ private slots: void onServiceRemoved(const QMdnsEngine::Service& service); private: - - template ::value, int> = 0> - static inline QMetaObject::Connection weakConnect(typename QtPrivate::FunctionPointer::Object* sender, - Func1 signal, - Func2 slot) - { - QMetaObject::Connection conn_normal = QObject::connect(sender, signal, slot); - - QMetaObject::Connection* conn_delete = new QMetaObject::Connection(); - - *conn_delete = QObject::connect(sender, signal, [conn_normal, conn_delete]() { - QObject::disconnect(conn_normal); - QObject::disconnect(*conn_delete); - delete conn_delete; - }); - return conn_normal; - } - /// The logger instance for mDNS-Service Logger* _log; diff --git a/include/utils/NetUtils.h b/include/utils/NetUtils.h index 3b247e49a..9020539b9 100644 --- a/include/utils/NetUtils.h +++ b/include/utils/NetUtils.h @@ -51,7 +51,7 @@ namespace NetUtils { { if ((port <= 0 || port > MAX_PORT) && port != -1) { - Error(log, "Invalid port [%d] for host: (%s)! - Port must be in range [0 - %d]", port, QSTRING_CSTR(host), MAX_PORT); + Error(log, "Invalid port [%d] for host: (%s)! - Port must be in range [1 - %d]", port, QSTRING_CSTR(host), MAX_PORT); return false; } return true; diff --git a/include/utils/WeakConnect.h b/include/utils/WeakConnect.h new file mode 100644 index 000000000..bcfaacfe2 --- /dev/null +++ b/include/utils/WeakConnect.h @@ -0,0 +1,63 @@ +#ifndef WEAKCONNECT_H +#define WEAKCONNECT_H + +#include + +// Qt includes +#include + +template ::value, int> = 0> +static inline QMetaObject::Connection weakConnect(typename QtPrivate::FunctionPointer::Object* sender, + Func1 signal, + typename QtPrivate::FunctionPointer::Object* receiver, + Func2 slot) +{ + QMetaObject::Connection conn_normal = QObject::connect(sender, signal, receiver, slot); + + QMetaObject::Connection* conn_delete = new QMetaObject::Connection(); + + *conn_delete = QObject::connect(sender, signal, [conn_normal, conn_delete]() { + QObject::disconnect(conn_normal); + QObject::disconnect(*conn_delete); + delete conn_delete; + }); + return conn_normal; +} + +template ::value, int> = 0> +static inline QMetaObject::Connection weakConnect(typename QtPrivate::FunctionPointer::Object* sender, + Func1 signal, + Func2 slot) +{ + QMetaObject::Connection conn_normal = QObject::connect(sender, signal, slot); + + QMetaObject::Connection* conn_delete = new QMetaObject::Connection(); + + *conn_delete = QObject::connect(sender, signal, [conn_normal, conn_delete]() { + QObject::disconnect(conn_normal); + QObject::disconnect(*conn_delete); + delete conn_delete; + }); + return conn_normal; +} + +template ::value, int> = 0> +static inline QMetaObject::Connection weakConnect(typename QtPrivate::FunctionPointer::Object* sender, + Func1 signal, + typename QtPrivate::FunctionPointer::Object* receiver, + Func2 slot) +{ + Q_UNUSED(receiver); + QMetaObject::Connection conn_normal = QObject::connect(sender, signal, slot); + + QMetaObject::Connection* conn_delete = new QMetaObject::Connection(); + + *conn_delete = QObject::connect(sender, signal, [conn_normal, conn_delete]() { + QObject::disconnect(conn_normal); + QObject::disconnect(*conn_delete); + delete conn_delete; + }); + return conn_normal; +} + +#endif // WEAKCONNECT_H diff --git a/include/utils/hyperion.h b/include/utils/hyperion.h index 2a71c3ce3..774267a8d 100644 --- a/include/utils/hyperion.h +++ b/include/utils/hyperion.h @@ -19,7 +19,7 @@ /// namespace hyperion { - void handleInitialEffect(Hyperion* hyperion, const QJsonObject& FGEffectConfig) + static void handleInitialEffect(Hyperion* hyperion, const QJsonObject& FGEffectConfig) { #define FGCONFIG_ARRAY fgColorConfig.toArray() @@ -63,12 +63,12 @@ namespace hyperion { #undef FGCONFIG_ARRAY } - ColorOrder createColorOrder(const QJsonObject &deviceConfig) + static ColorOrder createColorOrder(const QJsonObject &deviceConfig) { return stringToColorOrder(deviceConfig["colorOrder"].toString("rgb")); } - RgbTransform createRgbTransform(const QJsonObject& colorConfig) + static RgbTransform createRgbTransform(const QJsonObject& colorConfig) { const double backlightThreshold = colorConfig["backlightThreshold"].toDouble(0.0); const bool backlightColored = colorConfig["backlightColored"].toBool(false); @@ -81,7 +81,7 @@ namespace hyperion { return RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, static_cast(brightness), static_cast(brightnessComp)); } - OkhsvTransform createOkhsvTransform(const QJsonObject& colorConfig) + static OkhsvTransform createOkhsvTransform(const QJsonObject& colorConfig) { const double saturationGain = colorConfig["saturationGain"].toDouble(1.0); const double brightnessGain = colorConfig["brightnessGain"].toDouble(1.0); @@ -89,7 +89,7 @@ namespace hyperion { return OkhsvTransform(saturationGain, brightnessGain); } - RgbChannelAdjustment createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString& channelName, int defaultR, int defaultG, int defaultB) + static RgbChannelAdjustment createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString& channelName, int defaultR, int defaultG, int defaultB) { const QJsonArray& channelConfig = colorConfig[channelName].toArray(); return RgbChannelAdjustment( @@ -100,7 +100,7 @@ namespace hyperion { ); } - ColorAdjustment* createColorAdjustment(const QJsonObject & adjustmentConfig) + static ColorAdjustment* createColorAdjustment(const QJsonObject & adjustmentConfig) { const QString id = adjustmentConfig["id"].toString("default"); @@ -120,7 +120,7 @@ namespace hyperion { return adjustment; } - MultiColorAdjustment * createLedColorsAdjustment(int ledCnt, const QJsonObject & colorConfig) + static MultiColorAdjustment * createLedColorsAdjustment(int ledCnt, const QJsonObject & colorConfig) { // Create the result, the transforms are added to this MultiColorAdjustment * adjustment = new MultiColorAdjustment(ledCnt); @@ -184,7 +184,7 @@ namespace hyperion { * @param deviceOrder The default RGB channel ordering * @return The constructed ledstring */ - LedString createLedString(const QJsonArray& ledConfigArray, const ColorOrder deviceOrder) + static LedString createLedString(const QJsonArray& ledConfigArray, const ColorOrder deviceOrder) { LedString ledString; const QString deviceOrderStr = colorOrderToString(deviceOrder); @@ -215,7 +215,7 @@ namespace hyperion { return ledString; } - QSize getLedLayoutGridSize(const QJsonArray& ledConfigArray) + static QSize getLedLayoutGridSize(const QJsonArray& ledConfigArray) { std::vector midPointsX; std::vector midPointsY; diff --git a/include/utils/jsonschema/QJsonUtils.h b/include/utils/jsonschema/QJsonUtils.h index 63c22d349..98498a2b2 100644 --- a/include/utils/jsonschema/QJsonUtils.h +++ b/include/utils/jsonschema/QJsonUtils.h @@ -57,7 +57,9 @@ class QJsonUtils break; } case QJsonValue::Object: - ret = getDefaultValue(value.toObject().find("default").value()); + { + ret = getDefaultValue(value.toObject().value("default")); + } break; case QJsonValue::Bool: return value.toBool() ? "True" : "False"; diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index bfa76b0a9..e4418d549 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -21,6 +21,8 @@ #include #include +#include + #if defined(ENABLE_MF) #include #elif defined(ENABLE_V4L2) @@ -1453,7 +1455,7 @@ void JsonAPI::handleAuthorizeCommand(const QJsonObject &message, const QString & void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &command, int tan) { const QString &subc = message["subcommand"].toString(); - const quint8 &inst = message["instance"].toInt(); + const quint8 &inst = static_cast(message["instance"].toInt()); const QString &name = message["name"].toString(); if (subc == "switchTo") @@ -1471,7 +1473,12 @@ void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &c if (subc == "startInstance") { - connect(this, &API::onStartInstanceResponse, [=] (const int &tan) { sendSuccessReply(command + "-" + subc, tan); }); + //Only send update once + weakConnect(this, &API::onStartInstanceResponse, [this, command, subc] (int tan) + { + sendSuccessReply(command + "-" + subc, tan); + }); + if (!API::startInstance(inst, tan)) sendErrorReply("Can't start Hyperion instance index " + QString::number(inst), command + "-" + subc, tan); @@ -1825,6 +1832,7 @@ void JsonAPI::sendSuccessReply(const QString &command, int tan) { // create reply QJsonObject reply; + reply["instance"] = _hyperion->getInstanceIndex(); reply["success"] = true; reply["command"] = command; reply["tan"] = tan; @@ -1836,6 +1844,7 @@ void JsonAPI::sendSuccessReply(const QString &command, int tan) void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &command, int tan) { QJsonObject reply; + reply["instance"] = _hyperion->getInstanceIndex(); reply["success"] = true; reply["command"] = command; reply["tan"] = tan; @@ -1851,6 +1860,7 @@ void JsonAPI::sendErrorReply(const QString &error, const QString &command, int t { // create reply QJsonObject reply; + reply["instance"] = _hyperion->getInstanceIndex(); reply["success"] = false; reply["error"] = error; reply["command"] = command; diff --git a/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp b/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp index 4158bfb28..edb49a5bb 100644 --- a/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp +++ b/libsrc/utils/jsonschema/QJsonSchemaChecker.cpp @@ -64,7 +64,7 @@ QJsonObject QJsonSchemaChecker::getAutoCorrectedConfig(const QJsonObject& value, _messages.clear(); _autoCorrected = value; - for (const QString& correct : sequence) + for (const QString& correct : qAsConst(sequence)) { _correct = correct; _currentPath.clear(); @@ -234,7 +234,6 @@ void QJsonSchemaChecker::checkProperties(const QJsonObject& value, const QJsonOb const QJsonValue& propertyValue = *i; _currentPath.append("." + property); - QJsonObject::const_iterator required = propertyValue.toObject().find("required"); if (value.contains(property)) { @@ -242,7 +241,8 @@ void QJsonSchemaChecker::checkProperties(const QJsonObject& value, const QJsonOb } else if (!verifyDeps(property, value, schema)) { - if (required != propertyValue.toObject().end() && propertyValue.toObject().find("required").value().toBool() && !_ignoreRequired) + bool isRequired = propertyValue.toObject().value("required").toBool(false); + if (isRequired && !_ignoreRequired) { _error = true; @@ -273,9 +273,10 @@ bool QJsonSchemaChecker::verifyDeps(const QString& property, const QJsonObject& { const QJsonObject& depends = ((schema[property].toObject())["options"].toObject())["dependencies"].toObject(); - if (depends.keys().size() > 0) + const QStringList dependsKeys = depends.keys(); + if (!dependsKeys.isEmpty()) { - QString firstName = depends.keys().first(); + const QString firstName = dependsKeys.constFirst(); if (value.contains(firstName)) { if (value[firstName] != depends[firstName]) diff --git a/src/hyperion-aml/hyperion-aml.cpp b/src/hyperion-aml/hyperion-aml.cpp index 158954470..7bcc106ef 100644 --- a/src/hyperion-aml/hyperion-aml.cpp +++ b/src/hyperion-aml/hyperion-aml.cpp @@ -21,13 +21,6 @@ #include -// Constants -namespace { - - const char SERVICE_TYPE[] = "flatbuffer"; - -} //End of constants - using namespace commandline; // save the image as screenshot diff --git a/src/hyperion-dispmanx/hyperion-dispmanx.cpp b/src/hyperion-dispmanx/hyperion-dispmanx.cpp index 07ccf37f1..55ccee044 100644 --- a/src/hyperion-dispmanx/hyperion-dispmanx.cpp +++ b/src/hyperion-dispmanx/hyperion-dispmanx.cpp @@ -22,13 +22,6 @@ #include -// Constants -namespace { - - const char SERVICE_TYPE[] = "flatbuffer"; - -} //End of constants - using namespace commandline; // save the image as screenshot diff --git a/src/hyperion-osx/hyperion-osx.cpp b/src/hyperion-osx/hyperion-osx.cpp index b94b28810..7a9079351 100644 --- a/src/hyperion-osx/hyperion-osx.cpp +++ b/src/hyperion-osx/hyperion-osx.cpp @@ -20,13 +20,6 @@ #include -// Constants -namespace { - - const char SERVICE_TYPE[] = "flatbuffer"; - -} //End of constants - using namespace commandline; // save the image as screenshot diff --git a/src/hyperion-remote/JsonConnection.cpp b/src/hyperion-remote/JsonConnection.cpp index 5bad16a4f..669a5bf40 100644 --- a/src/hyperion-remote/JsonConnection.cpp +++ b/src/hyperion-remote/JsonConnection.cpp @@ -215,7 +215,7 @@ QJsonObject JsonConnection::getServerInfo() { if (!reply.contains("info") || !reply["info"].isObject()) { - throw std::runtime_error("No info available in result"); + throw std::runtime_error("No info available in reply"); } return reply["info"].toObject(); @@ -240,7 +240,7 @@ QString JsonConnection::getSysInfo() { if (!reply.contains("info") || !reply["info"].isObject()) { - throw std::runtime_error("No info available in result"); + throw std::runtime_error("No info available in reply"); } QJsonDocument doc(reply["info"].toObject()); @@ -417,12 +417,12 @@ QString JsonConnection::getConfig(std::string type) // parse reply message if (parseReply(reply)) { - if (!reply.contains("result") || !reply["result"].isObject()) + if (!reply.contains("info") || !reply["info"].isObject()) { - throw std::runtime_error("No configuration file available in result"); + throw std::runtime_error("No configuration file available in reply"); } - QJsonDocument doc(reply["result"].toObject()); + QJsonDocument doc(reply["info"].toObject()); QString result(doc.toJson(QJsonDocument::Indented)); return result; } @@ -442,7 +442,7 @@ void JsonConnection::setConfig(const QString &jsonString) QJsonObject configObj; if(!JsonUtils::parse("hyperion-remote-args", jsonString, configObj, _log)) { - throw std::runtime_error("Error in configset arguments, abort"); + throw std::runtime_error("Error in configSet arguments, abort"); } command["config"] = configObj; diff --git a/src/hyperiond/CMakeLists.txt b/src/hyperiond/CMakeLists.txt index 282d11c0f..dd0ec5b5d 100644 --- a/src/hyperiond/CMakeLists.txt +++ b/src/hyperiond/CMakeLists.txt @@ -31,7 +31,7 @@ if (APPLE) endif(APPLE) if (UNIX) - find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED ) + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus QUIET ) if (Qt${QT_VERSION_MAJOR}DBus_FOUND) set(hyperiond_POWER_MNG_DBUS "Qt${QT_VERSION_MAJOR}::DBus") endif() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9e5fe6a4c..0e447f571 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -42,16 +42,16 @@ endif(ENABLE_X11) add_executable(test_versions TestVersions.cpp) target_link_libraries(test_versions Qt${QT_VERSION_MAJOR}::Core) -######### These tests are broken. May they fix someone ########## +add_executable(test_image2ledsmap TestImage2LedsMap.cpp "${CMAKE_BINARY_DIR}/resources.qrc" ) +link_to_hyperion(test_image2ledsmap) -# add_executable(test_image2ledsmap TestImage2LedsMap.cpp) -# link_to_hyperion(test_image2ledsmap) +######### These tests are broken. May they fix someone ########## -# if (ENABLE_DISPMANX) +#if (ENABLE_DISPMANX) # add_subdirectory(dispmanx2png) -# endif (ENABLE_DISPMANX) +#endif (ENABLE_DISPMANX) -# add_executable(test_blackborderprocessor TestBlackBorderProcessor.cpp) -# link_to_hyperion(test_blackborderprocessor) +#add_executable(test_blackborderprocessor TestBlackBorderProcessor.cpp) +#link_to_hyperion(test_blackborderprocessor) ################################################### diff --git a/test/TestImage2LedsMap.cpp b/test/TestImage2LedsMap.cpp index aa80926c9..052a21efb 100644 --- a/test/TestImage2LedsMap.cpp +++ b/test/TestImage2LedsMap.cpp @@ -9,10 +9,9 @@ int main() { - QString homeDir = getenv("RASPILIGHT_HOME"); + const QString schemaFile = ":/hyperion-schema"; + const QString configFile = ":/hyperion_default.config"; - const QString schemaFile = homeDir + "/hyperion.schema.json"; - const QString configFile = homeDir + "/hyperion.config.json"; QJsonObject config; if (QJsonFactory::load(schemaFile, configFile, config) < 0)