Skip to content

Commit

Permalink
Merge pull request #521 from bojanpotocnik/develop
Browse files Browse the repository at this point in the history
Fix read and set of D-Bus properties in BleakClientBlueZDBus.pair()
  • Loading branch information
dlech authored Apr 21, 2021
2 parents b2f938a + 6174526 commit 3c388dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Fixed
* Fixed ``linux_autodoc_mock_import`` in ``docs/conf.py``.
* Minor fix for disconnection event handling in BlueZ backend. Fixes #491.
* Corrections for the Philips Hue lamp example. Merged #505
* Fixed BleakClientBlueZDBus.pair() method always returning True. Fixes #503.


`0.11.0`_ (2021-03-17)
Expand Down
9 changes: 6 additions & 3 deletions bleak/backends/bluezdbus/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,10 @@ async def pair(self, *args, **kwargs) -> bool:
)
)
assert_reply(reply)
if reply.body[0]:
if reply.body[0].value:
logger.debug(
f"BLE device @ {self.address} already paired with {self._adapter}"
)
return True

# Set device as trusted.
Expand All @@ -510,7 +513,7 @@ async def pair(self, *args, **kwargs) -> bool:
interface=defs.PROPERTIES_INTERFACE,
member="Set",
signature="ssv",
body=[defs.DEVICE_INTERFACE, "Trusted", True],
body=[defs.DEVICE_INTERFACE, "Trusted", Variant("b", True)],
)
)
assert_reply(reply)
Expand Down Expand Up @@ -541,7 +544,7 @@ async def pair(self, *args, **kwargs) -> bool:
)
assert_reply(reply)

return reply.body[0]
return reply.body[0].value

async def unpair(self) -> bool:
"""Unpair with the peripheral.
Expand Down

0 comments on commit 3c388dd

Please sign in to comment.