Kiosk: schedule client (conditional GET + atomic cache) and engine

Adds api_client support for GET /licenses/{key}/schedule with If-None-Match
and target-payload parsing (version/type/daily/weekly + legacy blocks), an
atomic on-disk schedule cache, a pure schedule engine (half-open blocks,
midnight self-wrap for daily, Sunday->Monday spillover for weekly, invalid
blocks skipped with a warning), and a background ScheduleManager that loads
the cache offline and pulls on boot and every 5 minutes. Adds engine/cache
tests against the shared docs/fixtures, including 304, corrupt cache, and
offline cases.
This commit is contained in:
NeilClack
2026-09-29 10:34:40 -05:00
parent b93fb8d2df
commit 509c925480
12 changed files with 1160 additions and 2 deletions
+19
View File
@@ -43,6 +43,7 @@ add_executable(radiantwave
src/settings_menu.cpp
src/system_settings_page.cpp
src/system_name_page.cpp
src/schedule_toggle_page.cpp
src/wifi_setup_page.cpp
src/audio_settings_page.cpp
src/audio/audio_manager.cpp
@@ -62,6 +63,9 @@ add_executable(radiantwave
src/network/license_status.cpp
src/network/system_name.cpp
src/network/system_name_sync.cpp
src/network/schedule_cache.cpp
src/schedule/schedule_engine.cpp
src/schedule/schedule_manager.cpp
src/config/yaml_parser.cpp
src/config/config_manager.cpp
src/db/database_manager.cpp
@@ -253,6 +257,21 @@ add_executable(test_system_name
target_include_directories(test_system_name PRIVATE src)
target_link_libraries(test_system_name PRIVATE GTest::gtest_main SQLite3::SQLite3)
# Schedule engine + cache tests (payload parsing, evaluation, offline cache)
add_executable(test_schedule_engine
tests/test_schedule_engine.cpp
src/schedule/schedule_engine.cpp
src/schedule/schedule_manager.cpp
src/network/schedule_cache.cpp
src/network/api_client.cpp
src/network/json.cpp
src/db/database_manager.cpp
)
target_include_directories(test_schedule_engine PRIVATE src)
target_link_libraries(test_schedule_engine PRIVATE GTest::gtest_main CURL::libcurl SQLite3::SQLite3)
target_compile_definitions(test_schedule_engine PRIVATE
RWT_FIXTURES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/docs/fixtures")
# TimeZone unit tests
add_executable(test_timezone
tests/test_timezone.cpp