mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 11:59:12 +03:00
начал писать обновление параметров
This commit is contained in:
@@ -1,17 +1,18 @@
|
|||||||
#include "DeviceList.h"
|
#include "DeviceList.h"
|
||||||
|
|
||||||
void addThisDeviceToList() {
|
void addThisDeviceToList() {
|
||||||
jsonWriteStr_(devListJson, "devicelist", "devicelist");
|
jsonWriteStr_(devListJson, "devicelist", ""); //метка для парсинга
|
||||||
jsonWriteStr_(devListJson, "ip", jsonReadStr(settingsFlashJson, "ip"));
|
jsonWriteStr_(devListJson, "ip", jsonReadStr(settingsFlashJson, "ip"));
|
||||||
jsonWriteStr_(devListJson, "id", jsonReadStr(settingsFlashJson, "id"));
|
jsonWriteStr_(devListJson, "id", jsonReadStr(settingsFlashJson, "id"));
|
||||||
jsonWriteStr_(devListJson, "name", jsonReadStr(settingsFlashJson, "name"));
|
jsonWriteStr_(devListJson, "name", jsonReadStr(settingsFlashJson, "name"));
|
||||||
|
|
||||||
devListJson = devListJson + ",";
|
// для проверки
|
||||||
String test;
|
// devListJson = devListJson + ",";
|
||||||
jsonWriteStr_(test, "ip", "192.168.88.88");
|
// String test;
|
||||||
jsonWriteStr_(test, "id", "123456789");
|
// jsonWriteStr_(test, "ip", "192.168.88.88");
|
||||||
jsonWriteStr_(test, "name", "test");
|
// jsonWriteStr_(test, "id", "123456789");
|
||||||
devListJson = devListJson + test;
|
// jsonWriteStr_(test, "name", "test");
|
||||||
|
// devListJson = devListJson + test;
|
||||||
|
|
||||||
devListJson = "[" + devListJson + "]";
|
devListJson = "[" + devListJson + "]";
|
||||||
Serial.println(devListJson);
|
Serial.println(devListJson);
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ void globalVarsSync() {
|
|||||||
jsonWriteStr_(settingsFlashJson, "root", mqttRootDevice);
|
jsonWriteStr_(settingsFlashJson, "root", mqttRootDevice);
|
||||||
jsonWriteStr_(settingsFlashJson, "id", chipId);
|
jsonWriteStr_(settingsFlashJson, "id", chipId);
|
||||||
saveSettingsFlashJson();
|
saveSettingsFlashJson();
|
||||||
jsonWriteStr_(ssidListJson, "ssid", "");
|
jsonWriteStr_(ssidListJson, "ssid", ""); //метка для парсинга
|
||||||
|
jsonWriteStr(paramsHeapJson, "params", ""); //метка для парсинга
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveSettingsFlashJson() {
|
void saveSettingsFlashJson() {
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ void standWebServerInit() {
|
|||||||
HTTP.send(200, "application/json", settingsFlashJson);
|
HTTP.send(200, "application/json", settingsFlashJson);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
HTTP.on("/paramsh.json", HTTP_GET, []() {
|
||||||
|
HTTP.send(200, "application/json", paramsHeapJson);
|
||||||
|
});
|
||||||
|
|
||||||
HTTP.on("/config.json", HTTP_GET, []() {
|
HTTP.on("/config.json", HTTP_GET, []() {
|
||||||
HTTP.send(200, "application/json", readFile(F("config.json"), 20000));
|
HTTP.send(200, "application/json", readFile(F("config.json"), 20000));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
|||||||
// dashboard===================================================================
|
// dashboard===================================================================
|
||||||
if (headerStr == "/") {
|
if (headerStr == "/") {
|
||||||
sendFileToWs("/layout.json", num, 1024);
|
sendFileToWs("/layout.json", num, 1024);
|
||||||
|
standWebSocket.sendTXT(num, paramsHeapJson);
|
||||||
}
|
}
|
||||||
if (headerStr == "/tuoyal") {
|
if (headerStr == "/tuoyal") {
|
||||||
writeFileUint8tByFrames("layout.json", payload, length, headerLenth, 256);
|
writeFileUint8tByFrames("layout.json", payload, length, headerLenth, 256);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void IoTItem::loop() {
|
|||||||
|
|
||||||
void IoTItem::regEvent(String value, String consoleInfo = "") {
|
void IoTItem::regEvent(String value, String consoleInfo = "") {
|
||||||
eventGen2(_id, value);
|
eventGen2(_id, value);
|
||||||
jsonWriteStr(paramsFlashJson, _id, value);
|
jsonWriteStr(paramsHeapJson, _id, value);
|
||||||
publishStatusMqtt(_id, value);
|
publishStatusMqtt(_id, value);
|
||||||
publishStatusWs(_id, value);
|
publishStatusWs(_id, value);
|
||||||
SerialPrint("I", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
|
SerialPrint("I", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
|
||||||
|
|||||||
Reference in New Issue
Block a user