-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtelemetry.h
More file actions
32 lines (25 loc) · 758 Bytes
/
telemetry.h
File metadata and controls
32 lines (25 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef TELEMETRY_LIB
#define TELEMETRY_LIB
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
#include "tlpi_hdr.h"
#define TLM_PUBLISHER 0x1
#define TLM_SUBSCRIBER 0x2
#define TLM_BOTH 0x3
#define TLM_CLOSED 0x4
#define DAEMON_DEFAULT_PORT "12000"
#define MAX_PATH_LENGTH 256
#define MAX_MESSAGE_LENGTH 4096
typedef struct {
int type;
int sfd;
uint32_t chn;
} tlm_t;
tlm_t tlm_open(uint8_t type, const char* channel_name, const char* ip, const char* port);
int32_t tlm_callback(tlm_t token, void (*message_callback)(tlm_t token, const char* message));
const char* tlm_read(tlm_t token, uint32_t* message_id);
int32_t tlm_post(tlm_t token, const char* message);
void tlm_close(tlm_t token);
int32_t tlm_type(tlm_t token);
#endif