[SailfishDevel] Bluetooth battery level monitoring

Anton Thomasson antonthomasson at gmail.com
Thu Dec 12 21:34:15 UTC 2019


Hi

I'd really like to have some monitoring of the battery level.
After having read up a bit on how it works, i happened by the relevant
Bluetooth AT event in the journal log.

Dec 06 18:45:11 Sailfish ofonod[2932]: Server: < AT+IPHONEACCEV=2,1,3,2,0\r

That says 2 pairs of data, and the pair starting with a 1 is followed by
the battery level, 3.
https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf p.69
While i appreciate the comedy value in using journalctl to check you
battery level, it is not very convenient

Anyway, seeing it there, logged by ofonod, means it should be very doable
to make available.
However it seems to be sent very seldom, effectively only when connecting,
simply listening to it from a 3rd-party app isn't quite enough. And
regardless, receiving it properly, saving it per session etc is the better
solution.

I guess i'm effectively asking for help finding where this was logged (i
looked for a while, but can't find it), where it can be handled properly
(tied to a specific headset/session). And then how it can be exposed, at
least to DBUS.
Does anyone feel like helping out getting this moving?

By an hint from r0kk3rz, i found how Android handles it, and it doesn't
look too complicated.
(although there are two different events that can be emitted)
http://androidxref.com/9.0.0_r3/xref/packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java#getBatteryLevelFromXEventVsc

Br,
Anton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20191212/a3f97bf0/attachment.html>


More information about the Devel mailing list