PureSwift / Bluetooth

Pure Swift Bluetooth library
http://pureswift.github.io/Bluetooth/
MIT License
174 stars 24 forks source link

Fix GATT Notifications #119

Open colemancda opened 5 years ago

colemancda commented 5 years ago

GATTServer should not be sending GATT notifications to the connected client that wrote the value.

colemancda commented 5 years ago

Initial work in https://github.com/PureSwift/Bluetooth/commit/ab33985b8621d122662be941b2a4f267cb80ba07 . Need to differentiate between:

colemancda commented 5 years ago

Notifications for characteristics will not work for multiple characteristics with the same UUID in a service.

https://github.com/PureSwift/Bluetooth/blob/ab33985b8621d122662be941b2a4f267cb80ba07/Sources/GATTServer.swift#L280

colemancda commented 5 years ago

There seems to also be issues in the GATTClient implementation https://gist.github.com/wlisac/75650c0bc54ffb4a248b8aff306ff715

sbrewin commented 3 years ago

I can confirm the there is an issue around GATTClient processing notifications. A peripheral receives and processes the subscribe request from the GATTClient and the unsubscribe request when the GATTClient is closed. Notifications sent by the peripheral are not being processed correctly by the GATTClient. Before I debug further I thought I’d ask if anyone else is actively working on this and if so what progress has been made?

justinmiller62 commented 3 years ago

I am also getting this error Assertion failed: Invalid range: file /data/scanner/SwiftScanner/.build/checkouts/Bluetooth/Sources/BluetoothGATT/GATTClient.swift, line 470

Whenever I start a notify on characteristic. It doesn't happen every time but does once about 1 in 3 times.