LSH-Core
Deterministic firmware core for Controllino-based Labo Smart Home nodes
 
Loading...
Searching...
No Matches
Deserializer Namespace Reference

Provides the entry point that validates and dispatches one inbound bridge 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.
 

Detailed Description

Provides the entry point that validates and dispatches one inbound bridge payload.

Function Documentation

◆ deserializeAndDispatch()

auto Deserializer::deserializeAndDispatch ( const JsonDocument &  doc) -> DispatchResult

Main entry point for command processing.

Consumes one decoded bridge document and immediately dispatches the corresponding action.

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 bridge runtime is intentionally semi-transparent and may raw-forward payloads it does not need to optimize locally, so this dispatcher is also the final semantic validation boundary for inbound LSH commands. Every scalar that matters semantically is validated explicitly so malformed bridge payloads are rejected here instead of being silently coerced by ArduinoJson conversions.

Parameters
docParsed ArduinoJson document from BridgeSerial, regardless of the active wire codec.
Returns
DispatchResult A struct indicating the side-effects of the command, telling the main loop if a general state update needs to be sent or if network click timers need to be checked.
Here is the call graph for this function:
Here is the caller graph for this function: