# covesa/dlt-viewer architecture

> Architecture diagram of the GitHub repository covesa/dlt-viewer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/covesa/dlt-viewer
- Repository: https://github.com/covesa/dlt-viewer

## Overview

##### Project type and purpose
- Desktop application (Qt-based GUI) + companion CLI tool
- Core function: import/parse DLT log streams (files, pcap, MF4), apply filters, view/export results, and send/receive control messages to a DLT daemon.
- Extensible via dynamically loaded plugins.

##### Main components
A. Presentation Layer
1. Qt GUI Application (“DLT Viewer”)
– Source in /src
– Classes: MainWindow, dialogs (filter, search, export, plugin), models/views (table model, proxy filter model), resource manager.
2. Command-line tool (“DLT Commander”)
– Source in /commander
– Parses CLI args, invokes core library to convert/filter logs without GUI.

B. Core Library (/qdlt)
- Parsing & decoding of DLT messages
- Filter engine & filter definition loader
- Plugin management (plugin interface, discovery, loading)
- Connection abstractions (file, stream, TCP/UDP, serial, D-Bus)
- Exporters/importers (text, CSV, DLT re-serialize)

C. Plugin Layer (/plugin)
- Each subfolder is a plugin implementing the qdlt::PluginInterface
- Examples: D-Bus control plugin, file-transfer plugin, segmentation plugin, viewer plugins, dummy/test plugins
- Plugins register commands, UI forms, filters, log storage backends, etc.

D. Data Sources & Sinks
- DLT log files (.dlt), pcap, MF4
- Live DLT daemon (via TCP/UDP/serial/D-Bus)
- Export targets (text, CSV, DLT)
- Project files (.dlp), filter files (.dlf)

E. Build & Deployment
- CMake (CMakeLists.txt in root, commander, parser, plugin, qdlt, src)
- Packaging scripts (scripts/{darwin,linux,windows})
- SDK generation (/sdk)
- CI workflows (.github/workflows/BuildPR.yml)

##### Relationships & data flow
- GUI/CLI ←→ Core Library
– GUI issues parse/load commands and displays filtered messages
– CLI issues parse/load/export commands in silent mode
- Core Library ▶ Plugin Manager ▶ Plugins
– On startup or on user request, core loads plugins from configured paths
– Plugins can register new filters, control commands, UI dialogs
- Core Library ↔ Data Sources
– Reads DLT files or connects to DLT daemon streams
- Core Library ▶ Exporters
– Writes out to text/CSV/DLT via internal exporter modules
- User actions (click/filter) ▶ GUI ▶ Core ▶ Model ▶ GUI update

##### Architectural patterns & design principles
- Layered architecture: Presentation / Application / Core / Plugins / Data
- Plugin pattern: dynamic discovery and loading via qdlt::PluginInterface
- MVC (Qt’s Model/View) in GUI for table display and filtering
- Observer pattern (Qt signals/slots) for event propagation
- Single-responsibility: each module (parser, exporter, UI dialog) encapsulates distinct functionality
- Dependency injection via interfaces (plugins talk to core through abstract classes)

##### Essential elements to capture
- Labels on each component (module name + path if needed)
- Plugin interface boundary between Core and Plugins
- Separation of GUI vs. CLI vs. Core vs. Plugins vs. Data

