From 0198da65952ecbd9c924d881bbc1e04411f9f9e2 Mon Sep 17 00:00:00 2001 From: Syping Date: Thu, 9 May 2024 21:59:57 +0200 Subject: [PATCH] fix JSON status bool --- SMSubServer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SMSubServer.cpp b/SMSubServer.cpp index aa1cf6e..20a5672 100644 --- a/SMSubServer.cpp +++ b/SMSubServer.cpp @@ -164,7 +164,7 @@ bool SMSubServer::messageReceived(QObject *socket, const QByteArray &message) #ifdef BOOST_JSON boost::json::object object; object["type"] = "status"; - object["status"] = status ? "on" : "off"; + object["status"] = status; object["start"] = startTime; object["stop"] = stopTime; const std::string json = boost::json::serialize(object) + '\n'; @@ -172,7 +172,7 @@ bool SMSubServer::messageReceived(QObject *socket, const QByteArray &message) #else QJsonObject object; object["type"] = "status"; - object["status"] = status ? "on" : "off"; + object["status"] = status; object["start"] = startTime; object["stop"] = stopTime; sendMessage(socket, QJsonDocument(object).toJson(QJsonDocument::Compact) + '\n'); @@ -371,14 +371,14 @@ void SMSubServer::statusUpdated(const bool status_, const qint64 time) #ifdef BOOST_JSON boost::json::object object; object["type"] = "status"; - object["status"] = status ? "on" : "off"; + object["status"] = status; object["start"] = startTime; object["stop"] = stopTime; json_output = QByteArray::fromStdString(boost::json::serialize(object) + '\n'); #else QJsonObject object; object["type"] = "status"; - object["status"] = status ? "on" : "off"; + object["status"] = status; object["start"] = startTime; object["stop"] = stopTime; json_output = QJsonDocument(object).toJson(QJsonDocument::Compact) + '\n';