|
LSH-Core
A robust C++ framework for Arduino-based home automation nodes
|
Provides a function to deserialize and dispatch a received Json payload. More...
Classes | |
| struct | DispatchResult |
| Represents the result of a dispatch operation. More... | |
Functions | |
| auto | deserializeAndDispatch (const JsonDocument &doc) -> DispatchResult |
| Main entry point for command processing. Deserializes a JSON document and immediately dispatches the corresponding action. | |
Provides a function to deserialize and dispatch a received Json payload.
| auto Deserializer::deserializeAndDispatch | ( | const JsonDocument & | doc | ) | -> DispatchResult |
Main entry point for command processing. Deserializes a JSON document and immediately dispatches the corresponding action.
Main entry point for command processing.
This function acts as a command dispatcher. It reads the command ID from the 'p' key and uses a switch statement for O(1) dispatching. It directly calls functions in other modules (Serializer, Actuators, NetworkClicks) to execute the command. This avoids intermediate state storage (like ResultsHolder) and multiple switch statements in the main loop, maximizing performance. The validation relies on a "validation by convention" approach, where a value of 0 for IDs or commands is treated as invalid, eliminating the need for containsKey checks.
| doc | A const reference to the parsed JsonDocument from EspCom. |

