[SYS] Introduce MQTT Broker mode (#1988)
This commit is contained in:
1 parent
ada83bf227
commit
8537b7498d
7 files changed
+212
-87
No files matched your search
+7
-1
@@ -706,6 +706,7 @@ void handleMQ() {
|
||||
JsonObject WEBtoSYS = WEBtoSYSBuffer.to<JsonObject>();
|
||||
bool update = false;
|
||||
|
||||
# if !MQTT_BROKER_MODE
|
||||
if (server.hasArg("mh")) {
|
||||
WEBtoSYS["mqtt_server"] = server.arg("mh");
|
||||
if (strncmp(cnt_parameters_array[CNT_DEFAULT_INDEX].mqtt_server, server.arg("mh").c_str(), parameters_size)) {
|
||||
@@ -746,6 +747,7 @@ void handleMQ() {
|
||||
WEBtoSYS.remove(it);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
if (server.hasArg("h")) {
|
||||
WEBtoSYS["gateway_name"] = server.arg("h");
|
||||
@@ -802,7 +804,11 @@ void handleMQ() {
|
||||
response += String(script);
|
||||
response += String(style);
|
||||
// mqtt server (mh), mqtt port (ml), mqtt username (mu), mqtt password (mp), secure connection (sc), server certificate (msc), topic (mt)
|
||||
# if MQTT_BROKER_MODE
|
||||
snprintf(buffer, WEB_TEMPLATE_BUFFER_MAX_SIZE, config_mqtt_body, jsonChar, gateway_name, "", "1883", "", "", gateway_name, mqtt_topic);
|
||||
# else
|
||||
snprintf(buffer, WEB_TEMPLATE_BUFFER_MAX_SIZE, config_mqtt_body, jsonChar, gateway_name, cnt_parameters_array[CNT_DEFAULT_INDEX].mqtt_server, cnt_parameters_array[CNT_DEFAULT_INDEX].mqtt_port, cnt_parameters_array[CNT_DEFAULT_INDEX].mqtt_user, (cnt_parameters_array[CNT_DEFAULT_INDEX].isConnectionSecure ? "checked" : ""), gateway_name, mqtt_topic);
|
||||
# endif
|
||||
response += String(buffer);
|
||||
snprintf(buffer, WEB_TEMPLATE_BUFFER_MAX_SIZE, footer, OMG_VERSION);
|
||||
response += String(buffer);
|
||||
@@ -2503,4 +2509,4 @@ void addLog(const uint8_t* buffer, size_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
Reference in new issue
Block a user