From b722ee6ec503cf8a18ce9bdab4b2c39a6c1a9590 Mon Sep 17 00:00:00 2001 From: shangjie119 <494948246@qq.com> Date: Wed, 10 Mar 2021 14:46:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=85=A8=E9=83=A8notify=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 删除全部notify list --- .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++++++ Classes/objc/BabyBluetooth.h | 5 +++++ Classes/objc/BabyBluetooth.m | 5 +++++ Classes/objc/BabySpeaker.h | 3 +++ Classes/objc/BabySpeaker.m | 5 +++++ 5 files changed, 26 insertions(+) create mode 100644 BabyBluetoothExamples/BabyBluetoothAppDemo/BabyBluetoothAppDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/BabyBluetoothExamples/BabyBluetoothAppDemo/BabyBluetoothAppDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/BabyBluetoothExamples/BabyBluetoothAppDemo/BabyBluetoothAppDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/BabyBluetoothExamples/BabyBluetoothAppDemo/BabyBluetoothAppDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Classes/objc/BabyBluetooth.h b/Classes/objc/BabyBluetooth.h index fb45387..0aaf8f3 100644 --- a/Classes/objc/BabyBluetooth.h +++ b/Classes/objc/BabyBluetooth.h @@ -474,6 +474,11 @@ characteristic:(CBCharacteristic *)characteristic - (void)cancelNotify:(CBPeripheral *)peripheral characteristic:(CBCharacteristic *)characteristic; +/** + 取消设备所有的notify + */ +- (void)cancelAllNotify; + /** 获取当前连接的peripherals */ diff --git a/Classes/objc/BabyBluetooth.m b/Classes/objc/BabyBluetooth.m index 81323c4..875a278 100644 --- a/Classes/objc/BabyBluetooth.m +++ b/Classes/objc/BabyBluetooth.m @@ -580,6 +580,11 @@ - (void)cancelNotify:(CBPeripheral *)peripheral [babySpeaker removeNotifyCallback:characteristic]; } +- (void)cancelAllNotify +{ + [babySpeaker removeAllNotify]; +} + //获取当前连接的peripherals - (NSArray *)findConnectedPeripherals { return [babyCentralManager findConnectedPeripherals]; diff --git a/Classes/objc/BabySpeaker.h b/Classes/objc/BabySpeaker.h index 0f51603..67fbee4 100644 --- a/Classes/objc/BabySpeaker.h +++ b/Classes/objc/BabySpeaker.h @@ -33,6 +33,9 @@ //添加到notify list - (void)removeNotifyCallback:(CBCharacteristic *)c; +//删除全部notify list +- (void)removeAllNotify; + //获取notify list - (NSMutableDictionary *)notifyCallBackList; diff --git a/Classes/objc/BabySpeaker.m b/Classes/objc/BabySpeaker.m index 8850b34..df10a24 100644 --- a/Classes/objc/BabySpeaker.m +++ b/Classes/objc/BabySpeaker.m @@ -100,6 +100,11 @@ - (void)removeNotifyCallback:(CBCharacteristic *)c { [notifyList removeObjectForKey:c.UUID.description]; } +//删除全部notify list +- (void)removeAllNotify { + [notifyList removeAllObjects]; +} + //获取notify list - (NSMutableDictionary *)notifyCallBackList { return notifyList;