|
|
|
@@ -112,20 +112,26 @@ func isJSONContentType(r *http.Request) bool { |
|
|
|
} |
|
|
|
|
|
|
|
type ConfigPatch struct { |
|
|
|
FrequencyMHz *float64 `json:"frequencyMHz,omitempty"` |
|
|
|
OutputDrive *float64 `json:"outputDrive,omitempty"` |
|
|
|
StereoEnabled *bool `json:"stereoEnabled,omitempty"` |
|
|
|
PilotLevel *float64 `json:"pilotLevel,omitempty"` |
|
|
|
RDSInjection *float64 `json:"rdsInjection,omitempty"` |
|
|
|
RDSEnabled *bool `json:"rdsEnabled,omitempty"` |
|
|
|
ToneLeftHz *float64 `json:"toneLeftHz,omitempty"` |
|
|
|
ToneRightHz *float64 `json:"toneRightHz,omitempty"` |
|
|
|
ToneAmplitude *float64 `json:"toneAmplitude,omitempty"` |
|
|
|
PS *string `json:"ps,omitempty"` |
|
|
|
RadioText *string `json:"radioText,omitempty"` |
|
|
|
PreEmphasisTauUS *float64 `json:"preEmphasisTauUS,omitempty"` |
|
|
|
LimiterEnabled *bool `json:"limiterEnabled,omitempty"` |
|
|
|
LimiterCeiling *float64 `json:"limiterCeiling,omitempty"` |
|
|
|
FrequencyMHz *float64 `json:"frequencyMHz,omitempty"` |
|
|
|
OutputDrive *float64 `json:"outputDrive,omitempty"` |
|
|
|
StereoEnabled *bool `json:"stereoEnabled,omitempty"` |
|
|
|
PilotLevel *float64 `json:"pilotLevel,omitempty"` |
|
|
|
RDSInjection *float64 `json:"rdsInjection,omitempty"` |
|
|
|
RDSEnabled *bool `json:"rdsEnabled,omitempty"` |
|
|
|
ToneLeftHz *float64 `json:"toneLeftHz,omitempty"` |
|
|
|
ToneRightHz *float64 `json:"toneRightHz,omitempty"` |
|
|
|
ToneAmplitude *float64 `json:"toneAmplitude,omitempty"` |
|
|
|
PS *string `json:"ps,omitempty"` |
|
|
|
RadioText *string `json:"radioText,omitempty"` |
|
|
|
PreEmphasisTauUS *float64 `json:"preEmphasisTauUS,omitempty"` |
|
|
|
LimiterEnabled *bool `json:"limiterEnabled,omitempty"` |
|
|
|
LimiterCeiling *float64 `json:"limiterCeiling,omitempty"` |
|
|
|
AudioGain *float64 `json:"audioGain,omitempty"` |
|
|
|
PI *string `json:"pi,omitempty"` |
|
|
|
PTY *int `json:"pty,omitempty"` |
|
|
|
BS412Enabled *bool `json:"bs412Enabled,omitempty"` |
|
|
|
BS412ThresholdDBr *float64 `json:"bs412ThresholdDBr,omitempty"` |
|
|
|
MpxGain *float64 `json:"mpxGain,omitempty"` |
|
|
|
} |
|
|
|
|
|
|
|
type IngestSaveRequest struct { |
|
|
|
@@ -528,12 +534,21 @@ func (s *Server) handleConfig(w http.ResponseWriter, r *http.Request) { |
|
|
|
if patch.ToneAmplitude != nil { |
|
|
|
next.Audio.ToneAmplitude = *patch.ToneAmplitude |
|
|
|
} |
|
|
|
if patch.AudioGain != nil { |
|
|
|
next.Audio.Gain = *patch.AudioGain |
|
|
|
} |
|
|
|
if patch.PS != nil { |
|
|
|
next.RDS.PS = *patch.PS |
|
|
|
} |
|
|
|
if patch.RadioText != nil { |
|
|
|
next.RDS.RadioText = *patch.RadioText |
|
|
|
} |
|
|
|
if patch.PI != nil { |
|
|
|
next.RDS.PI = *patch.PI |
|
|
|
} |
|
|
|
if patch.PTY != nil { |
|
|
|
next.RDS.PTY = *patch.PTY |
|
|
|
} |
|
|
|
if patch.PreEmphasisTauUS != nil { |
|
|
|
next.FM.PreEmphasisTauUS = *patch.PreEmphasisTauUS |
|
|
|
} |
|
|
|
@@ -555,6 +570,15 @@ func (s *Server) handleConfig(w http.ResponseWriter, r *http.Request) { |
|
|
|
if patch.RDSInjection != nil { |
|
|
|
next.FM.RDSInjection = *patch.RDSInjection |
|
|
|
} |
|
|
|
if patch.BS412Enabled != nil { |
|
|
|
next.FM.BS412Enabled = *patch.BS412Enabled |
|
|
|
} |
|
|
|
if patch.BS412ThresholdDBr != nil { |
|
|
|
next.FM.BS412ThresholdDBr = *patch.BS412ThresholdDBr |
|
|
|
} |
|
|
|
if patch.MpxGain != nil { |
|
|
|
next.FM.MpxGain = *patch.MpxGain |
|
|
|
} |
|
|
|
if err := next.Validate(); err != nil { |
|
|
|
s.mu.Unlock() |
|
|
|
http.Error(w, err.Error(), http.StatusBadRequest) |
|
|
|
|