Files
iot_skeleton/esp32/main/protocol.h
eugene-admin 4100931deb - websocket client on ESP32
- telemetry protocol builder
- server-side message handling
- database migrations
- telemetry persistence
2026-04-14 16:09:18 +03:00

49 lines
892 B
C

#pragma once
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int build_telemetry(
char* buf,
size_t buf_size,
uint32_t msg_id,
int64_t ts,
uint32_t device_id,
const char* metric,
const char* source,
const char* unit,
const int* values,
size_t count
);
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