WPF 中的蓝牙低功耗设备

Bluetooth Low Energy Device In WPF

我必须使用低功耗蓝牙 (BLE) 和 WPF 创建桌面应用程序。根据我的研究,Microsoft BLE API' not available for WPF.Microsoft 具有用于 UWP 的丰富 UWP APIs。那么我们可以在WPF上使用UWP BLE APIS吗? 我试过使用 Windows 运行 时间组件,但运气不好。

Windows.Devices.Bluetooth API 是 DualApiPartitioned,这意味着 API 允许从桌面应用程序调用。所以当你想使用BLE APIs时,你可以尝试在你的WPF中添加如下引用。

System.Runtime.WindowsRuntime, in: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
Windows, in: C:\Program Files (x86)\Windows Kits\UnionMetadata\Facade\Windows.WinMD​
Windows.Foundation.FoundationContract, in: C:\Program Files (x86)\Windows Kits\References.0.18362.0\Windows.Foundation.FoundationContract.0.0.0\Windows.Foundation.FoundationContract.winmd​
Windows.Foundation.UniversalApiContract, in: C:\Program Files (x86)\Windows Kits\References.0.18362.0\Windows.Foundation.UniversalApiContract.0.0.0\Windows.Foundation.UniversalApiContract.winmd

更多详细信息,您可以阅读这篇文章link