物联网设备开发: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;
TaskHa
超级会员免费看
订阅专栏 解锁全文
2万+

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



