# geek95dg/alfa156-headunit architecture

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

- Interactive diagram: https://gitdiagram.com/geek95dg/alfa156-headunit
- Repository: https://github.com/geek95dg/alfa156-headunit

## Overview

BCM is an in-car head unit whose runtime starts configured modules and presents vehicle, media, and navigation functions through dashboard displays. The principal workflow is vehicle inputs and sensors → domain modules → event-driven state and dashboard views. Separate branches cover diagnostics, camera switching, audio, connectivity, and route planning. The graph uses README claims and SOURCE INDEX references where available; unsampled implementations are represented at supported paths, with uncertain wiring omitted.

Main entry points: [`src/dashboard/renderer.py`](https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/renderer.py) (Dashboard renderer), [`main.py`](https://github.com/geek95dg/alfa156-headunit/blob/main/main.py) (Runtime entry), [`src/trip/route_planner.py`](https://github.com/geek95dg/alfa156-headunit/blob/main/src/trip/route_planner.py) (Route planner), [`src/core/event_bus.py`](https://github.com/geek95dg/alfa156-headunit/blob/main/src/core/event_bus.py) (Event bus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime core"]
  node_main["Runtime entry<br/>[main.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_events["Event bus<br/>[event_bus.py]"]
  node_modules["Module catalog<br/>[modules_catalog.py]"]
  node_power["Power lifecycle<br/>[power_manager.py]"]
end

subgraph group_display["Dashboards"]
  node_renderer["Dashboard renderer<br/>[renderer.py]"]
  node_web["Web dashboard<br/>[web_viewer.py]"]
  node_small["Small display<br/>[small_viewer.py]"]
  node_screens["Vehicle screens"]
  node_themes["Dashboard themes<br/>[theme_base.py]"]
  node_tripcomputer["Trip computer<br/>[trip_computer.py]"]
end

subgraph group_vehicle["Vehicle systems"]
  node_obd["K-Line diagnostics<br/>[kwp2000.py]"]
  node_ecu["ECU protocol<br/>[edc15c7.py]"]
  node_parking["Parking sensors<br/>[hcsr04.py]"]
  node_cameras["Camera switching"]
  node_grabber["Camera capture<br/>[ahd_grabber.py]"]
  node_vehiclecontrols["Vehicle controls"]
end

subgraph group_media["Media connectivity"]
  node_audio["Audio pipeline"]
  node_bluetooth["Bluetooth audio<br/>[bluetooth.py]"]
  node_androidauto["Android Auto<br/>[openauto.py]"]
  node_phonebook["Phonebook<br/>[phonebook.py]"]
  node_input["Steering inputs"]
end

subgraph group_travel["Travel services"]
  node_gps["GPS tracking<br/>[gps.py]"]
  node_routes["Route planner<br/>[route_planner.py]"]
  node_weather["Weather<br/>[weather.py]"]
end

node_driver(("Driver"))
node_ors["OpenRouteService"]
node_tomtom["TomTom Traffic"]
node_phone(("Phone"))
node_carinputs(("Vehicle signals"))

node_main -->|"loads"| node_config
node_main -->|"checks modules"| node_modules
node_main -->|"starts"| node_renderer
node_main -->|"starts"| node_web
node_main -->|"starts"| node_tripcomputer
node_main -->|"starts"| node_routes
node_renderer -->|"uses"| node_themes
node_renderer -->|"uses"| node_screens
node_renderer -->|"uses"| node_tripcomputer
node_renderer -->|"uses"| node_web
node_driver -.->|"views"| node_renderer
node_driver -.->|"uses"| node_web
node_driver -.->|"operates"| node_input
node_power -->|"publishes state"| node_events
node_carinputs -.->|"signals ignition"| node_power
node_carinputs -->|"signals gear and blinkers"| node_cameras
node_cameras -->|"selects feed"| node_grabber
node_cameras -->|"publishes feed"| node_events
node_obd -->|"uses protocol"| node_ecu
node_parking -.->|"publishes readings"| node_events
node_vehiclecontrols -.->|"exchanges signals"| node_events
node_bluetooth -->|"streams audio"| node_phone
node_androidauto -->|"provides projection"| node_driver
node_audio -.->|"plays sources"| node_bluetooth
node_phonebook -.->|"uses connection"| node_bluetooth
node_input -.->|"dispatches actions"| node_events
node_gps -.->|"provides location"| node_routes
node_routes -->|"requests directions"| node_ors
node_routes -->|"requests traffic"| node_tomtom
node_weather -.->|"feeds dashboard"| node_renderer
node_routes -->|"provides plans"| node_renderer
node_carinputs -.->|"supports parking"| node_parking

click node_main "https://github.com/geek95dg/alfa156-headunit/blob/main/main.py"
click node_config "https://github.com/geek95dg/alfa156-headunit/blob/main/src/core/config.py"
click node_events "https://github.com/geek95dg/alfa156-headunit/blob/main/src/core/event_bus.py"
click node_modules "https://github.com/geek95dg/alfa156-headunit/blob/main/src/core/modules_catalog.py"
click node_power "https://github.com/geek95dg/alfa156-headunit/blob/main/src/power/power_manager.py"
click node_renderer "https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/renderer.py"
click node_web "https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/web_viewer.py"
click node_small "https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/small_viewer.py"
click node_screens "https://github.com/geek95dg/alfa156-headunit/tree/main/src/dashboard/screens"
click node_themes "https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/themes/theme_base.py"
click node_tripcomputer "https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/trip_computer.py"
click node_obd "https://github.com/geek95dg/alfa156-headunit/blob/main/src/obd/kwp2000.py"
click node_ecu "https://github.com/geek95dg/alfa156-headunit/blob/main/src/obd/edc15c7.py"
click node_parking "https://github.com/geek95dg/alfa156-headunit/blob/main/src/parking/hcsr04.py"
click node_cameras "https://github.com/geek95dg/alfa156-headunit/blob/main/src/camera/camera_controller.py"
click node_grabber "https://github.com/geek95dg/alfa156-headunit/blob/main/src/camera/ahd_grabber.py"
click node_vehiclecontrols "https://github.com/geek95dg/alfa156-headunit/tree/main/src/vehicle"
click node_audio "https://github.com/geek95dg/alfa156-headunit/tree/main/src/audio"
click node_bluetooth "https://github.com/geek95dg/alfa156-headunit/blob/main/src/multimedia/bluetooth.py"
click node_androidauto "https://github.com/geek95dg/alfa156-headunit/blob/main/src/multimedia/openauto.py"
click node_phonebook "https://github.com/geek95dg/alfa156-headunit/blob/main/src/multimedia/phonebook.py"
click node_input "https://github.com/geek95dg/alfa156-headunit/tree/main/src/input"
click node_gps "https://github.com/geek95dg/alfa156-headunit/blob/main/src/location/gps.py"
click node_routes "https://github.com/geek95dg/alfa156-headunit/blob/main/src/trip/route_planner.py"
click node_weather "https://github.com/geek95dg/alfa156-headunit/blob/main/src/weather/weather.py"

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_main,node_config,node_events,node_modules,node_power toneBlue
class node_renderer,node_web,node_small,node_screens,node_themes,node_tripcomputer toneAmber
class node_obd,node_ecu,node_parking,node_cameras,node_grabber,node_vehiclecontrols,node_ors toneMint
class node_audio,node_bluetooth,node_androidauto,node_phonebook,node_input toneRose
class node_gps,node_routes,node_weather,node_driver,node_tomtom,node_phone,node_carinputs toneIndigo
```

## Components

### Runtime core

- [Runtime entry](https://github.com/geek95dg/alfa156-headunit/blob/main/main.py): `main.py`
- [Configuration](https://github.com/geek95dg/alfa156-headunit/blob/main/src/core/config.py): `src/core/config.py`
- [Event bus](https://github.com/geek95dg/alfa156-headunit/blob/main/src/core/event_bus.py): `src/core/event_bus.py`
- [Module catalog](https://github.com/geek95dg/alfa156-headunit/blob/main/src/core/modules_catalog.py): `src/core/modules_catalog.py`
- [Power lifecycle](https://github.com/geek95dg/alfa156-headunit/blob/main/src/power/power_manager.py): `src/power/power_manager.py`

### Dashboards

- [Dashboard renderer](https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/renderer.py): `src/dashboard/renderer.py`
- [Web dashboard](https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/web_viewer.py): `src/dashboard/web_viewer.py`
- [Small display](https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/small_viewer.py): `src/dashboard/small_viewer.py`
- [Vehicle screens](https://github.com/geek95dg/alfa156-headunit/tree/main/src/dashboard/screens): `src/dashboard/screens`
- [Dashboard themes](https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/themes/theme_base.py): `src/dashboard/themes/theme_base.py`
- [Trip computer](https://github.com/geek95dg/alfa156-headunit/blob/main/src/dashboard/trip_computer.py): `src/dashboard/trip_computer.py`

### Vehicle systems

- [K-Line diagnostics](https://github.com/geek95dg/alfa156-headunit/blob/main/src/obd/kwp2000.py): `src/obd/kwp2000.py`
- [ECU protocol](https://github.com/geek95dg/alfa156-headunit/blob/main/src/obd/edc15c7.py): `src/obd/edc15c7.py`
- [Parking sensors](https://github.com/geek95dg/alfa156-headunit/blob/main/src/parking/hcsr04.py): `src/parking/hcsr04.py`
- [Camera switching](https://github.com/geek95dg/alfa156-headunit/blob/main/src/camera/camera_controller.py): `src/camera/camera_controller.py`
- [Camera capture](https://github.com/geek95dg/alfa156-headunit/blob/main/src/camera/ahd_grabber.py): `src/camera/ahd_grabber.py`
- [Vehicle controls](https://github.com/geek95dg/alfa156-headunit/tree/main/src/vehicle): `src/vehicle`

### Media connectivity

- [Audio pipeline](https://github.com/geek95dg/alfa156-headunit/tree/main/src/audio): `src/audio`
- [Bluetooth audio](https://github.com/geek95dg/alfa156-headunit/blob/main/src/multimedia/bluetooth.py): `src/multimedia/bluetooth.py`
- [Android Auto](https://github.com/geek95dg/alfa156-headunit/blob/main/src/multimedia/openauto.py): `src/multimedia/openauto.py`
- [Phonebook](https://github.com/geek95dg/alfa156-headunit/blob/main/src/multimedia/phonebook.py): `src/multimedia/phonebook.py`
- [Steering inputs](https://github.com/geek95dg/alfa156-headunit/tree/main/src/input): `src/input`

### Travel services

- [GPS tracking](https://github.com/geek95dg/alfa156-headunit/blob/main/src/location/gps.py): `src/location/gps.py`
- [Route planner](https://github.com/geek95dg/alfa156-headunit/blob/main/src/trip/route_planner.py): `src/trip/route_planner.py`
- [Weather](https://github.com/geek95dg/alfa156-headunit/blob/main/src/weather/weather.py): `src/weather/weather.py`

### Other components

- **Driver**
- **OpenRouteService**
- **TomTom Traffic**
- **Phone**
- **Vehicle signals**

## Connections

- Runtime entry → Configuration: loads (evidence: `main.py`)
- Runtime entry → Module catalog: checks modules (evidence: `main.py`)
- Runtime entry → Dashboard renderer: starts (evidence: `main.py`)
- Runtime entry → Web dashboard: starts (evidence: `main.py`)
- Runtime entry → Trip computer: starts (evidence: `main.py`)
- Runtime entry → Route planner: starts (evidence: `main.py`)
- Dashboard renderer → Dashboard themes: uses (evidence: `src/dashboard/renderer.py`)
- Dashboard renderer → Vehicle screens: uses (evidence: `src/dashboard/renderer.py`)
- Dashboard renderer → Trip computer: uses (evidence: `src/dashboard/renderer.py`)
- Dashboard renderer → Web dashboard: uses (evidence: `src/dashboard/renderer.py`)
- Driver → Dashboard renderer: views
- Driver → Web dashboard: uses
- Driver → Steering inputs: operates
- Power lifecycle → Event bus: publishes state (evidence: `src/power/power_manager.py`)
- Vehicle signals → Power lifecycle: signals ignition
- Vehicle signals → Camera switching: signals gear and blinkers (evidence: `src/camera/camera_controller.py`)
- Camera switching → Camera capture: selects feed (evidence: `src/camera/camera_controller.py`)
- Camera switching → Event bus: publishes feed (evidence: `src/camera/camera_controller.py`)
- K-Line diagnostics → ECU protocol: uses protocol (evidence: `src/obd/simulator.py`)
- Parking sensors → Event bus: publishes readings
- Vehicle controls → Event bus: exchanges signals
- Bluetooth audio → Phone: streams audio (evidence: `README.md`)
- Android Auto → Driver: provides projection (evidence: `README.md`)
- Audio pipeline → Bluetooth audio: plays sources
- Phonebook → Bluetooth audio: uses connection
- Steering inputs → Event bus: dispatches actions (evidence: `src/input/arduino_serial.py`)
- GPS tracking → Route planner: provides location
- Route planner → OpenRouteService: requests directions (evidence: `src/trip/route_planner.py`)
- Route planner → TomTom Traffic: requests traffic (evidence: `src/trip/route_planner.py`)
- Weather → Dashboard renderer: feeds dashboard
- Route planner → Dashboard renderer: provides plans (evidence: `src/dashboard/renderer.py`)
- Vehicle signals → Parking sensors: supports parking
