# l1ghtshaper/bt-charge-indicator architecture

> Architecture diagram of the GitHub repository l1ghtshaper/bt-charge-indicator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/l1ghtshaper/bt-charge-indicator
- Repository: https://github.com/l1ghtshaper/bt-charge-indicator

## Overview

BT Charge Indicator is a Windows system-tray app that reads battery levels from paired Bluetooth devices and presents a quick status, device list, and settings. Its main workflow is: launch the tray app, scan Bluetooth devices using multiple Windows and device-specific protocols, combine readings into device state, then render tray status and notify on relevant changes. Additional capabilities include diagnostics, saved preferences, startup options, and update checks. The graph follows documented and indexed relationships; unsampled subsystem wiring is omitted where it cannot be verified.

Main entry points: [`UI/TrayApplicationContext.cs`](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/TrayApplicationContext.cs) (Tray controller), [`Services/BluetoothBatteryService.cs`](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/BluetoothBatteryService.cs) (Bluetooth scanner), [`Program.cs`](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Program.cs) (App entry point), [`Services/DesktopNotificationService.cs`](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/DesktopNotificationService.cs) (Desktop notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Tray experience"]
  node_program["App entry point<br/>[Program.cs]"]
  node_tray["Tray controller"]
  node_renderer["Tray icon renderer"]
  node_toastui["Connection cards"]
  node_presenter["Connection presenter"]
  node_branding["App branding<br/>[AppBranding.cs]"]
  node_textprompt["Text prompt<br/>[TextPrompt.cs]"]
end

subgraph group_battery["Battery detection"]
  node_device["Device reading model"]
  node_tws["Earbud readings"]
  node_trayreading["Tray reading model<br/>[TrayReading.cs]"]
  node_scan["Bluetooth scanner"]
  node_watcher["Device watcher"]
  node_airpods["AirPods reader"]
  node_fastpair["Fast Pair reader"]
  node_nothing["Nothing reader"]
  node_dualsense["DualSense reader"]
end

subgraph group_state["State and preferences"]
  node_localization["Localized text<br/>[AppText.cs]"]
  node_settingsmodel["App preferences<br/>[AppSettings.cs]"]
  node_settingsstore[("Settings store<br/>[SettingsStore.cs]")]
  node_history["Battery history<br/>[BatteryHistory.cs]"]
  node_connections["Connection tracker"]
  node_gatt["GATT probe history"]
end

subgraph group_alerts["Notifications and utilities"]
  node_notification["Desktop notifications"]
  node_diagnostics["Device diagnostics"]
  node_autostart["Windows startup"]
  node_updates["Update checks<br/>[UpdateService.cs]"]
  node_logger[("Error logger<br/>[AppLogger.cs]")]
end

node_user(("Windows user"))
node_windows["Windows Bluetooth"]

node_user -->|"launches"| node_program
node_program -->|"loads settings"| node_settingsstore
node_program -->|"sets language"| node_localization
node_program -->|"starts UI"| node_tray
node_tray -->|"requests scans"| node_scan
node_tray -->|"tracks devices"| node_watcher
node_watcher -->|"refreshes devices"| node_scan
node_scan -->|"reads Bluetooth"| node_windows
node_scan -->|"reads advertisements"| node_airpods
node_scan -->|"reads advertisements"| node_fastpair
node_scan -->|"reads RFCOMM"| node_nothing
node_scan -->|"reads HID"| node_dualsense
node_scan -->|"produces readings"| node_device
node_nothing -->|"returns components"| node_tws
node_fastpair -->|"returns components"| node_tws
node_tray -->|"renders status"| node_renderer
node_tray -->|"selects reading"| node_trayreading
node_tray -->|"saves preferences"| node_settingsstore
node_settingsstore -->|"loads and saves"| node_settingsmodel
node_tray -->|"tracks changes"| node_connections
node_tray -->|"records readings"| node_history
node_scan -->|"uses probe history"| node_gatt
node_tray -->|"shows connection cards"| node_presenter
node_presenter -->|"presents cards"| node_toastui
node_tray -->|"shows low battery"| node_notification
node_notification -->|"gets notification text"| node_localization
node_tray -->|"builds reports"| node_diagnostics
node_tray -->|"configures startup"| node_autostart
node_tray -->|"checks releases"| node_updates
node_scan -->|"logs failures"| node_logger
node_notification -->|"logs failures"| node_logger
node_textprompt -->|"uses branding"| node_branding
node_toastui -->|"gets card text"| node_localization

click node_program "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Program.cs"
click node_tray "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/TrayApplicationContext.cs"
click node_renderer "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/TrayIconRenderer.cs"
click node_toastui "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/ConnectionToastForm.cs"
click node_presenter "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/ConnectionNotificationPresenter.cs"
click node_branding "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/AppBranding.cs"
click node_textprompt "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/TextPrompt.cs"
click node_localization "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Localization/AppText.cs"
click node_device "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Models/BluetoothBatteryDevice.cs"
click node_tws "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Models/TwsBatteryReading.cs"
click node_trayreading "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Models/TrayReading.cs"
click node_scan "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/BluetoothBatteryService.cs"
click node_watcher "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/BluetoothDeviceWatcher.cs"
click node_airpods "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/AirPodsBatteryService.cs"
click node_fastpair "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/FastPairBatteryService.cs"
click node_nothing "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/NothingBatteryService.cs"
click node_dualsense "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/DualSenseBatteryService.cs"
click node_settingsmodel "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Settings/AppSettings.cs"
click node_settingsstore "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Settings/SettingsStore.cs"
click node_history "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/BatteryHistory.cs"
click node_connections "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/DeviceConnectionTracker.cs"
click node_gatt "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/GattProbeHistory.cs"
click node_notification "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/DesktopNotificationService.cs"
click node_diagnostics "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/DiagnosticReport.cs"
click node_autostart "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/AutoStartManager.cs"
click node_updates "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/UpdateService.cs"
click node_logger "https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/AppLogger.cs"

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_program,node_tray,node_renderer,node_toastui,node_presenter,node_branding,node_textprompt,node_user toneBlue
class node_device,node_tws,node_trayreading,node_scan,node_watcher,node_airpods,node_fastpair,node_nothing,node_dualsense toneAmber
class node_localization,node_settingsmodel,node_settingsstore,node_history,node_connections,node_gatt toneMint
class node_notification,node_diagnostics,node_autostart,node_updates,node_logger toneRose
class node_windows toneIndigo
```

## Components

### Tray experience

- [App entry point](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Program.cs): `Program.cs`
- [Tray controller](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/TrayApplicationContext.cs): `UI/TrayApplicationContext.cs`
- [Tray icon renderer](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/TrayIconRenderer.cs): `UI/TrayIconRenderer.cs`
- [Connection cards](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/ConnectionToastForm.cs): `UI/ConnectionToastForm.cs`
- [Connection presenter](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/ConnectionNotificationPresenter.cs): `UI/ConnectionNotificationPresenter.cs`
- [App branding](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/AppBranding.cs): `UI/AppBranding.cs`
- [Text prompt](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/UI/TextPrompt.cs): `UI/TextPrompt.cs`

### Battery detection

- [Device reading model](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Models/BluetoothBatteryDevice.cs): `Models/BluetoothBatteryDevice.cs`
- [Earbud readings](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Models/TwsBatteryReading.cs): `Models/TwsBatteryReading.cs`
- [Tray reading model](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Models/TrayReading.cs): `Models/TrayReading.cs`
- [Bluetooth scanner](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/BluetoothBatteryService.cs): `Services/BluetoothBatteryService.cs`
- [Device watcher](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/BluetoothDeviceWatcher.cs): `Services/BluetoothDeviceWatcher.cs`
- [AirPods reader](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/AirPodsBatteryService.cs): `Services/AirPodsBatteryService.cs`
- [Fast Pair reader](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/FastPairBatteryService.cs): `Services/FastPairBatteryService.cs`
- [Nothing reader](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/NothingBatteryService.cs): `Services/NothingBatteryService.cs`
- [DualSense reader](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/DualSenseBatteryService.cs): `Services/DualSenseBatteryService.cs`

### State and preferences

- [Localized text](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Localization/AppText.cs): `Localization/AppText.cs`
- [App preferences](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Settings/AppSettings.cs): `Settings/AppSettings.cs`
- [Settings store](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Settings/SettingsStore.cs): `Settings/SettingsStore.cs`
- [Battery history](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/BatteryHistory.cs): `Services/BatteryHistory.cs`
- [Connection tracker](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/DeviceConnectionTracker.cs): `Services/DeviceConnectionTracker.cs`
- [GATT probe history](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/GattProbeHistory.cs): `Services/GattProbeHistory.cs`

### Notifications and utilities

- [Desktop notifications](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/DesktopNotificationService.cs): `Services/DesktopNotificationService.cs`
- [Device diagnostics](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/DiagnosticReport.cs): `Services/DiagnosticReport.cs`
- [Windows startup](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/AutoStartManager.cs): `Services/AutoStartManager.cs`
- [Update checks](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/UpdateService.cs): `Services/UpdateService.cs`
- [Error logger](https://github.com/l1ghtshaper/bt-charge-indicator/blob/main/Services/AppLogger.cs): `Services/AppLogger.cs`

### Other components

- **Windows user**
- **Windows Bluetooth**

## Connections

- Windows user → App entry point: launches (evidence: `README.md`)
- App entry point → Settings store: loads settings (evidence: `Program.cs`)
- App entry point → Localized text: sets language (evidence: `Program.cs`)
- App entry point → Tray controller: starts UI (evidence: `Program.cs`)
- Tray controller → Bluetooth scanner: requests scans (evidence: `UI/TrayApplicationContext.cs`)
- Tray controller → Device watcher: tracks devices (evidence: `UI/TrayApplicationContext.cs`)
- Device watcher → Bluetooth scanner: refreshes devices (evidence: `Services/BluetoothDeviceWatcher.cs`)
- Bluetooth scanner → Windows Bluetooth: reads Bluetooth (evidence: `README.md`)
- Bluetooth scanner → AirPods reader: reads advertisements (evidence: `Services/BluetoothBatteryService.cs`)
- Bluetooth scanner → Fast Pair reader: reads advertisements (evidence: `Services/BluetoothBatteryService.cs`)
- Bluetooth scanner → Nothing reader: reads RFCOMM (evidence: `Services/BluetoothBatteryService.cs`)
- Bluetooth scanner → DualSense reader: reads HID (evidence: `Services/BluetoothBatteryService.cs`)
- Bluetooth scanner → Device reading model: produces readings (evidence: `Services/BluetoothBatteryService.cs`)
- Nothing reader → Earbud readings: returns components (evidence: `Services/NothingBatteryService.cs`)
- Fast Pair reader → Earbud readings: returns components (evidence: `Services/FastPairBatteryService.cs`)
- Tray controller → Tray icon renderer: renders status (evidence: `UI/TrayApplicationContext.cs`)
- Tray controller → Tray reading model: selects reading (evidence: `UI/TrayApplicationContext.cs`)
- Tray controller → Settings store: saves preferences (evidence: `Settings/SettingsStore.cs`)
- Settings store → App preferences: loads and saves (evidence: `Settings/SettingsStore.cs`)
- Tray controller → Connection tracker: tracks changes (evidence: `UI/TrayApplicationContext.cs`)
- Tray controller → Battery history: records readings (evidence: `Services/BatteryHistory.cs`)
- Bluetooth scanner → GATT probe history: uses probe history (evidence: `Services/BluetoothBatteryService.cs`)
- Tray controller → Connection presenter: shows connection cards (evidence: `UI/TrayApplicationContext.cs`)
- Connection presenter → Connection cards: presents cards (evidence: `UI/ConnectionNotificationPresenter.cs`)
- Tray controller → Desktop notifications: shows low battery (evidence: `UI/TrayApplicationContext.cs`)
- Desktop notifications → Localized text: gets notification text (evidence: `Services/DesktopNotificationService.cs`)
- Tray controller → Device diagnostics: builds reports (evidence: `UI/TrayApplicationContext.cs`)
- Tray controller → Windows startup: configures startup (evidence: `README.md`)
- Tray controller → Update checks: checks releases (evidence: `UI/TrayApplicationContext.cs`)
- Bluetooth scanner → Error logger: logs failures (evidence: `Services/BluetoothBatteryService.cs`)
- Desktop notifications → Error logger: logs failures (evidence: `Services/DesktopNotificationService.cs`)
- Text prompt → App branding: uses branding (evidence: `UI/TextPrompt.cs`)
- Connection cards → Localized text: gets card text (evidence: `UI/ConnectionToastForm.cs`)
