Commit 2a8504c
authored
[bluetooth] Fix BlueZ events stopping after reconnect (no SERVICES_DISCOVERED) (openhab#20950)
openhab#20903 changed onServicesResolved() to call discoverServices() instead of
firing SERVICES_DISCOVERED unconditionally. discoverServices() only notified
when the openHAB-side service list *grew* (getGattServices().size() >
getServices().size()). That list (supportedServices) is only cleared on BlueZ
object removal, so on a normal reconnect BlueZ re-fires ServicesResolved=true
while the list is already fully populated, the "grew" check is false, and
SERVICES_DISCOVERED is never re-fired.
Consumers built on ConnectedBluetoothHandler re-arm their notifications and
polling off onServicesDiscovered() (e.g. grundfosalpha enables notifications
and schedules its read loop there; the generic binding rebuilds channels).
Swallowing the event leaves the Thing ONLINE but silent after every reconnect
- no events are received, matching openhab#20947.
Fire SERVICES_DISCOVERED whenever the GATT is resolved with services present,
not only when the list just grew. Population still happens only when the list
grows, but the notification now always reaches listeners on a resolve. The
event is idempotent for all consumers (generic only adds missing channels;
ConnectedBluetoothHandler/grundfosalpha re-enabling notifications is a no-op
when already notifying).
Fixes openhab#20947
Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>1 parent 6e83787 commit 2a8504c
1 file changed
Lines changed: 11 additions & 3 deletions
File tree
- bundles/org.openhab.binding.bluetooth.bluez/src/main/java/org/openhab/binding/bluetooth/bluez/internal
Lines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
| 389 | + | |
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
395 | | - | |
| 394 | + | |
| 395 | + | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| |||
505 | 505 | | |
506 | 506 | | |
507 | 507 | | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
508 | 516 | | |
509 | 517 | | |
510 | 518 | | |
| |||
0 commit comments