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

标签 c# bluetooth-lowenergy windows-phone-8.1

我正在编写一个 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/

相关文章:

c# - ASP.Net MVC ModelState/Html.TextBox 回发问题

c# - 如何使用 SignalR Hubs 从服务器向客户端发送消息

ios - BLE writeValue 到外设

ios - CoreBluetooth - 可以多次调用 connectPeripheral

c# - 如何将带有 HTML 标签的文本拆分为数组

wpf - ListView 填充父级、屏幕或其他的宽度

c# - 如何模拟多个级别的 DbSet.Include lambda?

c# - 使用 C# 创建 native 可执行文件

ios - BLE设备随机断开

c# - C# 中的 swig - 在可移植类库中找不到 HandleRef