mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
Code moves unchanged; only files and names change. - entryPoints/WebUiRoutes.cpp: registerWebUiRoutes(), the port 80 routes and the UI's files, with the helpers only they use. - entryPoints/ApiRoutes.cpp: registerApiRoutes(), the port 8081 routes. - entryPoints/Web.cpp keeps the servers' lifecycle, auth and the handlers both route sets call; entryPoints/WebRoutes.h is what the three share. - entryPoints/MQTT.* -> MqttConnection.*, class MQTTClass -> MqttConnection. - outputs/SomfyMqtt.cpp -> outputs/MqttPublisher.cpp. - outputs/Sockets.* -> outputs/SocketEmitter.*. The subscribe and unsubscribe lists (the latter repeated groups/+/direction/set) become MqttCommands' MQTT_COMMAND_TOPICS, and a native test checks the parser takes every topic in it. GLOSSARY.md gains MqttConnection and Change fan-out. 328 native tests. Flash: esp32devdbg +3,112 bytes (the routes are a second ArduinoJson file), esp32dev -2,336 bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
766 B
C
19 lines
766 B
C
#ifndef MQTT_COMMANDS_H
|
|
#define MQTT_COMMANDS_H
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "ShadeRequests.h"
|
|
|
|
// The MQTT command topics, <root>/shades/<id>/<command>/set and
|
|
// <root>/groups/<id>/<command>/set. Kept free of the MQTT client so it can be
|
|
// unit tested on the PC (pio test -e native).
|
|
|
|
// Turns a message on a command topic into a shade request. False for a topic
|
|
// or value it doesn't take, which is dropped.
|
|
bool parseMqttCommand(const char *topic, const uint8_t *payload, size_t length, shade_request_t &req);
|
|
|
|
// The command topics under the root topic, + standing for any id. The MQTT
|
|
// connection subscribes to these.
|
|
#define MQTT_COMMAND_TOPIC_COUNT 14
|
|
extern const char *const MQTT_COMMAND_TOPICS[MQTT_COMMAND_TOPIC_COUNT];
|
|
#endif
|