# opendsh/dash architecture

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

- Interactive diagram: https://gitdiagram.com/opendsh/dash
- Repository: https://github.com/opendsh/dash

## Overview

##### Project Type and Purpose
- Project Type: OpenDash is a full-fledged infotainment system that acts as a user interface layer on top of OpenAuto. It integrates multimedia controls, vehicle diagnostics (OBD-II and CAN bus), and several services (like Bluetooth and a plugin system).
- Purpose: It is designed to manage in-car interfaces including windowed/fullscreen OpenAuto integration, theming (dark/light modes), app launching, media streaming (camera), and vehicle data processing. It also allows extensibility through plugins (brightness, launcher, radio, vehicle).

##### File Structure to Identify Main Components
- Core Application
- Directories: src/app, include/app – these contain primary application logic, UI components (pages, widgets, quick_views), and services (Bluetooth, clock, server).
- Vehicle Interfaces
- Directories: include/canbus, src/canbus and include/obd, src/obd – these suggest a hardware communication layer for vehicle diagnostics (OBD-II) and CAN bus communications.
- Plugin System
- Directories: plugins and include/plugins – multiple plugin folders (brightness, launcher, radio, vehicle) show an extensible architecture for adding new functions.
- Build and Configuration
- CMakeLists.txt at the top-level along with the cmake_modules directory – these files signal a CMake-based build system with customized find modules for external dependencies (e.g., GStreamer, openauto, libusb, etc.).
- Supporting Files
- Installation and automation scripts (install.sh, autostart.sh, rpi.sh) and GitHub workflows indicate CI/CD integration and automated deployment paths.

##### Final Recommendations for the Principal Software Engineer
- Every major component is clearly labeled and represented.
- Make a note on how the build system (CMake, custom scripts, CI/CD) integrates all parts and flows into the final deployable application.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI/Frontend (Qt)
    subgraph "UI/Frontend (Qt)"
        UI_App("Application Code")
        UI_Assets("UI Assets")
        UI_Styles_Dark("Dark Theme")
        UI_Styles_Light("Light Theme")
        UI_AA_Video("AA Video")
        UI_Camera_Video("Camera Video")
    end

    %% Core Application Logic & Services
    subgraph "Core Application Logic"
        Core_Services("AAHandler & Base Logic")
        Core_Bluetooth("Bluetooth Service")
        Core_ClockServer("Clock&Server Services")
    end

    %% Vehicle Data Interfaces
    subgraph "Vehicle Data Interfaces"
        Veh_CAN("CAN Bus")
        Veh_OBD("OBD Modules")
    end

    %% Plugin Architecture
    subgraph "Plugin Modules"
        Plugin_Brightness("Brightness Plugin")
        Plugin_Launcher("Launcher Plugin")
        Plugin_Radio("Radio Plugin")
        Plugin_Vehicle("Vehicle Plugin")
    end

    %% Build & Configuration Layer
    subgraph "Build System & Automation"
        Build_CMake("CMake & Modules")
        Build_Scripts("Scripts&CI/CD")
    end

    %% Interactions
    UI_App -->|"triggers"| Core_Services
    Veh_CAN -->|"feeds"| Core_Services
    Veh_OBD -->|"feeds"| Core_Services
    Veh_CAN -->|"updates"| UI_App
    Veh_OBD -->|"updates"| UI_App
    Core_Services -->|"extends"| Plugin_Brightness
    Core_Services -->|"extends"| Plugin_Launcher
    Core_Services -->|"extends"| Plugin_Radio
    Core_Services -->|"extends"| Plugin_Vehicle
    Build_CMake -->|"builds"| UI_App
    Build_CMake -->|"builds"| Core_Services
    Build_CMake -->|"builds"| Veh_CAN
    Build_CMake -->|"builds"| Veh_OBD
    Build_Cmake -->|"builds"| Plugin_Brightness
    Build_Cmake -->|"builds"| Plugin_Launcher
    Build_Cmake -->|"builds"| Plugin_Radio
    Build_Cmake -->|"builds"| Plugin_Vehicle
    Build_Scripts -->|"deploys"| UI_App
    Build_Scripts -->|"deploys"| Core_Services
    Build_Scripts -->|"deploys"| Veh_CAN
    Build_Scripts -->|"deploys"| Veh_OBD
    Build_Scripts -->|"deploys"| Plugin_Brightness
    Build_Scripts -->|"deploys"| Plugin_Launcher
    Build_Scripts -->|"deploys"| Plugin_Radio
    Build_Scripts -->|"deploys"| Plugin_Vehicle

    %% Click Events for UI/Frontend Component
    click UI_App "https://github.com/opendsh/dash/tree/develop/src/app"
    click UI_Assets "https://github.com/opendsh/dash/tree/develop/assets"
    click UI_Styles_Dark "https://github.com/opendsh/dash/blob/develop/assets/stylesheets/dark.qss"
    click UI_Styles_Light "https://github.com/opendsh/dash/blob/develop/assets/stylesheets/light.qss"
    click UI_AA_Video "https://github.com/opendsh/dash/blob/develop/assets/aa_video.qml"
    click UI_Camera_Video "https://github.com/opendsh/dash/blob/develop/assets/camera_video.qml"

    %% Click Events for Core Application Logic & Services
    click Core_Services "https://github.com/opendsh/dash/tree/develop/src/app"
    click Core_Bluetooth "https://github.com/opendsh/dash/blob/develop/include/app/services/bluetooth.hpp"
    click Core_ClockServer "https://github.com/opendsh/dash/blob/develop/include/app/services/clock.hpp"

    %% Click Events for Vehicle Communication Interfaces
    click Veh_CAN "https://github.com/opendsh/dash/tree/develop/include/canbus"
    click Veh_OBD "https://github.com/opendsh/dash/tree/develop/include/obd"

    %% Click Events for Plugin Architecture
    click Plugin_Brightness "https://github.com/opendsh/dash/tree/develop/plugins/brightness"
    click Plugin_Launcher "https://github.com/opendsh/dash/tree/develop/plugins/launcher/app"
    click Plugin_Radio "https://github.com/opendsh/dash/tree/develop/plugins/radio/rtl_sdr"
    click Plugin_Vehicle "https://github.com/opendsh/dash/tree/develop/plugins/vehicle"

    %% Click Events for Build & Configuration Layer
    click Build_CMake "https://github.com/opendsh/dash/blob/develop/CMakeLists.txt"
    click Build_Scripts "https://github.com/opendsh/dash/blob/develop/install.sh"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef core fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef vehicle fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef plugin fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef build fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;

    class UI_App,UI_Assets,UI_Styles_Dark,UI_Styles_Light,UI_AA_Video,UI_Camera_Video ui;
    class Core_Services,Core_Bluetooth,Core_ClockServer core;
    class Veh_CAN,Veh_OBD vehicle;
    class Plugin_Brightness,Plugin_Launcher,Plugin_Radio,Plugin_Vehicle plugin;
    class Build_Cmake,Build_Scripts build
```
