battery: Add BT SIG reserved numbers used by Battery Service
Subsystems (3)
PATCH v3 1/2 battery: Add BT SIG reserved numbers used by Battery Service
Add the Battery Level and Battery Power State UUIDs as per:
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.battery_level.xml
https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.battery_power_state.xml
--- lib/uuid.h | 2 ++ 1 file changed, 2 insertions(+)
lib/uuid.h +2 -0
@@ -119,6 +119,8 @@ 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_BATTERY_POWER_STATE 0x2A1A#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.2
PATCH v3 2/2 profiles/battery: Add Bluetooth LE Battery service
Only the Battery Level characteristic was tested with a Microsoft Arc Touch Mouse SE.
This patch however hopes to support both the Battery Level and the Battery Power State characteristics.
--- Makefile.plugins | 3 + doc/battery-api.txt | 36 +++ profiles/battery/battery.c | 575 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 614 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 +36 -0
@@ -0,0 +1,36 @@ +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 boolean Present [readonly] + + Whether the device has a battery present. + + boolean Rechargeable [readonly] + + Whether the battery built into the device is rechargeable + or not. + + uint16 Percentage [readonly] + + The percentage of battery left. Will be 0% percent if State is + used instead, depending on the Battery profile used by the device. + + string State [readonly] + + If Percentage is set, State will be an empty string. Otherwise this + will be one of 'unknown', 'discharging', 'charging' or + 'fully-charged'. + + string BatteryLevel [readonly] + + If Percentage is set, BatteryLevel will be an empty string. + Otherwise this will be one of 'normal', 'critical' or + 'unknown'.
profiles/battery/battery.c new file +575 -0
575 lines not on this page · raw message
Signature · 1 line
2.14.2