Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RadioStationsUnderGattForm

Tests

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.

Usage

#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 slot

Testing

This 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 esp32dev

CI 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.

Project structure

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

License

MIT

About

Lets up to 4 radio stations (name + stream URL) be (re)configured at runtime

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages