mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Backwards compatibility ensured
This commit is contained in:
15
libsrc/api/JSONRPC_schema/schema-clearall.json
Normal file
15
libsrc/api/JSONRPC_schema/schema-clearall.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"type":"object",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"command": {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["clearall"]
|
||||
},
|
||||
"tan" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@@ -24,7 +24,7 @@
|
||||
"type": "string",
|
||||
"minLength" : 4,
|
||||
"maxLength" : 20,
|
||||
"required": true
|
||||
"required": false
|
||||
},
|
||||
"color": {
|
||||
"type": "array",
|
||||
|
@@ -24,7 +24,7 @@
|
||||
"type": "string",
|
||||
"minLength" : 4,
|
||||
"maxLength" : 20,
|
||||
"required": true
|
||||
"required": false
|
||||
},
|
||||
"effect": {
|
||||
"type": "object",
|
||||
|
12
libsrc/api/JSONRPC_schema/schema-hyperion-classic.json
Normal file
12
libsrc/api/JSONRPC_schema/schema-hyperion-classic.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"type":"object",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"command": {
|
||||
"title" : "This schema is used to ensure backward compatibility with hyperion classic",
|
||||
"type" : "string",
|
||||
"required" : false
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
"command": {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo", "videomode"]
|
||||
"enum" : ["color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo", "videomode", "transform", "correction" , "temperature"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@
|
||||
<file alias="schema-serverinfo">JSONRPC_schema/schema-serverinfo.json</file>
|
||||
<file alias="schema-sysinfo">JSONRPC_schema/schema-sysinfo.json</file>
|
||||
<file alias="schema-clear">JSONRPC_schema/schema-clear.json</file>
|
||||
<file alias="schema-clearall">JSONRPC_schema/schema-clearall.json</file>
|
||||
<file alias="schema-adjustment">JSONRPC_schema/schema-adjustment.json</file>
|
||||
<file alias="schema-effect">JSONRPC_schema/schema-effect.json</file>
|
||||
<file alias="schema-create-effect">JSONRPC_schema/schema-create-effect.json</file>
|
||||
@@ -17,5 +18,9 @@
|
||||
<file alias="schema-logging">JSONRPC_schema/schema-logging.json</file>
|
||||
<file alias="schema-processing">JSONRPC_schema/schema-processing.json</file>
|
||||
<file alias="schema-videomode">JSONRPC_schema/schema-videomode.json</file>
|
||||
<!-- The following schemas are derecated but used to ensure backward compatibility with hyperion Classic remote control-->
|
||||
<file alias="schema-transform">JSONRPC_schema/schema-hyperion-classic.json</file>
|
||||
<file alias="schema-correction">JSONRPC_schema/schema-hyperion-classic.json</file>
|
||||
<file alias="schema-temperature">JSONRPC_schema/schema-hyperion-classic.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <QBuffer>
|
||||
#include <QByteArray>
|
||||
#include <QDateTime>
|
||||
#include <QHostInfo>
|
||||
|
||||
// hyperion includes
|
||||
#include <utils/jsonschema/QJsonFactory.h>
|
||||
@@ -104,6 +105,14 @@ void JsonAPI::handleMessage(const QString& messageString)
|
||||
else if (command == "logging") handleLoggingCommand (message, command, tan);
|
||||
else if (command == "processing") handleProcessingCommand (message, command, tan);
|
||||
else if (command == "videomode") handleVideoModeCommand (message, command, tan);
|
||||
|
||||
// BEGIN | The following commands are derecated but used to ensure backward compatibility with hyperion Classic remote control
|
||||
else if (command == "clearall") handleClearallCommand(message, command, tan);
|
||||
else if (command == "transform" || command == "correction" || command == "temperature")
|
||||
sendErrorReply("The command " + command + "is deprecated, please use the Hyperion Web Interface to configure");
|
||||
// END
|
||||
|
||||
// handle not implemented commands
|
||||
else handleNotImplemented ();
|
||||
}
|
||||
|
||||
@@ -114,7 +123,7 @@ void JsonAPI::handleColorCommand(const QJsonObject& message, const QString& comm
|
||||
// extract parameters
|
||||
int priority = message["priority"].toInt();
|
||||
int duration = message["duration"].toInt(-1);
|
||||
QString origin = message["origin"].toString() + "@"+_peerAddress;
|
||||
QString origin = message["origin"].toString("Empty") + "@"+_peerAddress;
|
||||
|
||||
std::vector<ColorRgb> colorData(_hyperion->getLedCount());
|
||||
const QJsonArray & jsonColor = message["color"].toArray();
|
||||
@@ -185,7 +194,7 @@ void JsonAPI::handleEffectCommand(const QJsonObject &message, const QString &com
|
||||
int priority = message["priority"].toInt();
|
||||
int duration = message["duration"].toInt(-1);
|
||||
QString pythonScript = message["pythonScript"].toString();
|
||||
QString origin = message["origin"].toString() + "@"+_peerAddress;
|
||||
QString origin = message["origin"].toString("Empty") + "@"+_peerAddress;
|
||||
const QJsonObject & effect = message["effect"].toObject();
|
||||
const QString & effectName = effect["name"].toString();
|
||||
const QString & data = message["imageData"].toString("").toUtf8();
|
||||
@@ -463,6 +472,46 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject& message, const QString&
|
||||
}
|
||||
info["sessions"] = sessions;
|
||||
|
||||
// BEGIN | The following entries are derecated but used to ensure backward compatibility with hyperion Classic remote control
|
||||
// TODO Output the real transformation information instead of default
|
||||
|
||||
// host name
|
||||
info["hostname"] = QHostInfo::localHostName();
|
||||
|
||||
// transform information (default values)
|
||||
QJsonArray transformArray;
|
||||
for (const QString& transformId : _hyperion->getAdjustmentIds())
|
||||
{
|
||||
QJsonObject transform;
|
||||
QJsonArray blacklevel, whitelevel, gamma, threshold;
|
||||
|
||||
transform["id"] = transformId;
|
||||
transform["saturationGain"] = 1.0;
|
||||
transform["valueGain"] = 1.0;
|
||||
transform["saturationLGain"] = 1.0;
|
||||
transform["luminanceGain"] = 1.0;
|
||||
transform["luminanceMinimum"] = 0.0;
|
||||
|
||||
for (int i = 0; i < 3; i++ )
|
||||
{
|
||||
blacklevel.append(0.0);
|
||||
whitelevel.append(1.0);
|
||||
gamma.append(2.50);
|
||||
threshold.append(0.0);
|
||||
}
|
||||
|
||||
transform.insert("blacklevel", blacklevel);
|
||||
transform.insert("whitelevel", whitelevel);
|
||||
transform.insert("gamma", gamma);
|
||||
transform.insert("threshold", threshold);
|
||||
|
||||
transformArray.append(transform);
|
||||
}
|
||||
|
||||
info["transform"] = transformArray;
|
||||
|
||||
// END
|
||||
|
||||
sendSuccessDataReply(QJsonDocument(info), command, tan);
|
||||
|
||||
// AFTER we send the info, the client might want to subscribe to future updates
|
||||
@@ -845,6 +894,16 @@ void JsonAPI::handleVideoModeCommand(const QJsonObject& message, const QString &
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleClearallCommand(const QJsonObject& message, const QString& command, const int tan)
|
||||
{
|
||||
emit forwardJsonMessage(message);
|
||||
|
||||
// clear priority
|
||||
_hyperion->clearall();
|
||||
|
||||
// send reply
|
||||
sendSuccessReply(command, tan);
|
||||
}
|
||||
|
||||
void JsonAPI::handleNotImplemented()
|
||||
{
|
||||
|
Reference in New Issue
Block a user