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

How to use the IBattery1 interface? #19

Open hansmbakker opened 3 years ago

hansmbakker commented 3 years ago

I see the IBattery1 interface is included in the library to deal with the point of Bluez hiding the battery characteristic, but is there any sample how we can best use it?

hansmbakker commented 3 years ago

I'm no DBus expert but there seem to be multiple DBus interfaces for the same object path (device and battery).

Should I use BluezManager.GetProxiesAsync<IBattery1>(string interfaceName, IDBusObject rootObject), use the adapter as rootObject and the create a constant for the Battery interface in BluezConstants?

vestervang commented 3 years ago

@hansmbakker I have implemented the IBattery interface in this fork. It's only on github packages at the moment, but should be doable to get in your project https://github.com/vestervang/DotNet-BlueZ just like https://github.com/Rod-O/DotNet-BlueZ has done. I might push it to nuget if it's needed.

hansmbakker commented 3 years ago

Thank you for letting me know! I'm not working on my project at the moment so unfortunately I cannot try your fork and give feedback, sorry. Wish you success on the development of your fork!