feat(Player,PlaybackHandler): specific ACK messages for playback.play/stop (F-067)

Every rejection used to reach the caller as "Playback command failed".
Player::command() now returns PlayerCommandResult { ok, message } and
PlaybackHandler forwards the message verbatim:

- busy, missing pid, invalid speed / note_assignments / durations / mode,
  timed|interval without duration, bells disabled, bell overload lockout,
  melody failed to load (incl. 0-byte file), not found without url,
  needs download but no SD card
- success: "Playback started", "Melody download started — …",
  "Playback stopped", and "Already stopped" (stop while idle stays SUCCESS —
  idempotent, goal state reached)

Validation runs before setMelodyAttributes(), so a rejected play no longer
half-applies its fields. Also fixes: url was sticky (a later play of another
pid could download the old URL under the new name); bells.disable let a play
"succeed" and report playing with silent bells; a non-string name/pid
assigned nullptr to std::string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-29 20:17:47 +03:00
co-authored by Claude Opus 5.5
parent 92a0a8d5e8
commit 46a1a2567f
9 changed files with 331 additions and 117 deletions
+8 -1
View File
@@ -204,7 +204,14 @@ public:
* Thread-safe atomic read operation.
*/
bool isEmergencyStopped() const { return _emergencyStop.load(); }
/**
* @brief Whether the bell mechanism master switch (bells.enable/disable) allows playback.
* start() refuses to run while this is false — Player checks it up front so a
* play command can be rejected with a reason instead of "playing" silently.
*/
bool areBellsEnabled() const;
// ═══════════════════════════════════════════════════════════════════════════════
// PERFORMANCE MONITORING
// ═══════════════════════════════════════════════════════════════════════════════