From: Bastien Nocera <hadess@hadess.net>
To: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Szymon Janc <szymon.janc@codecoup.pl>,
Bluez mailing list <linux-bluetooth@vger.kernel.org>
Subject: Re: Bluetooth LE battery reporting?
Date: Thu, 07 Sep 2017 16:03:36 +0200 [thread overview]
Message-ID: <1504793016.6911.70.camel@hadess.net> (raw)
In-Reply-To: <1504739780.6911.60.camel@hadess.net>
On Thu, 2017-09-07 at 01:16 +0200, Bastien Nocera wrote:
> On Wed, 2017-09-06 at 16:37 +0200, Bastien Nocera wrote:
> > On Wed, 2017-09-06 at 10:40 +0200, Marcel Holtmann wrote:
> > >
> >
> > <snip>
> > > 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.
Obviously, the reworked code I wrote at 1 AM didn't work correctly.
I've fixed the copy/paste bugs and pushed it.
> 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?
Still unsure about this, comments welcome.
> 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.
I've written parsing code for this. Does anyone know of a device which
would use the Battery Power State characteristic so I could try it out?
Finally, I've realised that my code replicates a lot of the code in
bas.[ch], which is only used by the hog profile plugin. Seeing as this
does nothing (the Battery Level is at the same level as the HoG
characteristics, not a child of it), I've removed it.
Cheers
next prev parent reply other threads:[~2017-09-07 14:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-05 16:03 Bluetooth LE battery reporting? Bastien Nocera
2017-09-05 17:37 ` Szymon Janc
2017-09-05 17:44 ` Marcel Holtmann
2017-09-06 8:29 ` Luiz Augusto von Dentz
2017-09-06 8:40 ` Marcel Holtmann
2017-09-06 14:37 ` Bastien Nocera
2017-09-06 23:16 ` Bastien Nocera
2017-09-07 14:03 ` Bastien Nocera [this message]
2017-09-07 14:15 ` Luiz Augusto von Dentz
2017-09-07 14:42 ` Bastien Nocera
2017-09-07 15:56 ` Bastien Nocera
2017-09-21 15:03 ` Bastien Nocera
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1504793016.6911.70.camel@hadess.net \
--to=hadess@hadess.net \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=szymon.janc@codecoup.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).