– two front-ends (GUI, CLI)
– a single, feature-rich core library
– a plugin ecosystem
– external data sources and sinks
– a unified build/deployment process.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        GUI["DLT Viewer (Qt GUI)"]:::presentation
        CLI["DLT Commander (CLI)"]:::presentation
    end

    %% Core Library Layer
    subgraph "Core Library"
        direction TB
        Core["Core Library (qdlt)"]:::core
        PM["Plugin Manager"]:::core
    end

    %% Plugins Layer
    subgraph "Plugin Layer"
        direction TB
        DBUS["D-Bus Plugin"]:::plugin
        STORAGE["Log Storage Plugin"]:::plugin
        SEG["Segmentation Plugin"]:::plugin
        SYSVIEW["System Viewer Plugin"]:::plugin
        TESTRB["Test Robot Plugin"]:::plugin
        VIEWERP["Viewer Plugin"]:::plugin
        FILEXFR["File Transfer Plugin"]:::plugin
        NONVERB["Non-Verbose Plugin"]:::plugin
        DUMMY["Dummy & Examples"]:::plugin
    end

    %% Data Sources & Sinks
    subgraph "Data Sources & Sinks"
        direction TB
        DLTFILES[("DLT Files (.dlt)")]:::external
        PCAPMF4[("PCAP / MF4")]:::external
        DAEMON(("DLT Daemon")):::external
        EXPORT[("Export Targets (text, CSV, DLT)")]:::external
        PROJFILES[("Project & Filter Files")]:::external
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        direction TB
        CMAKE[("CMake & Presets")]:::external
        SCRIPTS[("Packaging Scripts")]:::external
        SDK[("SDK Generation")]:::external
        CI[("CI Workflows")]:::external
    end

    %% Parser Examples
    Parser["Parser Examples"]:::external

    %% Connections
    GUI -->|"uses"| Core
    CLI -->|"uses"| Core
    Core -->|"manages"| PM
    PM -->|"loads plugins"| DBUS & STORAGE & SEG & SYSVIEW & TESTRB & VIEWERP & FILEXFR & NONVERB & DUMMY
    Core -->|"reads"| DLTFILES & PCAPMF4 & DAEMON
    Core -->|"writes"| EXPORT
    Core -->|"loads filters"| PROJFILES
    Core -->|"includes parser examples"| Parser
    CMAKE -->|builds| GUI & CLI & Core & Parser
    SCRIPTS -->|packages| GUI & CLI
    SDK -->|provides| Core
    CI -->|validates| CMAKE & SCRIPTS & SDK

    %% Click Events
    click GUI "https://github.com/covesa/dlt-viewer/tree/master/src/"
    click CLI "https://github.com/covesa/dlt-viewer/tree/master/commander/"
    click Core "https://github.com/covesa/dlt-viewer/tree/master/qdlt/"
    click PM "https://github.com/covesa/dlt-viewer/blob/master/qdlt/qdltpluginmanager.cpp"
    click DBUS "https://github.com/covesa/dlt-viewer/tree/master/plugin/dltdbusplugin/"
    click STORAGE "https://github.com/covesa/dlt-viewer/tree/master/plugin/dltlogstorageplugin/"
    click SEG "https://github.com/covesa/dlt-viewer/tree/master/plugin/dltsegmentationplugin/"
    click SYSVIEW "https://github.com/covesa/dlt-viewer/tree/master/plugin/dltsystemviewerplugin/"
    click TESTRB "https://github.com/covesa/dlt-viewer/tree/master/plugin/dlttestrobotplugin/"
    click VIEWERP "https://github.com/covesa/dlt-viewer/tree/master/plugin/dltviewerplugin/"
    click FILEXFR "https://github.com/covesa/dlt-viewer/tree/master/plugin/filetransferplugin/"
    click NONVERB "https://github.com/covesa/dlt-viewer/tree/master/plugin/nonverboseplugin/"
    click DUMMY "https://github.com/covesa/dlt-viewer/tree/master/plugin/"
    click PROJFILES "https://github.com/covesa/dlt-viewer/tree/master/filters/"
    click CMAKE "https://github.com/covesa/dlt-viewer/blob/master/CMakeLists.txt"
    click SCRIPTS "https://github.com/covesa/dlt-viewer/tree/master/scripts/"
    click SDK "https://github.com/covesa/dlt-viewer/tree/master/sdk/"
    click CI "https://github.com/covesa/dlt-viewer/blob/master/.github/workflows/BuildPR.yml"
    click Parser "https://github.com/covesa/dlt-viewer/tree/master/parser/"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#0366D6;
    classDef core fill:#DFF2BF,stroke:#4F8A10;
    classDef plugin fill:#FFF2CC,stroke:#B07A00;
    classDef external fill:#E8E8E8,stroke:#666666,stroke-dasharray: 5 5;
```
