Git Product home page Git Product logo

Comments (11)

muka avatar muka commented on June 27, 2024 1

Hi @ukBaz
I tried to get something to work and now I feel intimidate too :D
I am doing some refactoring on the library (on branch generator), after that I will retry to setup a beaconing example.

I think the way you described is a pretty good start.

Let me know if you have any update with some code to work on. Once it work could you also submit a PR?

Thanks

from go-bluetooth.

muka avatar muka commented on June 27, 2024

Hello
I added an example here
https://github.com/muka/go-bluetooth/blob/master/examples/beacon/beacon.go

It shows on mobile app but I think it still need some refinement, as beacons are not constantly visible.
Let me know

from go-bluetooth.

ukBaz avatar ukBaz commented on June 27, 2024

Thanks for posting this. I did panic when I clicked on the link in the email and it said the link was broken but I see you have edited the location. :-)

I am a golang noob so could you give a little more detail of how to run this. I have tried using your Makefile to run some other example but it is giving me various errors. Not sure if it is my setup or if there is something missing.

Thanks.

from go-bluetooth.

muka avatar muka commented on June 27, 2024

from go-bluetooth.

ukBaz avatar ukBaz commented on June 27, 2024

Thank you for sending the command across, very helpful.
This now suggests the beacon is running

$ go run main.go beacon eddystone

DEBU[0000] Retrieving adapter instance hci0             
DEBU[0000] Connecting to DBus                           
DEBU[0000] Creating LEAdvertisement1 instance           
DEBU[0000] Exposing LEAdvertisement1 instance           
DEBU[0000] Setup adapter                                
DEBU[0000] Registering LEAdvertisement1 instance        
DEBU[0000] eddystone ready                  

When I use the nRF Connect app on my phone I can't see the beacon.
If I monitor with bluetoothctl then I see it registers the advertisement (ActivieInstances increases) but then removes it right away.

[CHG] Controller FC:F8:AE:8F:0C:A4 DiscoverableTimeout: 0x00000000
[CHG] Controller FC:F8:AE:8F:0C:A4 SupportedInstances: 0x04
[CHG] Controller FC:F8:AE:8F:0C:A4 ActiveInstances: 0x01
[CHG] Controller FC:F8:AE:8F:0C:A4 SupportedInstances: 0x05
[CHG] Controller FC:F8:AE:8F:0C:A4 ActiveInstances: 0x00

If I put bluetoothd in debug mode then I see that it is getting a client timeout

bluetoothd[2592]: src/adapter.c:set_discoverable() sending set mode command for index 0
bluetoothd[2592]: src/adapter.c:set_mode() sending set mode command for index 0
bluetoothd[2592]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2592]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2592]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0
bluetoothd[2592]: src/advertising.c:parse_service_uuids() Adding ServiceUUID: FEAA
bluetoothd[2592]: src/advertising.c:parse_service_data() Adding ServiceData for FEAA
bluetoothd[2592]: src/advertising.c:parse_discoverable() Adding Flags 0x00
bluetoothd[2592]: src/advertising.c:refresh_adv() Refreshing advertisement: /org/bluez/example/advertisement0
bluetoothd[2592]: src/advertising.c:add_adv_callback() Advertisement registered: /org/bluez/example/advertisement0
bluetoothd[2592]: src/advertising.c:client_timeout() 
bluetoothd[2592]: src/advertising.c:client_release() Releasing advertisement :1.173, /org/bluez/example/advertisement0

I suspect that is RegisterAdvertisement getting a timeout trying to read the org.bluez.LEAdvertisement1 interface. You say that beacons are not constantly visible, are you seeing the same?
Could it be that the publishing of org.bluez.LEAdvertisement1 needs to happen in a separate thread?

It is clear that my golang skills are not very good at the moment so please feel free to close this issue if you think the issue is with the user rather than the library.

from go-bluetooth.

muka avatar muka commented on June 27, 2024

There is still something out of place, the timeout is a good indicator.

This setup is similar to the bluez python example, it could be related to golang types introspection by dbus library.

Let's keep the issue open until it works properly, thanks

from go-bluetooth.

muka avatar muka commented on June 27, 2024

You were right, the timeout was the problem. Removing DiscoverableTimeout which was set to 0 show the beacon in a stable manner.

Maybe this is relevant https://www.spinics.net/lists/linux-bluetooth/msg79915.html

Please reopen if still not working

Thanks

from go-bluetooth.

ukBaz avatar ukBaz commented on June 27, 2024

Thanks for the update. I'll test in the next couple of days.

There is also this patch that I wondered if it was relevant:
https://marc.info/?l=linux-bluetooth&m=156509924619419&w=2

from go-bluetooth.

ukBaz avatar ukBaz commented on June 27, 2024

Apologies, this took longer for me to get back to than I had hoped for.
Sadly, the beacon example still isn't working for me :-(

Screenshot from 2019-08-10 20-01-52

I am busy on another project now so there is no pressure from me. However, if you would like me to test anything then let me know.

from go-bluetooth.

muka avatar muka commented on June 27, 2024

from go-bluetooth.

muka avatar muka commented on June 27, 2024

Just pushed the updated version which works with both ibeacon and eddystone.

https://github.com/muka/go-bluetooth/blob/master/examples/beacon/beacon.go#L14

Please reopen if needed

from go-bluetooth.

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.