Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ docker run -p 8050:8050 sdr-docker
## API endpoints

### RX
- `GET /api/status` — system status, RX metrics, peak power
- `GET /api/status` — system status, RX metrics, peak power; includes `sdr_connected` (bool) indicating whether the SDR hardware is currently open
- `GET /api/packets` — poll-and-drain decoded packets (NDJSON)

### TX
Expand Down
1 change: 1 addition & 0 deletions src/stream_web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ def api_status():
cs_stats[chip]["avg_rs_corr_pct"] = round(sum(pcts) / len(pcts), 1)

return jsonify(
sdr_connected=state.rx_connected.is_set(),
devices=dev_list, stats=stats,
td_img=td_b64, td_running=state.td_running,
td_device_id=state.td_target_ntw_id,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_mock_sdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,11 @@ def test_api_status_device_fields(self):
assert isinstance(dev["seq_nums"], list)
assert isinstance(dev["max_energy_dB"], (int, float))
assert "chipset" in dev

def test_api_status_reports_sdr_connected(self):
client = self._client()
# rx_connected reflects whether the SDR hardware is currently open.
state.rx_connected.set()
assert client.get("/api/status").get_json()["sdr_connected"] is True
state.rx_connected.clear()
assert client.get("/api/status").get_json()["sdr_connected"] is False
Loading