[SailfishDevel] Bluetooth battery level monitoring

Pali Rohár pali.rohar at gmail.com
Thu Dec 12 23:07:29 UTC 2019


On Thursday 12 December 2019 22:34:15 Anton Thomasson wrote:
> 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

Hello! This request is partially related to my proposal how to handle
Bluetooth HFP profile on Linux where pulseaudio, ofono and power supply
software are involved. Here is link to email discussion about my proposal:

https://lore.kernel.org/linux-bluetooth/20191201185740.uot7zb2s53p5gu7z@pali/T/#u

-- 
Pali Rohár
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20191213/9e73c0bd/attachment.sig>


More information about the Devel mailing list