低功耗蓝牙连接如 [英] Bluetooth Low Energy conection

查看:496
本文介绍了低功耗蓝牙连接如的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发应用程序为Win 8.1 PC与我的BLE设备进行通信。我读了在Win 8也没有像扫描功能的BLE,所以我读MS一些例子,尝试简单的连接到我的设备符合UUID:A9DA45B4-34F8-C660-591D-F6918B5B988C

I'm trying to develop app for Win 8.1 PC to communicate with my BLE device. I read that in Win 8 there is no something like scanning functionality for BLE so I read some examples from MS and try to simple connect to my device with UUID: "A9DA45B4-34F8-C660-591D-F6918B5B988C"

所以我写了一些$基于MS的例子C $ C:

So I write some code based on ms examples:

 var devices = await DeviceInformation.FindAllAsync(
            GattDeviceService.GetDeviceSelectorFromUuid(new Guid("A9DA45B4-34F8-C660-591D-F6918B5B988C")), new string[] { "System.Devices.ContainerId" });

 if (devices.Count > 0){
    //Do something
 }

但是,这code总是返回我空的设备列表中。更多比我仍然能够通过Android或iOS应用到我的设备连接。

But this code always return me empty devices list. More over I am still able to connect my device by android or iOS app.

有人能告诉我,如果它是连接BLE好办法吗?

Can someone told me if it is good way to connect BLE?

推荐答案

进入设置 - >更改电脑设置 - > - > PC和设备 - >蓝牙。

Go to Settings --> Change PC Settings --> --> PC and devices --> Bluetooth.

请确保您的设备是可发现,然后再建立连接。

Make sure that your device is discoverable, then establish a connection.

再试一次当你做,如果它仍不能正常工作,请尝试使用以下code:

Try again when you're done, if it still doesn't work, try with following code:

var devices = await DeviceInformation.FindAllAsync(
        GattDeviceService.GetDeviceSelectorFromUuid(GattServiceUuids.GenericAccess));

devices.Count应该返回至少为1

devices.Count should return at least 1.

这篇关于低功耗蓝牙连接如的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