21#ifndef LSHCORE_COMMUNICATION_ESP_COM_HPP
22#define LSHCORE_COMMUNICATION_ESP_COM_HPP
24#include <ArduinoJson.h>
40#ifndef CONFIG_MSG_PACK
46 void sendJson(
const JsonDocument &json);
50 [[nodiscard]]
auto canPing() -> bool;
Defines build-time configurable parameters for serial communication.
Declares the function to deserialize and dispatch commands received from the ESP bridge.
Perform communication via Serial.
Definition esp_com.cpp:30
uint32_t lastReceivedPayloadTime_ms
Last time a valid payload has been received.
Definition esp_com.cpp:34
auto receiveAndDispatch() -> Deserializer::DispatchResult
Reads from the communication serial port, processes complete messages, and dispatches commands.
Definition esp_com.cpp:79
size_t bytesRead
Number of bytes currently in the inputBuffer.
Definition esp_com.cpp:38
uint32_t lastSentPayloadTime_ms
Last time a payload has been sent.
Definition esp_com.cpp:33
bool firstValidPayloadReceived
True after the first valid payload has been received.
Definition esp_com.cpp:35
auto canPing() -> bool
Ping minimum interval check.
Definition esp_com.cpp:159
void updateLastSentTime()
Set last time payload has been sent to now.
Definition esp_com.cpp:170
auto isConnected() -> bool
Checks if the ESP is considered connected.
Definition esp_com.cpp:185
void sendJson(const JsonDocument &json)
Sends a JsonDocument via Serial.
Definition esp_com.cpp:56
char inputBuffer[constants::espComConfigs::RAW_INPUT_BUFFER_SIZE]
Raw buffer for incoming serial data.
Definition esp_com.cpp:37
void init()
Init serial.
Definition esp_com.cpp:45
constexpr uint16_t RAW_INPUT_BUFFER_SIZE
Final allocated size for the raw serial input buffer.
Definition config.hpp:93
Represents the result of a dispatch operation.
Definition deserializer.hpp:36
Internal bridge that imports user-defined macros into the library's scope.