CoreBluetooth:唯一UUID的生命周期是多少 [英] CoreBluetooth: What is the lifetime of unique UUIDs

查看:180
本文介绍了CoreBluetooth:唯一UUID的生命周期是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关闭这个问题,

连接到外围设备后,我可以检索其唯一的 CFUUIDRef ,并可以通过<$ c $重新连接它C> retrievePeripherals 。但是,我发现在关闭应用程序后我无法使用它重新连接。

After connecting to a peripheral, I can retrieve its CFUUIDRef, which is unique, and can use it to reconnect via retrievePeripherals. However, I have found that I can not use it to reconnect after closing the application.

唯一 UUID 连接后生成的只对应用程序的生命周期有效,或者我们是否应该保存它以供以后使用?我试图让我的应用程序记住一个特定的外围设备,但除了 peripheral.UUID 之外,我不知道任何其他唯一标识符。

Is the unique UUID generated after a connection only valid for the lifetime of the application or are we supposed to be able to save it for later use? I am trying to have my application remember one particular peripheral, but besides peripheral.UUID, I don't know of any other unique identifiers.

推荐答案

长话短说,是的,您可以使用 UUID 重新连接到同一设备,即使您关闭应用程序(完全按照你说的方式)。我已经完成了我的每一个核心蓝牙应用程序,我保证100%正是你应该如何做到这一点。

Long story short, YES you can use the UUID to reconnect to the same device even after you close the application (in exactly the way you say). I've done it with every single one of my corebluetooth apps and I guarantee you 100% that's exactly how you should do it.

但我认为你不是与外围配对??那是一个很大的问题。您需要实际建立配对请求并让外围设备显示在蓝牙表中。然后将使用iOS设备固化 UUID ,直到您刷新iOS设备的网络设置。 (这当然取决于没有芯片组。虽然这对于业内一些最常见的设备来说都是正确的,但它可以在没有它的情况下完成。指出你的芯片组我会确认我是否知道一种方式或另一种方式)

I assume however, that you are not pairing with peripheral?? That's a big problem right there. You need to actually establish the pairing request and get the peripheral to show up in the bluetooth table. The UUID will then be solidified with the iOS device and will remain until you flush the Network Settings of the iOS device. (This of course being dependent on ble chipset..While this stands true for some of the most common devices in the industry, it can be accomplished without it though. Indicate your chipset and I'll confirm if I know one way or the other)

另一种可能性是您的BLE设备存在固件问题,在断开连接后,它会强制自己进入广告模式或其他状态。这也会影响你重新连接的能力。如果您有任何问题,请告诉我们。

The other possibility is that your BLE device has a firmware problem, wherein after you disconnect, it forces itself into advertising mode or something. This will also mess with your ability to reconnect. Let me know if you have any questions!

这篇关于CoreBluetooth:唯一UUID的生命周期是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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