# jojogaming93/phonecontrol architecture

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

- Interactive diagram: https://gitdiagram.com/jojogaming93/phonecontrol
- Repository: https://github.com/jojogaming93/phonecontrol

## Overview

PhoneControl is a native Windows app for mirroring an Android phone over USB and translating PC keyboard/mouse input into editable touch mappings. The main workflow is selecting and connecting a phone, opening its mirrored view, then applying foreground-only controls through a persistent touch channel. Profiles, mapping edits, and optional driving-HUD recognition support that workflow. The graph reflects the sampled implementation and README; some connection details and unsampled subsystems are represented only where documented.

Main entry points: [`src/PhoneControl/MainWindow.cs`](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/MainWindow.cs) (Dashboard UI), [`src/PhoneControl/InputEngine.cs`](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/InputEngine.cs) (Input engine), [`src/PhoneControl/DrivingModeMonitor.cs`](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DrivingModeMonitor.cs) (Driving mode monitor), [`src/PhoneControl/DeviceSession.cs`](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DeviceSession.cs) (Device session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and connection"]
  node_program["App startup<br/>[Program.cs]"]
  node_window["Dashboard UI<br/>[MainWindow.cs]"]
  node_policy["Connection policy"]
  node_session["Device session<br/>[DeviceSession.cs]"]
  node_appinfo["About and license<br/>[AppInfo.cs]"]
end

subgraph group_controls["Controls and profiles"]
  node_input["Input engine<br/>[InputEngine.cs]"]
  node_raw["Raw input<br/>[RawInputReader.cs]"]
  node_aim["Aim gestures<br/>[AimGesture.cs]"]
  node_wheel["Wheel input<br/>[MouseWheelInput.cs]"]
  node_mapping["Mapping overlay<br/>[MappingOverlay.cs]"]
  node_profile["Profiles and settings<br/>[Profile.cs]"]
end

subgraph group_driving["Driving recognition"]
  node_monitor["Driving mode monitor"]
  node_capture["Mirror frame capture"]
  node_detector["HUD detector"]
  node_detecttest["Detection regression tool"]
end

subgraph group_platform["Phone and Windows"]
  node_phone(("Android phone"))
  node_scrcpy["ADB and scrcpy"]
  node_native["Windows interop<br/>[Native.cs]"]
  node_samsung["Samsung driver repair<br/>[SamsungDriver.cs]"]
end

node_user(("PC user"))

node_user -->|"starts"| node_program
node_program -->|"opens"| node_window
node_window -->|"checks connection"| node_policy
node_window -->|"connects device"| node_session
node_window -->|"repairs driver"| node_samsung
node_window -->|"shows details"| node_appinfo
node_session -->|"connects USB"| node_phone
node_session -->|"starts mirroring"| node_scrcpy
node_session -->|"opens control channel"| node_phone
node_window -->|"configures controls"| node_input
node_window -->|"registers input"| node_raw
node_raw -->|"forwards events"| node_input
node_input -->|"sends touches"| node_session
node_input -->|"reads mappings"| node_profile
node_input -->|"updates aiming"| node_aim
node_input -->|"reads wheel actions"| node_wheel
node_window -->|"edits mappings"| node_mapping
node_window -->|"imports and saves"| node_profile
node_input -->|"checks foreground"| node_native
node_raw -->|"reads device events"| node_native
node_window -->|"starts recognition"| node_monitor
node_monitor -->|"captures mirror"| node_capture
node_monitor -->|"captures fallback frame"| node_session
node_monitor -->|"classifies HUD"| node_detector
node_monitor -->|"sets driving mode"| node_input
node_capture -->|"captures desktop"| node_native
node_detecttest -->|"checks recognition"| node_monitor

click node_program "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/Program.cs"
click node_window "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/MainWindow.cs"
click node_policy "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/ConnectionPolicy.cs"
click node_session "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DeviceSession.cs"
click node_input "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/InputEngine.cs"
click node_raw "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/RawInputReader.cs"
click node_aim "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/AimGesture.cs"
click node_wheel "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/MouseWheelInput.cs"
click node_mapping "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/MappingOverlay.cs"
click node_profile "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/Profile.cs"
click node_native "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/Native.cs"
click node_samsung "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/SamsungDriver.cs"
click node_monitor "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DrivingModeMonitor.cs"
click node_capture "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/MirrorFrameCapture.cs"
click node_detector "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DrivingHudDetector.cs"
click node_detecttest "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DrivingDetectionTest.cs"
click node_appinfo "https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/AppInfo.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_window,node_policy,node_session,node_appinfo,node_user toneBlue
class node_input,node_raw,node_aim,node_wheel,node_mapping,node_profile toneAmber
class node_monitor,node_capture,node_detector,node_detecttest toneMint
class node_phone,node_scrcpy,node_native,node_samsung toneRose
```

## Components

### App and connection

- [App startup](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/Program.cs): `src/PhoneControl/Program.cs`
- [Dashboard UI](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/MainWindow.cs): `src/PhoneControl/MainWindow.cs`
- [Connection policy](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/ConnectionPolicy.cs): `src/PhoneControl/ConnectionPolicy.cs`
- [Device session](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DeviceSession.cs): `src/PhoneControl/DeviceSession.cs`
- [About and license](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/AppInfo.cs): `src/PhoneControl/AppInfo.cs`

### Controls and profiles

- [Input engine](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/InputEngine.cs): `src/PhoneControl/InputEngine.cs`
- [Raw input](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/RawInputReader.cs): `src/PhoneControl/RawInputReader.cs`
- [Aim gestures](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/AimGesture.cs): `src/PhoneControl/AimGesture.cs`
- [Wheel input](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/MouseWheelInput.cs): `src/PhoneControl/MouseWheelInput.cs`
- [Mapping overlay](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/MappingOverlay.cs): `src/PhoneControl/MappingOverlay.cs`
- [Profiles and settings](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/Profile.cs): `src/PhoneControl/Profile.cs`

### Driving recognition

- [Driving mode monitor](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DrivingModeMonitor.cs): `src/PhoneControl/DrivingModeMonitor.cs`
- [Mirror frame capture](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/MirrorFrameCapture.cs): `src/PhoneControl/MirrorFrameCapture.cs`
- [HUD detector](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DrivingHudDetector.cs): `src/PhoneControl/DrivingHudDetector.cs`
- [Detection regression tool](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/DrivingDetectionTest.cs): `src/PhoneControl/DrivingDetectionTest.cs`

### Phone and Windows

- **Android phone**
- **ADB and scrcpy**
- [Windows interop](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/Native.cs): `src/PhoneControl/Native.cs`
- [Samsung driver repair](https://github.com/jojogaming93/phonecontrol/blob/main/src/PhoneControl/SamsungDriver.cs): `src/PhoneControl/SamsungDriver.cs`

### Other components

- **PC user**

## Connections

- PC user → App startup: starts (evidence: `README.md`)
- App startup → Dashboard UI: opens (evidence: `src/PhoneControl/Program.cs`)
- Dashboard UI → Connection policy: checks connection (evidence: `src/PhoneControl/MainWindow.cs`)
- Dashboard UI → Device session: connects device (evidence: `src/PhoneControl/MainWindow.cs`)
- Dashboard UI → Samsung driver repair: repairs driver (evidence: `src/PhoneControl/MainWindow.cs`)
- Dashboard UI → About and license: shows details (evidence: `src/PhoneControl/MainWindow.cs`)
- Device session → Android phone: connects USB (evidence: `README.md`)
- Device session → ADB and scrcpy: starts mirroring (evidence: `README.md`)
- Device session → Android phone: opens control channel (evidence: `src/PhoneControl/DeviceSession.cs`)
- Dashboard UI → Input engine: configures controls (evidence: `src/PhoneControl/MainWindow.cs`)
- Dashboard UI → Raw input: registers input (evidence: `src/PhoneControl/MainWindow.cs`)
- Raw input → Input engine: forwards events (evidence: `src/PhoneControl/RawInputReader.cs`)
- Input engine → Device session: sends touches (evidence: `src/PhoneControl/InputEngine.cs`)
- Input engine → Profiles and settings: reads mappings (evidence: `src/PhoneControl/InputEngine.cs`)
- Input engine → Aim gestures: updates aiming (evidence: `src/PhoneControl/InputEngine.cs`)
- Input engine → Wheel input: reads wheel actions (evidence: `src/PhoneControl/InputEngine.cs`)
- Dashboard UI → Mapping overlay: edits mappings (evidence: `src/PhoneControl/MainWindow.cs`)
- Dashboard UI → Profiles and settings: imports and saves (evidence: `src/PhoneControl/MainWindow.cs`)
- Input engine → Windows interop: checks foreground (evidence: `src/PhoneControl/InputEngine.cs`)
- Raw input → Windows interop: reads device events (evidence: `src/PhoneControl/RawInputReader.cs`)
- Dashboard UI → Driving mode monitor: starts recognition (evidence: `src/PhoneControl/MainWindow.cs`)
- Driving mode monitor → Mirror frame capture: captures mirror (evidence: `src/PhoneControl/DrivingModeMonitor.cs`)
- Driving mode monitor → Device session: captures fallback frame (evidence: `src/PhoneControl/DrivingModeMonitor.cs`)
- Driving mode monitor → HUD detector: classifies HUD (evidence: `src/PhoneControl/DrivingModeMonitor.cs`)
- Driving mode monitor → Input engine: sets driving mode (evidence: `src/PhoneControl/DrivingModeMonitor.cs`)
- Mirror frame capture → Windows interop: captures desktop (evidence: `src/PhoneControl/MirrorFrameCapture.cs`)
- Detection regression tool → Driving mode monitor: checks recognition (evidence: `src/PhoneControl/DrivingDetectionTest.cs`)
