Architecture
The four links
Fenpo uses four separate links between the phone and the PC. Each feature picks the link that needs the least from the phone app; the iPhone app only steps in for things that have no other way.
| Link | Who sets it up | What it carries | Phone app needed |
|---|---|---|---|
| 1. BLE GATT to Apple's services | PC is the client, iPhone the server | Notifications (ANCS), media (AMS), battery (BAS), time (CTS) | No |
| 2. Classic Bluetooth | PC is the client | Messages (MAP) | No |
| 3. Fenpo BLE channel | PC is a GATT server (peripheral), the phone connects to it | Wake-ups, small commands, short clipboard text, proximity, the PC's addresses | Yes |
| 4. Fenpo data channel | Phone is the client, PC the server, over the local network | Files, photos, larger clipboard items, camera and screen video, shared folders | Yes |
Why is the phone the central and the PC the peripheral? When iOS acts as a peripheral in the background, it moves its service UUIDs into an "overflow" area that Windows cannot scan. With the iPhone as the central, iOS wakes the app for about 10 seconds on each notification, using the bluetooth-central background mode and state restoration.
On Android there are no Apple BLE services: notifications and media come from the Android app over the Fenpo channel. The Fenpo BLE and data channels work the same way as on the iPhone.
Windows side
Fenpo for Windows runs as a single process (MSIX, full trust, started at sign-in):
Fenpo.exe
├── Generic Host (Microsoft.Extensions.Hosting)
│ ├── BluetoothHostedService manages links 1-3, reconnects
│ ├── TransportHostedService link 4: TLS server, DNS-SD registration, LocalSend
│ ├── NotificationRouter ANCS → Windows notification / call window
│ ├── ClipboardService Windows clipboard ↔ Fenpo
│ ├── ProximityService RSSI → lock
│ └── LocalApiServer named pipe, for the shell and other clients
├── UI (WinUI 3) window created only when opened, stays in the tray when closed
│ ├── MainWindow NavigationView, pages
│ ├── TrayFlyout H.NotifyIcon.WinUI
│ └── IslandWindow always on top, transparent, top center of the screen
└── Data: SQLite database in the package's LocalState folder
Fenpo.VirtualCamera.dll Native AOT COM media source, runs inside Frame Server
A single process is used because Bluetooth connections are tied to the app identity (the MSIX package), and APIs such as phone line transport, app notifications and the share target require a package identity.
Projects
windows/
├── src/
│ ├── Fenpo.App/ WinUI 3, single-project MSIX packaging, views and view models
│ ├── Fenpo.Core/ domain model, service interfaces, pairing, settings, SQLite
│ ├── Fenpo.Bluetooth/ ANCS, AMS, BAS, CTS clients; GATT server; OBEX, MAP
│ ├── Fenpo.Transport/ TLS server, framing, DNS-SD, LocalSend
│ ├── Fenpo.Protocol/ C# types generated from .proto
│ ├── Fenpo.Sdk/ named pipe client
│ └── Fenpo.VirtualCamera/ Native AOT COM server
└── tests/
├── Fenpo.Core.Tests/
├── Fenpo.Bluetooth.Tests/ ANCS/MAP parsers tested with recorded byte sequences
└── Fenpo.Transport.Tests/
Dependency direction: App → Core ← Bluetooth, Transport. Core does not depend on any WinRT type, so the parsers and business logic can be tested without Windows.
Notification, message and media services are fed through source-independent interfaces (INotificationSource, IMessageSource, IMediaSource). For the iPhone the sources are ANCS, MAP and AMS; Android adds its own source over the Fenpo channel.
Example: notification flow
iPhone ANCS Notification Source ─► AncsClient.NotificationAdded(uid, category, flags)
─► GetNotificationAttributes on the Control Point (ordered queue)
─► join the Data Source chunks ─► AncsNotification
─► AppIdentityResolver (display name + App Store lookup icon, SQLite cache)
─► NotificationRouter
├─ category IncomingCall ─► IslandWindow (Answer = ANCS Positive, Decline = Negative)
├─ app Messages ─► AppNotification + reply box (sent through MAP)
└─ other ─► AppNotification (Dismiss = ANCS Negative)
Protocol
protocol/ is the contract the three apps share. The messages are Protocol Buffers in protocol/fenpo/v1/, and the Windows, iPhone and Android types are generated from them. gRPC is not used; Fenpo has its own framing. The protocol README in the repository is in English and covers framing, the BLE channel and pairing.
Handshake: every connection starts with a Hello (or a PairingRequest on a pairing connection). It carries the device type, OS version, model and a capability list, and each side only turns on what both support. This lets Android or another client be added without special cases on the Windows side.
Framing:
- Data channel (TLS):
[uint32 length, big-endian][Envelope bytes]. Control messages travel on one long-lived connection. File bodies and video flow on separate TLS connections so the control channel is never blocked. The phone always opens the connections; there is no listening socket on the phone. - BLE channel: one Fenpo service with two characteristics,
rx(the phone writes) andtx(the PC notifies), both requiring an encrypted link. Each envelope is first sealed with AES-GCM, then split into chunks to fit the MTU. Larger payloads trigger a "switch to Wi‑Fi" signal: the PC asks over BLE and the phone opens the data connection, even from the background.
Pairing and security
- On first launch the PC creates an ECDSA P-256 key and a self-signed certificate (protected with DPAPI on Windows). P-256 is supported by Windows Schannel, Apple Network.framework and the Android TLS stack alike.
- The PC shows a QR code containing its ID, name, addresses, the SHA-256 fingerprint of its certificate and a one-time 128-bit token. There is no numeric fallback code: without the QR code the phone has no fingerprint to verify, and a short code would not protect against a man in the middle.
- The phone connects over TLS, verifies the server certificate against the fingerprint and sends a
PairingRequestwith its own certificate and the token. The PC consumes the token and pins the phone's fingerprint. From then on every connection is TLS 1.3 with certificate pinning on both sides. - On the iPhone, AccessorySetupKit is used to select the PC's Fenpo BLE service. iOS shows its pairing prompt and creates the bond; the PC then finds ANCS over the same bond and iOS asks to share notifications.
- Classic Bluetooth (MAP) needs a Windows Bluetooth pairing. The setup wizard guides the user to it and to the matching switches on the iPhone.
- Messages on the BLE channel are additionally encrypted with AES-256-GCM using a key the PC creates during pairing and sends over TLS. Each sender keeps a persistent, increasing counter; the receiver rejects any counter that is not higher than the last one it saw. The BLE bond alone is never treated as a source of trust.
Discovery
- DNS-SD: the PC registers
_fenpo._tcp. - When the BLE channel is connected, the PC sends its current IP addresses over it. Since the iPhone cannot browse Bonjour in the background, this is the main path.