[SYS] Remove handleJsonQueue wrapper and use std::string (#2038)
Co-authored-by: Florian <1technophile@users.noreply.github.com>
This commit is contained in:
1 parent
cb824e2ee4
commit
719976b652
36 files changed
+68
-74
No files matched your search
+8
-13
@@ -89,7 +89,7 @@ struct JsonBundle {
|
||||
StaticJsonDocument<JSON_MSG_BUFFER> doc;
|
||||
};
|
||||
|
||||
std::queue<String> jsonQueue;
|
||||
std::queue<std::string> jsonQueue;
|
||||
|
||||
#ifdef ESP32
|
||||
# include <driver/adc.h>
|
||||
@@ -496,7 +496,7 @@ boolean enqueueJsonObject(const StaticJsonDocument<JSON_MSG_BUFFER>& jsonDoc, in
|
||||
return false;
|
||||
}
|
||||
Log.trace(F("Enqueue JSON" CR));
|
||||
String jsonString;
|
||||
std::string jsonString;
|
||||
serializeJson(jsonDoc, jsonString);
|
||||
#ifdef ESP32
|
||||
// Semaphore check before enqueueing a document
|
||||
@@ -514,14 +514,9 @@ boolean enqueueJsonObject(const StaticJsonDocument<JSON_MSG_BUFFER>& jsonDoc, in
|
||||
return true;
|
||||
}
|
||||
|
||||
// Semaphore check before enqueueing a document
|
||||
bool handleJsonEnqueue(const StaticJsonDocument<JSON_MSG_BUFFER>& jsonDoc, int timeout) {
|
||||
return enqueueJsonObject(jsonDoc, timeout);
|
||||
}
|
||||
|
||||
// Semaphore check before enqueueing a document with default timeout QueueSemaphoreTimeOutLoop
|
||||
bool handleJsonEnqueue(const StaticJsonDocument<JSON_MSG_BUFFER>& jsonDoc) {
|
||||
return handleJsonEnqueue(jsonDoc, QueueSemaphoreTimeOutLoop);
|
||||
bool enqueueJsonObject(const StaticJsonDocument<JSON_MSG_BUFFER>& jsonDoc) {
|
||||
return enqueueJsonObject(jsonDoc, QueueSemaphoreTimeOutLoop);
|
||||
}
|
||||
|
||||
#ifdef ESP32
|
||||
@@ -2824,7 +2819,7 @@ String stateMeasures() {
|
||||
SYSdata["modules"] = modules;
|
||||
|
||||
SYSdata["origin"] = subjectSYStoMQTT;
|
||||
handleJsonEnqueue(SYSdata);
|
||||
enqueueJsonObject(SYSdata);
|
||||
pubOled(subjectSYStoMQTT, SYSdata);
|
||||
|
||||
char jsonChar[100];
|
||||
@@ -3074,7 +3069,7 @@ bool checkForUpdates() {
|
||||
latestVersion = jsondata["latest_version"].as<String>();
|
||||
jsondata["origin"] = subjectRLStoMQTT;
|
||||
jsondata["retain"] = true;
|
||||
handleJsonEnqueue(jsondata);
|
||||
enqueueJsonObject(jsondata);
|
||||
|
||||
Log.trace(F("Update file found on server" CR));
|
||||
return true;
|
||||
@@ -3149,7 +3144,7 @@ void MQTTHttpsFWUpdate(char* topicOri, JsonObject& HttpsFwUpdateData) {
|
||||
StaticJsonDocument<JSON_MSG_BUFFER> jsondata;
|
||||
jsondata["release_summary"] = "Update in progress ...";
|
||||
jsondata["origin"] = subjectRLStoMQTT;
|
||||
handleJsonEnqueue(jsondata);
|
||||
enqueueJsonObject(jsondata);
|
||||
|
||||
std::string ota_cert = processCert(HttpsFwUpdateData["ota_server_cert"] | "");
|
||||
Log.notice(F("OTA cert: %s" CR), ota_cert.c_str());
|
||||
@@ -3225,7 +3220,7 @@ void MQTTHttpsFWUpdate(char* topicOri, JsonObject& HttpsFwUpdateData) {
|
||||
jsondata["release_summary"] = "Update success !";
|
||||
jsondata["installed_version"] = latestVersion;
|
||||
jsondata["origin"] = subjectRLStoMQTT;
|
||||
handleJsonEnqueue(jsondata);
|
||||
enqueueJsonObject(jsondata);
|
||||
# if !MQTT_BROKER_MODE
|
||||
if (cnt_index != 0) // We don't enable the change of cert provided at build time
|
||||
cnt_parameters_array[cnt_index].ota_server_cert = ota_cert;
|
||||
|
||||
Reference in new issue
Block a user