Comments (4)
This seems like is similar to #266 .
I suspect the issue is that the scanning is creating new devices in BlueZ which triggers the InterfacesAdded
D-Bus signal. The observer
code also removes those devices once it has the device information to work around a "feature" in BlueZ that throttles the reporting of discovered devices. Then the self.ble_uart.on_connect
is using the same InterfacesAdded
D-Bus signal.
So the investigation would need to focus on following section of code to make it more robust to the different scenarios where a InterfacesAdded
signal is triggered.
python-bluezero/bluezero/adapter.py
Lines 304 to 322 in 392a115
If you have any feedback or insight into how this could be changed (or tested) then please share.
from python-bluezero.
Thanks for the quick answer and your insight!
I have sadly no good idea whats the best way to adjust the code of yours. But if you have access to an ibeacon:
Create two python applications. One to advertise as BLE peripheral, one to scan for beacons.
When you start the peripheral application, use subprocess.Popen
to start the beacon scanner.
This should be enough to reproduce my issues.
Until this issue can be fixed. What would be the best way to handle the thrown exceptions? I tried to wrap different parts of my code in try: except:
blocks but nothing helped to catch them.
from python-bluezero.
From the start of this project there has always been a philosophy about complexity; that the library would attempt to help people along the learning curve as they learnt about using Bluetooth with Python and that for some they would outgrow the library as they wanted more control.
This meant that there was an acceptance that the abstraction would bring restrictions and that is why the concept of complexity levels was used. An interesting blog around this topic is "When you need to escape an abstraction, how violent is your exit?"
The observer
and peripheral
modules are at level 10 that looks to simplify event loops and so starts them in the background without the user knowing.
As a result of this the two applications want to create and start an event loop which means they have to run them in different processes to work. You have achieved this by using subprocess
for one of them. However, that is not really how the event loop should be used. Both the "applications" should be registered to the same event loop and then the event loop started.
I have hacked together an example that starts just the one event loop:
https://github.com/ukBaz/python-bluezero/pull/381/files?diff=split&w=0
When I run the ticket_380 branch I don't see the errors that you are reporting.
I suspect that what this means is that you need to access the lower level API's to make your application(s) work cleanly.
from python-bluezero.
Closing because of inactivity.
from python-bluezero.
Related Issues (20)
- create 2 services from the same source? HOT 3
- Force disconnect clients from peripheral HOT 2
- How best to get extra information like RSSI and tx_power during scan HOT 2
- Disabling BlueZ request to pair with central on connect. HOT 5
- AttributeError: module 'bluezero.async_tools' has no attribute 'EventLoop' HOT 9
- Tests failing and blocking release HOT 1
- Can't install dbus-python to use bluezero HOT 3
- Error "dbus.exceptions.DBusException: org.bluez.Error.NotAvailable: Operation currently not available" on central HOT 8
- using class methods as callbacks fails for writes HOT 2
- Method to determinate current/negotiated MTU for connection HOT 7
- Documentation about PIN on pairing HOT 6
- Name a service and a characteristic HOT 1
- Method to retrieve remote device path in StartNotify and StopNotify HOT 9
- Advertisment of peripheral HOT 3
- Unable to set `DiscoverableTimeout` HOT 2
- What is srv_id 0 zero? HOT 1
- Enable services changed on Generic Attribute service HOT 1
- Wait notification functionality feature HOT 2
- Setting Manufacturer data in Advertiser only works if data is less than 3 bytes long HOT 4
- How to show Txpower in advertisement data HOT 12
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 python-bluezero.