Initial commit for ESP32

This commit is contained in:
2026-04-01 20:32:34 +03:00
parent 6f3584fe6d
commit 3772981b8f
12 changed files with 3715 additions and 1 deletions

18
esp32/main/protocol.h Normal file
View File

@@ -0,0 +1,18 @@
#pragma once
#include "cJSON.h"
#include <string>
struct ProtocolMessage {
int v;
std::string id;
std::string type;
uint64_t ts;
std::string deviceId; // C++ строка
cJSON* payload;
};
// Создание JSON из структуры
cJSON* protocol_message_to_json(const ProtocolMessage *msg);
// Разбор JSON в структуру
int protocol_json_to_message(const char *json_str, ProtocolMessage *msg);