| @@ -219,7 +219,16 @@ func (rt *dspRuntime) buildSurveillanceResult(art *spectrumArtifacts) pipeline.S | |||||
| policy := pipeline.PolicyFromConfig(rt.cfg) | policy := pipeline.PolicyFromConfig(rt.cfg) | ||||
| candidates := pipeline.CandidatesFromSignals(art.detected, "surveillance-detector") | candidates := pipeline.CandidatesFromSignals(art.detected, "surveillance-detector") | ||||
| scheduled := pipeline.ScheduleCandidates(candidates, policy) | scheduled := pipeline.ScheduleCandidates(candidates, policy) | ||||
| level := pipeline.AnalysisLevel{ | |||||
| Name: "surveillance", | |||||
| SampleRate: rt.cfg.SampleRate, | |||||
| FFTSize: rt.cfg.Surveillance.AnalysisFFTSize, | |||||
| CenterHz: rt.cfg.CenterHz, | |||||
| SpanHz: float64(rt.cfg.SampleRate), | |||||
| Source: "baseband", | |||||
| } | |||||
| return pipeline.SurveillanceResult{ | return pipeline.SurveillanceResult{ | ||||
| Level: level, | |||||
| Candidates: candidates, | Candidates: candidates, | ||||
| Scheduled: scheduled, | Scheduled: scheduled, | ||||
| Finished: art.finished, | Finished: art.finished, | ||||
| @@ -262,7 +271,16 @@ func (rt *dspRuntime) buildRefinementInput(surv pipeline.SurveillanceResult) pip | |||||
| Source: windowSource, | Source: windowSource, | ||||
| }) | }) | ||||
| } | } | ||||
| level := pipeline.AnalysisLevel{ | |||||
| Name: "refinement", | |||||
| SampleRate: rt.cfg.SampleRate, | |||||
| FFTSize: rt.cfg.FFTSize, | |||||
| CenterHz: rt.cfg.CenterHz, | |||||
| SpanHz: float64(rt.cfg.SampleRate), | |||||
| Source: "refinement-window", | |||||
| } | |||||
| input := pipeline.RefinementInput{ | input := pipeline.RefinementInput{ | ||||
| Level: level, | |||||
| Candidates: append([]pipeline.Candidate(nil), surv.Candidates...), | Candidates: append([]pipeline.Candidate(nil), surv.Candidates...), | ||||
| Scheduled: scheduled, | Scheduled: scheduled, | ||||
| Plan: plan, | Plan: plan, | ||||
| @@ -2,7 +2,17 @@ package pipeline | |||||
| import "sdr-wideband-suite/internal/detector" | import "sdr-wideband-suite/internal/detector" | ||||
| type AnalysisLevel struct { | |||||
| Name string `json:"name"` | |||||
| SampleRate int `json:"sample_rate"` | |||||
| FFTSize int `json:"fft_size"` | |||||
| CenterHz float64 `json:"center_hz"` | |||||
| SpanHz float64 `json:"span_hz"` | |||||
| Source string `json:"source,omitempty"` | |||||
| } | |||||
| type SurveillanceResult struct { | type SurveillanceResult struct { | ||||
| Level AnalysisLevel `json:"level"` | |||||
| Candidates []Candidate `json:"candidates"` | Candidates []Candidate `json:"candidates"` | ||||
| Scheduled []ScheduledCandidate `json:"scheduled,omitempty"` | Scheduled []ScheduledCandidate `json:"scheduled,omitempty"` | ||||
| Finished []detector.Event `json:"finished"` | Finished []detector.Event `json:"finished"` | ||||
| @@ -21,6 +31,7 @@ type RefinementPlan struct { | |||||
| } | } | ||||
| type RefinementInput struct { | type RefinementInput struct { | ||||
| Level AnalysisLevel `json:"level"` | |||||
| Candidates []Candidate `json:"candidates,omitempty"` | Candidates []Candidate `json:"candidates,omitempty"` | ||||
| Scheduled []ScheduledCandidate `json:"scheduled,omitempty"` | Scheduled []ScheduledCandidate `json:"scheduled,omitempty"` | ||||
| Plan RefinementPlan `json:"plan,omitempty"` | Plan RefinementPlan `json:"plan,omitempty"` | ||||
| @@ -29,6 +29,7 @@ func TestSurveillanceResultCarriesScheduledCandidates(t *testing.T) { | |||||
| func TestRefinementInputCarriesScheduledCandidates(t *testing.T) { | func TestRefinementInputCarriesScheduledCandidates(t *testing.T) { | ||||
| res := RefinementInput{ | res := RefinementInput{ | ||||
| Level: AnalysisLevel{Name: "refinement"}, | |||||
| Candidates: []Candidate{{ID: 2}}, | Candidates: []Candidate{{ID: 2}}, | ||||
| Scheduled: []ScheduledCandidate{{Candidate: Candidate{ID: 2}, Priority: 4}}, | Scheduled: []ScheduledCandidate{{Candidate: Candidate{ID: 2}, Priority: 4}}, | ||||
| Plan: RefinementPlan{ | Plan: RefinementPlan{ | ||||