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

时间:2014-07-24 08:06:30

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

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

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>

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

1 个答案:

答案 0 :(得分:2)

心率传感器必须先在&#34;设置 - >蓝牙&#34;中进行配对。在手机上。