#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 #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#20947
Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>
Pick up the upstream bluez-dbus fix that returns a snapshot from
DeviceManager.getDevices() (hypfvieh/bluez-dbus#75), avoiding a
ConcurrentModificationException when BlueZ mutates the device list
during iteration, which could take the bridge offline and stall
updates.
Updates the bundle dependency, the BlueZ Karaf feature, and the
aggregated Bluetooth feature to 0.3.5.
Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>
* [bluetooth] Recover BlueZ devices after object removal
Reset cached adapter and device state when BlueZ removes their DBus objects, and populate GATT services before notifying listeners. This allows always-connected devices to reconnect after device removal or adapter unplug/replug.
Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>
* [bluetooth] Bump bluez-dbus-osgi to 0.3.3
Picks up the upstream bluez-dbus fix that evicts cached device wrappers when
BlueZ removes the underlying DBus object (hypfvieh/bluez-dbus#73), so the binding
recovers from stale device objects instead of getting stuck on a dead proxy.
* [bluetooth] Bump bluez-dbus-osgi to 0.3.4
Use the corrected release containing the verified BlueZ object-lifecycle and retryable GATT discovery fixes.
Signed-off-by: Vlad Kolotoff <vkolotoff@pm.me>
Devices whose BlueZ connection completes shortly after the binding's connect
call times out, or that reconnect later, never had their GATT services
discovered, so their channels were never built or stopped updating (the Thing
kept only the rssi channel, or logged 'characteristic is missing' forever).
Signed-off-by: Vlad Kolotoff <vkolotov@gmail.com>