Files
Bose-SoundTouch/pkg/speaker/speaker.go
T
Tobias GesellchenandClaude Opus 4.7 c8c38b78e6 refactor(speaker): introduce pkg/speaker leaf for shared protocol constants
The HTTP port and on-device paths for the SoundTouch speaker were
duplicated across pkg/client (unexported) and pkg/service/constants
(under a service-layer prefix). Both spots needed the same values, and
the next round of work (group/persistence handling in the CLI) would
have created a third — or worse, dragged pkg/service into the CLI's
dependency graph just for a port number.

pkg/speaker is a no-deps leaf that holds the speaker-protocol
constants: HTTPPort, the request paths, and the on-device persistence
file locations (now including GroupServiceFileLocation, for the
upcoming stereo-pair sync work). The client library, the service, the
CLI, and tests can all import it without introducing a layering edge.

This commit moves nothing into pkg/speaker that doesn't belong there —
the service-specific constants (provider IDs, file names, date stub,
etc.) stay in pkg/service/constants. Only the genuinely
protocol-level values move.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 23:18:08 +02:00

30 lines
1.2 KiB
Go

// Package speaker holds protocol-level constants for the Bose SoundTouch
// speaker's local API surface: the well-known HTTP port, the request paths
// exposed by every device, and the on-device file locations the migration
// flow needs to know about.
//
// This package is intentionally a leaf with no internal dependencies, so
// any layer can import it (client library, service, CLI, tests) without
// introducing a cycle or a cross-topic edge. Anything speaker-shaped that
// would otherwise be duplicated between packages belongs here.
package speaker
// HTTPPort is the well-known port the SoundTouch device exposes its local
// API on (e.g. /info, /presets, /group).
const HTTPPort = 8090
// Well-known HTTP paths the SoundTouch device serves on HTTPPort.
const (
DeviceInfoPath = "/info"
PresetsPath = "/presets"
RecentsPath = "/recents"
)
// On-device filesystem paths that the migration/sync flow needs to read or
// write over SSH. These live in the device's persistence area and are not
// part of the HTTP surface.
const (
SourcesFileLocation = "/mnt/nv/BoseApp-Persistence/1/Sources.xml"
GroupServiceFileLocation = "/mnt/nv/BoseApp-Persistence/1/GroupService.xml"
)