- telemetry protocol builder - server-side message handling - database migrations - telemetry persistence
49 lines
892 B
C
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 |