mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Various Fixes/Updates (#1549)
* Update FindWindowsSDK.cmake * cmake support libcec without version * Ensure Light-Ids are strings * Fix type - do not have dbus as requried * Fixing #1544 * Cleanup * CleanupFix #1551 * Consistently return instance number with JSON replies (#1504) * hyperion-remote- Fix extracting reply for configGet request * Qt 6.6 - Fix iterator finds * Fix test_image2ledsmap * Ensure window.currentHyperionInstanceName is set, cleanup system/log clipboard report * Address protobuf cmake warning * Update License * Update ChangeLog * Address CodeQL and clang findings
This commit is contained in:
parent
f665f1e1b6
commit
fa7a5b6b56
11
CHANGELOG.md
11
CHANGELOG.md
@ -24,6 +24,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Restart correctly, if running as service (#1368)
|
- 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
|
## Removed
|
||||||
|
|
||||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -278,8 +278,9 @@ $(document).ready(function () {
|
|||||||
if (getStorage('lastSelectedInstance'))
|
if (getStorage('lastSelectedInstance'))
|
||||||
removeStorage('lastSelectedInstance')
|
removeStorage('lastSelectedInstance')
|
||||||
|
|
||||||
currentHyperionInstance = 0;
|
window.currentHyperionInstance = 0;
|
||||||
currentHyperionInstanceName = getInstanceNameByIndex(0);
|
window.currentHyperionInstanceName = getInstanceNameByIndex(0);
|
||||||
|
|
||||||
requestServerConfig();
|
requestServerConfig();
|
||||||
setTimeout(requestServerInfo, 100)
|
setTimeout(requestServerInfo, 100)
|
||||||
setTimeout(requestTokenInfo, 200)
|
setTimeout(requestTokenInfo, 200)
|
||||||
@ -293,7 +294,7 @@ $(document).ready(function () {
|
|||||||
$('#btn_hypinstanceswitch').toggle(false)
|
$('#btn_hypinstanceswitch').toggle(false)
|
||||||
|
|
||||||
// update listing for button
|
// update listing for button
|
||||||
updateUiOnInstance(currentHyperionInstance);
|
updateUiOnInstance(window.currentHyperionInstance);
|
||||||
updateHyperionInstanceListing();
|
updateHyperionInstanceListing();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ $(document).ready(function () {
|
|||||||
function infoSummary() {
|
function infoSummary() {
|
||||||
var info = "";
|
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 += "\n< ----- System information -------------------- >\n";
|
||||||
info += getSystemInfo() + '\n';
|
info += getSystemInfo() + '\n';
|
||||||
@ -43,22 +44,36 @@ $(document).ready(function () {
|
|||||||
info += "\n< ----- Configured Instances ------------------ >\n";
|
info += "\n< ----- Configured Instances ------------------ >\n";
|
||||||
var instances = window.serverInfo.instance;
|
var instances = window.serverInfo.instance;
|
||||||
for (var i = 0; i < instances.length; i++) {
|
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";
|
info += "\n< ----- This instance's priorities ------------ >\n";
|
||||||
var prios = window.serverInfo.priorities;
|
var prios = window.serverInfo.priorities;
|
||||||
|
|
||||||
|
if (prios.length > 0) {
|
||||||
|
|
||||||
for (var i = 0; i < prios.length; i++) {
|
for (var i = 0; i < prios.length; i++) {
|
||||||
info += prios[i].priority + ': ';
|
|
||||||
|
var prio = prios[i].priority.toString().padStart(3, '0');
|
||||||
|
|
||||||
|
info += prio + ': ';
|
||||||
if (prios[i].visible) {
|
if (prios[i].visible) {
|
||||||
info += ' VISIBLE!';
|
info += ' VISIBLE -';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
info += ' ';
|
info += ' INVISIBLE -';
|
||||||
}
|
}
|
||||||
info += ' (' + prios[i].componentId + ') Owner: ' + prios[i].owner + '\n';
|
info += ' (' + prios[i].componentId + ')';
|
||||||
|
if (prios[i].owner) {
|
||||||
|
info += ' (Owner: ' + prios[i].owner + ')';
|
||||||
}
|
}
|
||||||
info += 'priorities_autoselect: ' + window.serverInfo.priorities_autoselect + '\n';
|
info += '\n';
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info += 'The current priority list is empty!\n';
|
||||||
|
}
|
||||||
|
info += 'Autoselect: ' + window.serverInfo.priorities_autoselect + '\n';
|
||||||
|
|
||||||
info += "\n< ----- This instance components' status ------->\n";
|
info += "\n< ----- This instance components' status ------->\n";
|
||||||
var comps = window.serverInfo.components;
|
var comps = window.serverInfo.components;
|
||||||
@ -67,7 +82,7 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
info += "\n< ----- This instance's configuration --------- >\n";
|
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";
|
info += "\n< ----- Current Log --------------------------- >\n";
|
||||||
var logMsgs = document.getElementById("logmessages").textContent;
|
var logMsgs = document.getElementById("logmessages").textContent;
|
||||||
@ -193,18 +208,19 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// toggle fullscreen button in log output
|
// toggle fullscreen button in log output
|
||||||
$(".fullscreen-btn").mousedown(function(e) {
|
$(".fullscreen-btn").mousedown(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".fullscreen-btn").click(function(e) {
|
$(".fullscreen-btn").click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(this).children('i')
|
$(this).children('i')
|
||||||
.toggleClass('fa-expand')
|
.toggleClass('fa-expand')
|
||||||
.toggleClass('fa-compress');
|
.toggleClass('fa-compress');
|
||||||
$('#conf_cont').toggle();
|
$('#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();
|
removeOverlay();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -171,6 +171,10 @@ function initLanguageSelection() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateUiOnInstance(inst) {
|
function updateUiOnInstance(inst) {
|
||||||
|
|
||||||
|
window.currentHyperionInstance = inst;
|
||||||
|
window.currentHyperionInstanceName = getInstanceNameByIndex(inst);
|
||||||
|
|
||||||
$("#active_instance_friendly_name").text(getInstanceNameByIndex(inst));
|
$("#active_instance_friendly_name").text(getInstanceNameByIndex(inst));
|
||||||
if (window.serverInfo.instance.filter(entry => entry.running).length > 1) {
|
if (window.serverInfo.instance.filter(entry => entry.running).length > 1) {
|
||||||
$('#btn_hypinstanceswitch').toggle(true);
|
$('#btn_hypinstanceswitch').toggle(true);
|
||||||
|
@ -854,11 +854,17 @@ function checkUserResult(reply, usr) {
|
|||||||
|
|
||||||
function useGroupId(id) {
|
function useGroupId(id) {
|
||||||
$('#groupId').val(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;
|
groupLightsLocations = hueGroups[id].locations;
|
||||||
get_hue_lights();
|
get_hue_lights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function discover_hue_bridges() {
|
async function discover_hue_bridges() {
|
||||||
$('#wiz_hue_ipstate').html($.i18n('edt_dev_spec_devices_discovery_inprogress'));
|
$('#wiz_hue_ipstate').html($.i18n('edt_dev_spec_devices_discovery_inprogress'));
|
||||||
$('#wiz_hue_discovered').html("")
|
$('#wiz_hue_discovered').html("")
|
||||||
@ -1016,11 +1022,11 @@ function beginWizardHue() {
|
|||||||
$('#host').val(host);
|
$('#host').val(host);
|
||||||
|
|
||||||
var port = eV("port");
|
var port = eV("port");
|
||||||
if (port > 0) {
|
if (port == 0) {
|
||||||
$('#port').val(port);
|
$('#port').val(80);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#port').val('');
|
$('#port').val(port);
|
||||||
}
|
}
|
||||||
hueIPs.unshift({ host: host, port: port });
|
hueIPs.unshift({ host: host, port: port });
|
||||||
|
|
||||||
@ -1037,7 +1043,13 @@ function beginWizardHue() {
|
|||||||
|
|
||||||
hueIPs = [];
|
hueIPs = [];
|
||||||
hueIPsinc = 0;
|
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 {
|
else {
|
||||||
discover_hue_bridges();
|
discover_hue_bridges();
|
||||||
|
@ -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
|
# Relevant Wikipedia article: http://en.wikipedia.org/wiki/Microsoft_Windows_SDK
|
||||||
#
|
#
|
||||||
@ -49,10 +49,11 @@
|
|||||||
# http://academic.cleardefinition.com
|
# http://academic.cleardefinition.com
|
||||||
# Iowa State University HCI Graduate Program/VRAC
|
# 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.
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
# http://www.boost.org/LICENSE_1_0.txt)
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
# SPDX-License-Identifier: BSL-1.0
|
||||||
|
|
||||||
set(_preferred_sdk_dirs) # pre-output
|
set(_preferred_sdk_dirs) # pre-output
|
||||||
set(_win_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
|
# although version numbers listed on that page don't necessarily match the directory
|
||||||
# used by the installer.
|
# used by the installer.
|
||||||
set(_winsdk_win10vers
|
set(_winsdk_win10vers
|
||||||
|
10.0.22000.0
|
||||||
|
10.0.20348.0
|
||||||
|
10.0.19041.0
|
||||||
10.0.18362.0 # Win10 1903 "19H1"
|
10.0.18362.0 # Win10 1903 "19H1"
|
||||||
10.0.17763.0 # Win10 1809 "October 2018 Update"
|
10.0.17763.0 # Win10 1809 "October 2018 Update"
|
||||||
10.0.17134.0 # Redstone 4 aka Win10 1803 "April 2018 Update"
|
10.0.17134.0 # Redstone 4 aka Win10 1803 "April 2018 Update"
|
||||||
|
@ -72,7 +72,7 @@ endif()
|
|||||||
# .deb files for apt
|
# .deb files for apt
|
||||||
# https://cmake.org/cmake/help/latest/cpack_gen/deb.html
|
# 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_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" )
|
SET ( CPACK_DEBIAN_PACKAGE_SECTION "Miscellaneous" )
|
||||||
|
|
||||||
# .rpm for rpm
|
# .rpm for rpm
|
||||||
|
2
dependencies/CMakeLists.txt
vendored
2
dependencies/CMakeLists.txt
vendored
@ -150,7 +150,7 @@ if(ENABLE_PROTOBUF_SERVER)
|
|||||||
set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Build protobuf static")
|
set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Build protobuf static")
|
||||||
endif()
|
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
|
# define the include for the protobuf library
|
||||||
set(PROTOBUF_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf/src")
|
set(PROTOBUF_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/external/protobuf/src")
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
// Utility includes
|
// Utility includes
|
||||||
#include <utils/Logger.h>
|
#include <utils/Logger.h>
|
||||||
|
#include <utils/WeakConnect.h>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
constexpr std::chrono::milliseconds DEFAULT_DISCOVER_TIMEOUT{ 500 };
|
constexpr std::chrono::milliseconds DEFAULT_DISCOVER_TIMEOUT{ 500 };
|
||||||
@ -103,24 +104,6 @@ private slots:
|
|||||||
void onServiceRemoved(const QMdnsEngine::Service& service);
|
void onServiceRemoved(const QMdnsEngine::Service& service);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
template <typename Func1, typename Func2, typename std::enable_if_t<!std::is_member_pointer<Func2>::value, int> = 0>
|
|
||||||
static inline QMetaObject::Connection weakConnect(typename QtPrivate::FunctionPointer<Func1>::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
|
/// The logger instance for mDNS-Service
|
||||||
Logger* _log;
|
Logger* _log;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace NetUtils {
|
|||||||
{
|
{
|
||||||
if ((port <= 0 || port > MAX_PORT) && port != -1)
|
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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
63
include/utils/WeakConnect.h
Normal file
63
include/utils/WeakConnect.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#ifndef WEAKCONNECT_H
|
||||||
|
#define WEAKCONNECT_H
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
// Qt includes
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
template <typename Func1, typename Func2, typename std::enable_if_t<std::is_member_pointer<Func2>::value, int> = 0>
|
||||||
|
static inline QMetaObject::Connection weakConnect(typename QtPrivate::FunctionPointer<Func1>::Object* sender,
|
||||||
|
Func1 signal,
|
||||||
|
typename QtPrivate::FunctionPointer<Func2>::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 <typename Func1, typename Func2, typename std::enable_if_t<!std::is_member_pointer<Func2>::value, int> = 0>
|
||||||
|
static inline QMetaObject::Connection weakConnect(typename QtPrivate::FunctionPointer<Func1>::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 <typename Func1, typename Func2, typename std::enable_if_t<!std::is_member_pointer<Func2>::value, int> = 0>
|
||||||
|
static inline QMetaObject::Connection weakConnect(typename QtPrivate::FunctionPointer<Func1>::Object* sender,
|
||||||
|
Func1 signal,
|
||||||
|
typename QtPrivate::FunctionPointer<Func2>::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
|
@ -19,7 +19,7 @@
|
|||||||
///
|
///
|
||||||
namespace hyperion {
|
namespace hyperion {
|
||||||
|
|
||||||
void handleInitialEffect(Hyperion* hyperion, const QJsonObject& FGEffectConfig)
|
static void handleInitialEffect(Hyperion* hyperion, const QJsonObject& FGEffectConfig)
|
||||||
{
|
{
|
||||||
#define FGCONFIG_ARRAY fgColorConfig.toArray()
|
#define FGCONFIG_ARRAY fgColorConfig.toArray()
|
||||||
|
|
||||||
@ -63,12 +63,12 @@ namespace hyperion {
|
|||||||
#undef FGCONFIG_ARRAY
|
#undef FGCONFIG_ARRAY
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorOrder createColorOrder(const QJsonObject &deviceConfig)
|
static ColorOrder createColorOrder(const QJsonObject &deviceConfig)
|
||||||
{
|
{
|
||||||
return stringToColorOrder(deviceConfig["colorOrder"].toString("rgb"));
|
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 double backlightThreshold = colorConfig["backlightThreshold"].toDouble(0.0);
|
||||||
const bool backlightColored = colorConfig["backlightColored"].toBool(false);
|
const bool backlightColored = colorConfig["backlightColored"].toBool(false);
|
||||||
@ -81,7 +81,7 @@ namespace hyperion {
|
|||||||
return RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, static_cast<uint8_t>(brightness), static_cast<uint8_t>(brightnessComp));
|
return RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, static_cast<uint8_t>(brightness), static_cast<uint8_t>(brightnessComp));
|
||||||
}
|
}
|
||||||
|
|
||||||
OkhsvTransform createOkhsvTransform(const QJsonObject& colorConfig)
|
static OkhsvTransform createOkhsvTransform(const QJsonObject& colorConfig)
|
||||||
{
|
{
|
||||||
const double saturationGain = colorConfig["saturationGain"].toDouble(1.0);
|
const double saturationGain = colorConfig["saturationGain"].toDouble(1.0);
|
||||||
const double brightnessGain = colorConfig["brightnessGain"].toDouble(1.0);
|
const double brightnessGain = colorConfig["brightnessGain"].toDouble(1.0);
|
||||||
@ -89,7 +89,7 @@ namespace hyperion {
|
|||||||
return OkhsvTransform(saturationGain, brightnessGain);
|
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();
|
const QJsonArray& channelConfig = colorConfig[channelName].toArray();
|
||||||
return RgbChannelAdjustment(
|
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");
|
const QString id = adjustmentConfig["id"].toString("default");
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ namespace hyperion {
|
|||||||
return adjustment;
|
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
|
// Create the result, the transforms are added to this
|
||||||
MultiColorAdjustment * adjustment = new MultiColorAdjustment(ledCnt);
|
MultiColorAdjustment * adjustment = new MultiColorAdjustment(ledCnt);
|
||||||
@ -184,7 +184,7 @@ namespace hyperion {
|
|||||||
* @param deviceOrder The default RGB channel ordering
|
* @param deviceOrder The default RGB channel ordering
|
||||||
* @return The constructed ledstring
|
* @return The constructed ledstring
|
||||||
*/
|
*/
|
||||||
LedString createLedString(const QJsonArray& ledConfigArray, const ColorOrder deviceOrder)
|
static LedString createLedString(const QJsonArray& ledConfigArray, const ColorOrder deviceOrder)
|
||||||
{
|
{
|
||||||
LedString ledString;
|
LedString ledString;
|
||||||
const QString deviceOrderStr = colorOrderToString(deviceOrder);
|
const QString deviceOrderStr = colorOrderToString(deviceOrder);
|
||||||
@ -215,7 +215,7 @@ namespace hyperion {
|
|||||||
return ledString;
|
return ledString;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize getLedLayoutGridSize(const QJsonArray& ledConfigArray)
|
static QSize getLedLayoutGridSize(const QJsonArray& ledConfigArray)
|
||||||
{
|
{
|
||||||
std::vector<int> midPointsX;
|
std::vector<int> midPointsX;
|
||||||
std::vector<int> midPointsY;
|
std::vector<int> midPointsY;
|
||||||
|
@ -57,7 +57,9 @@ public:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QJsonValue::Object:
|
case QJsonValue::Object:
|
||||||
ret = getDefaultValue(value.toObject().find("default").value());
|
{
|
||||||
|
ret = getDefaultValue(value.toObject().value("default"));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case QJsonValue::Bool:
|
case QJsonValue::Bool:
|
||||||
return value.toBool() ? "True" : "False";
|
return value.toBool() ? "True" : "False";
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include <hyperion/GrabberWrapper.h>
|
#include <hyperion/GrabberWrapper.h>
|
||||||
#include <grabber/QtGrabber.h>
|
#include <grabber/QtGrabber.h>
|
||||||
|
|
||||||
|
#include <utils/WeakConnect.h>
|
||||||
|
|
||||||
#if defined(ENABLE_MF)
|
#if defined(ENABLE_MF)
|
||||||
#include <grabber/MFGrabber.h>
|
#include <grabber/MFGrabber.h>
|
||||||
#elif defined(ENABLE_V4L2)
|
#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)
|
void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &command, int tan)
|
||||||
{
|
{
|
||||||
const QString &subc = message["subcommand"].toString();
|
const QString &subc = message["subcommand"].toString();
|
||||||
const quint8 &inst = message["instance"].toInt();
|
const quint8 &inst = static_cast<quint8>(message["instance"].toInt());
|
||||||
const QString &name = message["name"].toString();
|
const QString &name = message["name"].toString();
|
||||||
|
|
||||||
if (subc == "switchTo")
|
if (subc == "switchTo")
|
||||||
@ -1471,7 +1473,12 @@ void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &c
|
|||||||
|
|
||||||
if (subc == "startInstance")
|
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))
|
if (!API::startInstance(inst, tan))
|
||||||
sendErrorReply("Can't start Hyperion instance index " + QString::number(inst), command + "-" + subc, 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
|
// create reply
|
||||||
QJsonObject reply;
|
QJsonObject reply;
|
||||||
|
reply["instance"] = _hyperion->getInstanceIndex();
|
||||||
reply["success"] = true;
|
reply["success"] = true;
|
||||||
reply["command"] = command;
|
reply["command"] = command;
|
||||||
reply["tan"] = tan;
|
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)
|
void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &command, int tan)
|
||||||
{
|
{
|
||||||
QJsonObject reply;
|
QJsonObject reply;
|
||||||
|
reply["instance"] = _hyperion->getInstanceIndex();
|
||||||
reply["success"] = true;
|
reply["success"] = true;
|
||||||
reply["command"] = command;
|
reply["command"] = command;
|
||||||
reply["tan"] = tan;
|
reply["tan"] = tan;
|
||||||
@ -1851,6 +1860,7 @@ void JsonAPI::sendErrorReply(const QString &error, const QString &command, int t
|
|||||||
{
|
{
|
||||||
// create reply
|
// create reply
|
||||||
QJsonObject reply;
|
QJsonObject reply;
|
||||||
|
reply["instance"] = _hyperion->getInstanceIndex();
|
||||||
reply["success"] = false;
|
reply["success"] = false;
|
||||||
reply["error"] = error;
|
reply["error"] = error;
|
||||||
reply["command"] = command;
|
reply["command"] = command;
|
||||||
|
@ -64,7 +64,7 @@ QJsonObject QJsonSchemaChecker::getAutoCorrectedConfig(const QJsonObject& value,
|
|||||||
_messages.clear();
|
_messages.clear();
|
||||||
_autoCorrected = value;
|
_autoCorrected = value;
|
||||||
|
|
||||||
for (const QString& correct : sequence)
|
for (const QString& correct : qAsConst(sequence))
|
||||||
{
|
{
|
||||||
_correct = correct;
|
_correct = correct;
|
||||||
_currentPath.clear();
|
_currentPath.clear();
|
||||||
@ -234,7 +234,6 @@ void QJsonSchemaChecker::checkProperties(const QJsonObject& value, const QJsonOb
|
|||||||
const QJsonValue& propertyValue = *i;
|
const QJsonValue& propertyValue = *i;
|
||||||
|
|
||||||
_currentPath.append("." + property);
|
_currentPath.append("." + property);
|
||||||
QJsonObject::const_iterator required = propertyValue.toObject().find("required");
|
|
||||||
|
|
||||||
if (value.contains(property))
|
if (value.contains(property))
|
||||||
{
|
{
|
||||||
@ -242,7 +241,8 @@ void QJsonSchemaChecker::checkProperties(const QJsonObject& value, const QJsonOb
|
|||||||
}
|
}
|
||||||
else if (!verifyDeps(property, value, schema))
|
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;
|
_error = true;
|
||||||
|
|
||||||
@ -273,9 +273,10 @@ bool QJsonSchemaChecker::verifyDeps(const QString& property, const QJsonObject&
|
|||||||
{
|
{
|
||||||
const QJsonObject& depends = ((schema[property].toObject())["options"].toObject())["dependencies"].toObject();
|
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.contains(firstName))
|
||||||
{
|
{
|
||||||
if (value[firstName] != depends[firstName])
|
if (value[firstName] != depends[firstName])
|
||||||
|
@ -21,13 +21,6 @@
|
|||||||
|
|
||||||
#include <utils/DefaultSignalHandler.h>
|
#include <utils/DefaultSignalHandler.h>
|
||||||
|
|
||||||
// Constants
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
const char SERVICE_TYPE[] = "flatbuffer";
|
|
||||||
|
|
||||||
} //End of constants
|
|
||||||
|
|
||||||
using namespace commandline;
|
using namespace commandline;
|
||||||
|
|
||||||
// save the image as screenshot
|
// save the image as screenshot
|
||||||
|
@ -22,13 +22,6 @@
|
|||||||
|
|
||||||
#include <utils/DefaultSignalHandler.h>
|
#include <utils/DefaultSignalHandler.h>
|
||||||
|
|
||||||
// Constants
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
const char SERVICE_TYPE[] = "flatbuffer";
|
|
||||||
|
|
||||||
} //End of constants
|
|
||||||
|
|
||||||
using namespace commandline;
|
using namespace commandline;
|
||||||
|
|
||||||
// save the image as screenshot
|
// save the image as screenshot
|
||||||
|
@ -20,13 +20,6 @@
|
|||||||
|
|
||||||
#include <utils/DefaultSignalHandler.h>
|
#include <utils/DefaultSignalHandler.h>
|
||||||
|
|
||||||
// Constants
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
const char SERVICE_TYPE[] = "flatbuffer";
|
|
||||||
|
|
||||||
} //End of constants
|
|
||||||
|
|
||||||
using namespace commandline;
|
using namespace commandline;
|
||||||
|
|
||||||
// save the image as screenshot
|
// save the image as screenshot
|
||||||
|
@ -215,7 +215,7 @@ QJsonObject JsonConnection::getServerInfo()
|
|||||||
{
|
{
|
||||||
if (!reply.contains("info") || !reply["info"].isObject())
|
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();
|
return reply["info"].toObject();
|
||||||
@ -240,7 +240,7 @@ QString JsonConnection::getSysInfo()
|
|||||||
{
|
{
|
||||||
if (!reply.contains("info") || !reply["info"].isObject())
|
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());
|
QJsonDocument doc(reply["info"].toObject());
|
||||||
@ -417,12 +417,12 @@ QString JsonConnection::getConfig(std::string type)
|
|||||||
// parse reply message
|
// parse reply message
|
||||||
if (parseReply(reply))
|
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));
|
QString result(doc.toJson(QJsonDocument::Indented));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -442,7 +442,7 @@ void JsonConnection::setConfig(const QString &jsonString)
|
|||||||
QJsonObject configObj;
|
QJsonObject configObj;
|
||||||
if(!JsonUtils::parse("hyperion-remote-args", jsonString, configObj, _log))
|
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;
|
command["config"] = configObj;
|
||||||
|
@ -31,7 +31,7 @@ if (APPLE)
|
|||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
if (UNIX)
|
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)
|
if (Qt${QT_VERSION_MAJOR}DBus_FOUND)
|
||||||
set(hyperiond_POWER_MNG_DBUS "Qt${QT_VERSION_MAJOR}::DBus")
|
set(hyperiond_POWER_MNG_DBUS "Qt${QT_VERSION_MAJOR}::DBus")
|
||||||
endif()
|
endif()
|
||||||
|
@ -42,16 +42,16 @@ endif(ENABLE_X11)
|
|||||||
add_executable(test_versions TestVersions.cpp)
|
add_executable(test_versions TestVersions.cpp)
|
||||||
target_link_libraries(test_versions Qt${QT_VERSION_MAJOR}::Core)
|
target_link_libraries(test_versions Qt${QT_VERSION_MAJOR}::Core)
|
||||||
|
|
||||||
|
add_executable(test_image2ledsmap TestImage2LedsMap.cpp "${CMAKE_BINARY_DIR}/resources.qrc" )
|
||||||
|
link_to_hyperion(test_image2ledsmap)
|
||||||
|
|
||||||
######### These tests are broken. May they fix someone ##########
|
######### These tests are broken. May they fix someone ##########
|
||||||
|
|
||||||
# add_executable(test_image2ledsmap TestImage2LedsMap.cpp)
|
#if (ENABLE_DISPMANX)
|
||||||
# link_to_hyperion(test_image2ledsmap)
|
|
||||||
|
|
||||||
# if (ENABLE_DISPMANX)
|
|
||||||
# add_subdirectory(dispmanx2png)
|
# add_subdirectory(dispmanx2png)
|
||||||
# endif (ENABLE_DISPMANX)
|
#endif (ENABLE_DISPMANX)
|
||||||
|
|
||||||
# add_executable(test_blackborderprocessor TestBlackBorderProcessor.cpp)
|
#add_executable(test_blackborderprocessor TestBlackBorderProcessor.cpp)
|
||||||
# link_to_hyperion(test_blackborderprocessor)
|
#link_to_hyperion(test_blackborderprocessor)
|
||||||
|
|
||||||
###################################################
|
###################################################
|
||||||
|
@ -9,10 +9,9 @@
|
|||||||
|
|
||||||
int main()
|
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;
|
QJsonObject config;
|
||||||
if (QJsonFactory::load(schemaFile, configFile, config) < 0)
|
if (QJsonFactory::load(schemaFile, configFile, config) < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user