mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Return tan to API requests whenever possible (#1002)
* Return tan to API requests whenever possible * Set default tan to value 0 Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
parent
11d98fddb9
commit
be0bccea59
@ -280,7 +280,7 @@ private:
|
|||||||
///
|
///
|
||||||
/// Handle an incoming JSON message of unknown type
|
/// Handle an incoming JSON message of unknown type
|
||||||
///
|
///
|
||||||
void handleNotImplemented();
|
void handleNotImplemented(const QString &command, int tan);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Send a standard reply indicating success
|
/// Send a standard reply indicating success
|
||||||
|
@ -97,10 +97,14 @@ void JsonAPI::handleMessage(const QString &messageString, const QString &httpAut
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tan = 0;
|
||||||
|
if (message.value("tan") != QJsonValue::Undefined)
|
||||||
|
tan = message["tan"].toInt();
|
||||||
|
|
||||||
// check basic message
|
// check basic message
|
||||||
if (!JsonUtils::validate(ident, message, ":schema", _log))
|
if (!JsonUtils::validate(ident, message, ":schema", _log))
|
||||||
{
|
{
|
||||||
sendErrorReply("Errors during message validation, please consult the Hyperion Log.");
|
sendErrorReply("Errors during message validation, please consult the Hyperion Log.", "" /*command*/, tan);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,12 +112,10 @@ void JsonAPI::handleMessage(const QString &messageString, const QString &httpAut
|
|||||||
const QString command = message["command"].toString();
|
const QString command = message["command"].toString();
|
||||||
if (!JsonUtils::validate(ident, message, QString(":schema-%1").arg(command), _log))
|
if (!JsonUtils::validate(ident, message, QString(":schema-%1").arg(command), _log))
|
||||||
{
|
{
|
||||||
sendErrorReply("Errors during specific message validation, please consult the Hyperion Log", command);
|
sendErrorReply("Errors during specific message validation, please consult the Hyperion Log", command, tan);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tan = message["tan"].toInt();
|
|
||||||
|
|
||||||
// client auth before everything else but not for http
|
// client auth before everything else but not for http
|
||||||
if (!_noListener && command == "authorize")
|
if (!_noListener && command == "authorize")
|
||||||
{
|
{
|
||||||
@ -177,12 +179,12 @@ proceed:
|
|||||||
else if (command == "clearall")
|
else if (command == "clearall")
|
||||||
handleClearallCommand(message, command, tan);
|
handleClearallCommand(message, command, tan);
|
||||||
else if (command == "transform" || command == "correction" || command == "temperature")
|
else if (command == "transform" || command == "correction" || command == "temperature")
|
||||||
sendErrorReply("The command " + command + "is deprecated, please use the Hyperion Web Interface to configure");
|
sendErrorReply("The command " + command + "is deprecated, please use the Hyperion Web Interface to configure", command, tan);
|
||||||
// END
|
// END
|
||||||
|
|
||||||
// handle not implemented commands
|
// handle not implemented commands
|
||||||
else
|
else
|
||||||
handleNotImplemented();
|
handleNotImplemented(command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonAPI::handleColorCommand(const QJsonObject &message, const QString &command, int tan)
|
void JsonAPI::handleColorCommand(const QJsonObject &message, const QString &command, int tan)
|
||||||
@ -1426,9 +1428,9 @@ void JsonAPI::handleLedDeviceCommand(const QJsonObject &message, const QString &
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonAPI::handleNotImplemented()
|
void JsonAPI::handleNotImplemented(const QString &command, int tan)
|
||||||
{
|
{
|
||||||
sendErrorReply("Command not implemented");
|
sendErrorReply("Command not implemented", command, tan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonAPI::sendSuccessReply(const QString &command, int tan)
|
void JsonAPI::sendSuccessReply(const QString &command, int tan)
|
||||||
|
Loading…
Reference in New Issue
Block a user