From d16b6cd3cc38e46ef7ed9983530bc08d5011e4a1 Mon Sep 17 00:00:00 2001 From: Jan Svabenik Date: Sat, 21 Mar 2026 21:29:09 +0100 Subject: [PATCH] feat: add surveillance/display level metadata --- cmd/sdrd/phase_state_test.go | 2 +- cmd/sdrd/pipeline_runtime.go | 24 +++++++++++++++++------- internal/pipeline/phases.go | 16 +++++++++------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/cmd/sdrd/phase_state_test.go b/cmd/sdrd/phase_state_test.go index 9438501..ab29a04 100644 --- a/cmd/sdrd/phase_state_test.go +++ b/cmd/sdrd/phase_state_test.go @@ -8,7 +8,7 @@ import ( func TestPhaseStateCarriesPhaseResults(t *testing.T) { ps := &phaseState{ - surveillance: pipeline.SurveillanceResult{NoiseFloor: -90, Scheduled: []pipeline.ScheduledCandidate{{Candidate: pipeline.Candidate{ID: 1}, Priority: 5}}}, + surveillance: pipeline.SurveillanceResult{Level: pipeline.AnalysisLevel{Name: "surveillance"}, NoiseFloor: -90, Scheduled: []pipeline.ScheduledCandidate{{Candidate: pipeline.Candidate{ID: 1}, Priority: 5}}}, refinementInput: pipeline.RefinementInput{Scheduled: []pipeline.ScheduledCandidate{{Candidate: pipeline.Candidate{ID: 1}, Priority: 5}}, SampleRate: 2048000, FFTSize: 2048, CenterHz: 7.1e6}, refinement: pipeline.RefinementResult{Level: pipeline.AnalysisLevel{Name: "refinement"}, Decisions: []pipeline.SignalDecision{{ShouldRecord: true}}, Candidates: []pipeline.Candidate{{ID: 1}}}, queueStats: decisionQueueStats{RecordQueued: 1}, diff --git a/cmd/sdrd/pipeline_runtime.go b/cmd/sdrd/pipeline_runtime.go index 465c99e..a9d8484 100644 --- a/cmd/sdrd/pipeline_runtime.go +++ b/cmd/sdrd/pipeline_runtime.go @@ -229,14 +229,24 @@ func (rt *dspRuntime) buildSurveillanceResult(art *spectrumArtifacts) pipeline.S SpanHz: float64(rt.cfg.SampleRate), Source: "baseband", } + displayLevel := pipeline.AnalysisLevel{ + Name: "presentation", + SampleRate: rt.cfg.SampleRate, + FFTSize: rt.cfg.Surveillance.DisplayBins, + CenterHz: rt.cfg.CenterHz, + SpanHz: float64(rt.cfg.SampleRate), + Source: "display", + } return pipeline.SurveillanceResult{ - Level: level, - Candidates: candidates, - Scheduled: scheduled, - Finished: art.finished, - Signals: art.detected, - NoiseFloor: art.noiseFloor, - Thresholds: art.thresholds, + Level: level, + Levels: []pipeline.AnalysisLevel{level}, + DisplayLevel: displayLevel, + Candidates: candidates, + Scheduled: scheduled, + Finished: art.finished, + Signals: art.detected, + NoiseFloor: art.noiseFloor, + Thresholds: art.thresholds, } } diff --git a/internal/pipeline/phases.go b/internal/pipeline/phases.go index 71a4084..f0ceee3 100644 --- a/internal/pipeline/phases.go +++ b/internal/pipeline/phases.go @@ -12,13 +12,15 @@ type AnalysisLevel struct { } type SurveillanceResult struct { - Level AnalysisLevel `json:"level"` - Candidates []Candidate `json:"candidates"` - Scheduled []ScheduledCandidate `json:"scheduled,omitempty"` - Finished []detector.Event `json:"finished"` - Signals []detector.Signal `json:"signals"` - NoiseFloor float64 `json:"noise_floor"` - Thresholds []float64 `json:"thresholds,omitempty"` + Level AnalysisLevel `json:"level"` + Levels []AnalysisLevel `json:"levels,omitempty"` + Candidates []Candidate `json:"candidates"` + Scheduled []ScheduledCandidate `json:"scheduled,omitempty"` + Finished []detector.Event `json:"finished"` + Signals []detector.Signal `json:"signals"` + NoiseFloor float64 `json:"noise_floor"` + Thresholds []float64 `json:"thresholds,omitempty"` + DisplayLevel AnalysisLevel `json:"display_level"` } type RefinementPlan struct {