mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Troubleshooting and ...
- More i18n - Easy use of mutual exclusion in JsonAPI with QMutexLocker - Smoothing type "linear" hidden in the WebUI, because there is currently only one - Message forwarding implemented again - For compatibility to home assistants and other remote controls, "activeEffects" and "activeLedColor" has been added to the JSON-RPC - FlatBuffer clear now the Priority on disconnect - The information "available V4L2 devices" is now only displayed if the device list is not empty - LED device "PiBlaster" excluded from OSX build
This commit is contained in:
@@ -114,43 +114,3 @@ void JsonServer::closedConnection(void)
|
||||
// schedule to delete the connection object
|
||||
connection->deleteLater();
|
||||
}
|
||||
|
||||
void JsonServer::sendMessage(const QJsonObject & message, QTcpSocket * socket)
|
||||
{
|
||||
// serialize message
|
||||
QJsonDocument writer(message);
|
||||
QByteArray serializedMessage = writer.toJson(QJsonDocument::Compact) + "\n";
|
||||
|
||||
// write message
|
||||
socket->write(serializedMessage);
|
||||
if (!socket->waitForBytesWritten())
|
||||
{
|
||||
Debug(_log, "Error while writing data to host");
|
||||
return;
|
||||
}
|
||||
|
||||
// read reply data
|
||||
QByteArray serializedReply;
|
||||
while (!serializedReply.contains('\n'))
|
||||
{
|
||||
// receive reply
|
||||
if (!socket->waitForReadyRead())
|
||||
{
|
||||
Debug(_log, "Error while writing data from host");
|
||||
return;
|
||||
}
|
||||
|
||||
serializedReply += socket->readAll();
|
||||
}
|
||||
|
||||
// parse reply data
|
||||
QJsonParseError error;
|
||||
QJsonDocument reply = QJsonDocument::fromJson(serializedReply ,&error);
|
||||
|
||||
if (error.error != QJsonParseError::NoError)
|
||||
{
|
||||
Error(_log, "Error while parsing reply: invalid json");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user