File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44share
55fyne-cross
66dist /
7- completions /
7+ completions /
8+ research
9+
Original file line number Diff line number Diff line change @@ -35,7 +35,11 @@ var eqProfileCmd = &cobra.Command{
3535 Args : cobra .MaximumNArgs (1 ),
3636 Run : func (cmd * cobra.Command , _ []string ) {
3737 ctx := cmd .Context ()
38- eqProfile , _ := currentSpeaker .GetEQProfileV2 (ctx )
38+ eqProfile , err := currentSpeaker .GetEQProfileV2 (ctx )
39+ if err != nil {
40+ fmt .Fprintf (cmd .ErrOrStderr (), "Error getting EQ profile: %v\n " , err )
41+ return
42+ }
3943 fmt .Println (eqProfile )
4044 },
4145}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ type EQProfileV2 struct {
1313 Balance int `json:"balance"` // Left/right balance (-10 to +10)
1414 BassExtension string `json:"bassExtension"` // Bass extension mode: "less", "standard", or "more"
1515 DeskMode bool `json:"deskMode"` // Whether desk mode is enabled
16- DeskModeSetting int `json:"deskModeSetting"` // Desk mode compensation level
16+ DeskModeSetting float32 `json:"deskModeSetting"` // Desk mode compensation level
1717 HighPassMode bool `json:"highPassMode"` // Whether high-pass filter is enabled (for use with subwoofer)
1818 HighPassModeFreq int `json:"highPassModeFreq"` // High-pass filter frequency in Hz
1919 IsExpertMode bool `json:"isExpertMode"` // Whether expert mode is enabled
@@ -38,7 +38,14 @@ type EQProfileV2 struct {
3838// Each source can have its own EQ profile settings.
3939func (s * KEFSpeaker ) GetEQProfileV2 (ctx context.Context ) (EQProfileV2 , error ) {
4040 eqProfile , err := JSONUnmarshalValue (s .getData (ctx , "kef:eqProfile/v2" ))
41- return eqProfile .(EQProfileV2 ), err
41+ if err != nil {
42+ return EQProfileV2 {}, err
43+ }
44+ profile , ok := eqProfile .(EQProfileV2 )
45+ if ! ok {
46+ return EQProfileV2 {}, ErrUnknownType
47+ }
48+ return profile , nil
4249}
4350
4451// String returns the EQ profile as a formatted JSON string.
Original file line number Diff line number Diff line change @@ -29,9 +29,10 @@ const (
2929
3030// Common errors.
3131var (
32- ErrConnectionRefused = errors .New ("connection refused" )
33- ErrConnectionTimeout = errors .New ("connection timed out" )
34- ErrHostNotFound = errors .New ("host not found" )
32+ ErrConnectionRefused = errors .New ("connection refused" )
33+ ErrConnectionTimeout = errors .New ("connection timed out" )
34+ ErrHostNotFound = errors .New ("host not found" )
35+ ErrInvalidJSONResponse = errors .New ("invalid JSON response" )
3536)
3637
3738// KEFPostRequest represents the JSON structure for POST requests to the KEF API.
You can’t perform that action at this time.
0 commit comments