ESP32的物联网通信与安全功能实现
1. 应用程序编码
在项目中添加的第一个源代码文件是 main/AppRestClient.hpp ,用于实现客户端功能。以下是该文件的代码:
#pragma once
#include <string>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "json.hpp"
#include "AppEsp32C3Bsp.hpp"
#include "esp_http_client.h"
namespace app
{
struct sSensorConfig
{
std::string name;
bool enabled;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(sSensorConfig, name, enabled);
struct sSensorData
{
std::string name;
std::string button;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(sSensorData, name, button);
class AppRestClient
{
private:
AppEsp32C3Bsp m_bsp;
bool m_toggle_btn;
TaskHandle_t m_p
超级会员免费看
订阅专栏 解锁全文
645

被折叠的 条评论
为什么被折叠?



