CHanges 26.12.2019 Correction and PowerOff add

This commit is contained in:
SputnikElf
2019-12-26 16:34:40 +01:00
parent ccd01c1ce2
commit aef4e3a571
14 changed files with 353 additions and 255 deletions

View File

@@ -0,0 +1,20 @@
{
"type":"object",
"required":true,
"properties":{
"command": {
"type" : "string",
"required" : true,
"enum" : ["platform"]
},
"subcommand" : {
"type" : "string",
"required" : true,
"enum" : ["poweroff"]
},
"tan" : {
"type" : "integer"
}
},
"additionalProperties": false
}

View File

@@ -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", "authorize", "instance", "transform", "correction" , "temperature"]
"enum" : ["color", "image", "effect", "create-effect", "delete-effect", "serverinfo", "clear", "clearall", "adjustment", "sourceselect", "config", "componentstate", "ledcolors", "logging", "processing", "sysinfo", "videomode", "authorize", "instance", "transform", "correction" , "temperature", "platform"]
}
}
}

View File

@@ -18,8 +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>
<file alias="schema-authorize">JSONRPC_schema/schema-authorize.json</file>
<file alias="schema-instance">JSONRPC_schema/schema-instance.json</file>
<file alias="schema-authorize">JSONRPC_schema/schema-authorize.json</file>
<file alias="schema-instance">JSONRPC_schema/schema-instance.json</file>
<file alias="schema-platform">JSONRPC_schema/schema-platform.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>

View File

@@ -4,6 +4,7 @@
// stl includes
#include <iostream>
#include <iterator>
#include <cstdio>
// Qt includes
#include <QResource>
@@ -189,6 +190,7 @@ void JsonAPI::handleMessage(const QString& messageString, const QString& httpAut
else if (command == "processing") handleProcessingCommand (message, command, tan);
else if (command == "videomode") handleVideoModeCommand (message, command, tan);
else if (command == "instance") handleInstanceCommand (message, command, tan);
else if (command == "platform") handlePlatformCommand (message, command, tan);
// BEGIN | The following commands are derecated but used to ensure backward compatibility with hyperion Classic remote control
else if (command == "clearall")
@@ -1486,6 +1488,16 @@ void JsonAPI::handleInstanceCommand(const QJsonObject & message, const QString &
}
}
void JsonAPI::handlePlatformCommand(const QJsonObject & message, const QString &command, const int tan)
{
const QString & subc = message["subcommand"].toString();
//const quint8 & inst = message["instance"].toInt();
//const QString & name = message["name"].toString();
sendSuccessReply(command+"-"+subc, tan);
int result = system("poweroff");
}
void JsonAPI::handleNotImplemented()
{
sendErrorReply("Command not implemented");
@@ -1519,7 +1531,7 @@ void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &comm
void JsonAPI::sendErrorReply(const QString &error, const QString &command, const int tan)
{
// create reply
// create reply
QJsonObject reply;
reply["success"] = false;
reply["error"] = error;