# cngksy/wireless-battery architecture

> Architecture diagram of the GitHub repository cngksy/wireless-battery, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cngksy/wireless-battery
- Repository: https://github.com/cngksy/wireless-battery

## Overview

Wireless Battery is a Windows taskbar utility that discovers reported battery levels and presents them per device. Its main workflow is the app’s refresh/menu orchestration, battery polling across HID, Windows, and vendor sources, then per-monitor taskbar display and device details. The README also documents settings, startup management, device reporting, localization, and verified update installation. Some orchestration code is omitted from excerpts, so edges for those documented workflows cite the README; the graph does not infer unshown calls.

Main entry points: [`App.cs`](https://github.com/cngksy/wireless-battery/blob/main/App.cs) (App coordinator), [`Battery.cs`](https://github.com/cngksy/wireless-battery/blob/main/Battery.cs) (Battery polling), [`Widget.cs`](https://github.com/cngksy/wireless-battery/blob/main/Widget.cs) (Taskbar indicator), [`Updates.cs`](https://github.com/cngksy/wireless-battery/blob/main/Updates.cs) (Update client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and taskbar UI"]
  node_app["App coordinator<br/>[App.cs]"]
  node_widget["Taskbar indicator<br/>[Widget.cs]"]
  node_taskbars["Taskbar placement<br/>[Taskbars.cs]"]
end

subgraph group_sensing["Battery sensing"]
  node_battery["Battery polling<br/>[Battery.cs]"]
  node_hid["Windows HID access<br/>[Native.cs]"]
  node_windows["Bluetooth and XInput<br/>[WindowsDevices.cs]"]
end

subgraph group_vendors["Vendor integrations"]
  node_ghub["G HUB reader<br/>[GHub.cs]"]
  node_steelseries["SteelSeries reader<br/>[SteelSeries.cs]"]
end

subgraph group_management["Settings and updates"]
  node_settings[("User preferences<br/>[UserSettings.cs]")]
  node_autostart["Windows startup<br/>[Autostart.cs]"]
  node_updates["Update client<br/>[Updates.cs]"]
end

node_user(("Windows user"))
node_github(("GitHub releases"))
node_ghub_service(("G HUB service"))
node_steelseries_service(("SteelSeries GG"))
node_windows_devices(("Windows devices"))

node_user -->|"uses menu"| node_app
node_app -->|"refreshes readings"| node_battery
node_battery -->|"polls devices"| node_windows
node_battery -->|"polls vendor"| node_ghub
node_battery -->|"reads keyboard"| node_steelseries
node_windows -->|"reads properties"| node_windows_devices
node_ghub -->|"queries locally"| node_ghub_service
node_steelseries -->|"queries locally"| node_steelseries_service
node_app -->|"updates display"| node_widget
node_widget -->|"finds placement"| node_taskbars
node_user -->|"hovers devices"| node_widget
node_app -->|"loads preferences"| node_settings
node_app -->|"manages startup"| node_autostart
node_app -->|"checks updates"| node_updates
node_updates -->|"checks releases"| node_github
node_user -->|"requests install"| node_updates
node_battery -->|"uses HID channel"| node_hid

click node_app "https://github.com/cngksy/wireless-battery/blob/main/App.cs"
click node_widget "https://github.com/cngksy/wireless-battery/blob/main/Widget.cs"
click node_taskbars "https://github.com/cngksy/wireless-battery/blob/main/Taskbars.cs"
click node_battery "https://github.com/cngksy/wireless-battery/blob/main/Battery.cs"
click node_hid "https://github.com/cngksy/wireless-battery/blob/main/Native.cs"
click node_windows "https://github.com/cngksy/wireless-battery/blob/main/WindowsDevices.cs"
click node_ghub "https://github.com/cngksy/wireless-battery/blob/main/GHub.cs"
click node_steelseries "https://github.com/cngksy/wireless-battery/blob/main/SteelSeries.cs"
click node_settings "https://github.com/cngksy/wireless-battery/blob/main/UserSettings.cs"
click node_autostart "https://github.com/cngksy/wireless-battery/blob/main/Autostart.cs"
click node_updates "https://github.com/cngksy/wireless-battery/blob/main/Updates.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_app,node_widget,node_taskbars,node_user toneBlue
class node_battery,node_hid,node_windows toneAmber
class node_ghub,node_steelseries toneMint
class node_settings,node_autostart,node_updates toneRose
class node_github,node_ghub_service,node_steelseries_service,node_windows_devices toneIndigo
```

## Components

### App and taskbar UI

- [App coordinator](https://github.com/cngksy/wireless-battery/blob/main/App.cs): `App.cs`
- [Taskbar indicator](https://github.com/cngksy/wireless-battery/blob/main/Widget.cs): `Widget.cs`
- [Taskbar placement](https://github.com/cngksy/wireless-battery/blob/main/Taskbars.cs): `Taskbars.cs`

### Battery sensing

- [Battery polling](https://github.com/cngksy/wireless-battery/blob/main/Battery.cs): `Battery.cs`
- [Windows HID access](https://github.com/cngksy/wireless-battery/blob/main/Native.cs): `Native.cs`
- [Bluetooth and XInput](https://github.com/cngksy/wireless-battery/blob/main/WindowsDevices.cs): `WindowsDevices.cs`

### Vendor integrations

- [G HUB reader](https://github.com/cngksy/wireless-battery/blob/main/GHub.cs): `GHub.cs`
- [SteelSeries reader](https://github.com/cngksy/wireless-battery/blob/main/SteelSeries.cs): `SteelSeries.cs`

### Settings and updates

- [User preferences](https://github.com/cngksy/wireless-battery/blob/main/UserSettings.cs): `UserSettings.cs`
- [Windows startup](https://github.com/cngksy/wireless-battery/blob/main/Autostart.cs): `Autostart.cs`
- [Update client](https://github.com/cngksy/wireless-battery/blob/main/Updates.cs): `Updates.cs`

### Other components

- **Windows user**
- **GitHub releases**
- **G HUB service**
- **SteelSeries GG**
- **Windows devices**

## Connections

- Windows user → App coordinator: uses menu (evidence: `README.md`)
- App coordinator → Battery polling: refreshes readings (evidence: `README.md`)
- Battery polling → Bluetooth and XInput: polls devices (evidence: `Battery.cs`)
- Battery polling → G HUB reader: polls vendor (evidence: `Battery.cs`)
- Battery polling → SteelSeries reader: reads keyboard (evidence: `Battery.cs`)
- Bluetooth and XInput → Windows devices: reads properties (evidence: `README.md`)
- G HUB reader → G HUB service: queries locally (evidence: `README.md`)
- SteelSeries reader → SteelSeries GG: queries locally (evidence: `README.md`)
- App coordinator → Taskbar indicator: updates display (evidence: `README.md`)
- Taskbar indicator → Taskbar placement: finds placement (evidence: `Widget.cs`)
- Windows user → Taskbar indicator: hovers devices (evidence: `README.md`)
- App coordinator → User preferences: loads preferences (evidence: `App.cs`)
- App coordinator → Windows startup: manages startup (evidence: `README.md`)
- App coordinator → Update client: checks updates (evidence: `README.md`)
- Update client → GitHub releases: checks releases (evidence: `Updates.cs`)
- Windows user → Update client: requests install (evidence: `README.md`)
- Battery polling → Windows HID access: uses HID channel (evidence: `Battery.cs`)
