powerpods/main/cmd_handler.h
simon 43a85ce697 Add command queue dispatcher and VERSION UART handler.
Centralize command dispatch over a FreeRTOS queue so UART and future
ESP-NOW transports can register handlers; implement the protobuf VERSION
command with framed nanopb responses including build git hash.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-18 21:46:51 +02:00

27 lines
558 B
C

#ifndef CMD_HANDLER_H
#define CMD_HANDLER_H
#include "esp_err.h"
#include "freertos/idf_additions.h"
typedef struct {
uint16_t msg_id;
uint8_t *payload;
size_t len;
} generic_msg_t;
typedef void (*msg_callback_t)(const uint8_t *data, size_t len);
typedef struct {
uint16_t msg_id;
msg_callback_t callback;
} msg_binding_t;
void init_cmdHandler(QueueHandle_t queue);
void vCmdDispatcherTask(void *param);
esp_err_t msg_register_handler(uint16_t id, msg_callback_t cb);
esp_err_t msg_post(uint16_t id, const uint8_t *data, size_t len);
#endif