1. 优化了cpp_json的内容,使其更modern
2. 稍微优化了一下系统配置类 3. 增加了系统版本号,便于区分系统版本,方便OTA 4. 重写OTA的逻辑,完成了Cpp的OTA封装,测试通过
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#include <queue>
|
||||
#include <condition_variable>
|
||||
#include "esp_websocket_client.h"
|
||||
#include "cJSON.h"
|
||||
#include "cpp_json.h"
|
||||
#include "ThreadManager.h"
|
||||
#include "WifiConnectors.h"
|
||||
|
||||
@@ -32,7 +32,7 @@ struct WebSocketConfig {
|
||||
};
|
||||
|
||||
// JSON数据回调
|
||||
using JsonDataCallback = std::function<void(cJSON* json)>;
|
||||
using JsonDataCallback = std::function<void(cppjson::Json&)>;
|
||||
// 事件回调
|
||||
using EventCallback = std::function<void(WebSocketEvent event, const std::string& message)>;
|
||||
|
||||
@@ -98,8 +98,8 @@ public:
|
||||
// 断开连接
|
||||
void disconnect();
|
||||
|
||||
// 发送JSON数据,注意此成员函数会释放json数据,调用之后请不要再次释放json数据
|
||||
bool sendJson(cJSON* json);
|
||||
// 发送JSON数据
|
||||
bool sendJson(const cppjson::Json& json);
|
||||
|
||||
// 发送原始字符串数据
|
||||
bool sendRaw(const std::string& data);
|
||||
|
||||
Reference in New Issue
Block a user