# j-mazz/rf-detector architecture

> Architecture diagram of the GitHub repository j-mazz/rf-detector, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/j-mazz/rf-detector
- Repository: https://github.com/j-mazz/rf-detector

## Overview

rfdet is a streaming RF-energy observation tool: users configure a mock, raw SC16 replay, or optional SoapySDR capture, then receive frequency-band event records and operational health. The documented analysis path is continuous FFT-based detection; events are emitted as begin/update/end records, with bounded pipeline resources and loss accounting. The graph preserves the named runtime modules and README capabilities, but source excerpts cover only CLI orchestration, so internal module-to-module calls are shown only where documented rather than inferred from module names.

Main entry points: [`src/rf/pipeline.cppm`](https://github.com/j-mazz/rf-detector/blob/main/src/rf/pipeline.cppm) (Pipeline System), [`src/main.cpp`](https://github.com/j-mazz/rf-detector/blob/main/src/main.cpp) (CLI Orchestrator), [`src/rf/acquire.cppm`](https://github.com/j-mazz/rf-detector/blob/main/src/rf/acquire.cppm) (Source Adapters), [`src/rf/output.cppm`](https://github.com/j-mazz/rf-detector/blob/main/src/rf/output.cppm) (CSV Events)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Input Sources"]
  node_acquisition["Source Adapters<br/>[acquire.cppm]"]
  node_soapy["Soapy Adapter<br/>[soapy.cppm]"]
end

subgraph group_analysis["Signal Analysis"]
  node_signal["Signal Windows<br/>[signal.cppm]"]
  node_fft["FFT Analysis<br/>[fft.cppm]"]
  node_dsp["Band Detector<br/>[dsp.cppm]"]
  node_simd["SIMD Kernels<br/>[simd.cppm]"]
  node_core["Core Utilities<br/>[core.cppm]"]
end

subgraph group_flow["Pipeline Runtime"]
  node_pipeline["Pipeline System<br/>[pipeline.cppm]"]
  node_memory["Fixed Pools<br/>[memory.cppm]"]
  node_runtime["Stage State<br/>[runtime.cppm]"]
  node_entry["CLI Orchestrator<br/>[main.cpp]"]
end

subgraph group_results["Events and Health"]
  node_csv["CSV Events<br/>[output.cppm]"]
  node_health["Health Monitor<br/>[health.cppm]"]
end

node_operator(("CLI User"))
node_sc16["SC16 Capture"]
node_receiver["SDR Receiver"]
node_eventfile["Event CSV"]

node_operator -->|"configures run"| node_entry
node_sc16 -->|"replayed as samples"| node_acquisition
node_receiver -.->|"provides samples"| node_soapy
node_entry -->|"selects source"| node_acquisition
node_entry -->|"selects device"| node_soapy
node_entry -->|"constructs and initializes"| node_pipeline
node_entry -->|"configures callback"| node_csv
node_entry -->|"reports status"| node_health
node_acquisition -.->|"feeds capture"| node_pipeline
node_pipeline -->|"analyzes windows"| node_signal
node_signal -->|"transforms samples"| node_fft
node_fft -->|"supports detection"| node_dsp
node_dsp -.->|"uses kernels"| node_simd
node_pipeline -->|"uses fixed pools"| node_memory
node_pipeline -.->|"updates counters"| node_runtime
node_pipeline -->|"dispatches events"| node_csv
node_csv -->|"writes records"| node_eventfile
node_health -->|"observes status"| node_runtime
node_pipeline -.->|"uses utilities"| node_core

click node_acquisition "https://github.com/j-mazz/rf-detector/blob/main/src/rf/acquire.cppm"
click node_soapy "https://github.com/j-mazz/rf-detector/blob/main/src/rf/soapy.cppm"
click node_pipeline "https://github.com/j-mazz/rf-detector/blob/main/src/rf/pipeline.cppm"
click node_memory "https://github.com/j-mazz/rf-detector/blob/main/src/rf/memory.cppm"
click node_runtime "https://github.com/j-mazz/rf-detector/blob/main/src/rf/runtime.cppm"
click node_signal "https://github.com/j-mazz/rf-detector/blob/main/src/rf/signal.cppm"
click node_fft "https://github.com/j-mazz/rf-detector/blob/main/src/rf/fft.cppm"
click node_dsp "https://github.com/j-mazz/rf-detector/blob/main/src/rf/dsp.cppm"
click node_simd "https://github.com/j-mazz/rf-detector/blob/main/src/rf/simd.cppm"
click node_core "https://github.com/j-mazz/rf-detector/blob/main/src/rf/core.cppm"
click node_csv "https://github.com/j-mazz/rf-detector/blob/main/src/rf/output.cppm"
click node_health "https://github.com/j-mazz/rf-detector/blob/main/src/rf/health.cppm"
click node_entry "https://github.com/j-mazz/rf-detector/blob/main/src/main.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_acquisition,node_soapy,node_operator toneBlue
class node_signal,node_fft,node_dsp,node_simd,node_core toneAmber
class node_pipeline,node_memory,node_runtime,node_entry toneMint
class node_csv,node_health toneRose
class node_sc16,node_receiver,node_eventfile toneIndigo
```

## Components

### Input Sources

- [Source Adapters](https://github.com/j-mazz/rf-detector/blob/main/src/rf/acquire.cppm): `src/rf/acquire.cppm`
- [Soapy Adapter](https://github.com/j-mazz/rf-detector/blob/main/src/rf/soapy.cppm): `src/rf/soapy.cppm`

### Signal Analysis

- [Signal Windows](https://github.com/j-mazz/rf-detector/blob/main/src/rf/signal.cppm): `src/rf/signal.cppm`
- [FFT Analysis](https://github.com/j-mazz/rf-detector/blob/main/src/rf/fft.cppm): `src/rf/fft.cppm`
- [Band Detector](https://github.com/j-mazz/rf-detector/blob/main/src/rf/dsp.cppm): `src/rf/dsp.cppm`
- [SIMD Kernels](https://github.com/j-mazz/rf-detector/blob/main/src/rf/simd.cppm): `src/rf/simd.cppm`
- [Core Utilities](https://github.com/j-mazz/rf-detector/blob/main/src/rf/core.cppm): `src/rf/core.cppm`

### Pipeline Runtime

- [Pipeline System](https://github.com/j-mazz/rf-detector/blob/main/src/rf/pipeline.cppm): `src/rf/pipeline.cppm`
- [Fixed Pools](https://github.com/j-mazz/rf-detector/blob/main/src/rf/memory.cppm): `src/rf/memory.cppm`
- [Stage State](https://github.com/j-mazz/rf-detector/blob/main/src/rf/runtime.cppm): `src/rf/runtime.cppm`
- [CLI Orchestrator](https://github.com/j-mazz/rf-detector/blob/main/src/main.cpp): `src/main.cpp`

### Events and Health

- [CSV Events](https://github.com/j-mazz/rf-detector/blob/main/src/rf/output.cppm): `src/rf/output.cppm`
- [Health Monitor](https://github.com/j-mazz/rf-detector/blob/main/src/rf/health.cppm): `src/rf/health.cppm`

### Other components

- **CLI User**
- **SC16 Capture**
- **SDR Receiver**
- **Event CSV**

## Connections

- CLI User → CLI Orchestrator: configures run (evidence: `src/main.cpp`)
- SC16 Capture → Source Adapters: replayed as samples (evidence: `README.md`)
- SDR Receiver → Soapy Adapter: provides samples
- CLI Orchestrator → Source Adapters: selects source (evidence: `src/main.cpp`)
- CLI Orchestrator → Soapy Adapter: selects device (evidence: `src/main.cpp`)
- CLI Orchestrator → Pipeline System: constructs and initializes (evidence: `src/main.cpp`)
- CLI Orchestrator → CSV Events: configures callback (evidence: `src/main.cpp`)
- CLI Orchestrator → Health Monitor: reports status (evidence: `src/main.cpp`)
- Source Adapters → Pipeline System: feeds capture
- Pipeline System → Signal Windows: analyzes windows (evidence: `README.md`)
- Signal Windows → FFT Analysis: transforms samples (evidence: `README.md`)
- FFT Analysis → Band Detector: supports detection (evidence: `README.md`)
- Band Detector → SIMD Kernels: uses kernels
- Pipeline System → Fixed Pools: uses fixed pools (evidence: `README.md`)
- Pipeline System → Stage State: updates counters
- Pipeline System → CSV Events: dispatches events (evidence: `README.md`)
- CSV Events → Event CSV: writes records
- Health Monitor → Stage State: observes status (evidence: `README.md`)
- Pipeline System → Core Utilities: uses utilities
