gpt4 book ai didi

c# - 如何从 Windows Phone 8.1 发现低功耗蓝牙设备 (BLE)

转载 作者:太空宇宙 更新时间:2023-11-03 10:42:12 24 4
gpt4 key购买 nike

我正在编写一个 Silverlight Windows Phone 8.1 应用程序,我正在尝试连接来自 Windows Phone 8.1 的低功耗蓝牙 (BLE) 设备,该设备是“心率”,但我没有得到结果。请参阅下面的代码。

protected async override void OnNavigatedTo(NavigationEventArgs e)
{
var devices = await DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid
(GattServiceUuids.HeartRate));
if (devices.Count > 0)
{

}
}

我还在 appmanifest 文件中添加了功能。

<Capabilities>
<Capability Name="internetClient"/>
<m2:DeviceCapability Name="bluetooth.genericAttributeProfile">
<m2:Device Id="any">
<m2:Function Type="name:heartRate" />
<m2:Function Type="serviceId:0000180d-0000-1000-8000-00805f9b34fb" />
</m2:Device>
</m2:DeviceCapability>

一切似乎都很好,但我没有得到输出。出了什么问题?

最佳答案

必须先在手机的“设置->蓝牙”中配对心率传感器。

关于c# - 如何从 Windows Phone 8.1 发现低功耗蓝牙设备 (BLE),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24928264/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com