Initial commit for ESP32
This commit is contained in:
18
esp32/main/protocol.h
Normal file
18
esp32/main/protocol.h
Normal 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);
|
||||
Reference in New Issue
Block a user