Add esp32s2 support
This commit is contained in:
@@ -1,18 +1,36 @@
|
||||
#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;
|
||||
};
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// Создание JSON из структуры
|
||||
cJSON* protocol_message_to_json(const ProtocolMessage *msg);
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Разбор JSON в структуру
|
||||
int protocol_json_to_message(const char *json_str, ProtocolMessage *msg);
|
||||
int build_telemetry_single(
|
||||
char* buf,
|
||||
size_t buf_size,
|
||||
const char* id,
|
||||
const char* device_id,
|
||||
int64_t ts_ms,
|
||||
const char* metric,
|
||||
double value,
|
||||
const char* unit, // optional (NULL)
|
||||
const char* source, // optional (NULL)
|
||||
int64_t m_ts_ms // optional (0 = нет)
|
||||
);
|
||||
|
||||
int build_event(
|
||||
char* buf,
|
||||
size_t buf_size,
|
||||
const char* id,
|
||||
const char* device_id,
|
||||
int64_t ts_ms,
|
||||
const char* name,
|
||||
const char* severity, // optional
|
||||
const char* message // optional
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user