battery: Add BT SIG reserved number used by Battery Service
Subsystems (3)
PATCH v5 1/2 battery: Add BT SIG reserved number used by Battery Service
Add the Battery Level UUID as per:
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.battery_level.xml
--- lib/uuid.h | 1 + 1 file changed, 1 insertion(+)
lib/uuid.h +1 -0
@@ -119,6 +119,7 @@ extern "C" {#define GATT_CHARAC_RECONNECTION_ADDRESS 0x2A03#define GATT_CHARAC_PERIPHERAL_PREF_CONN 0x2A04#define GATT_CHARAC_SERVICE_CHANGED 0x2A05 +#define GATT_CHARAC_BATTERY_LEVEL 0x2A19#define GATT_CHARAC_SYSTEM_ID 0x2A23#define GATT_CHARAC_MODEL_NUMBER_STRING 0x2A24#define GATT_CHARAC_SERIAL_NUMBER_STRING 0x2A25
Signature · 1 line
2.14.3
PATCH v5 2/2 profiles/battery: Add Bluetooth LE Battery service
The Battery Level characteristic was tested with a Microsoft Arc Touch Mouse SE.
The Battery1 interface is now exported for Bluetooth LE devices which support the Battery Level characteristic, providing a single "Percentage" value to other integration points in the OS, such as UPower for consumption on most free desktops.
See https://bugs.freedesktop.org/show_bug.cgi?id=92370
--- Makefile.plugins | 3 + doc/battery-api.txt | 14 ++ profiles/battery/battery.c | 373 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 390 insertions(+) create mode 100644 doc/battery-api.txt create mode 100644 profiles/battery/battery.c
Makefile.plugins +3 -0
@@ -100,6 +100,9 @@ builtin_sources += profiles/midi/midi.c \ builtin_ldadd += @ALSA_LIBS@ endif +builtin_modules += battery +builtin_sources += profiles/battery/battery.c + if SIXAXIS plugin_LTLIBRARIES += plugins/sixaxis.la plugins_sixaxis_la_SOURCES = plugins/sixaxis.c
doc/battery-api.txt new file +14 -0
@@ -0,0 +1,14 @@ +BlueZ D-Bus Battery API description +*********************************** + + +Battery hierarchy +================= + +Service org.bluez +Interface org.bluez.Battery1 +Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX + +Properties byte Percentage [readonly] + + The percentage of battery left as an unsigned 8-bit integer.
profiles/battery/battery.c new file +373 -0
373 lines not on this page · raw message
Signature · 1 line
2.14.3
Hi,
Quoted 19 lines · Bastien Nocera
Add the Battery Level UUID as per:
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.battery_level.xml--- lib/uuid.h | 1 + 1 file changed, 1 insertion(+)lib/uuid.h +1
-1@@ -119,6 +119,7 @@ extern "C" {#define GATT_CHARAC_RECONNECTION_ADDRESS 0x2A03#define GATT_CHARAC_PERIPHERAL_PREF_CONN 0x2A04#define GATT_CHARAC_SERVICE_CHANGED 0x2A05 +#define GATT_CHARAC_BATTERY_LEVEL 0x2A19#define GATT_CHARAC_SYSTEM_ID 0x2A23#define GATT_CHARAC_MODEL_NUMBER_STRING 0x2A24#define GATT_CHARAC_SERIAL_NUMBER_STRING 0x2A25 --
Quoted 1 line
2.14.3
Applied, thanks.
Signature · 1 line
Luiz Augusto von Dentz