MeshTalos/main/lib/meshtalos.h
2025-12-31 14:53:05 +08:00

36 lines
860 B
C

/*
* DOCUMENT of sync to peer
* if a tcp connection is established, it need to send a subscribe command to
* root. and root will compare scheduled topic then send it.
*
*
* subscribe command:
* mpack formatted: [ uint8_t id = 1, char topic[TOPIC_LEN] ]
*/
#pragma once
#include "./storage.h"
#define TOPIC_LEN 20
#define IMG_W_SIZE 152
#define IMG_H_SIZE 296
#define DISPLAY_SIZE IMG_W_SIZE *IMG_H_SIZE
#define IMG_HEADER_SIZE 15
#define IMG_SIZE IMG_HEADER_SIZE + DISPLAY_SIZE
#define IMG_BLK_SIZE 300
struct Meshtalos {
struct Storage *storage;
};
// struct sync_jobs {
// // char *tag_name;
// char topic[TOPIC_LEN];
// };
// struct sub {
// char topic[TOPIC_LEN];
// struct sub *next;
// };
// extern struct sub *sub_list;
struct Meshtalos *mtsh_init();
void mtsh_listen(struct Meshtalos *mtsh, const int worker_port, int http_port);