Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatt Server not offering Services #44

Closed
Severon96 opened this issue Aug 25, 2022 · 9 comments
Closed

Gatt Server not offering Services #44

Severon96 opened this issue Aug 25, 2022 · 9 comments

Comments

@Severon96
Copy link

Severon96 commented Aug 25, 2022

Hey guys,

can someone help me please, because i'm a little confused why i'm not seeing any services when using a BTLE Scanner?

I used the GATT-Server implementation that is documented here:
https://docs.rs/bluer/latest/src/gatt_server_io/gatt_server_io.rs.html

I changed nothing, also i'm using the UUIDs from the gatt.inc.
Maybe someone can help me here? Because I don't know what the problem is.

I fixed the initial issue, that I had, by using the UUIDs from the examples. But I'm certain that that's not the right way to work with the crate.

@Severon96 Severon96 changed the title Gatt Server reports "Not Registered" Gatt Server not offering Services Aug 26, 2022
@surban
Copy link
Collaborator

surban commented Aug 29, 2022

Does the corresponding GATT client example work, when used together with the GATT server example?

What BlueZ version are you using?

@Severon96
Copy link
Author

Nope, I don't get the examples working. They're always failing with this Error:

thread 'main' panicked at 'services: Os { code: 2, kind: NotFound, message: "No such file or directory" }', bluer/build.rs:256:6

My BlueZ version is: 5.43-2+rpt2+deb9u2

@surban
Copy link
Collaborator

surban commented Aug 29, 2022

Please make sure you cloned the repository with submodules as described in the README.

@Severon96
Copy link
Author

Severon96 commented Aug 30, 2022

I've forgot the --recursive flag when checking out, that's correct. But nevertheless I added it when checking out again I still receive the "NotFound" error when running the example. But now without any message.

pi@raspberrypi:~/bluer/bluer $ cargo run --all-features --example gatt_server_io   Compiling tokio v1.20.1
   Compiling dbus v0.9.6
   Compiling dbus-crossroads v0.5.1
   Compiling dbus-tokio v0.7.5
   Compiling tokio-stream v0.1.9
   Compiling bluer v0.15.0 (/home/pi/bluer/bluer)
    Finished dev [unoptimized + debuginfo] target(s) in 6m 39s
     Running `/home/pi/bluer/target/debug/examples/gatt_server_io`
Error: Error { kind: NotFound, message: "" }

Regarding your question for my BlueZ version:
I tried another command to fetch the version today and received 5.50 as output. I don't know why it's different, when I use another command (bluetoothd -v this time), but I thought it may help you to know that.

@surban
Copy link
Collaborator

surban commented Aug 30, 2022

Could you run bluetoothctl and verify that an adapter is present?

@Severon96
Copy link
Author

Severon96 commented Aug 30, 2022

The adapter wasn't present, I fixed that now. But I now get another error when trying to launch the example:

pi@raspberrypi:~/bluer $ cargo run --all-features --example gatt_server_io
    Finished dev [unoptimized + debuginfo] target(s) in 1.73s
     Running `target/debug/examples/gatt_server_io`
Error: Error { kind: Internal(DBus("org.freedesktop.DBus.Error.AccessDenied")), message: "Rejected send message, 2 matched rules; type=\"method_call\", sender=\":1.9\" (uid=1000 pid=2927 comm=\"target/debug/examples/gatt_server_io \") interface=\"org.freedesktop.DBus.ObjectManager\" member=\"GetManagedObjects\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.bluez\" (uid=0 pid=459 comm=\"/usr/local/libexec/bluetooth/bluetoothd --experime\")" }

I made the experience that if I build my code and run the compiled version with sudo this error is fixed. But that doesn't work for the example because it throws an "NotRegistered"-Error for me then.

@surban
Copy link
Collaborator

surban commented Aug 30, 2022

Please update BlueZ to at least version 5.60.

@Severon96
Copy link
Author

So, sorry that you didn't hear anything from me in the past days. The update of BlueZ didn't work very well on my old image with Raspbian Stretch running on it.
I've created a new image now and updated to 5.65.
Now the gatt_server_io example is starting and I can search with some bluetooth-tools for it. Also my code is working, too (not wondering, since it's nearly an exact copy of the example, but Hey. Worth mentioning!).
Thanks for your help!

@surban
Copy link
Collaborator

surban commented Oct 1, 2022

Great to hear it's working now!

@surban surban closed this as completed Oct 1, 2022
otaviojr added a commit to otaviojr/bluer that referenced this issue May 10, 2023
# This is the 1st commit message:

BLE Passive Scanning

# This is the commit message #2:

monitor

# This is the commit message bluez#3:

monitor

# This is the commit message bluez#4:

monitor

# This is the commit message bluez#5:

monitor

# This is the commit message bluez#6:

monitor

# This is the commit message bluez#7:

monitor

# This is the commit message bluez#8:

monitor

# This is the commit message bluez#9:

monitor

# This is the commit message bluez#10:

monitor

# This is the commit message bluez#11:

monitor

# This is the commit message bluez#12:

monitor

# This is the commit message bluez#13:

monitor

# This is the commit message bluez#14:

monitor

# This is the commit message bluez#15:

monitor

# This is the commit message bluez#16:

monitor

# This is the commit message bluez#17:

monitor

# This is the commit message bluez#18:

monitor

# This is the commit message bluez#19:

monitor

# This is the commit message bluez#20:

monitor

# This is the commit message bluez#21:

monitor

# This is the commit message bluez#22:

monitor

# This is the commit message bluez#23:

monitor

# This is the commit message bluez#24:

monitor

# This is the commit message bluez#25:

monitor

# This is the commit message bluez#26:

monitor

# This is the commit message bluez#27:

monitor

# This is the commit message bluez#28:

monitor

# This is the commit message bluez#29:

monitor

# This is the commit message bluez#30:

monitor

# This is the commit message bluez#31:

monitor

# This is the commit message bluez#32:

monitor

# This is the commit message bluez#33:

monitor

# This is the commit message bluez#34:

monitor

# This is the commit message bluez#35:

monitor

# This is the commit message bluez#36:

monitor

# This is the commit message bluez#37:

monitor

# This is the commit message bluez#38:

monitor

# This is the commit message bluez#39:

monitor

# This is the commit message bluez#40:

monitor

# This is the commit message bluez#41:

monitor

# This is the commit message bluez#42:

monitor

# This is the commit message bluez#43:

monitor

# This is the commit message bluez#44:

monitor

# This is the commit message bluez#45:

monitor

# This is the commit message bluez#46:

monitor

# This is the commit message bluez#47:

monitor

# This is the commit message bluez#48:

monitor

# This is the commit message bluez#49:

monitor

# This is the commit message bluez#50:

monitor

# This is the commit message bluez#51:

monitor

# This is the commit message bluez#52:

monitor

# This is the commit message bluez#53:

monitor

# This is the commit message bluez#54:

monitor

# This is the commit message bluez#55:

monitor

# This is the commit message bluez#56:

monitor

# This is the commit message bluez#57:

monitor

# This is the commit message bluez#58:

monitor

# This is the commit message bluez#59:

monitor

# This is the commit message bluez#60:

monitor

# This is the commit message bluez#61:

monitor

# This is the commit message bluez#62:

monitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants