question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hanging on "async with BleakClient..."

See original GitHub issue
  • bleak version: 0.5.0-develop
  • Operating System: macOS 10.14.6 (on early 2015 Macbook Air)

Description

In running the examples on MacOS, everything hangs after/within async with BleakClient(address, loop=loop) as client: (within run) i.e. the subsequent typical example x = await client.is_connected or any other calls do not appear to run. Despite this, the OS does indicate that the BLE device is connected indefinitely until the script is stopped. Everything appears to be working fine on Windows.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:22 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
sn-uaudiocommented, Jul 2, 2020

I will include the changes in #213 in a version 0.7.X release as soon as someone confirms that it is still present.

Hello, I can confirm that the issue is still present for me with v0.7.0 on macOS 10.14.6. I updated to bleak 0.7.0 and was still having this problem. I added this line as a workaround and it seems to have solved the issue for me:

if not self.connected_peripheral_delegate:

Here is the context:

@objc.python_method
def did_connect_peripheral(self, central, peripheral):
    logger.debug(
        "Successfully connected to device uuid {}".format(
            peripheral.identifier().UUIDString()
        )
    )
    if not self.connected_peripheral_delegate:
        peripheralDelegate = PeripheralDelegate.alloc().initWithPeripheral_(peripheral)
        self.connected_peripheral_delegate = peripheralDelegate
        self._connection_state = CMDConnectionState.CONNECTED
1reaction
hbldhcommented, Jun 30, 2020

I have merged #227 into develop and will make a version 0.7.0 release later today with those changes as well as a lot of others. If the “fire twice” problem is still left after release of version 0.7.0, I will include the changes in #213 in a version 0.7.X release as soon as someone confirms that it is still present.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hangling of bleakClient.connect in continous ... - Stack Overflow
I want to run an infinite loop where I can continuously connect and disconnect to the BLE devices. I have a code which...
Read more >
bleak 0.11.0 - PyPI
Bleak is a GATT client software, capable of connecting to BLE devices acting as GATT servers. It is designed to provide a asynchronous,...
Read more >
How to Send Data between PC and Arduino using Bluetooth ...
The Connection class's primary job is to manage BleakClient 's connection with the remote device. The manager function is one of the async...
Read more >
Bluetooth Weather Station - Arduino Project Hub
Any client that hangs on too long is blocking others from reading. ... async def run(address): async with BleakClient(address) as client: ...
Read more >
A look at the AN9002 Bluetooth Multi-meter protocol
... async def run(address): client = BleakClient(address) async with BleakClient(address) as ... First I went for the low hanging fruit.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found