mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
- in json reply the command is written again, to better identify it. (#182)
- also added a transaction number (tan). This is a user defined number to track exactly every reply
This commit is contained in:
parent
f6f7f55e92
commit
e46d392ed1
@ -42,10 +42,8 @@
|
|||||||
},
|
},
|
||||||
"colorOrder" :
|
"colorOrder" :
|
||||||
{
|
{
|
||||||
"type":
|
"type" : "string",
|
||||||
{
|
"enum" : ["rgb", "bgr", "rbg", "brg", "gbr", "grb"]
|
||||||
"enum" : ["bgr", "rbg", "brg", "gbr", "grb"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties" : true
|
"additionalProperties" : true
|
||||||
@ -888,11 +886,9 @@
|
|||||||
},
|
},
|
||||||
"colorOrder":
|
"colorOrder":
|
||||||
{
|
{
|
||||||
"type":
|
"type": "string",
|
||||||
{
|
|
||||||
"enum" : ["bgr", "rbg", "brg", "gbr", "grb"]
|
"enum" : ["bgr", "rbg", "brg", "gbr", "grb"]
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"additionalProperties" : false
|
"additionalProperties" : false
|
||||||
}
|
}
|
||||||
|
@ -246,31 +246,32 @@ void JsonClientConnection::handleMessage(const std::string &messageString)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tan = message.get("tan",0).asInt();
|
||||||
// switch over all possible commands and handle them
|
// switch over all possible commands and handle them
|
||||||
if (command == "color")
|
if (command == "color")
|
||||||
handleColorCommand(message);
|
handleColorCommand(message, command, tan);
|
||||||
else if (command == "image")
|
else if (command == "image")
|
||||||
handleImageCommand(message);
|
handleImageCommand(message, command, tan);
|
||||||
else if (command == "effect")
|
else if (command == "effect")
|
||||||
handleEffectCommand(message);
|
handleEffectCommand(message, command, tan);
|
||||||
else if (command == "serverinfo")
|
else if (command == "serverinfo")
|
||||||
handleServerInfoCommand(message);
|
handleServerInfoCommand(message, command, tan);
|
||||||
else if (command == "clear")
|
else if (command == "clear")
|
||||||
handleClearCommand(message);
|
handleClearCommand(message, command, tan);
|
||||||
else if (command == "clearall")
|
else if (command == "clearall")
|
||||||
handleClearallCommand(message);
|
handleClearallCommand(message, command, tan);
|
||||||
else if (command == "transform")
|
else if (command == "transform")
|
||||||
handleTransformCommand(message);
|
handleTransformCommand(message, command, tan);
|
||||||
else if (command == "temperature")
|
else if (command == "temperature")
|
||||||
handleTemperatureCommand(message);
|
handleTemperatureCommand(message, command, tan);
|
||||||
else if (command == "adjustment")
|
else if (command == "adjustment")
|
||||||
handleAdjustmentCommand(message);
|
handleAdjustmentCommand(message, command, tan);
|
||||||
else if (command == "sourceselect")
|
else if (command == "sourceselect")
|
||||||
handleSourceSelectCommand(message);
|
handleSourceSelectCommand(message, command, tan);
|
||||||
else if (command == "config")
|
else if (command == "config")
|
||||||
handleConfigCommand(message);
|
handleConfigCommand(message, command, tan);
|
||||||
else if (command == "componentstate")
|
else if (command == "componentstate")
|
||||||
handleComponentStateCommand(message);
|
handleComponentStateCommand(message, command, tan);
|
||||||
else
|
else
|
||||||
handleNotImplemented();
|
handleNotImplemented();
|
||||||
}
|
}
|
||||||
@ -310,7 +311,7 @@ void JsonClientConnection::forwardJsonMessage(const Json::Value & message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleColorCommand(const Json::Value &message)
|
void JsonClientConnection::handleColorCommand(const Json::Value &message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
forwardJsonMessage(message);
|
forwardJsonMessage(message);
|
||||||
|
|
||||||
@ -346,10 +347,10 @@ void JsonClientConnection::handleColorCommand(const Json::Value &message)
|
|||||||
_hyperion->setColors(priority, colorData, duration);
|
_hyperion->setColors(priority, colorData, duration);
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleImageCommand(const Json::Value &message)
|
void JsonClientConnection::handleImageCommand(const Json::Value &message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
forwardJsonMessage(message);
|
forwardJsonMessage(message);
|
||||||
|
|
||||||
@ -363,7 +364,7 @@ void JsonClientConnection::handleImageCommand(const Json::Value &message)
|
|||||||
// check consistency of the size of the received data
|
// check consistency of the size of the received data
|
||||||
if (data.size() != width*height*3)
|
if (data.size() != width*height*3)
|
||||||
{
|
{
|
||||||
sendErrorReply("Size of image data does not match with the width and height");
|
sendErrorReply("Size of image data does not match with the width and height", command, tan);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,10 +380,10 @@ void JsonClientConnection::handleImageCommand(const Json::Value &message)
|
|||||||
_hyperion->setColors(priority, ledColors, duration);
|
_hyperion->setColors(priority, ledColors, duration);
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleEffectCommand(const Json::Value &message)
|
void JsonClientConnection::handleEffectCommand(const Json::Value &message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
forwardJsonMessage(message);
|
forwardJsonMessage(message);
|
||||||
|
|
||||||
@ -403,14 +404,16 @@ void JsonClientConnection::handleEffectCommand(const Json::Value &message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleServerInfoCommand(const Json::Value &)
|
void JsonClientConnection::handleServerInfoCommand(const Json::Value &, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
// create result
|
// create result
|
||||||
Json::Value result;
|
Json::Value result;
|
||||||
result["success"] = true;
|
result["success"] = true;
|
||||||
|
result["command"] = command;
|
||||||
|
result["tan"] = tan;
|
||||||
Json::Value & info = result["info"];
|
Json::Value & info = result["info"];
|
||||||
|
|
||||||
// add host name for remote clients
|
// add host name for remote clients
|
||||||
@ -641,7 +644,7 @@ void JsonClientConnection::handleServerInfoCommand(const Json::Value &)
|
|||||||
sendMessage(result);
|
sendMessage(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleClearCommand(const Json::Value &message)
|
void JsonClientConnection::handleClearCommand(const Json::Value &message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
forwardJsonMessage(message);
|
forwardJsonMessage(message);
|
||||||
|
|
||||||
@ -652,10 +655,10 @@ void JsonClientConnection::handleClearCommand(const Json::Value &message)
|
|||||||
_hyperion->clear(priority);
|
_hyperion->clear(priority);
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleClearallCommand(const Json::Value & message)
|
void JsonClientConnection::handleClearallCommand(const Json::Value & message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
forwardJsonMessage(message);
|
forwardJsonMessage(message);
|
||||||
|
|
||||||
@ -663,10 +666,10 @@ void JsonClientConnection::handleClearallCommand(const Json::Value & message)
|
|||||||
_hyperion->clearall();
|
_hyperion->clearall();
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleTransformCommand(const Json::Value &message)
|
void JsonClientConnection::handleTransformCommand(const Json::Value &message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
const Json::Value & transform = message["transform"];
|
const Json::Value & transform = message["transform"];
|
||||||
|
|
||||||
@ -738,11 +741,11 @@ void JsonClientConnection::handleTransformCommand(const Json::Value &message)
|
|||||||
// commit the changes
|
// commit the changes
|
||||||
_hyperion->transformsUpdated();
|
_hyperion->transformsUpdated();
|
||||||
|
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JsonClientConnection::handleTemperatureCommand(const Json::Value &message)
|
void JsonClientConnection::handleTemperatureCommand(const Json::Value &message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
const Json::Value & temperature = message["temperature"];
|
const Json::Value & temperature = message["temperature"];
|
||||||
|
|
||||||
@ -765,10 +768,10 @@ void JsonClientConnection::handleTemperatureCommand(const Json::Value &message)
|
|||||||
// commit the changes
|
// commit the changes
|
||||||
_hyperion->temperaturesUpdated();
|
_hyperion->temperaturesUpdated();
|
||||||
|
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleAdjustmentCommand(const Json::Value &message)
|
void JsonClientConnection::handleAdjustmentCommand(const Json::Value &message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
const Json::Value & adjustment = message["adjustment"];
|
const Json::Value & adjustment = message["adjustment"];
|
||||||
|
|
||||||
@ -806,10 +809,10 @@ void JsonClientConnection::handleAdjustmentCommand(const Json::Value &message)
|
|||||||
// commit the changes
|
// commit the changes
|
||||||
_hyperion->adjustmentsUpdated();
|
_hyperion->adjustmentsUpdated();
|
||||||
|
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleSourceSelectCommand(const Json::Value & message)
|
void JsonClientConnection::handleSourceSelectCommand(const Json::Value & message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (message.get("auto",false).asBool())
|
if (message.get("auto",false).asBool())
|
||||||
@ -824,40 +827,42 @@ void JsonClientConnection::handleSourceSelectCommand(const Json::Value & message
|
|||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sendErrorReply("setting current priority failed");
|
sendErrorReply("setting current priority failed", command, tan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleConfigCommand(const Json::Value & message)
|
void JsonClientConnection::handleConfigCommand(const Json::Value & message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
std::string subcommand = message.get("subcommand","").asString();
|
std::string subcommand = message.get("subcommand","").asString();
|
||||||
if (subcommand == "getschema")
|
if (subcommand == "getschema")
|
||||||
{
|
{
|
||||||
handleSchemaGetCommand(message);
|
handleSchemaGetCommand(message, command, tan);
|
||||||
}
|
}
|
||||||
else if (subcommand == "getconfig")
|
else if (subcommand == "getconfig")
|
||||||
{
|
{
|
||||||
handleConfigGetCommand(message);
|
handleConfigGetCommand(message, command, tan);
|
||||||
}
|
}
|
||||||
else if (subcommand == "setconfig")
|
else if (subcommand == "setconfig")
|
||||||
{
|
{
|
||||||
handleConfigSetCommand(message);
|
handleConfigSetCommand(message, command, tan);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sendErrorReply("unknown or missing subcommand");
|
sendErrorReply("unknown or missing subcommand", command, tan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleConfigGetCommand(const Json::Value & message)
|
void JsonClientConnection::handleConfigGetCommand(const Json::Value & message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
// create result
|
// create result
|
||||||
Json::Value result;
|
Json::Value result;
|
||||||
result["success"] = true;
|
result["success"] = true;
|
||||||
|
result["command"] = command;
|
||||||
|
result["tan"] = tan;
|
||||||
Json::Value & config = result["result"];
|
Json::Value & config = result["result"];
|
||||||
config = _hyperion->getJsonConfig();
|
config = _hyperion->getJsonConfig();
|
||||||
|
|
||||||
@ -865,11 +870,13 @@ void JsonClientConnection::handleConfigGetCommand(const Json::Value & message)
|
|||||||
sendMessage(result);
|
sendMessage(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleSchemaGetCommand(const Json::Value & message)
|
void JsonClientConnection::handleSchemaGetCommand(const Json::Value & message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
// create result
|
// create result
|
||||||
Json::Value result;
|
Json::Value result;
|
||||||
result["success"] = true;
|
result["success"] = true;
|
||||||
|
result["command"] = command;
|
||||||
|
result["tan"] = tan;
|
||||||
Json::Value & schemaJson = result["result"];
|
Json::Value & schemaJson = result["result"];
|
||||||
|
|
||||||
// make sure the resources are loaded (they may be left out after static linking)
|
// make sure the resources are loaded (they may be left out after static linking)
|
||||||
@ -889,7 +896,7 @@ void JsonClientConnection::handleSchemaGetCommand(const Json::Value & message)
|
|||||||
sendMessage(result);
|
sendMessage(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleConfigSetCommand(const Json::Value &message)
|
void JsonClientConnection::handleConfigSetCommand(const Json::Value &message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
struct nested
|
struct nested
|
||||||
{
|
{
|
||||||
@ -920,7 +927,7 @@ void JsonClientConnection::handleConfigSetCommand(const Json::Value &message)
|
|||||||
std::string errors;
|
std::string errors;
|
||||||
if (!checkJson(message["config"], ":/hyperion-schema", errors, true))
|
if (!checkJson(message["config"], ":/hyperion-schema", errors, true))
|
||||||
{
|
{
|
||||||
sendErrorReply("Error while validating json: " + errors);
|
sendErrorReply("Error while validating json: " + errors, command, tan);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -930,13 +937,13 @@ void JsonClientConnection::handleConfigSetCommand(const Json::Value &message)
|
|||||||
|
|
||||||
JsonFactory::writeJson(_hyperion->getConfigFileName(), hyperionConfig);
|
JsonFactory::writeJson(_hyperion->getConfigFileName(), hyperionConfig);
|
||||||
|
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
sendErrorReply("Error while parsing json: Message size " + message.size());
|
sendErrorReply("Error while parsing json: Message size " + message.size(), command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleComponentStateCommand(const Json::Value& message)
|
void JsonClientConnection::handleComponentStateCommand(const Json::Value& message, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
const Json::Value & componentState = message["componentstate"];
|
const Json::Value & componentState = message["componentstate"];
|
||||||
Components component = stringToComponent(QString::fromStdString(componentState.get("component", "invalid").asString()));
|
Components component = stringToComponent(QString::fromStdString(componentState.get("component", "invalid").asString()));
|
||||||
@ -944,11 +951,11 @@ void JsonClientConnection::handleComponentStateCommand(const Json::Value& messag
|
|||||||
if (component != COMP_INVALID)
|
if (component != COMP_INVALID)
|
||||||
{
|
{
|
||||||
_hyperion->setComponentState(component, componentState.get("state", true).asBool());
|
_hyperion->setComponentState(component, componentState.get("state", true).asBool());
|
||||||
sendSuccessReply();
|
sendSuccessReply(command, tan);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sendErrorReply("invalid component name");
|
sendErrorReply("invalid component name", command, tan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1029,22 +1036,26 @@ void JsonClientConnection::sendMessage(const Json::Value & message, QTcpSocket *
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::sendSuccessReply()
|
void JsonClientConnection::sendSuccessReply(const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
// create reply
|
// create reply
|
||||||
Json::Value reply;
|
Json::Value reply;
|
||||||
reply["success"] = true;
|
reply["success"] = true;
|
||||||
|
reply["command"] = command;
|
||||||
|
reply["tan"] = tan;
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::sendErrorReply(const std::string &error)
|
void JsonClientConnection::sendErrorReply(const std::string &error, const std::string &command, const int tan)
|
||||||
{
|
{
|
||||||
// create reply
|
// create reply
|
||||||
Json::Value reply;
|
Json::Value reply;
|
||||||
reply["success"] = false;
|
reply["success"] = false;
|
||||||
reply["error"] = error;
|
reply["error"] = error;
|
||||||
|
reply["command"] = command;
|
||||||
|
reply["tan"] = tan;
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
sendMessage(reply);
|
sendMessage(reply);
|
||||||
|
@ -74,100 +74,100 @@ private:
|
|||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleColorCommand(const Json::Value & message);
|
void handleColorCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Image message
|
/// Handle an incoming JSON Image message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleImageCommand(const Json::Value & message);
|
void handleImageCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Effect message
|
/// Handle an incoming JSON Effect message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleEffectCommand(const Json::Value & message);
|
void handleEffectCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Server info message
|
/// Handle an incoming JSON Server info message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleServerInfoCommand(const Json::Value & message);
|
void handleServerInfoCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Clear message
|
/// Handle an incoming JSON Clear message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleClearCommand(const Json::Value & message);
|
void handleClearCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Clearall message
|
/// Handle an incoming JSON Clearall message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleClearallCommand(const Json::Value & message);
|
void handleClearallCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Transform message
|
/// Handle an incoming JSON Transform message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleTransformCommand(const Json::Value & message);
|
void handleTransformCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Temperature message
|
/// Handle an incoming JSON Temperature message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleTemperatureCommand(const Json::Value & message);
|
void handleTemperatureCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Adjustment message
|
/// Handle an incoming JSON Adjustment message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleAdjustmentCommand(const Json::Value & message);
|
void handleAdjustmentCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON SourceSelect message
|
/// Handle an incoming JSON SourceSelect message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleSourceSelectCommand(const Json::Value & message);
|
void handleSourceSelectCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
/// Handle an incoming JSON GetConfig message
|
/// Handle an incoming JSON GetConfig message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleConfigCommand(const Json::Value & message);
|
void handleConfigCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
/// Handle an incoming JSON GetConfig message
|
/// Handle an incoming JSON GetConfig message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleSchemaGetCommand(const Json::Value & message);
|
void handleSchemaGetCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
/// Handle an incoming JSON GetConfig message
|
/// Handle an incoming JSON GetConfig message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleConfigGetCommand(const Json::Value & message);
|
void handleConfigGetCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON SetConfig message
|
/// Handle an incoming JSON SetConfig message
|
||||||
///
|
///
|
||||||
void handleConfigSetCommand(const Json::Value & message);
|
void handleConfigSetCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Component State message
|
/// Handle an incoming JSON Component State message
|
||||||
///
|
///
|
||||||
/// @param message the incoming message
|
/// @param message the incoming message
|
||||||
///
|
///
|
||||||
void handleComponentStateCommand(const Json::Value & message);
|
void handleComponentStateCommand(const Json::Value & message, const std::string &command, const int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON message of unknown type
|
/// Handle an incoming JSON message of unknown type
|
||||||
@ -185,14 +185,14 @@ private:
|
|||||||
///
|
///
|
||||||
/// Send a standard reply indicating success
|
/// Send a standard reply indicating success
|
||||||
///
|
///
|
||||||
void sendSuccessReply();
|
void sendSuccessReply(const std::string &command="", const int tan=0);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Send an error message back to the client
|
/// Send an error message back to the client
|
||||||
///
|
///
|
||||||
/// @param error String describing the error
|
/// @param error String describing the error
|
||||||
///
|
///
|
||||||
void sendErrorReply(const std::string & error);
|
void sendErrorReply(const std::string & error, const std::string &command="", const int tan=0);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Do handshake for a websocket connection
|
/// Do handshake for a websocket connection
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["adjustment"]
|
"enum" : ["adjustment"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"adjustment": {
|
"adjustment": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": true,
|
"required": true,
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["clear"]
|
"enum" : ["clear"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"priority": {
|
"priority": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
"type" : "string",
|
"type" : "string",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["clearall"]
|
"enum" : ["clearall"]
|
||||||
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["color"]
|
"enum" : ["color"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"priority": {
|
"priority": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["componentstate"]
|
"enum" : ["componentstate"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"componentstate":
|
"componentstate":
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@ -17,6 +20,7 @@
|
|||||||
{
|
{
|
||||||
"component":
|
"component":
|
||||||
{
|
{
|
||||||
|
"type" : "string",
|
||||||
"enum" : ["SMOOTHING", "BLACKBORDER", "KODICHECKER", "FORWARDER", "UDPLISTENER", "BOBLIGHTSERVER", "GRABBER"],
|
"enum" : ["SMOOTHING", "BLACKBORDER", "KODICHECKER", "FORWARDER", "UDPLISTENER", "BOBLIGHTSERVER", "GRABBER"],
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["getconfig","setconfig","getschema"]
|
"enum" : ["getconfig","setconfig","getschema"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"type" : "object"
|
"type" : "object"
|
||||||
},
|
},
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["correction"]
|
"enum" : ["correction"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"correction": {
|
"correction": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": true,
|
"required": true,
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["effect"]
|
"enum" : ["effect"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"priority": {
|
"priority": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["image"]
|
"enum" : ["image"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"priority": {
|
"priority": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
"type" : "string",
|
"type" : "string",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["serverinfo"]
|
"enum" : ["serverinfo"]
|
||||||
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["sourceselect"]
|
"enum" : ["sourceselect"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"priority": {
|
"priority": {
|
||||||
"type": "integer"
|
"type": "integer"
|
||||||
},
|
},
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["temperature"]
|
"enum" : ["temperature"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"temperature": {
|
"temperature": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": true,
|
"required": true,
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["transform"]
|
"enum" : ["transform"]
|
||||||
},
|
},
|
||||||
|
"tan" : {
|
||||||
|
"type" : "integer"
|
||||||
|
},
|
||||||
"transform": {
|
"transform": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": true,
|
"required": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user