BabyBluetooth icon indicating copy to clipboard operation
BabyBluetooth copied to clipboard

蓝牙外设返回的数据会有缓存

Open chenrengui opened this issue 7 years ago • 7 comments

请问为什么要对蓝牙外设返回的数据做缓存,怎么清除缓存呢?调用的方法为notify: characteristic: block:

在block回调里面,得到的蓝牙外设返回的数据,会有缓存,这是什么情况???

chenrengui avatar Nov 17 '17 01:11 chenrengui

同问 连接上会返回一次以前的数据 怎么清除

lz11 avatar Feb 27 '18 03:02 lz11

我也碰到了这个问题,查看文档没有地方提到有缓存。感觉像是蓝牙设备(外围设备)的缓存。

yinanwang1 avatar Jun 27 '19 07:06 yinanwang1

在发现特征值的代理方法里,你是不是调用了readValue的方法?

| | crgtpy 邮箱:[email protected] |

Signature is customized by Netease Mail Master

在2019年06月27日 15:29,阿南 写道:

我也碰到了这个问题,查看文档没有地方提到有缓存。感觉像是蓝牙设备(外围设备)的缓存。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

chenrengui avatar Jun 27 '19 07:06 chenrengui

我在- (void)setBlockOnDiscoverCharacteristicsAtChannel:(NSString *)channel block:(void (^)(CBPeripheral *peripheral,CBService *service,NSError *error))block这个方法里,实现了 - (void)notify:(CBPeripheral *)peripheral characteristic:(CBCharacteristic *)characteristic这个方法来监听value的变化。

yinanwang1 avatar Jun 27 '19 12:06 yinanwang1

setBlockOnDiscoverCharacteristics

你这么做解决问题了么

alanFri avatar Dec 04 '19 07:12 alanFri

我把这个方法注释掉了,就好了

| | crgtpy 邮箱:[email protected] |

Signature is customized by Netease Mail Master

在2019年12月04日 15:06,alanFri 写道:

setBlockOnDiscoverCharacteristics

你这么做解决问题了么

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

chenrengui avatar Dec 04 '19 10:12 chenrengui

我注释了- (void)setBlockOnDiscoverCharacteristicsAtChannel:(NSString *)channel block:(void (^)(CBPeripheral *peripheral,CBService *service,NSError *error))block 还是不行,缓存数据还是从setBlockOnDidWriteValueForCharacteristicAtChannel 返回了。。。

quietStefan avatar Jul 02 '21 02:07 quietStefan