CoreBluetooth设备名称变更 [英] CoreBluetooth device name change

查看:423
本文介绍了CoreBluetooth设备名称变更的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在创建一个简单的iOS蓝牙应用程序。我现在有一个设备与修改名称的能力。什么我发现是,当我连接到CBPeripheral设备,它似乎缓存了旧设备的名称。

I am currently creating a simple iOS bluetooth app. I currently have a device with the ability to modify the name. What I am finding is that when I connect to a CBPeripheral device, it seems to be caching the old device name.


  1. 通过我的应用程序连接到设备上。

  2. 从通过我的应用程序的设备断开连接。

  3. 更改设备的名称。

  4. 重新发现/通过我的应用程序重新连接到设备(与现有CBPeripheral对象)。

遵循上面的程序,我期待我的iOS应用程序,以发现新的设备名称。不过,我发现它有保留旧的名称,而不是一个趋势。通过从CBPeripheral设备断开两次,我发现我可以检索新名称。

By following the procedure above, I was expecting my iOS app to discover the new device name. However, I am finding that it has a tendency of retaining the old name instead. By disconnecting from the CBPeripheral device twice, I find that I can retrieve the new name.

所以我的问题是,有没有办法,以获得最新的设备名称,更新或清除CBPeripheral现有发现的特征(或重新发现新的特点,每次)?

So my question is, is there a way to update or clear CBPeripheral's existing discovered characteristics (or rediscovering new characteristics each time) in order to get the latest device name?

下面是一个类似的问题:<一href=\"http://stackoverflow.com/questions/13180134/corebluetooth-refreshing-local-name-of-an-already-discovered-peripheral\">CoreBluetooth:已经发现的外围的清凉的当地名称

Here is a similar issue: CoreBluetooth: Refreshing local name of an already discovered Peripheral

推荐答案

我有一个类似的问题,而且它不仅与设备名称的问题,但一些characterstics在特定的模式改变(如固件升级的设备上)

I had a similar issue, moreover it wasn't a problem only with the device's name but some characterstics changed in specific modes (like firmware upgrade on a device).

得到苹果如下回答:结果
答案是,附件需要支持GATT服务变更了的特性 - 请阅读规范,特别是第3卷,部分G,2.5.2和第3卷,部分G,7.1。

Got the following answer from apple:
"The answer is that the accessory needs to support the GATT Service Changed characteristic - please read the specification, specifically Vol 3, Part G, 2.5.2, and Vol 3, Part G, 7.1."

这个名字的问题已经被其标榜的广告数据属性的设备名称解决。 (然而,这可能需要特定的固件,因为它并不总是有在进阶包属性)

The name issue has been solved by having the device name advertised as a property in the advertisement data. (This however might need specific firmware as it doesn't always have that property in the adv package)

否则到的重置核心蓝牙缓存的:你将需要重新启动iOS的蓝牙适配器,我无法管理在iOS编程做

Otherwise to reset the core-bluetooth cache: you will need to re-start the iOS bluetooth adapter which I couldn't manage to do programatically on iOS.

这篇关于CoreBluetooth设备名称变更的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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