# robotastic/trunk-recorder architecture

> Architecture diagram of the GitHub repository robotastic/trunk-recorder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/robotastic/trunk-recorder
- Repository: https://github.com/robotastic/trunk-recorder

## Overview

##### Main System Components

a) Input Layer:
- SDR Hardware Interface (RTL-SDR, HackRF, USRP, etc.)
- IQ File Source (for playback)

b) Signal Processing Layer:
- GNU Radio Processing Blocks
- Channelizer
- Decoders (P25, DMR, Analog)
- Signal Detection

c) Recording Layer:
- Analog Recorder
- P25 Recorder
- DMR Recorder
- SigMF Recorder
- Debug Recorder

d) Plugin System:
- Plugin Manager
- Various Upload Plugins (Broadcastify, OpenMHz, RDIOScanner)
- Status/Statistics Plugins

e) Control & Management:
- System Monitor
- Configuration Manager
- Call Concluder
- Talkgroup Manager

##### Relationships and Data Flow

**[SDR Hardware] → [GNU Radio Blocks] → [Signal Processing] → [Recorders] → [Storage/Upload]**
- ↑                      ↑                  ↑

- [Control Channel] → [Trunking Manager] → [Call Manager]
- ↓
- [Plugin System]

##### Technical Details

- GNU Radio version compatibility (3.7 - 3.10)
- Supported voice formats (P25 Phase 1/2, DMR, Analog)
- Control channel monitoring paths
- Recording format outputs
- Plugin API interfaces

##### Implementation Notes

- Use UML-style notation for class relationships
- Interface definitions between major components
- Threading model for parallel processing
- Configuration input points

##### External Integrations

- Connections to OpenMHz
- Broadcastify integration points
- Websocket interfaces
- Plugin extension points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        SDR["SDR Hardware Interface"]:::input
        IQ["IQ File Source"]:::input
    end

    subgraph SignalProcessing
        GNURadio["GNU Radio Blocks"]:::processing
        Channelizer["Channelizer"]:::processing
        SigDetect["Signal Detection"]:::processing
        subgraph Decoders
            P25Dec["P25 Decoder"]:::decoder
            DMRDec["DMR Decoder"]:::decoder
            AnalogDec["Analog Decoder"]:::decoder
        end
    end

    subgraph Recording
        P25Rec["P25 Recorder"]:::recorder
        DMRRec["DMR Recorder"]:::recorder
        AnalogRec["Analog Recorder"]:::recorder
        SigMFRec["SigMF Recorder"]:::recorder
        DebugRec["Debug Recorder"]:::recorder
    end

    subgraph TrunkingSystems
        P25Trunk["P25 Trunking"]:::trunking
        SmartNet["SmartNet Trunking"]:::trunking
        ControlChannel["Control Channel"]:::trunking
    end

    subgraph Management
        Config["Configuration Manager"]:::management
        TalkGrpMgr["Talkgroup Manager"]:::management
        CallConcluder["Call Concluder"]:::management
        SysMon["System Monitor"]:::management
    end

    subgraph Plugins
        PluginMgr["Plugin Manager"]:::plugin
        subgraph Uploaders
            Broadcastify["Broadcastify"]:::uploader
            OpenMHz["OpenMHz"]:::uploader
            RDIOScanner["RDIOScanner"]:::uploader
        end
    end

    SDR --> GNURadio
    IQ --> GNURadio
    GNURadio --> Channelizer
    Channelizer --> SigDetect
    SigDetect --> P25Dec
    SigDetect --> DMRDec
    SigDetect --> AnalogDec

    P25Dec --> P25Rec
    DMRDec --> DMRRec
    AnalogDec --> AnalogRec
    SigDetect --> SigMFRec
    SigDetect --> DebugRec

    ControlChannel --> P25Trunk
    ControlChannel --> SmartNet
    P25Trunk --> TalkGrpMgr
    SmartNet --> TalkGrpMgr

    Config --> SysMon
    TalkGrpMgr --> CallConcluder
    SysMon --> PluginMgr

    P25Rec --> PluginMgr
    DMRRec --> PluginMgr
    AnalogRec --> PluginMgr
    SigMFRec --> PluginMgr

    PluginMgr --> Broadcastify
    PluginMgr --> OpenMHz
    PluginMgr --> RDIOScanner

    %% Click events for component mapping
    click IQ "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/sources/iq_file_source.h"
    click SDR "https://github.com/robotastic/trunk-recorder/blob/master/cmake/Modules/FindGnuradioOsmosdr.cmake"
    click Channelizer "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/gr_blocks/channelizer.h"
    click SigDetect "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/gr_blocks/signal_detector_cvf.h"
    click Decoders "https://github.com/robotastic/trunk-recorder/tree/master/trunk-recorder/gr_blocks/decoders/"
    click AnalogRec "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/recorders/analog_recorder.h"
    click P25Rec "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/recorders/p25_recorder.h"
    click DMRRec "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/recorders/dmr_recorder.h"
    click SigMFRec "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/recorders/sigmf_recorder.h"
    click DebugRec "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/recorders/debug_recorder.h"
    click PluginMgr "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/plugin_manager/plugin_manager.h"
    click Broadcastify "https://github.com/robotastic/trunk-recorder/blob/master/plugins/broadcastify_uploader/broadcastify_uploader.cc"
    click OpenMHz "https://github.com/robotastic/trunk-recorder/blob/master/plugins/openmhz_uploader/openmhz_uploader.cc"
    click RDIOScanner "https://github.com/robotastic/trunk-recorder/blob/master/plugins/rdioscanner_uploader/rdioscanner_uploader.cc"
    click CallConcluder "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/call_concluder/call_concluder.h"
    click Config "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/config.h"
    click TalkGrpMgr "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/talkgroups.h"
    click SysMon "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/monitor_systems.h"
    click P25Trunk "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/systems/p25_trunking.h"
    click SmartNet "https://github.com/robotastic/trunk-recorder/blob/master/trunk-recorder/systems/smartnet_trunking.h"

    %% Styling
    classDef input fill:#a8e6cf
    classDef processing fill:#dcedc1
    classDef decoder fill:#ffd3b6
    classDef recorder fill:#ffaaa5
    classDef trunking fill:#ff8b94
    classDef management fill:#98ddca
    classDef plugin fill:#d4a5a5
    classDef uploader fill:#ffb6b9

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Signal Processing"]:::processing
        L3["Decoders"]:::decoder
        L4["Recorders"]:::recorder
        L5["Trunking Systems"]:::trunking
        L6["Management"]:::management
        L7["Plugin System"]:::plugin
        L8["Uploaders"]:::uploader
    end
```
