Lets up to 4 radio stations (name + stream URL) be (re)configured at runtime through a BLE form built with GattForm, persisted across reboots.
RadioStation/applySubmittedStation() (bundled in this same package)
implement the rule applied to each slot on a form submission — no
BLE/Preferences dependency, so that part is covered by fast native unit
tests — see test/test_native.
#include <RadioStationsUnderGattForm.h>
RadioStationsUnderGattForm stationManager;
void setup() {
auto stations = stationManager.listStations();
// ... feed `stations` to whatever plays them ...
}
// Call these from wherever fits your app (a menu item, a button press, ...):
// stationManager.startProvisioning(); // opens the BLE form to (re)configure slots
// stationManager.stopProvisioning();
// stationManager.clearStations(); // wipes every stored slotThis library ships its own platformio.ini (dev/test harness only — not used
by projects that depend on it):
# Fast unit tests (applySubmittedStation()), no hardware required
pio test -e native
# Persistence tests (Preferences/NVS) + _applySubmission, run on an actual ESP32 board
pio test -e esp32devCI runs pio test -e native on every push/PR (no hardware available in
CI, so esp32dev stays a local/manual check) — see
.github/workflows/tests.yml.
src/RadioStationsUnderGattForm.h/.cpp Public facade: provisioning, persistence, listStations()
src/RadioStation.h/.cpp RadioStation + applySubmittedStation(), hardware-independent
test/test_native/ Unit tests for applySubmittedStation(), run on the host
test/test_embedded/ Integration tests (Preferences persistence), run on an ESP32 board