Git Product home page Git Product logo

Comments (3)

ukBaz avatar ukBaz commented on September 22, 2024 1

Glad to hear you are making progress.

There's another thing, I can read adapter.discoverabletimeout but when I try to write it, I get a DBusException("Invalid signature for 'DiscoverableTimeout'"). Setting discoverable-timeout manually with bluetoothctl works.
Is there specific information I can provide and should I open another issue for this?

It should be as simple as:

adapter.discoverabletimeout = 180

If that isn't working then open a new issue and we can work on it there.

from python-bluezero.

ukBaz avatar ukBaz commented on September 22, 2024

The target of the Bluezero library is to put a facade to help get started with the BlueZ D-Bus API. To look behind that facade at what is actually going on; For the creation of a BLE Peripheral, an advertisement and a GATT server needs to be created and published to the Bluetooth daemon (bluetoothd) running on the Linux machine. The Peripheral is asynchronous so it will only appear when the event loop (mainloop) is run. When that is run then bluetoothd will make them available over the air. bluetoothd will not advertise when there is a connection to the GATT server.
Advertising will not work without the adapter being discoverable.

There isn't a great deal of information in your text for me to speculate what might be going wrong as there is no code and little debug information. Have your tried running one of the examples in the repo?
If I were to speculate based on what I've seen before, then either the event loop is not being started or your advertisement is too big.

When running your script have separate terminals open with the following running to get more debug information:

  • bluetoothctl
    
  • journalctl -f -u bluetooth
    
  • sudo busctl monitor org.bluez
    
  • sudo btmon
    

If you do a show inside bluetoothctl then it will report how many advertisements are registered and how many are active.

If it looks to be running without error, then use a generic Bluetooth Low Energy scanning and exploration tool, such as nRF Connect, to see what is being advertised and connect to the GATT server.

from python-bluezero.

furgerf avatar furgerf commented on September 22, 2024

Thanks for your quick reply! I checked a few other things based on that and believe I understand now what was going on. There are a few factors that confused me:

  • When I initially started having connection issues (for whatever other reason), I stopped the application with the GATT server to remove a source of uncertainty, but that made things worse.
  • I assumed that I should still be able to see the device and its default characteristics/services in a LEscan even with the application stopped - that's true but then I need to manually start advertising in btmgmt.
  • Even when the device wasn't advertising on BLE, I could still see it in scans with bluetoothctl, from what I saw with the tools you mentioned, it showed up on br/edr. In that case, connecting with bluetoothctl always ended up in a org.bluez.NotAvailable error and the device disconnected again after a moment (and when I changed from dual to le mode in /etc/bluetooth/main.conf, I stopped discovering the device altogether, which makes sense as well).

I was building my application based on the cpu_temperature.py example, that was easy and worked really well - thank you 👍

There's another thing, I can read adapter.discoverabletimeout but when I try to write it, I get a DBusException("Invalid signature for 'DiscoverableTimeout'"). Setting discoverable-timeout manually with bluetoothctl works.
Is there specific information I can provide and should I open another issue for this?

from python-bluezero.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.