Commit 9f8cba6d5c32704e68918136e8072362d2baba9c
1 parent
79da48c3
feat:notification uuid
Showing
2 changed files
with
5 additions
and
0 deletions
HDFwear/Tools/Bluetooth+Types.swift
... | ... | @@ -28,6 +28,8 @@ public struct BLEConfig { |
28 | 28 | static let ReadUUID = "0000FFF3-0000-1000-8000-00805F9B34FB" //读取数据特征值 |
29 | 29 | static let WriteUUID = "0000FFF2-0000-1000-8000-00805F9B34FB" //写入数据特征值 |
30 | 30 | |
31 | + static let NotificationUUID = "0000FFD2-0000-1000-8000-00805F9B34FB" //写入数据特征值 | |
32 | + | |
31 | 33 | // 0000FFF4-0000-1000-8000-00805F9B34FB // 转换特征值 |
32 | 34 | |
33 | 35 | // 旧 | ... | ... |
HDFwear/Tools/BluetoothManager.swift
... | ... | @@ -1882,6 +1882,9 @@ extension BluetoothManager: CBPeripheralDelegate { |
1882 | 1882 | delegate.didSetupServiceCharacteristics(peripheral) |
1883 | 1883 | } |
1884 | 1884 | } |
1885 | + if BLEConfig.NotificationUUID.contains(uuid) { | |
1886 | + peripheral.setNotifyValue(true, for: char) | |
1887 | + } | |
1885 | 1888 | } |
1886 | 1889 | } |
1887 | 1890 | ... | ... |