How polargoose/bluetoothdevicepairing works
Project type and purpose
• This is a console-based command-line utility (written in C#/.NET) for discovering, pairing, connecting, disconnecting, and unpairing Bluetooth and BLE audio devices on Windows. It exposes a set of commands (e.g. “discover”, “pair-by-mac”, “disconnect-bluetooth-audio-device-by-name”) that call into a domain library which wraps the Windows Bluetooth APIs.
File structure
• Top-level: solution file, build scripts, nuget.config, README, LICENSE
• src/Program.cs → entry point that bootstraps a command parser and dispatches to “Commands”
• src/Commands → individual command classes (e.g. PairDeviceByMac, DiscoverDevices) + shared options & utilities
• src/Bluetooth → core domain library with sub-packages:
• Adapters (AdapterFinder, Adapter, AdapterMacAddress)
• Devices (BluetoothDevice, BluetoothLeDevice, AudioDevice + enumerators, DeviceDiscoverer, DevicePairer, DeviceUnPairer)
• Utils (filtering, watchers)
• src/Utils → cross-cutting exception type
• FodyWeavers.xml, Directory.Build.props → build/config glue
• Program.cs + build.ps1 + GitHub Actions workflow → deployment pipeline
README for additional insights
• Describes commands, behavior when pairing, discovery time, return codes
• Target platform: Windows 10 1809+
• Depends on Windows.Devices.Enumeration UWP APIs via interop calls in src/Bluetooth/Devices/Interop.cs
• No external services or databases—purely local OS API calls
Detail & thoroughness
• If desired, annotate potential extension points (e.g. adding new Commands, adding support for another OS API)
• Layers—don’t collapse the domain layer; show Adapters vs. Devices vs. AudioDevices submodules