mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Update Json Interface (Enable/Disable components during runtime) (#150)
* Update Hyperion.h * Add files via upload * Update CMakeLists.txt * Update Hyperion.cpp * Update JsonClientConnection.cpp * Update JsonClientConnection.h * Update JsonSchemas.qrc * Add files via upload * Update schema.json * Update JsonConnection.cpp * Update JsonConnection.h * Update hyperion-remote.cpp
This commit is contained in:
committed by
brindosch
parent
f183032270
commit
bfb06966de
@@ -260,6 +260,8 @@ void JsonClientConnection::handleMessage(const std::string &messageString)
|
||||
handleSourceSelectCommand(message);
|
||||
else if (command == "configget")
|
||||
handleConfigGetCommand(message);
|
||||
else if (command == "componentstate")
|
||||
handleComponentStateCommand(message);
|
||||
else
|
||||
handleNotImplemented();
|
||||
}
|
||||
@@ -815,6 +817,29 @@ void JsonClientConnection::handleConfigGetCommand(const Json::Value &)
|
||||
sendMessage(result);
|
||||
}
|
||||
|
||||
void JsonClientConnection::handleComponentStateCommand(const Json::Value& message)
|
||||
{
|
||||
const Json::Value & componentState = message["componentstate"];
|
||||
std::string component = componentState.get("component", "").asString();
|
||||
|
||||
if (component == "SMOOTHING")
|
||||
_hyperion->setComponentState((Components)0, componentState.get("state", true).asBool());
|
||||
else if (component == "BLACKBORDER")
|
||||
_hyperion->setComponentState((Components)1, componentState.get("state", true).asBool());
|
||||
else if (component == "KODICHECKER")
|
||||
_hyperion->setComponentState((Components)2, componentState.get("state", true).asBool());
|
||||
else if (component == "FORWARDER")
|
||||
_hyperion->setComponentState((Components)3, componentState.get("state", true).asBool());
|
||||
else if (component == "UDPLISTENER")
|
||||
_hyperion->setComponentState((Components)4, componentState.get("state", true).asBool());
|
||||
else if (component == "BOBLIGHTSERVER")
|
||||
_hyperion->setComponentState((Components)5, componentState.get("state", true).asBool());
|
||||
else if (component == "GRABBER")
|
||||
_hyperion->setComponentState((Components)6, componentState.get("state", true).asBool());
|
||||
|
||||
sendSuccessReply();
|
||||
}
|
||||
|
||||
void JsonClientConnection::handleNotImplemented()
|
||||
{
|
||||
sendErrorReply("Command not implemented");
|
||||
|
@@ -16,6 +16,7 @@
|
||||
// util includes
|
||||
#include <utils/jsonschema/JsonSchemaChecker.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Components.h>
|
||||
|
||||
class ImageProcessor;
|
||||
|
||||
@@ -140,6 +141,13 @@ private:
|
||||
/// @param message the incoming message
|
||||
///
|
||||
void handleConfigGetCommand(const Json::Value & message);
|
||||
|
||||
///
|
||||
/// Handle an incoming JSON Component State message
|
||||
///
|
||||
/// @param message the incoming message
|
||||
///
|
||||
void handleComponentStateCommand(const Json::Value & message);
|
||||
|
||||
///
|
||||
/// Handle an incoming JSON message of unknown type
|
||||
|
@@ -13,5 +13,6 @@
|
||||
<file alias="schema-effect">schema/schema-effect.json</file>
|
||||
<file alias="schema-sourceselect">schema/schema-sourceselect.json</file>
|
||||
<file alias="schema-configget">schema/schema-configget.json</file>
|
||||
<file alias="schema-componentstate">schema/schema-componentstate.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
33
libsrc/jsonserver/schema/schema-componentstate.json
Normal file
33
libsrc/jsonserver/schema/schema-componentstate.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"type":"object",
|
||||
"required":true,
|
||||
"properties":
|
||||
{
|
||||
"command":
|
||||
{
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["componentstate"]
|
||||
},
|
||||
"componentstate":
|
||||
{
|
||||
"type": "object",
|
||||
"required": true,
|
||||
"properties":
|
||||
{
|
||||
"component":
|
||||
{
|
||||
"enum" : ["SMOOTHING", "BLACKBORDER", "KODICHECKER", "FORWARDER", "UDPLISTENER", "BOBLIGHTSERVER", "GRABBER"],
|
||||
"required": true
|
||||
},
|
||||
"state":
|
||||
{
|
||||
"type": "bool",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
"command": {
|
||||
"type" : "string",
|
||||
"required" : true,
|
||||
"enum" : ["color", "image", "effect", "serverinfo", "clear", "clearall", "transform", "correction", "temperature", "adjustment", "sourceselect", "configget"]
|
||||
"enum" : ["color", "image", "effect", "serverinfo", "clear", "clearall", "transform", "correction", "temperature", "adjustment", "sourceselect", "configget", "componentstate"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user