Skip to content

Commit

Permalink
backends/p4android: fix using wrong tx_power value
Browse files Browse the repository at this point in the history
This was using the advertisement received signal strength indicator
instead of the transmitted power level. This is now fixed.

Fixes: #1532
  • Loading branch information
dlech committed Apr 29, 2024
1 parent 76a94a9 commit 86b28ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Fixed
* Fixed BlueZ ``_wait_removed`` completion on invalid object path. Fixes #1489.
* Fixed rare unhandled exception when scanning on macOS when using ``use_bdaddr``. Fixes #1523.
* Fixed scanning silently failing on Windows when Bluetooth is off. Fixes #1535.
* Fixed using wrong value for ``tx_power`` in Android backend. Fixes #1532.

`0.21.1`_ (2023-09-08)
======================
Expand Down
4 changes: 2 additions & 2 deletions bleak/backends/p4android/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ def _handle_scan_result(self, result) -> None:
entry.getKey().toString(): bytes(entry.getValue())
for entry in record.getServiceData().entrySet()
}
tx_power = result.getTxPower()
tx_power = record.getTxPowerLevel()

# change "not present" value to None to match other backends
if tx_power == defs.ScanResult.TX_POWER_NOT_PRESENT:
if tx_power == -2147483648: # Integer#MIN_VALUE
tx_power = None

advertisement = AdvertisementData(
Expand Down

0 comments on commit 86b28ac

Please sign in to comment.