|
Void Sentry
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
|
The /commands WebSocket: parses each HUD message, hands it to the remote sink and replies with JSON metrics. More...
#include <commands_handler.h>
Public Member Functions | |
| CommandsWebSocketHandler (httpd_handle_t server_handle, const char *uri, BaseDetectionModule *detection=nullptr, const BaseStatusProvider *status=nullptr, remote::BaseRemoteSink *remote=nullptr, const StreamBroadcaster *stream=nullptr) | |
| void | register_endpoint () |
| Registers the WebSocket endpoint on the server. | |
| void | unregister_endpoint () |
| Removes the endpoint from the server. | |
Static Public Attributes | |
| static constexpr size_t | kMaxMessage = 64 |
| Longest accepted message in bytes; the longest real command ("move:down-right") is 15. | |
The /commands WebSocket: parses each HUD message, hands it to the remote sink and replies with JSON metrics.
Request/reply: every received text frame gets exactly one JSON reply (the HUD's poll loop depends on it). Receive and reply buffers live on the httpd task's stack (64 B and hud::kReplySize), so there is no heap use per message and nothing to leak when a send fails.
| CommandsWebSocketHandler::CommandsWebSocketHandler | ( | httpd_handle_t | server_handle, |
| const char * | uri, | ||
| BaseDetectionModule * | detection = nullptr, | ||
| const BaseStatusProvider * | status = nullptr, | ||
| remote::BaseRemoteSink * | remote = nullptr, | ||
| const StreamBroadcaster * | stream = nullptr ) |
| server_handle | Running httpd server to register the endpoint on. |
| uri | Endpoint path (must outlive the handler; a string literal). |
| detection | Optional detection module for the tracker fields. |
| status | Optional controller status for the mode/calibration fields. |
| remote | Optional sink that receives the parsed commands (the Controller). |
| stream | Optional /stream broadcaster whose viewer count is sent as "vw" (0 when null). Must outlive the handler; StreamBroadcaster::viewer_count() is safe to call from the httpd task (but not concurrently with StreamBroadcaster::stop(), so httpd must be stopped first). |