Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Nearby/FastPair protocol (Pixel buds left/right/case report) #94

Merged
merged 5 commits into from
Dec 14, 2023

Conversation

drinkcat
Copy link
Contributor

This is, at least, what Google Pixel Buds use to report left, right, and case battery status. Also, extend the BatteryStateQuerier class to support returning more than one value, and I added logging support (mostly for my debugging convenience).

I figured that out by enabling BT snoop logs on my phone. The protocol is simple, and data is sent from the headset automatically on connection (and regularly when the battery level changes). Once I figured out which UUID the channel/port corresponded to, I found out it is Google's Nearby/Fastpair protocol (https://developers.google.com/nearby/fast-pair/landing-page). The protocol documentation doesn't appear to be public, but information can be gathered from opensource code.

Only tested with Google Pixel Buds A-series. I believe some BT speakers use that protocol as well.

Current function only returns "overall" battery status, but later
change will allow more detailed reporting.

Also change the name of the function, as it could potentially be
useful to library users when more information can be fetched.
Will be useful when we add support for Nearby.
This is, at least, what Google Pixel Buds use to report left, right,
and case battery status.

The protocol documentation doesn't appear to be public, but information
can be gathered from opensource code.
@TheWeirdDev
Copy link
Owner

Well done!
Everything seems good to me.

Feel free to add your name to the authors before I merge.

@drinkcat
Copy link
Contributor Author

Well done! Everything seems good to me.

Feel free to add your name to the authors before I merge.

Done! Thanks!

@TheWeirdDev TheWeirdDev merged commit 45cd1f7 into TheWeirdDev:master Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants