Skip to content

Add seek command support and refactor controller command API#94

Merged
kahrendt merged 4 commits into
mainfrom
controller-seek-support
Jul 14, 2026
Merged

Add seek command support and refactor controller command API#94
kahrendt merged 4 commits into
mainfrom
controller-seek-support

Conversation

@kahrendt

Copy link
Copy Markdown
Contributor

Wires up the player seek commands that were previously recognized but unsendable: SEEK now carries position_ms and SEEK_RELATIVE carries offset_ms, and the controller state parses the server's seek_max_ms.

Refactors send_command onto a flat ClientCommandControllerObject struct built with designated initializers, replacing the positional optional<volume>/optional<mute> parameters (which would have grown a 4th and 5th positional arg for seek). The old positional overload is kept, marked deprecated for removal in v0.8.0, so existing ESPHome/dev-branch callers keep working until the v0.7.0 migration. The vestigial internal ClientCommandControllerObject/ClientCommandMessage structs are removed in favor of the public struct.

Migrates the TUI example to the struct API and add a Shift+Left/Shift+Right relative-seek keybinding.

kahrendt added 3 commits July 14, 2026 09:17
Wire up the player seek commands that were previously recognized but
unsendable: SEEK now carries position_ms and SEEK_RELATIVE carries
offset_ms, and the controller state parses the server's seek_max_ms.

Refactor send_command onto a flat ClientCommandControllerObject struct
built with designated initializers, replacing the positional
optional<volume>/optional<mute> parameters (which would have grown a 4th
and 5th positional arg for seek). The old positional overload is kept,
marked deprecated for removal in v0.8.0, so existing ESPHome/dev-branch
callers keep working until the v0.7.0 migration. The vestigial internal
ClientCommandControllerObject/ClientCommandMessage structs are removed in
favor of the public struct.

Migrate the TUI example to the struct API and add a Shift+Left/Shift+Right
relative-seek keybinding.
Migrate the Sending Commands examples and the accessor snippet to the
ClientCommandControllerObject designated-initializer API, add SEEK and
SEEK_RELATIVE examples, and note the deprecated positional overload.
Add SEEK/SEEK_RELATIVE to the SendspinControllerCommand reference table,
fix the VOLUME/MUTE field descriptions, and list seek_max_ms among the
controller state fields.
@kahrendt
kahrendt requested a review from Copilot July 14, 2026 14:31
@kahrendt kahrendt added the enhancement New feature or request label Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds full seek support to the controller role by (1) parsing the server-provided seek_max_ms upper bound and (2) making client seek commands sendable with explicit parameters. It also refactors the controller command-sending API to a single struct-based interface to avoid growing positional optional parameters.

Changes:

  • Parse seek_max_ms from server/state controller payloads and expose it via ServerStateControllerObject.
  • Refactor format_client_command_message and controller send_command to use ClientCommandControllerObject, adding position_ms/offset_ms serialization for SEEK/SEEK_RELATIVE.
  • Update tests, docs, and the TUI example (including Shift+Left/Right relative-seek keybindings) to use the struct API.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_protocol.cpp Adds coverage for seek_max_ms parsing and seek/struct-based command serialization behavior.
src/protocol.cpp Implements seek_max_ms parsing and struct-based client/command JSON formatting (including seek fields).
src/protocol_messages.h Removes internal vestigial command message structs; updates client/command formatter declaration to struct-based API.
src/controller_role.cpp Adds struct-based send_command overload and forwards deprecated positional overload into the struct form.
src/controller_role_impl.h Updates Impl API to accept ClientCommandControllerObject.
include/sendspin/controller_role.h Exposes seek_max_ms and defines the public ClientCommandControllerObject (volume/mute/seek params) plus the new send_command overload.
examples/tui_client/tui.cpp Migrates TUI to struct-based commands and adds Shift+Arrow relative-seek handling.
docs/integration-guide.md Updates integration documentation to the struct-based command API and documents seek usage + deprecation notice.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kahrendt
kahrendt enabled auto-merge (squash) July 14, 2026 14:38
@kahrendt
kahrendt merged commit 46f5a4a into main Jul 14, 2026
5 checks passed
@kahrendt
kahrendt deleted the controller-seek-support branch July 14, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants