Add preset polish and broadcast metadata (fw 0.8.0).
Ship station reorder, DAB playing ids in presets, RDS PS/RT and DAB DLS in tuner status, Si4684 data-service read, host tests, and UI now-playing lines. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -102,6 +102,21 @@ public:
|
||||
[[nodiscard]] std::expected<void, core::StationListError> removeAt(
|
||||
std::size_t index);
|
||||
|
||||
/**
|
||||
* @brief reorder — move a preset within the list and persist.
|
||||
*
|
||||
* @dname reorder
|
||||
* @param fromIndex Current list position.
|
||||
* @param toIndex Target list position.
|
||||
* @return Ok on success, or StationListError.
|
||||
* @pubstate mutates list_ and NVS on success.
|
||||
*
|
||||
* @author Michele Bigi
|
||||
* @date 2026-07-06
|
||||
*/
|
||||
[[nodiscard]] std::expected<void, core::StationListError> reorder(
|
||||
std::size_t fromIndex, std::size_t toIndex);
|
||||
|
||||
/**
|
||||
* @brief tuneToIndex — recall a saved preset on the tuner.
|
||||
*
|
||||
|
||||
@@ -62,8 +62,8 @@ std::expected<void, core::StationListError> StationService::add(
|
||||
return added;
|
||||
}
|
||||
if (auto saved = persist(); !saved) {
|
||||
list_.removeAt(list_.stations().size() - 1U);
|
||||
return std::unexpected(core::StationListError::Full);
|
||||
(void)list_.removeAt(list_.stations().size() - 1U);
|
||||
return std::unexpected(core::StationListError::PersistFailed);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -75,6 +75,22 @@ std::expected<void, core::StationListError> StationService::removeAt(
|
||||
return removed;
|
||||
}
|
||||
if (auto saved = persist(); !saved) {
|
||||
return std::unexpected(core::StationListError::PersistFailed);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::expected<void, core::StationListError> StationService::reorder(
|
||||
std::size_t fromIndex,
|
||||
std::size_t toIndex)
|
||||
{
|
||||
if (auto moved = list_.move(fromIndex, toIndex); !moved) {
|
||||
return moved;
|
||||
}
|
||||
if (auto saved = persist(); !saved) {
|
||||
if (list_.move(toIndex, fromIndex)) {
|
||||
return std::unexpected(core::StationListError::PersistFailed);
|
||||
}
|
||||
return std::unexpected(core::StationListError::NotFound);
|
||||
}
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user