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:
Paulchen-Panther
2016-08-04 13:10:53 +02:00
committed by brindosch
parent f183032270
commit bfb06966de
12 changed files with 179 additions and 2 deletions

View File

@@ -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");