56 lines
996 B
C
56 lines
996 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "ringbuf.h"
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
int build_telemetry(
|
|
char* buf,
|
|
size_t buf_size,
|
|
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
|
|
);
|
|
|
|
uint32_t protocol_next_id();
|
|
|
|
void protocol_send_event_hb(int64_t ts);
|
|
|
|
bool protocol_is_connected();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif |