TheWeirdDev / Bluetooth_Headset_Battery_Level

A python script to get battery level from Bluetooth headsets
GNU General Public License v3.0
766 stars 80 forks source link

Change battery level function to allow library use #56

Closed Giannie closed 3 years ago

Giannie commented 3 years ago

I have changed the output of the batter level command to return just the percentage so that the the code can be used as an external library for other applications. I have also renamed the function to more accurately represent what it does.

I did this so that it could be used for example for a status bar like i3bar or polybar.

TheWeirdDev commented 3 years ago

This is still not ready to be used as a library function. The caller must know how to create a socket, find the port number and loop until it gets the battery level.

My suggestion is to make a wrapper function around get existing one that only receives the MAC address and does the rest of the work by itself.

TheWeirdDev commented 3 years ago

This could now be closed in favor of #66. This PR was inactive for a long time anyway.