简体   繁体   English

如何清除 iOS 中的 BLE 缓存,连接蓝牙设备

[英]How to clear BLE cache in iOS, connected Bluetooth device

We are working Bluetooth device for connection perform the read/write operations.我们正在使用蓝牙设备连接执行读/写操作。 Bluetooth services Not going to update once we connect Bluetooth device.蓝牙服务 连接蓝牙设备后不会更新。 If we have added new read/write BLE service characteristics then we need to reset iPhone.如果我们添加了新的读/写 BLE 服务特性,那么我们需要重置 iPhone。

We are doing the below steps我们正在执行以下步骤

Initially we connect to Bluetooth Device.最初我们连接到蓝牙设备。 we are perform the READ and WRITE all services.我们正在执行 READ 和 WRITE 所有服务。 But if Bluetooth device firmware version Updated and this version we have added new BLE service characteristics, in that case I am not able to get new BLE service in iOS device iPhone and iPad.但是如果蓝牙设备固件版本更新并且这个版本我们添加了新的 BLE 服务特性,在这种情况下,我无法在 iOS 设备 iPhone 和 iPad 中获得新的 BLE 服务。

I have to reset all device and then i can get new updated services from Bluetooth Device.我必须重置所有设备,然后才能从蓝牙设备获取新的更新服务。

How we can fix this issue on iOS swift.我们如何在 iOS swift 上解决此问题。

Thanks in advance !提前致谢 !

You can solve your problem by providing the service changed characteristic on your BLE device.您可以通过在 BLE 设备上提供服务更改特性来解决您的问题。 Take the Accessory Design Guidelines as a reference.附件设计指南作为参考。 It states at 11.12.2 (emphasis mine):它在 11.12.2(强调我的)中声明:

The accessory must implement the Service Changed characteristic only if the accessory has the ability to change its services during its lifetime .仅当配件在其生命周期内能够更改其服务时,配件才必须实现服务更改特性。

Simply implementing this will force your iPhone and iPad to always read the services and characteristics from the device instead from the cache.简单地实现这一点将强制您的 iPhone 和 iPad 始终从设备读取服务和特征,而不是从缓存中读取。 This is explained here .这是解释here

Other than resetting your devices Bluetooth adapter I am not aware of another way to reset the cache.除了重置您的设备蓝牙适配器之外,我不知道另一种重置缓存的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM