Skip to content

Commit

Permalink
Fix change propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Jan 24, 2024
1 parent 409e041 commit e76c75c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Sources/SpeziBluetooth/CoreBluetooth/BluetoothPeripheral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,14 @@ public actor BluetoothPeripheral {
}
}

private func propagateChanges(for service: CBService) {
guard let gattService = getService(id: service.uuid) else {
return
}

gattService.updateCharacteristics()
}

Check warning on line 478 in Sources/SpeziBluetooth/CoreBluetooth/BluetoothPeripheral.swift

View check run for this annotation

Codecov / codecov/patch

Sources/SpeziBluetooth/CoreBluetooth/BluetoothPeripheral.swift#L472-L478

Added lines #L472 - L478 were not covered by tests

private func propagateChanges(for characteristic: CBCharacteristic) {
guard let service = characteristic.service,
let gattCharacteristic = getCharacteristic(id: characteristic.uuid, on: service.uuid) else {
Expand Down Expand Up @@ -524,6 +532,8 @@ extension BluetoothPeripheral {
}

fileprivate func discovered(characteristics: [CBCharacteristic], for service: CBService) {
propagateChanges(for: service)

Check warning on line 536 in Sources/SpeziBluetooth/CoreBluetooth/BluetoothPeripheral.swift

View check run for this annotation

Codecov / codecov/patch

Sources/SpeziBluetooth/CoreBluetooth/BluetoothPeripheral.swift#L535-L536

Added lines #L535 - L536 were not covered by tests
// automatically subscribe to discovered characteristics for which we have a handler subscribed!
for characteristic in characteristics {
// TODO: how about the encryption required stuff?
Expand Down

0 comments on commit e76c75c

Please sign in to comment.