fix: Add mandatory capability checking for advanced audio endpoints

The official API specification requires that advanced audio endpoints are
only available if the specific capability is listed in GET /capabilities.

## Changes

### Capability Checking Implementation
- GetAudioDSPControls() now checks for 'audiodspcontrols' capability first
- GetAudioProductToneControls() checks for 'audioproducttonecontrols' capability
- GetAudioProductLevelControls() checks for 'audioproductlevelcontrols' capability
- Added hasCapability() helper method for capability verification

### Error Handling
- Clear error messages when advanced features not supported by device
- Graceful degradation for consumer devices without professional features
- Proper validation flow: capability check → endpoint access → validation

### Documentation Updates
- Emphasizes conditional availability based on device capabilities
- Updated API coverage to reflect capability-dependent implementation
- Clarifies that advanced audio controls are professional/high-end features

## Device Behavior

### Consumer Devices (SoundTouch 10, 20, 30)
- Advanced audio methods return clear 'not supported' errors
- Basic audio controls remain fully functional
- No breaking changes to existing functionality

### Professional Devices
- Full access to advanced audio controls when capabilities present
- Automatic capability verification ensures API compliance
- Complete validation and error handling maintained

## API Compliance
- Now correctly implements conditional endpoint availability per API spec
- Aligns with official documentation requirement for capability checking
- Maintains 100% API specification compliance for supported features

This fix ensures the implementation correctly follows the official API
specification's requirement for capability-based feature availability.
This commit is contained in:
Tobias Gesellchen
2026-01-11 00:29:52 +01:00
parent 5e55ab22ae
commit 1f47c763dc
2 changed files with 70 additions and 18 deletions
+14 -7
View File
@@ -307,23 +307,29 @@ Remove individual device from existing zone using official API format.
- **Enhanced**: `CreateZone()`, `AddToZone()`, `RemoveFromZone()` methods via `/setZone`
- **Status**: Provides both official low-level API and enhanced high-level operations
### Advanced Audio Controls ✅ **Implemented**
Professional/high-end device features (only available via `/capabilities` check):
### Advanced Audio Controls ✅ **Conditionally Available**
Professional/high-end device features (only available on devices that list these capabilities):
#### `/audiodspcontrols` - GET/POST ✅ **Implemented**
Access DSP settings including audio modes and video sync delay.
**Implementation**: Available via `GetAudioDSPControls()`, `SetAudioDSPControls()`, `SetAudioMode()`, `SetVideoSyncAudioDelay()` methods
**Availability**: Only available if `audiodspcontrols` is listed in the reply to `GET /capabilities`
**Implementation**: Available via `GetAudioDSPControls()`, `SetAudioDSPControls()`, `SetAudioMode()`, `SetVideoSyncAudioDelay()` methods with automatic capability checking
#### `/audioproducttonecontrols` - GET/POST ✅ **Implemented**
Advanced bass and treble controls (beyond basic `/bass` endpoint).
**Implementation**: Available via `GetAudioProductToneControls()`, `SetAudioProductToneControls()`, `SetAdvancedBass()`, `SetAdvancedTreble()` methods
**Availability**: Only available if `audioproducttonecontrols` is listed in the reply to `GET /capabilities`
**Implementation**: Available via `GetAudioProductToneControls()`, `SetAudioProductToneControls()`, `SetAdvancedBass()`, `SetAdvancedTreble()` methods with automatic capability checking
#### `/audioproductlevelcontrols` - GET/POST ✅ **Implemented**
Speaker level controls for front-center and rear-surround speakers.
**Implementation**: Available via `GetAudioProductLevelControls()`, `SetAudioProductLevelControls()`, `SetFrontCenterSpeakerLevel()`, `SetRearSurroundSpeakersLevel()` methods
**Availability**: Only available if `audioproductlevelcontrols` is listed in the reply to `GET /capabilities`
**Implementation**: Available via `GetAudioProductLevelControls()`, `SetAudioProductLevelControls()`, `SetFrontCenterSpeakerLevel()`, `SetRearSurroundSpeakersLevel()` methods with automatic capability checking
### Clock and Network Endpoints 🔍 **Extra**
These endpoints work with real hardware but are NOT in official API v1.0:
@@ -342,13 +348,14 @@ These endpoints work with real hardware but are NOT in official API v1.0:
- **Total Official Endpoints**: 19
- **Implemented**: 18 (95%)
- **Non-functional**: 1 (5%) - `/trackInfo` times out on real devices
- **Missing Low-Impact**: 0 (0%)
- **Conditionally Available**: 3 (16%) - Advanced audio endpoints require device support
### Feature Coverage: 100%
- ✅ All essential user functionality implemented
- ✅ All core device operations supported
- ✅ All core device operations supported
- ✅ Complete WebSocket event system
- ✅ Full multiroom capabilities
- ✅ Complete advanced audio controls (where supported by device)
- 🔍 Additional features beyond official specification