Return-Path: Message-ID: <1504739780.6911.60.camel@hadess.net> Subject: Re: Bluetooth LE battery reporting? From: Bastien Nocera To: Marcel Holtmann , Luiz Augusto von Dentz Cc: Szymon Janc , Bluez mailing list Date: Thu, 07 Sep 2017 01:16:20 +0200 In-Reply-To: <1504708668.6911.56.camel@hadess.net> References: <1504627402.6911.48.camel@hadess.net> <9D01587F-3821-46CF-B8CE-2311BE8E8592@holtmann.org> <9713FF9C-7E23-448F-AC8B-755F32C461C7@holtmann.org> <1504708668.6911.56.camel@hadess.net> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 List-ID: On Wed, 2017-09-06 at 16:37 +0200, Bastien Nocera wrote: > On Wed, 2017-09-06 at 10:40 +0200, Marcel Holtmann wrote: > > > > > > I assumed that it is forbidden to include HID battery reporting > > events via the GATT HID descriptors. I think the standard clearly > > says these have to come via battery service and not via HID. > > So we're back to implementing battery reporting as a separate > profile. > What would be a good example/skeleton to use to implement this? This is what I managed to do so far: https://github.com/hadess/bluez/commits/ble-battery A first (gentle) pass at a review would be nice, especially if there's a better way to get notifications on both the attributes in one go. The second question is how I would export this. I'm currently thinking that exporting a new interface on the device itself might be the best idea, and I'll monitor devices directly in UPower to export them to desktops. Would that be a good way? And as UPower will be the likely consumer of this data, I think I'll try mapping this set of flags: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.battery_power_state.xml to UPower properties rather than trying to export it as-is. Cheers