From 9f8cba6d5c32704e68918136e8072362d2baba9c Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 7 Mar 2024 20:43:09 +0800 Subject: [PATCH] feat:notification uuid --- HDFwear/Tools/Bluetooth+Types.swift | 2 ++ HDFwear/Tools/BluetoothManager.swift | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/HDFwear/Tools/Bluetooth+Types.swift b/HDFwear/Tools/Bluetooth+Types.swift index 6565d06..9eac08d 100644 --- a/HDFwear/Tools/Bluetooth+Types.swift +++ b/HDFwear/Tools/Bluetooth+Types.swift @@ -28,6 +28,8 @@ public struct BLEConfig { static let ReadUUID = "0000FFF3-0000-1000-8000-00805F9B34FB" //读取数据特征值 static let WriteUUID = "0000FFF2-0000-1000-8000-00805F9B34FB" //写入数据特征值 + static let NotificationUUID = "0000FFD2-0000-1000-8000-00805F9B34FB" //写入数据特征值 + // 0000FFF4-0000-1000-8000-00805F9B34FB // 转换特征值 // 旧 diff --git a/HDFwear/Tools/BluetoothManager.swift b/HDFwear/Tools/BluetoothManager.swift index ecd9676..38afbce 100644 --- a/HDFwear/Tools/BluetoothManager.swift +++ b/HDFwear/Tools/BluetoothManager.swift @@ -1882,6 +1882,9 @@ extension BluetoothManager: CBPeripheralDelegate { delegate.didSetupServiceCharacteristics(peripheral) } } + if BLEConfig.NotificationUUID.contains(uuid) { + peripheral.setNotifyValue(true, for: char) + } } } -- libgit2 0.21.4