Comments (11)
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.
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.
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.
from go-bluetooth.
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.
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.
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.
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.
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 :-(
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.
from go-bluetooth.
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)
- List paired devices HOT 1
- Example with authorization HOT 4
- Bluez 5.65 support HOT 2
- Ignore missing fields in MapToStruct HOT 1
- "org.bluez.Error.AlreadyExists" faulire when adding second GATT Server HOT 5
- Missing tags for version 5.64 and 5.65 HOT 5
- Regarding the Listeners HOT 1
- Error: Properties.GetAll org.bluez.GattManager1: No such interface 'org.bluez.GattManager1' HOT 1
- media.NewMediaPlayer1 panics HOT 1
- generate stubs for 5.66 HOT 2
- Cannot create device object without opening Discover channel
- how can i use this callback on branch bluez/5.54? HOT 1
- GetAll method does not exist HOT 1
- Please generate version bluez-5.66.json HOT 4
- Advertised Services Do Not Show In Packet 5.55
- How to set it up so that it can be connected directly without pairing? HOT 1
- CharWriteCallback sender address?
- Device Properties Class
- Unable to generate JSON from the newer .rst bluez documentation. HOT 8
- Test cases depend on host system bluetooth stack. HOT 2
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 go-bluetooth.