# anton7444/osharepc architecture

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

- Interactive diagram: https://gitdiagram.com/anton7444/osharepc
- Repository: https://github.com/anton7444/osharepc

## Overview

OShare PC is an unofficial Windows client for exchanging files with compatible phones. The user turns sharing on, discovers a phone, and sends files; the reverse flow accepts a phone-initiated transfer and saves received files. The backend coordinates BLE discovery and links with LAN transfer services, while the desktop GUI communicates with it through an authenticated bridge. The README documents the GUI/backend relationship; source excerpts and the SOURCE INDEX establish many backend dependencies, but do not expose the bridge protocol or all transfer call paths.

Main entry points: [`SenderEngine.cs`](https://github.com/anton7444/osharepc/blob/main/SenderEngine.cs) (Sender engine), [`ReceiveGattServer.cs`](https://github.com/anton7444/osharepc/blob/main/ReceiveGattServer.cs) (Receive GATT server), [`oshare_gui/windows/runner/drag_drop_bridge.cpp`](https://github.com/anton7444/osharepc/blob/main/oshare_gui/windows/runner/drag_drop_bridge.cpp) (Desktop GUI), [`Program.cs`](https://github.com/anton7444/osharepc/blob/main/Program.cs) (Backend entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop control"]
  node_desktop_ui["Desktop GUI"]
  node_backend["Backend entry<br/>[Program.cs]"]
  node_bridge["Authenticated bridge"]
end

subgraph group_coordination["Transfer coordination"]
  node_engine["Sender engine<br/>[SenderEngine.cs]"]
  node_settings[("Settings<br/>[SettingsStore.cs]")]
end

subgraph group_discovery["Phone discovery"]
  node_scanner["Phone scanner<br/>[PhoneScanner.cs]"]
  node_advertiser["BLE advertiser"]
  node_fallback_advertiser["Fallback advertiser"]
  node_gatt_link["BLE link<br/>[GattLink.cs]"]
end

subgraph group_sending["Send and networking"]
  node_lan["LAN discovery<br/>[LanDiscovery.cs]"]
  node_lan_info["LAN interface<br/>[LanInfo.cs]"]
  node_hotspot["Mobile hotspot<br/>[HotspotManager.cs]"]
  node_wifi_joiner["Wi-Fi join<br/>[WifiJoiner.cs]"]
  node_transfer_server["Send server<br/>[TransferServer.cs]"]
  node_transfer_task["Transfer task<br/>[TransferTask.cs]"]
end

subgraph group_receiving["Receive and storage"]
  node_receive_gatt["Receive GATT server"]
  node_receive_session["Receive session<br/>[ReceiveSession.cs]"]
  node_downloads["Download location<br/>[DownloadsFolder.cs]"]
end

subgraph group_account["Account support"]
  node_account_login["Account login"]
  node_account_client["Account service client"]
  node_account_hash["BLE account hash"]
end

node_user(("PC user"))
node_phone(("Compatible phone"))
node_oppo_service["OPPO account service"]

node_user -->|"controls"| node_desktop_ui
node_desktop_ui -->|"starts beside"| node_backend
node_desktop_ui -->|"uses bridge"| node_bridge
node_backend -->|"starts engine"| node_engine
node_engine -->|"starts scan"| node_scanner
node_engine -->|"coordinates"| node_advertiser
node_engine -->|"coordinates"| node_fallback_advertiser
node_engine -->|"connects"| node_gatt_link
node_engine -->|"uses"| node_transfer_server
node_engine -->|"starts receiver"| node_receive_gatt
node_engine -->|"manages hotspot"| node_hotspot
node_engine -->|"uses discovery"| node_lan
node_engine -->|"detects LAN"| node_lan_info
node_engine -->|"joins Wi-Fi"| node_wifi_joiner
node_engine -->|"reads settings"| node_settings
node_phone -.->|"broadcasts to"| node_scanner
node_phone -.->|"initiates receive"| node_receive_gatt
node_transfer_server -->|"creates task"| node_transfer_task
node_receive_gatt -->|"starts session"| node_receive_session
node_receive_gatt -->|"selects save path"| node_downloads
node_receive_session -.->|"receives files"| node_phone
node_engine -->|"checks account"| node_account_hash
node_account_login -->|"calls"| node_account_client
node_account_client -->|"sends requests"| node_oppo_service
node_account_hash -.->|"uses account ID"| node_settings

click node_desktop_ui "https://github.com/anton7444/osharepc/blob/main/oshare_gui/windows/runner/drag_drop_bridge.cpp"
click node_backend "https://github.com/anton7444/osharepc/blob/main/Program.cs"
click node_bridge "https://github.com/anton7444/osharepc/blob/main/OShareBridgeServer.cs"
click node_engine "https://github.com/anton7444/osharepc/blob/main/SenderEngine.cs"
click node_settings "https://github.com/anton7444/osharepc/blob/main/SettingsStore.cs"
click node_scanner "https://github.com/anton7444/osharepc/blob/main/PhoneScanner.cs"
click node_advertiser "https://github.com/anton7444/osharepc/blob/main/AllianceAdvertiser.cs"
click node_fallback_advertiser "https://github.com/anton7444/osharepc/blob/main/GattServiceFallbackAdvertiser.cs"
click node_gatt_link "https://github.com/anton7444/osharepc/blob/main/GattLink.cs"
click node_lan "https://github.com/anton7444/osharepc/blob/main/LanDiscovery.cs"
click node_lan_info "https://github.com/anton7444/osharepc/blob/main/LanInfo.cs"
click node_hotspot "https://github.com/anton7444/osharepc/blob/main/HotspotManager.cs"
click node_wifi_joiner "https://github.com/anton7444/osharepc/blob/main/WifiJoiner.cs"
click node_transfer_server "https://github.com/anton7444/osharepc/blob/main/TransferServer.cs"
click node_transfer_task "https://github.com/anton7444/osharepc/blob/main/TransferTask.cs"
click node_receive_gatt "https://github.com/anton7444/osharepc/blob/main/ReceiveGattServer.cs"
click node_receive_session "https://github.com/anton7444/osharepc/blob/main/ReceiveSession.cs"
click node_downloads "https://github.com/anton7444/osharepc/blob/main/DownloadsFolder.cs"
click node_account_login "https://github.com/anton7444/osharepc/blob/main/OppoAccount/OppoAccountLoginSession.cs"
click node_account_client "https://github.com/anton7444/osharepc/blob/main/OppoAccount/OppoAccountClient.cs"
click node_account_hash "https://github.com/anton7444/osharepc/blob/main/OppoAccount/OppoAccountBleHash.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_desktop_ui,node_backend,node_bridge,node_user toneBlue
class node_engine,node_settings toneAmber
class node_scanner,node_advertiser,node_fallback_advertiser,node_gatt_link toneMint
class node_lan,node_lan_info,node_hotspot,node_wifi_joiner,node_transfer_server,node_transfer_task toneRose
class node_receive_gatt,node_receive_session,node_downloads,node_phone,node_oppo_service toneIndigo
class node_account_login,node_account_client,node_account_hash toneTeal
```

## Components

### Desktop control

- [Desktop GUI](https://github.com/anton7444/osharepc/blob/main/oshare_gui/windows/runner/drag_drop_bridge.cpp): `oshare_gui/windows/runner/drag_drop_bridge.cpp`
- [Backend entry](https://github.com/anton7444/osharepc/blob/main/Program.cs): `Program.cs`
- [Authenticated bridge](https://github.com/anton7444/osharepc/blob/main/OShareBridgeServer.cs): `OShareBridgeServer.cs`

### Transfer coordination

- [Sender engine](https://github.com/anton7444/osharepc/blob/main/SenderEngine.cs): `SenderEngine.cs`
- [Settings](https://github.com/anton7444/osharepc/blob/main/SettingsStore.cs): `SettingsStore.cs`

### Phone discovery

- [Phone scanner](https://github.com/anton7444/osharepc/blob/main/PhoneScanner.cs): `PhoneScanner.cs`
- [BLE advertiser](https://github.com/anton7444/osharepc/blob/main/AllianceAdvertiser.cs): `AllianceAdvertiser.cs`
- [Fallback advertiser](https://github.com/anton7444/osharepc/blob/main/GattServiceFallbackAdvertiser.cs): `GattServiceFallbackAdvertiser.cs`
- [BLE link](https://github.com/anton7444/osharepc/blob/main/GattLink.cs): `GattLink.cs`

### Send and networking

- [LAN discovery](https://github.com/anton7444/osharepc/blob/main/LanDiscovery.cs): `LanDiscovery.cs`
- [LAN interface](https://github.com/anton7444/osharepc/blob/main/LanInfo.cs): `LanInfo.cs`
- [Mobile hotspot](https://github.com/anton7444/osharepc/blob/main/HotspotManager.cs): `HotspotManager.cs`
- [Wi-Fi join](https://github.com/anton7444/osharepc/blob/main/WifiJoiner.cs): `WifiJoiner.cs`
- [Send server](https://github.com/anton7444/osharepc/blob/main/TransferServer.cs): `TransferServer.cs`
- [Transfer task](https://github.com/anton7444/osharepc/blob/main/TransferTask.cs): `TransferTask.cs`

### Receive and storage

- [Receive GATT server](https://github.com/anton7444/osharepc/blob/main/ReceiveGattServer.cs): `ReceiveGattServer.cs`
- [Receive session](https://github.com/anton7444/osharepc/blob/main/ReceiveSession.cs): `ReceiveSession.cs`
- [Download location](https://github.com/anton7444/osharepc/blob/main/DownloadsFolder.cs): `DownloadsFolder.cs`

### Account support

- [Account login](https://github.com/anton7444/osharepc/blob/main/OppoAccount/OppoAccountLoginSession.cs): `OppoAccount/OppoAccountLoginSession.cs`
- [Account service client](https://github.com/anton7444/osharepc/blob/main/OppoAccount/OppoAccountClient.cs): `OppoAccount/OppoAccountClient.cs`
- [BLE account hash](https://github.com/anton7444/osharepc/blob/main/OppoAccount/OppoAccountBleHash.cs): `OppoAccount/OppoAccountBleHash.cs`

### Other components

- **PC user**
- **Compatible phone**
- **OPPO account service**

## Connections

- PC user → Desktop GUI: controls (evidence: `README.md`)
- Desktop GUI → Backend entry: starts beside (evidence: `README.md`)
- Desktop GUI → Authenticated bridge: uses bridge (evidence: `README.md`)
- Backend entry → Sender engine: starts engine (evidence: `Program.cs`)
- Sender engine → Phone scanner: starts scan (evidence: `SenderEngine.cs`)
- Sender engine → BLE advertiser: coordinates (evidence: `SenderEngine.cs`)
- Sender engine → Fallback advertiser: coordinates (evidence: `SenderEngine.cs`)
- Sender engine → BLE link: connects (evidence: `SenderEngine.cs`)
- Sender engine → Send server: uses (evidence: `SenderEngine.cs`)
- Sender engine → Receive GATT server: starts receiver (evidence: `SenderEngine.cs`)
- Sender engine → Mobile hotspot: manages hotspot (evidence: `SenderEngine.cs`)
- Sender engine → LAN discovery: uses discovery (evidence: `SenderEngine.cs`)
- Sender engine → LAN interface: detects LAN (evidence: `SenderEngine.cs`)
- Sender engine → Wi-Fi join: joins Wi-Fi (evidence: `SenderEngine.cs`)
- Sender engine → Settings: reads settings (evidence: `SenderEngine.cs`)
- Compatible phone → Phone scanner: broadcasts to
- Compatible phone → Receive GATT server: initiates receive
- Send server → Transfer task: creates task (evidence: `TransferServer.cs`)
- Receive GATT server → Receive session: starts session (evidence: `ReceiveGattServer.cs`)
- Receive GATT server → Download location: selects save path (evidence: `ReceiveGattServer.cs`)
- Receive session → Compatible phone: receives files
- Sender engine → BLE account hash: checks account (evidence: `SenderEngine.cs`)
- Account login → Account service client: calls (evidence: `OppoAccount/OppoAccountLoginSession.cs`)
- Account service client → OPPO account service: sends requests (evidence: `OppoAccount/OppoAccountClient.cs`)
- BLE account hash → Settings: uses account ID
