mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
IPv6 support (#1369)
* hyperion-remote - Support IPv6 * LEDDevices - Remove IPv6 limitations * Separate JsonEditorHostValidation * Standalone grabbers & JSON/Flatbuffer forwarder: IPv6 support * remote: Fix setting multiple colors via Hex, add standard logging * IPv6 Updates -Add db migration activities * Addressing non-Windows compile issues * Code cleanup, address clang feedback * Update address (hostname, IPv4/IPv6) help text * Apply migration steps to "old" configurations imported * Show user the UI-Url, if hyperion is already running, address clang findings * Windows Cmake OpenSLL output * Minor Text update
This commit is contained in:
@@ -279,6 +279,11 @@ bool Hyperion::saveSettings(const QJsonObject& config, bool correct)
|
||||
return _settingsManager->saveSettings(config, correct);
|
||||
}
|
||||
|
||||
bool Hyperion::restoreSettings(const QJsonObject& config, bool correct)
|
||||
{
|
||||
return _settingsManager->restoreSettings(config, correct);
|
||||
}
|
||||
|
||||
int Hyperion::getLatchTime() const
|
||||
{
|
||||
return _ledDeviceWrapper->getLatchTime();
|
||||
|
@@ -9,16 +9,18 @@
|
||||
|
||||
// utils includes
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/NetUtils.h>
|
||||
|
||||
// qt includes
|
||||
#include <QTcpServer>
|
||||
#include <QTcpSocket>
|
||||
#include <QHostInfo>
|
||||
#include <QNetworkInterface>
|
||||
|
||||
#include <flatbufserver/FlatBufferConnection.h>
|
||||
|
||||
MessageForwarder::MessageForwarder(Hyperion *hyperion)
|
||||
: QObject()
|
||||
, _hyperion(hyperion)
|
||||
MessageForwarder::MessageForwarder(Hyperion* hyperion)
|
||||
: _hyperion(hyperion)
|
||||
, _log(Logger::getInstance("NETFORWARDER"))
|
||||
, _muxer(_hyperion->getMuxerInstance())
|
||||
, _forwarder_enabled(true)
|
||||
@@ -40,58 +42,74 @@ MessageForwarder::MessageForwarder(Hyperion *hyperion)
|
||||
MessageForwarder::~MessageForwarder()
|
||||
{
|
||||
while (!_forwardClients.isEmpty())
|
||||
{
|
||||
delete _forwardClients.takeFirst();
|
||||
}
|
||||
}
|
||||
|
||||
void MessageForwarder::handleSettingsUpdate(settings::type type, const QJsonDocument &config)
|
||||
void MessageForwarder::handleSettingsUpdate(settings::type type, const QJsonDocument& config)
|
||||
{
|
||||
if(type == settings::NETFORWARD)
|
||||
if (type == settings::NETFORWARD)
|
||||
{
|
||||
// clear the current targets
|
||||
_jsonSlaves.clear();
|
||||
_flatSlaves.clear();
|
||||
_jsonTargets.clear();
|
||||
_flatbufferTargets.clear();
|
||||
while (!_forwardClients.isEmpty())
|
||||
{
|
||||
delete _forwardClients.takeFirst();
|
||||
}
|
||||
|
||||
// build new one
|
||||
const QJsonObject &obj = config.object();
|
||||
if ( !obj["json"].isNull() )
|
||||
const QJsonObject& obj = config.object();
|
||||
if (!obj["json"].isNull())
|
||||
{
|
||||
const QJsonArray & addr = obj["json"].toArray();
|
||||
const QJsonArray& addr = obj["json"].toArray();
|
||||
for (const auto& entry : addr)
|
||||
{
|
||||
addJsonSlave(entry.toString());
|
||||
addJsonTarget(entry.toObject());
|
||||
}
|
||||
}
|
||||
|
||||
if ( !obj["flat"].isNull() )
|
||||
if (!obj["flat"].isNull())
|
||||
{
|
||||
const QJsonArray & addr = obj["flat"].toArray();
|
||||
const QJsonArray& addr = obj["flat"].toArray();
|
||||
for (const auto& entry : addr)
|
||||
{
|
||||
addFlatbufferSlave(entry.toString());
|
||||
addFlatbufferTarget(entry.toObject());
|
||||
}
|
||||
}
|
||||
|
||||
if (!_jsonSlaves.isEmpty() && obj["enable"].toBool() && _forwarder_enabled)
|
||||
bool isForwarderEnabledinSettings = obj["enable"].toBool(false);
|
||||
|
||||
if (!_jsonTargets.isEmpty() && isForwarderEnabledinSettings && _forwarder_enabled)
|
||||
{
|
||||
InfoIf(obj["enable"].toBool(true), _log, "Forward now to json targets '%s'", QSTRING_CSTR(_jsonSlaves.join(", ")));
|
||||
for (const auto& targetHost : qAsConst(_jsonTargets))
|
||||
{
|
||||
InfoIf(isForwarderEnabledinSettings, _log, "Forwarding now to JSON-target host: %s port: %u", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
|
||||
}
|
||||
|
||||
connect(_hyperion, &Hyperion::forwardJsonMessage, this, &MessageForwarder::forwardJsonMessage, Qt::UniqueConnection);
|
||||
} else if (_jsonSlaves.isEmpty() || ! obj["enable"].toBool() || !_forwarder_enabled)
|
||||
disconnect(_hyperion, &Hyperion::forwardJsonMessage, 0, 0);
|
||||
|
||||
if (!_flatSlaves.isEmpty() && obj["enable"].toBool() && _forwarder_enabled)
|
||||
{
|
||||
InfoIf(obj["enable"].toBool(true), _log, "Forward now to flatbuffer targets '%s'", QSTRING_CSTR(_flatSlaves.join(", ")));
|
||||
}
|
||||
else if ( _flatSlaves.isEmpty() || ! obj["enable"].toBool() || !_forwarder_enabled)
|
||||
else if (_jsonTargets.isEmpty() || !isForwarderEnabledinSettings || !_forwarder_enabled)
|
||||
{
|
||||
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
|
||||
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
|
||||
disconnect(_hyperion, &Hyperion::forwardJsonMessage, nullptr, nullptr);
|
||||
}
|
||||
|
||||
if (!_flatbufferTargets.isEmpty() && isForwarderEnabledinSettings && _forwarder_enabled)
|
||||
{
|
||||
for (const auto& targetHost : qAsConst(_flatbufferTargets))
|
||||
{
|
||||
InfoIf(isForwarderEnabledinSettings, _log, "Forwarding now to Flatbuffer-target host: %s port: %u", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
|
||||
}
|
||||
}
|
||||
else if (_flatbufferTargets.isEmpty() || !isForwarderEnabledinSettings || !_forwarder_enabled)
|
||||
{
|
||||
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, nullptr, nullptr);
|
||||
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, nullptr, nullptr);
|
||||
}
|
||||
|
||||
// update comp state
|
||||
_hyperion->setNewComponentState(hyperion::COMP_FORWARDER, obj["enable"].toBool(true));
|
||||
_hyperion->setNewComponentState(hyperion::COMP_FORWARDER, isForwarderEnabledinSettings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,146 +129,161 @@ void MessageForwarder::handlePriorityChanges(quint8 priority)
|
||||
const QJsonObject obj = _hyperion->getSetting(settings::NETFORWARD).object();
|
||||
if (priority != 0 && _forwarder_enabled && obj["enable"].toBool())
|
||||
{
|
||||
//_flatSlaves.clear();
|
||||
//while (!_forwardClients.isEmpty())
|
||||
// delete _forwardClients.takeFirst();
|
||||
|
||||
hyperion::Components activeCompId = _hyperion->getPriorityInfo(priority).componentId;
|
||||
if (activeCompId == hyperion::COMP_GRABBER || activeCompId == hyperion::COMP_V4L)
|
||||
{
|
||||
if ( !obj["flat"].isNull() )
|
||||
if (!obj["flat"].isNull())
|
||||
{
|
||||
const QJsonArray & addr = obj["flat"].toArray();
|
||||
const QJsonArray& addr = obj["flat"].toArray();
|
||||
for (const auto& entry : addr)
|
||||
{
|
||||
addFlatbufferSlave(entry.toString());
|
||||
addFlatbufferTarget(entry.toObject());
|
||||
}
|
||||
}
|
||||
|
||||
switch(activeCompId)
|
||||
switch (activeCompId)
|
||||
{
|
||||
case hyperion::COMP_GRABBER:
|
||||
{
|
||||
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
|
||||
connect(_hyperion, &Hyperion::forwardSystemProtoMessage, this, &MessageForwarder::forwardFlatbufferMessage, Qt::UniqueConnection);
|
||||
}
|
||||
break;
|
||||
case hyperion::COMP_V4L:
|
||||
{
|
||||
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
|
||||
connect(_hyperion, &Hyperion::forwardV4lProtoMessage, this, &MessageForwarder::forwardFlatbufferMessage, Qt::UniqueConnection);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
|
||||
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
|
||||
}
|
||||
case hyperion::COMP_GRABBER:
|
||||
{
|
||||
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, nullptr, nullptr);
|
||||
connect(_hyperion, &Hyperion::forwardSystemProtoMessage, this, &MessageForwarder::forwardFlatbufferMessage, Qt::UniqueConnection);
|
||||
}
|
||||
break;
|
||||
case hyperion::COMP_V4L:
|
||||
{
|
||||
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, nullptr, nullptr);
|
||||
connect(_hyperion, &Hyperion::forwardV4lProtoMessage, this, &MessageForwarder::forwardFlatbufferMessage, Qt::UniqueConnection);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, nullptr, nullptr);
|
||||
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, 0, 0);
|
||||
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, 0, 0);
|
||||
disconnect(_hyperion, &Hyperion::forwardSystemProtoMessage, nullptr, nullptr);
|
||||
disconnect(_hyperion, &Hyperion::forwardV4lProtoMessage, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessageForwarder::addJsonSlave(const QString& slave)
|
||||
void MessageForwarder::addJsonTarget(const QJsonObject& targetConfig)
|
||||
{
|
||||
QStringList parts = slave.split(":");
|
||||
if (parts.size() != 2)
|
||||
{
|
||||
Error(_log, "Unable to parse address (%s)",QSTRING_CSTR(slave));
|
||||
return;
|
||||
}
|
||||
TargetHost targetHost;
|
||||
|
||||
bool ok;
|
||||
parts[1].toUShort(&ok);
|
||||
if (!ok)
|
||||
QString config_host = targetConfig["host"].toString();
|
||||
if (NetUtils::resolveHostAddress(_log, config_host, targetHost.host))
|
||||
{
|
||||
Error(_log, "Unable to parse port number (%s)",QSTRING_CSTR(parts[1]));
|
||||
return;
|
||||
}
|
||||
int config_port = targetConfig["port"].toInt();
|
||||
if (NetUtils::isValidPort(_log, config_port, config_host))
|
||||
{
|
||||
targetHost.port = static_cast<quint16>(config_port);
|
||||
|
||||
// verify loop with jsonserver
|
||||
const QJsonObject &obj = _hyperion->getSetting(settings::JSONSERVER).object();
|
||||
if(QHostAddress(parts[0]) == QHostAddress::LocalHost && parts[1].toInt() == obj["port"].toInt())
|
||||
{
|
||||
Error(_log, "Loop between JsonServer and Forwarder! (%s)",QSTRING_CSTR(slave));
|
||||
return;
|
||||
}
|
||||
// verify loop with JSON-server
|
||||
const QJsonObject& obj = _hyperion->getSetting(settings::JSONSERVER).object();
|
||||
if ((QNetworkInterface::allAddresses().indexOf(targetHost.host) != -1) && targetHost.port == static_cast<quint16>(obj["port"].toInt()))
|
||||
{
|
||||
Error(_log, "Loop between JSON-Server and Forwarder! Configuration for host: %s, port: %d is ignored.", QSTRING_CSTR(config_host), config_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_forwarder_enabled)
|
||||
{
|
||||
if (_jsonTargets.indexOf(targetHost) == -1)
|
||||
{
|
||||
Info(_log, "JSON-Forwarder settings: Adding target host: %s port: %u", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
|
||||
_jsonTargets << targetHost;
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning(_log, "JSON Forwarder settings: Duplicate target host configuration! Configuration for host: %s, port: %d is ignored.", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
|
||||
}
|
||||
}
|
||||
|
||||
if (_forwarder_enabled && !_jsonSlaves.contains(slave))
|
||||
_jsonSlaves << slave;
|
||||
}
|
||||
|
||||
void MessageForwarder::addFlatbufferSlave(const QString& slave)
|
||||
{
|
||||
QStringList parts = slave.split(":");
|
||||
if (parts.size() != 2)
|
||||
{
|
||||
Error(_log, "Unable to parse address (%s)",QSTRING_CSTR(slave));
|
||||
return;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
parts[1].toUShort(&ok);
|
||||
if (!ok)
|
||||
{
|
||||
Error(_log, "Unable to parse port number (%s)",QSTRING_CSTR(parts[1]));
|
||||
return;
|
||||
}
|
||||
|
||||
// verify loop with flatbufserver
|
||||
const QJsonObject &obj = _hyperion->getSetting(settings::FLATBUFSERVER).object();
|
||||
if(QHostAddress(parts[0]) == QHostAddress::LocalHost && parts[1].toInt() == obj["port"].toInt())
|
||||
{
|
||||
Error(_log, "Loop between Flatbuffer Server and Forwarder! (%s)",QSTRING_CSTR(slave));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_forwarder_enabled && !_flatSlaves.contains(slave))
|
||||
{
|
||||
_flatSlaves << slave;
|
||||
FlatBufferConnection* flatbuf = new FlatBufferConnection("Forwarder", slave.toLocal8Bit().constData(), _priority, false);
|
||||
_forwardClients << flatbuf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessageForwarder::forwardJsonMessage(const QJsonObject &message)
|
||||
void MessageForwarder::addFlatbufferTarget(const QJsonObject& targetConfig)
|
||||
{
|
||||
TargetHost targetHost;
|
||||
|
||||
QString config_host = targetConfig["host"].toString();
|
||||
if (NetUtils::resolveHostAddress(_log, config_host, targetHost.host))
|
||||
{
|
||||
int config_port = targetConfig["port"].toInt();
|
||||
if (NetUtils::isValidPort(_log, config_port, config_host))
|
||||
{
|
||||
targetHost.port = static_cast<quint16>(config_port);
|
||||
|
||||
// verify loop with Flatbuffer-server
|
||||
const QJsonObject& obj = _hyperion->getSetting(settings::FLATBUFSERVER).object();
|
||||
if ((QNetworkInterface::allAddresses().indexOf(targetHost.host) != -1) && targetHost.port == static_cast<quint16>(obj["port"].toInt()))
|
||||
{
|
||||
Error(_log, "Loop between Flatbuffer-Server and Forwarder! Configuration for host: %s, port: %d is ignored.", QSTRING_CSTR(config_host), config_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_forwarder_enabled)
|
||||
{
|
||||
if (_flatbufferTargets.indexOf(targetHost) == -1)
|
||||
{
|
||||
Info(_log, "Flatbuffer-Forwarder settings: Adding target host: %s port: %u", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
|
||||
_flatbufferTargets << targetHost;
|
||||
|
||||
FlatBufferConnection* flatbuf = new FlatBufferConnection("Forwarder", targetHost.host.toString(), _priority, false, targetHost.port);
|
||||
_forwardClients << flatbuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning(_log, "Flatbuffer Forwarder settings: Duplicate target host configuration! Configuration for host: %s, port: %d is ignored.", QSTRING_CSTR(targetHost.host.toString()), targetHost.port);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessageForwarder::forwardJsonMessage(const QJsonObject& message)
|
||||
{
|
||||
if (_forwarder_enabled)
|
||||
{
|
||||
QTcpSocket client;
|
||||
for (int i=0; i<_jsonSlaves.size(); i++)
|
||||
for (const auto& targetHost : qAsConst(_jsonTargets))
|
||||
{
|
||||
QStringList parts = _jsonSlaves.at(i).split(":");
|
||||
client.connectToHost(QHostAddress(parts[0]), parts[1].toUShort());
|
||||
if ( client.waitForConnected(500) )
|
||||
client.connectToHost(targetHost.host, targetHost.port);
|
||||
if (client.waitForConnected(500))
|
||||
{
|
||||
sendJsonMessage(message,&client);
|
||||
sendJsonMessage(message, &client);
|
||||
client.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessageForwarder::forwardFlatbufferMessage(const QString& name, const Image<ColorRgb> &image)
|
||||
void MessageForwarder::forwardFlatbufferMessage(const QString& /*name*/, const Image<ColorRgb>& image)
|
||||
{
|
||||
if (_forwarder_enabled)
|
||||
{
|
||||
for (int i=0; i < _forwardClients.size(); i++)
|
||||
for (int i = 0; i < _forwardClients.size(); i++)
|
||||
{
|
||||
_forwardClients.at(i)->setImage(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessageForwarder::sendJsonMessage(const QJsonObject &message, QTcpSocket *socket)
|
||||
void MessageForwarder::sendJsonMessage(const QJsonObject& message, QTcpSocket* socket)
|
||||
{
|
||||
// for hyperion classic compatibility
|
||||
QJsonObject jsonMessage = message;
|
||||
if (jsonMessage.contains("tan") && jsonMessage["tan"].isNull())
|
||||
{
|
||||
jsonMessage["tan"] = 100;
|
||||
}
|
||||
|
||||
// serialize message
|
||||
QJsonDocument writer(jsonMessage);
|
||||
@@ -280,7 +313,7 @@ void MessageForwarder::sendJsonMessage(const QJsonObject &message, QTcpSocket *s
|
||||
|
||||
// parse reply data
|
||||
QJsonParseError error;
|
||||
QJsonDocument reply = QJsonDocument::fromJson(serializedReply ,&error);
|
||||
QJsonDocument::fromJson(serializedReply, &error);
|
||||
|
||||
if (error.error != QJsonParseError::NoError)
|
||||
{
|
||||
@@ -288,3 +321,4 @@ void MessageForwarder::sendJsonMessage(const QJsonObject &message, QTcpSocket *s
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,8 @@
|
||||
|
||||
// util
|
||||
#include <utils/JsonUtils.h>
|
||||
#include <utils/QStringUtils.h>
|
||||
|
||||
#include <db/SettingsTable.h>
|
||||
#include "HyperionConfig.h"
|
||||
|
||||
@@ -14,6 +16,7 @@
|
||||
#include <utils/JsonUtils.h>
|
||||
|
||||
#include <utils/version.hpp>
|
||||
|
||||
using namespace semver;
|
||||
|
||||
// Constants
|
||||
@@ -25,23 +28,23 @@ QJsonObject SettingsManager::schemaJson;
|
||||
|
||||
SettingsManager::SettingsManager(quint8 instance, QObject* parent, bool readonlyMode)
|
||||
: QObject(parent)
|
||||
, _log(Logger::getInstance("SETTINGSMGR"))
|
||||
, _instance(instance)
|
||||
, _sTable(new SettingsTable(instance, this))
|
||||
, _configVersion(DEFAULT_VERSION)
|
||||
, _previousVersion(DEFAULT_VERSION)
|
||||
, _readonlyMode(readonlyMode)
|
||||
, _log(Logger::getInstance("SETTINGSMGR"))
|
||||
, _instance(instance)
|
||||
, _sTable(new SettingsTable(instance, this))
|
||||
, _configVersion(DEFAULT_VERSION)
|
||||
, _previousVersion(DEFAULT_VERSION)
|
||||
, _readonlyMode(readonlyMode)
|
||||
{
|
||||
_sTable->setReadonlyMode(_readonlyMode);
|
||||
// get schema
|
||||
if(schemaJson.isEmpty())
|
||||
if (schemaJson.isEmpty())
|
||||
{
|
||||
Q_INIT_RESOURCE(resource);
|
||||
try
|
||||
{
|
||||
schemaJson = QJsonFactory::readSchema(":/hyperion-schema");
|
||||
}
|
||||
catch(const std::runtime_error& error)
|
||||
catch (const std::runtime_error& error)
|
||||
{
|
||||
throw std::runtime_error(error.what());
|
||||
}
|
||||
@@ -49,7 +52,7 @@ SettingsManager::SettingsManager(quint8 instance, QObject* parent, bool readonly
|
||||
|
||||
// get default config
|
||||
QJsonObject defaultConfig;
|
||||
if(!JsonUtils::readFile(":/hyperion_default.config", defaultConfig, _log))
|
||||
if (!JsonUtils::readFile(":/hyperion_default.config", defaultConfig, _log))
|
||||
{
|
||||
throw std::runtime_error("Failed to read default config");
|
||||
}
|
||||
@@ -57,45 +60,51 @@ SettingsManager::SettingsManager(quint8 instance, QObject* parent, bool readonly
|
||||
// transform json to string lists
|
||||
QStringList keyList = defaultConfig.keys();
|
||||
QStringList defValueList;
|
||||
for(const auto & key : keyList)
|
||||
for (const auto& key : qAsConst(keyList))
|
||||
{
|
||||
if(defaultConfig[key].isObject())
|
||||
if (defaultConfig[key].isObject())
|
||||
{
|
||||
defValueList << QString(QJsonDocument(defaultConfig[key].toObject()).toJson(QJsonDocument::Compact));
|
||||
}
|
||||
else if(defaultConfig[key].isArray())
|
||||
else if (defaultConfig[key].isArray())
|
||||
{
|
||||
defValueList << QString(QJsonDocument(defaultConfig[key].toArray()).toJson(QJsonDocument::Compact));
|
||||
}
|
||||
}
|
||||
|
||||
// fill database with default data if required
|
||||
for(const auto & key : keyList)
|
||||
for (const auto& key : qAsConst(keyList))
|
||||
{
|
||||
QString val = defValueList.takeFirst();
|
||||
// prevent overwrite
|
||||
if(!_sTable->recordExist(key))
|
||||
_sTable->createSettingsRecord(key,val);
|
||||
if (!_sTable->recordExist(key))
|
||||
{
|
||||
_sTable->createSettingsRecord(key, val);
|
||||
}
|
||||
}
|
||||
|
||||
// need to validate all data in database construct the entire data object
|
||||
// TODO refactor schemaChecker to accept QJsonArray in validate(); QJsonDocument container? To validate them per entry...
|
||||
QJsonObject dbConfig;
|
||||
for(const auto & key : keyList)
|
||||
for (const auto& key : qAsConst(keyList))
|
||||
{
|
||||
QJsonDocument doc = _sTable->getSettingsRecord(key);
|
||||
if(doc.isArray())
|
||||
if (doc.isArray())
|
||||
{
|
||||
dbConfig[key] = doc.array();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbConfig[key] = doc.object();
|
||||
}
|
||||
}
|
||||
|
||||
//Check, if database requires migration
|
||||
bool isNewRelease = false;
|
||||
// Use instance independent SettingsManager to track migration status
|
||||
if ( instance == GLOABL_INSTANCE_ID)
|
||||
if (_instance == GLOABL_INSTANCE_ID)
|
||||
{
|
||||
if ( resolveConfigVersion(dbConfig) )
|
||||
if (resolveConfigVersion(dbConfig))
|
||||
{
|
||||
QJsonObject newGeneralConfig = dbConfig["general"].toObject();
|
||||
|
||||
@@ -107,16 +116,16 @@ SettingsManager::SettingsManager(quint8 instance, QObject* parent, bool readonly
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ( _configVersion > BUILD_VERSION )
|
||||
if (_configVersion > BUILD_VERSION)
|
||||
{
|
||||
Error(_log, "Database version [%s] is greater than current Hyperion version [%s]", _configVersion.getVersion().c_str(), BUILD_VERSION.getVersion().c_str());
|
||||
// TODO: Remove version checking and Settingsmanager from components' constructor to be able to stop hyperion.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( _previousVersion < BUILD_VERSION )
|
||||
if (_previousVersion < BUILD_VERSION)
|
||||
{
|
||||
if ( _configVersion == BUILD_VERSION )
|
||||
if (_configVersion == BUILD_VERSION)
|
||||
{
|
||||
newGeneralConfig["previousVersion"] = BUILD_VERSION.getVersion().c_str();
|
||||
dbConfig["general"] = newGeneralConfig;
|
||||
@@ -139,7 +148,7 @@ SettingsManager::SettingsManager(quint8 instance, QObject* parent, bool readonly
|
||||
|
||||
// possible data upgrade steps to prevent data loss
|
||||
bool migrated = handleConfigUpgrade(dbConfig);
|
||||
if ( isNewRelease || migrated )
|
||||
if (isNewRelease || migrated)
|
||||
{
|
||||
saveSettings(dbConfig, true);
|
||||
}
|
||||
@@ -147,28 +156,34 @@ SettingsManager::SettingsManager(quint8 instance, QObject* parent, bool readonly
|
||||
// validate full dbconfig against schema, on error we need to rewrite entire table
|
||||
QJsonSchemaChecker schemaChecker;
|
||||
schemaChecker.setSchema(schemaJson);
|
||||
QPair<bool,bool> valid = schemaChecker.validate(dbConfig);
|
||||
QPair<bool, bool> valid = schemaChecker.validate(dbConfig);
|
||||
// check if our main schema syntax is IO
|
||||
if (!valid.second)
|
||||
{
|
||||
for (auto & schemaError : schemaChecker.getMessages())
|
||||
for (auto& schemaError : schemaChecker.getMessages())
|
||||
{
|
||||
Error(_log, "Schema Syntax Error: %s", QSTRING_CSTR(schemaError));
|
||||
}
|
||||
throw std::runtime_error("The config schema has invalid syntax. This should never happen! Go fix it!");
|
||||
}
|
||||
if (!valid.first)
|
||||
{
|
||||
Info(_log,"Table upgrade required...");
|
||||
Info(_log, "Table upgrade required...");
|
||||
dbConfig = schemaChecker.getAutoCorrectedConfig(dbConfig);
|
||||
|
||||
for (auto & schemaError : schemaChecker.getMessages())
|
||||
for (auto& schemaError : schemaChecker.getMessages())
|
||||
{
|
||||
Warning(_log, "Config Fix: %s", QSTRING_CSTR(schemaError));
|
||||
}
|
||||
|
||||
saveSettings(dbConfig,true);
|
||||
saveSettings(dbConfig, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_qconfig = dbConfig;
|
||||
}
|
||||
|
||||
Debug(_log,"Settings database initialized");
|
||||
Debug(_log, "Settings database initialized");
|
||||
}
|
||||
|
||||
QJsonDocument SettingsManager::getSetting(settings::type type) const
|
||||
@@ -179,11 +194,11 @@ QJsonDocument SettingsManager::getSetting(settings::type type) const
|
||||
QJsonObject SettingsManager::getSettings() const
|
||||
{
|
||||
QJsonObject config;
|
||||
for(const auto & key : _qconfig.keys())
|
||||
for (const auto& key : _qconfig.keys())
|
||||
{
|
||||
//Read all records from database to ensure that global settings are read across instances
|
||||
QJsonDocument doc = _sTable->getSettingsRecord(key);
|
||||
if(doc.isArray())
|
||||
if (doc.isArray())
|
||||
{
|
||||
config.insert(key, doc.array());
|
||||
}
|
||||
@@ -195,26 +210,32 @@ QJsonObject SettingsManager::getSettings() const
|
||||
return config;
|
||||
}
|
||||
|
||||
bool SettingsManager::saveSettings(QJsonObject config, bool correct)
|
||||
bool SettingsManager::restoreSettings(QJsonObject config, bool correct)
|
||||
{
|
||||
// optional data upgrades e.g. imported legacy/older configs
|
||||
// handleConfigUpgrade(config);
|
||||
handleConfigUpgrade(config);
|
||||
return saveSettings(config, correct);
|
||||
}
|
||||
|
||||
bool SettingsManager::saveSettings(QJsonObject config, bool correct)
|
||||
{
|
||||
// we need to validate data against schema
|
||||
QJsonSchemaChecker schemaChecker;
|
||||
schemaChecker.setSchema(schemaJson);
|
||||
if (!schemaChecker.validate(config).first)
|
||||
{
|
||||
if(!correct)
|
||||
if (!correct)
|
||||
{
|
||||
Error(_log,"Failed to save configuration, errors during validation");
|
||||
Error(_log, "Failed to save configuration, errors during validation");
|
||||
return false;
|
||||
}
|
||||
Warning(_log,"Fixing json data!");
|
||||
Warning(_log, "Fixing json data!");
|
||||
config = schemaChecker.getAutoCorrectedConfig(config);
|
||||
|
||||
for (const auto & schemaError : schemaChecker.getMessages())
|
||||
for (const auto& schemaError : schemaChecker.getMessages())
|
||||
{
|
||||
Warning(_log, "Config Fix: %s", QSTRING_CSTR(schemaError));
|
||||
}
|
||||
}
|
||||
|
||||
// store the new config
|
||||
@@ -223,26 +244,26 @@ bool SettingsManager::saveSettings(QJsonObject config, bool correct)
|
||||
// extract keys and data
|
||||
QStringList keyList = config.keys();
|
||||
QStringList newValueList;
|
||||
for(const auto & key : keyList)
|
||||
for (const auto& key : qAsConst(keyList))
|
||||
{
|
||||
if(config[key].isObject())
|
||||
if (config[key].isObject())
|
||||
{
|
||||
newValueList << QString(QJsonDocument(config[key].toObject()).toJson(QJsonDocument::Compact));
|
||||
}
|
||||
else if(config[key].isArray())
|
||||
else if (config[key].isArray())
|
||||
{
|
||||
newValueList << QString(QJsonDocument(config[key].toArray()).toJson(QJsonDocument::Compact));
|
||||
}
|
||||
}
|
||||
|
||||
int rc = true;
|
||||
bool rc = true;
|
||||
// compare database data with new data to emit/save changes accordingly
|
||||
for(const auto & key : keyList)
|
||||
for (const auto& key : qAsConst(keyList))
|
||||
{
|
||||
QString data = newValueList.takeFirst();
|
||||
if(_sTable->getSettingsRecordString(key) != data)
|
||||
if (_sTable->getSettingsRecordString(key) != data)
|
||||
{
|
||||
if ( ! _sTable->createSettingsRecord(key, data) )
|
||||
if (!_sTable->createSettingsRecord(key, data))
|
||||
{
|
||||
rc = false;
|
||||
}
|
||||
@@ -255,7 +276,7 @@ bool SettingsManager::saveSettings(QJsonObject config, bool correct)
|
||||
return rc;
|
||||
}
|
||||
|
||||
inline QString fixVersion (const QString& version)
|
||||
inline QString fixVersion(const QString& version)
|
||||
{
|
||||
QString newVersion;
|
||||
//Try fixing version number, remove dot separated pre-release identifiers not supported
|
||||
@@ -279,12 +300,12 @@ bool SettingsManager::resolveConfigVersion(QJsonObject& config)
|
||||
QString configVersion = generalConfig["configVersion"].toString();
|
||||
QString previousVersion = generalConfig["previousVersion"].toString();
|
||||
|
||||
if ( !configVersion.isEmpty() )
|
||||
if (!configVersion.isEmpty())
|
||||
{
|
||||
isValid = _configVersion.setVersion(configVersion.toStdString());
|
||||
if (!isValid)
|
||||
{
|
||||
isValid = _configVersion.setVersion( fixVersion(configVersion).toStdString() );
|
||||
isValid = _configVersion.setVersion(fixVersion(configVersion).toStdString());
|
||||
if (isValid)
|
||||
{
|
||||
Info(_log, "Invalid config version [%s] fixed. Updated to [%s]", QSTRING_CSTR(configVersion), _configVersion.getVersion().c_str());
|
||||
@@ -293,16 +314,15 @@ bool SettingsManager::resolveConfigVersion(QJsonObject& config)
|
||||
}
|
||||
else
|
||||
{
|
||||
_configVersion.setVersion(DEFAULT_VERSION);
|
||||
isValid = true;
|
||||
}
|
||||
|
||||
if ( !previousVersion.isEmpty() && isValid )
|
||||
if (!previousVersion.isEmpty() && isValid)
|
||||
{
|
||||
isValid = _previousVersion.setVersion(previousVersion.toStdString());
|
||||
if (!isValid)
|
||||
{
|
||||
isValid = _previousVersion.setVersion( fixVersion(previousVersion).toStdString() );
|
||||
isValid = _previousVersion.setVersion(fixVersion(previousVersion).toStdString());
|
||||
if (isValid)
|
||||
{
|
||||
Info(_log, "Invalid previous version [%s] fixed. Updated to [%s]", QSTRING_CSTR(previousVersion), _previousVersion.getVersion().c_str());
|
||||
@@ -323,7 +343,7 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
|
||||
bool migrated = false;
|
||||
|
||||
//Only migrate, if valid versions are available
|
||||
if ( !resolveConfigVersion(config) )
|
||||
if (!resolveConfigVersion(config))
|
||||
{
|
||||
Warning(_log, "Invalid version information found in configuration. No database migration executed.");
|
||||
}
|
||||
@@ -333,26 +353,26 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
|
||||
if (_previousVersion < _configVersion)
|
||||
{
|
||||
//Migration steps for versions <= alpha 9
|
||||
semver::version targetVersion {"2.0.0-alpha.9"};
|
||||
if (_previousVersion <= targetVersion )
|
||||
semver::version targetVersion{ "2.0.0-alpha.9" };
|
||||
if (_previousVersion <= targetVersion)
|
||||
{
|
||||
Info(_log, "Instance [%u]: Migrate LED Layout from current version [%s] to version [%s] or later", _instance, _previousVersion.getVersion().c_str(), targetVersion.getVersion().c_str());
|
||||
Info(_log, "Instance [%u]: Migrate from version [%s] to version [%s] or later", _instance, _previousVersion.getVersion().c_str(), targetVersion.getVersion().c_str());
|
||||
|
||||
// LED LAYOUT UPGRADE
|
||||
// from { hscan: { minimum: 0.2, maximum: 0.3 }, vscan: { minimum: 0.2, maximum: 0.3 } }
|
||||
// from { h: { min: 0.2, max: 0.3 }, v: { min: 0.2, max: 0.3 } }
|
||||
// to { hmin: 0.2, hmax: 0.3, vmin: 0.2, vmax: 0.3}
|
||||
if(config.contains("leds"))
|
||||
if (config.contains("leds"))
|
||||
{
|
||||
const QJsonArray ledarr = config["leds"].toArray();
|
||||
const QJsonObject led = ledarr[0].toObject();
|
||||
|
||||
if(led.contains("hscan") || led.contains("h"))
|
||||
if (led.contains("hscan") || led.contains("h"))
|
||||
{
|
||||
const bool whscan = led.contains("hscan");
|
||||
QJsonArray newLedarr;
|
||||
|
||||
for(const auto & entry : ledarr)
|
||||
for (const auto& entry : ledarr)
|
||||
{
|
||||
const QJsonObject led = entry.toObject();
|
||||
QJsonObject hscan;
|
||||
@@ -363,7 +383,7 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
|
||||
QJsonValue vmax;
|
||||
QJsonObject nL;
|
||||
|
||||
if(whscan)
|
||||
if (whscan)
|
||||
{
|
||||
hscan = led["hscan"].toObject();
|
||||
vscan = led["vscan"].toObject();
|
||||
@@ -391,27 +411,27 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
|
||||
// replace
|
||||
config["leds"] = newLedarr;
|
||||
migrated = true;
|
||||
Info(_log,"Instance [%u]: LED Layout migrated", _instance);
|
||||
Info(_log, "Instance [%u]: LED Layout migrated", _instance);
|
||||
}
|
||||
}
|
||||
|
||||
if(config.contains("ledConfig"))
|
||||
if (config.contains("ledConfig"))
|
||||
{
|
||||
QJsonObject oldLedConfig = config["ledConfig"].toObject();
|
||||
if ( !oldLedConfig.contains("classic"))
|
||||
if (!oldLedConfig.contains("classic"))
|
||||
{
|
||||
QJsonObject newLedConfig;
|
||||
newLedConfig.insert("classic", oldLedConfig );
|
||||
QJsonObject defaultMatrixConfig {{"ledshoriz", 1}
|
||||
newLedConfig.insert("classic", oldLedConfig);
|
||||
QJsonObject defaultMatrixConfig{ {"ledshoriz", 1}
|
||||
,{"ledsvert", 1}
|
||||
,{"cabling","snake"}
|
||||
,{"start","top-left"}
|
||||
};
|
||||
newLedConfig.insert("matrix", defaultMatrixConfig );
|
||||
newLedConfig.insert("matrix", defaultMatrixConfig);
|
||||
|
||||
config["ledConfig"] = newLedConfig;
|
||||
migrated = true;
|
||||
Info(_log,"Instance [%u]: LED-Config migrated", _instance);
|
||||
Info(_log, "Instance [%u]: LED-Config migrated", _instance);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +449,7 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
|
||||
const QJsonArray ledarr = config["leds"].toArray();
|
||||
int layoutLedCount = ledarr.size();
|
||||
|
||||
if (hwLedcount < layoutLedCount )
|
||||
if (hwLedcount < layoutLedCount)
|
||||
{
|
||||
Warning(_log, "Instance [%u]: HwLedCount/Layout mismatch! Setting Hardware LED count to number of LEDs configured via layout", _instance);
|
||||
hwLedcount = layoutLedCount;
|
||||
@@ -442,7 +462,7 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
|
||||
if (newDeviceConfig.contains("type"))
|
||||
{
|
||||
QString type = newDeviceConfig["type"].toString();
|
||||
if (type == "atmoorb" || type == "fadecandy" || type == "philipshue" )
|
||||
if (type == "atmoorb" || type == "fadecandy" || type == "philipshue")
|
||||
{
|
||||
if (newDeviceConfig.contains("output"))
|
||||
{
|
||||
@@ -520,8 +540,150 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
|
||||
Debug(_log, "Framegrabber records migrated");
|
||||
}
|
||||
}
|
||||
|
||||
//Migration steps for versions <= 2.0.12
|
||||
_previousVersion = targetVersion;
|
||||
targetVersion.setVersion("2.0.12");
|
||||
if (_previousVersion <= targetVersion)
|
||||
{
|
||||
Info(_log, "Instance [%u]: Migrate from version [%s] to version [%s] or later", _instance, _previousVersion.getVersion().c_str(), targetVersion.getVersion().c_str());
|
||||
|
||||
// Have Hostname/IP-address separate from port for LED-Devices
|
||||
if (config.contains("device"))
|
||||
{
|
||||
QJsonObject newDeviceConfig = config["device"].toObject();
|
||||
|
||||
if (newDeviceConfig.contains("host"))
|
||||
{
|
||||
QString oldHost = newDeviceConfig["host"].toString();
|
||||
|
||||
// Resolve hostname and port
|
||||
QStringList addressparts = QStringUtils::split(oldHost, ":", QStringUtils::SplitBehavior::SkipEmptyParts);
|
||||
|
||||
newDeviceConfig["host"] = addressparts[0];
|
||||
|
||||
if (addressparts.size() > 1)
|
||||
{
|
||||
if (!newDeviceConfig.contains("port"))
|
||||
{
|
||||
newDeviceConfig["port"] = addressparts[1].toInt();
|
||||
}
|
||||
migrated = true;
|
||||
}
|
||||
|
||||
if (migrated)
|
||||
{
|
||||
config["device"] = newDeviceConfig;
|
||||
Debug(_log, "LED-Device records migrated");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Have Hostname/IP-address separate from port for Forwarder
|
||||
if (config.contains("forwarder"))
|
||||
{
|
||||
QJsonObject newForwarderConfig = config["forwarder"].toObject();
|
||||
|
||||
QJsonArray json;
|
||||
if (newForwarderConfig.contains("json"))
|
||||
{
|
||||
QJsonArray oldJson = newForwarderConfig["json"].toArray();
|
||||
QJsonObject newJsonConfig;
|
||||
|
||||
for (const QJsonValue& value : qAsConst(oldJson))
|
||||
{
|
||||
if (value.isString())
|
||||
{
|
||||
QString oldHost = value.toString();
|
||||
// Resolve hostname and port
|
||||
QStringList addressparts = QStringUtils::split(oldHost, ":", QStringUtils::SplitBehavior::SkipEmptyParts);
|
||||
QString host = addressparts[0];
|
||||
|
||||
if (host != "127.0.0.1")
|
||||
{
|
||||
newJsonConfig["host"] = host;
|
||||
|
||||
if (addressparts.size() > 1)
|
||||
{
|
||||
newJsonConfig["port"] = addressparts[1].toInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
newJsonConfig["port"] = 19444;
|
||||
}
|
||||
json.append(newJsonConfig);
|
||||
migrated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!json.isEmpty())
|
||||
{
|
||||
newForwarderConfig["json"] = json;
|
||||
}
|
||||
else
|
||||
{
|
||||
newForwarderConfig.remove("json");
|
||||
}
|
||||
}
|
||||
|
||||
QJsonArray flatbuffer;
|
||||
if (newForwarderConfig.contains("flat"))
|
||||
{
|
||||
QJsonArray oldFlatbuffer = newForwarderConfig["flat"].toArray();
|
||||
QJsonObject newFlattbufferConfig;
|
||||
|
||||
for (const QJsonValue& value : qAsConst(oldFlatbuffer))
|
||||
{
|
||||
if (value.isString())
|
||||
{
|
||||
QString oldHost = value.toString();
|
||||
// Resolve hostname and port
|
||||
QStringList addressparts = QStringUtils::split(oldHost, ":", QStringUtils::SplitBehavior::SkipEmptyParts);
|
||||
QString host = addressparts[0];
|
||||
|
||||
if (host != "127.0.0.1")
|
||||
{
|
||||
newFlattbufferConfig["host"] = host;
|
||||
|
||||
if (addressparts.size() > 1)
|
||||
{
|
||||
newFlattbufferConfig["port"] = addressparts[1].toInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
newFlattbufferConfig["port"] = 19400;
|
||||
}
|
||||
|
||||
flatbuffer.append(newFlattbufferConfig);
|
||||
migrated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flatbuffer.isEmpty())
|
||||
{
|
||||
newForwarderConfig["flat"] = flatbuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
newForwarderConfig.remove("flat");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (json.isEmpty() && flatbuffer.isEmpty())
|
||||
{
|
||||
newForwarderConfig["enable"] = false;
|
||||
}
|
||||
|
||||
if (migrated)
|
||||
{
|
||||
config["forwarder"] = newForwarderConfig;
|
||||
Debug(_log, "Forwarder records migrated");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return migrated;
|
||||
}
|
||||
|
@@ -2,40 +2,76 @@
|
||||
"type" : "object",
|
||||
"title" : "edt_conf_fw_heading_title",
|
||||
"required" : true,
|
||||
"properties" :
|
||||
{
|
||||
"enable" :
|
||||
{
|
||||
"type" : "boolean",
|
||||
"title" : "edt_conf_general_enable_title",
|
||||
"required" : true,
|
||||
"default" : false,
|
||||
"propertyOrder" : 1
|
||||
"properties": {
|
||||
"enable": {
|
||||
"type": "boolean",
|
||||
"title": "edt_conf_general_enable_title",
|
||||
"required": true,
|
||||
"default": false,
|
||||
"propertyOrder": 1
|
||||
},
|
||||
"json" :
|
||||
{
|
||||
"type" : "array",
|
||||
"title" : "edt_conf_fw_json_title",
|
||||
"required" : true,
|
||||
"default" : ["127.0.0.1:19446"],
|
||||
"items" : {
|
||||
"type": "string",
|
||||
"title" : "edt_conf_fw_json_itemtitle"
|
||||
},
|
||||
"propertyOrder" : 2
|
||||
"json": {
|
||||
"type": "array",
|
||||
"title": "edt_conf_fw_json_title",
|
||||
"propertyOrder": 2,
|
||||
"uniqueItems": true,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"title": "edt_conf_fw_json_itemtitle",
|
||||
"required": true,
|
||||
"properties": {
|
||||
"host": {
|
||||
"type": "string",
|
||||
"format": "hostname_or_ip",
|
||||
"minLength": 7,
|
||||
"title": "edt_dev_spec_targetIpHost_title",
|
||||
"required": true,
|
||||
"propertyOrder": 1
|
||||
},
|
||||
"port": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 65535,
|
||||
"default": 19444,
|
||||
"title": "edt_dev_spec_port_title",
|
||||
"required": true,
|
||||
"access": "expert",
|
||||
"propertyOrder": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"flat" :
|
||||
{
|
||||
"type" : "array",
|
||||
"title" : "edt_conf_fw_flat_title",
|
||||
"required" : true,
|
||||
"default" : ["127.0.0.1:19401"],
|
||||
"items" : {
|
||||
"type": "string",
|
||||
"title" : "edt_conf_fw_flat_itemtitle"
|
||||
},
|
||||
"propertyOrder" : 3
|
||||
"flat": {
|
||||
"type": "array",
|
||||
"title": "edt_conf_fw_flat_title",
|
||||
"propertyOrder": 3,
|
||||
"uniqueItems": true,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"title": "edt_conf_fw_flat_itemtitle",
|
||||
"required": true,
|
||||
"properties": {
|
||||
"host": {
|
||||
"type": "string",
|
||||
"format": "hostname_or_ip",
|
||||
"minLength": 7,
|
||||
"title": "edt_dev_spec_targetIpHost_title",
|
||||
"required": true,
|
||||
"propertyOrder": 1
|
||||
},
|
||||
"port": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 65535,
|
||||
"default": 19400,
|
||||
"title": "edt_dev_spec_port_title",
|
||||
"required": true,
|
||||
"access": "expert",
|
||||
"propertyOrder": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
}
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@
|
||||
"hidden": true
|
||||
},
|
||||
"required": true,
|
||||
"default": "",
|
||||
"comment": "The 'available_devices' settings are dynamically inserted into the WebUI under PropertyOrder '2'.",
|
||||
"propertyOrder": 3
|
||||
},
|
||||
|
Reference in New Issue
Block a user