LSH-Core
A robust C++ framework for Arduino-based home automation nodes
Loading...
Searching...
No Matches
esp_com.cpp File Reference

Implements the serial communication logic, including sending and receiving data. More...

Include dependency graph for esp_com.cpp:

Namespaces

namespace  EspCom
 Perform communication via Serial.
 

Functions

void EspCom::init ()
 Init serial.
 
void EspCom::sendJson (const JsonDocument &json)
 Sends a JsonDocument via Serial.
 
auto EspCom::receiveAndDispatch () -> Deserializer::DispatchResult
 Reads from the communication serial port, processes complete messages, and dispatches commands.
 
auto EspCom::canPing () -> bool
 Ping minimum interval check.
 
void EspCom::updateLastSentTime ()
 Set last time payload has been sent to now.
 
auto EspCom::isConnected () -> bool
 Checks if the ESP is considered connected.
 

Variables

uint32_t EspCom::lastSentPayloadTime_ms = 0U
 Last time a payload has been sent.
 
uint32_t EspCom::lastReceivedPayloadTime_ms = 0U
 Last time a valid payload has been received.
 
bool EspCom::firstValidPayloadReceived = false
 True after the first valid payload has been received.
 
char EspCom::inputBuffer [constants::espComConfigs::RAW_INPUT_BUFFER_SIZE]
 Raw buffer for incoming serial data.
 
size_t EspCom::bytesRead = 0
 Number of bytes currently in the inputBuffer.
 

Detailed Description

Implements the serial communication logic, including sending and receiving data.

Author
Jacopo Labardi (labodj)

Copyright 2025 Jacopo Labardi

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.