hashtagchris / DotNet-BlueZ

A quick and dirty library for BlueZ's D-Bus APIs. Focus is on Bluetooth Low Energy APIs.
Apache License 2.0
104 stars 37 forks source link

Missing Services #12

Open Fungusware opened 4 years ago

Fungusware commented 4 years ago

Hi,

When running my application that uses this excellent on a standard Ubuntu linux box, I can see all 6 of my BLE services and the characteristics. I can also grab data from them.

When I run the same application on the Raspberry Pi, I can see only one service, and not the ones I need. I have added the 'pi' user to the lp and bluetooth groups.

I'm guessing 'dotnet run' might need to run with sudo but I'm not sure.

Any help is greatly appriciated.

gvheertum commented 4 years ago

Did you do a discovery scan before accessing the devices. I noticed that in some cases the Bluetooth adapter needs to get some time to fully discover devices. Maybe that helps. If there is need to run as sudo you will get exceptions from the dbus stating that you are not allowed to perform an action. So I think sudo won't help.

Fungusware commented 4 years ago

Ok, I will try this and report back.

Much appreciated.

On Fri, Nov 20, 2020 at 3:54 PM Gertjan van Heertum < notifications@github.com> wrote:

Did you do a discovery scan before accessing the devices. I noticed that in some cases the Bluetooth adapter needs to get some time to fully discover devices. Maybe that helps. If there is need to run as sudo you will get exceptions from the dbus stating that you are not allowed to perform an action. So I think sudo won't help.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hashtagchris/DotNet-BlueZ/issues/12#issuecomment-730983563, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYHB5EUWJVUFSXCRT7ZWSTSQYOB5ANCNFSM4T4NQNMA .

--

John Anderson Fungusware http://fungusware.com http://www.xenserver-backup.com

hansmbakker commented 3 years ago

@Fungusware did you find the cause of your issue?

Fungusware commented 3 years ago

Unfortunately time restraints meant I had to abandon my testing, and I ended up just using Linux command line and pipe it back into the C# code. Not pretty but its effective.

hansmbakker commented 3 years ago

I found out the hard way that the Battery service is hidden / inaccessible as a GATT service (#3) - you need to access it via the org.Bluez.Battery1 interface but it is not clear to me how to do that (#19)