Comments (3)
I just tried creating the same situation by running two separate gatttool processes, and had the same result: while one connect is pending, others immediately fail. So presumably this is not a bluepy issue, but something lower level. I'd still love any suggestions on workarounds, fixes, or working-as-intended. Thanks!
from bluepy.
It looks like it's a limitation of Bluetooth LE itself. Connecting to a peripheral is done with the LE_Create_Connection command; the Bluetooth 4.0 spec says (vol 2, sec 7.8.12, page 826)
The Host shall not issue this command when another LE_Create_Connection is pending in the
Controller; if this does occur the Controller shall return the Command Disallowed error code shall
be used.
Sadly, then, it's built in to the HCI command specification that only one connection can be pending at a a time.
Thanks
Ian
from bluepy.
Apologies--I meant to close this myself. In case it is ever of use to anyone else, I also tracked down the kernel code implementing the limitation, and it appears to only limit it to one connection per CID (rather than one globally). Since all my devices are using the Attribute CID (0x04) and I don't really have control over it, I haven't tested whether you can do multiple connections on different channels or the limitation matches the BT4 spec, though I note that the error returned is EBUSY.
Also, note that canceling the connection does allow for new connections, so I'm manually timing out my asynchronous connects after a much shorter period. (I'm also now listening for announcements on another BT dongle and using that to limit connection attempts to missing devices.)
Thanks!
from bluepy.
Related Issues (20)
- bluepy-helper crashes HOT 1
- Sampling frequency HOT 6
- thon3
- BluePy not compatible with Python 3.10 or newer
- Multiple Instances of a single Service
- Reading Accelerometer Data from SensorTag CC2650
- Try to use timeout HOT 4
- getting temperature data
- unable to make it work on Python 3.7.3
- Failed to connect to peripheral <my mac address>, addr type: random HOT 4
- Select a host Bluetooth device (the one that starts the connection) HOT 7
- ResourceWarning: unclosed file <_io.TextIOWrapper name=6 encoding='UTF-8'>
- Infinite timeout
- HCI Selection Failure HOT 1
- Help! Loaded everything but doesn't see the camera.
- Unable to set connection parameters and advertasing parameters Thingy:52
- Bluepy and Bookworm HOT 6
- Can't connect to any peripherals with Bluetooth adapter hci1
- te
- get_services.py: unable to generate uuids.json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bluepy.