Initialize the spectrum visualizer pointer before the device type determines
whether a SpectrumVis instance is created. This ensures unsupported or
unexpected device types leave the member in a defined state.
Found by Coverity (UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
GET .../spectrum/history reads the history the spectrum display keeps
for scrolling and reports, over the last seconds and a frequency range
reduced to bins, the per bin maximum, mean and occupancy against a
floor taken as the median of the per bin means, and the signals: each
run of bins above the threshold with its frequency, width, peak, duty
cycle and first and last seen. GET .../spectrum/history/image renders
the same history as a greyscale PNG with its extents in headers.
GLSpectrumInterface gains getSpectrumHistory, which GLSpectrumView
answers from its scroll buffer under its mutex, folding consecutive
rows together by maximum so that at most the rows asked for span the
whole period, since every FFT is a row. Rows taken at another centre or
rate are skipped and counted.
SpectrumVis reads the display while holding its mutex, so the display
is now attached and detached under it, and each side clears the other
on destruction.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Server side for the spectrum paths added to the spec: GET spectrum/report
returns whichever measurement is switched on, POST spectrum/actions
carries autoscale, clearSpectrum, resetMeasurements, freeze and
gotoMarker, and GET spectrum/data returns the power values reduced to a
number of bins. The display actions reach the spectrum through new
GLSpectrumInterface methods that default to doing nothing, so an instance
without a GUI ignores them rather than every caller having to know.
The measurement results are kept as plain values behind a lock and
published once per displayed frame, so a report costs nothing until one is
asked for, and the figures match what is on screen.
Also completes the main spectrum settings, which were only partly carried
over the API, and adds reports that had no way to be read at all: vessels
for AIS, stations for APRS, sondes for Radiosonde, the programme list for
DAB, the RDS programme service name for BFM, and validity flags for the
ADS-B aircraft report so a caller can tell a missing position from one at
zero. Map settings are exposed through their generated setters.
Two fixes found while testing: the frequency scanner dropped the frequency
list because the API calls it "frequencies" and everything downstream
keys it as "frequencySettings", and the spectrum adapters bound a
reference to the error message before init() had allocated one, so every
error path returned no response at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>