Skip to content

RaftHelperClasses

Rob Dobson edited this page May 3, 2026 · 1 revision

Raft Helper Classes

Reference index of utility classes provided by RaftCore/components/core/. These are general-purpose helpers reachable from any SysMod or application code.

For high-level subsystems (file system, network, comms, devices) see the dedicated pages linked from Home.

Concurrency and timing

Class Purpose
RaftThreading Cross-platform task / mutex / semaphore wrappers (FreeRTOS on ESP32, std::thread on Linux unit tests).
ThreadSafeQueue<T> Bounded thread-safe queue with optional blocking wait.
RingBuffer<T> Lock-free single-producer / single-consumer ring buffer.
Raft::isTimeout() Wrap-safe timeout check on millis()-style timestamps.
SupervisorStats Per-step timing histogram for SysMod loop work; used by SysManager.

I/O and signals

Class Purpose
DebounceButton Edge-debounced GPIO input with hold/click events.
StatusIndicator LED status patterns (steady, blink, breathe, fault codes).
ConfigPinMap Resolve pin names like "GPIO5" or "D7" from JSON config to numeric pins.
MiniHDLC HDLC byte-stuffing framer with CRC; used by ProtocolRICSerial and ESPOTAUpdate.

Data and parsing

Class / namespace Purpose
RaftJson / RaftJsonIF JSON parser used everywhere — see JSON / RaftJson.
RaftJsonNVS RaftJson backed by ESP NVS (non-volatile storage).
RaftJsonPrefixed Layered JSON view with a path prefix — used to give each SysMod its own subtree.
ExpressionEval Evaluate arithmetic / boolean expressions with named variables.
NumericalFilters Moving-average / IIR / median filters for sensor data.
NamedValueProvider Generic interface for "fetch a named value as int/float/string".
Raft::libb64 Base64 encode/decode.

Persistence and identity

Class Purpose
ArPreferences Arduino-Preferences-compatible key/value store over NVS.
DNSResolver Asynchronous DNS lookup with caching.
getSystemUniqueString() Stable unique string derived from the chip's MAC — used as default MQTT client ID, advertising name suffix, etc.

Logging

Class Purpose
LoggerCore Singleton that fan-outs ESP IDF log records to registered remote loggers.
LOG_I/W/E/D/V Standard ESP IDF log macros — work as-is in Raft.

For remote-logging configuration see LogManager SysMod and Remote Logging.

Architecture

Class Purpose
RaftCoreApp Top-level container: creates SysManager, file system, configuration, REST endpoint manager. Your main.cpp instantiates one of these.
SysManager Owns SysMods and drives the lifecycle. See SysManager.
RaftSysMod Base class for every module. See SysMods.
RestAPIEndpointManager Endpoint registry used by HTTP, BLE, serial — see Adding REST API Endpoints.
CommsCoreIF / CommsChannelManager Channel registry — see Comms Channels.
RaftBusSystem (Bus/) Generic bus abstraction; concrete implementations live in RaftI2C.
RaftDevice Per-device base class used by DeviceManager.

LED pixels

LEDPixels/ provides RMT-driven WS2812 / SK6812 / APA102 strips with effects. Configured purely through JSON.

See LEDPixels overview and LED Pixels JSON Config.

Where to look in the source

All classes listed above live under RaftCore/components/core/. Each folder contains a header that documents its public API; tests for several of them live under RaftCore/unit_tests/ and RaftCore/linux_unit_tests/.

Clone this wiki locally