Skip to content

Fix Bluez BT LE battery reading

This commit addresses two related issues:

  • From Bluez 5.55 onwards the battery service is available through both GattService1 and Battery1 interface. This broke the current implementation in a way that the battery level was always '0'. This patch uses the GattService1 interface if available
  • The Battery1 interface is not always available during the service discovery, it's not generated yet. This causes the service to be missed. This patch also checks if the battery remote service is available also from 'Device1' interface

This commit has been tested with Bluez versions 5.42..5.63 with Qt6, and with few selected versions with Qt5

Fixes: QTBUG-70222 Pick-to: 5.15 6.2 6.3 Change-Id: I963947937cf85c8082fb044afe223f41e141b7c0 Reviewed-by: Alex Blasche (cherry picked from commit e7604172)

  • asturmlechner 2023-04-10: Resolve conflict with dev branch commit 66bb9839

Merge request reports