Skip to content

Commit 000126d

Browse files
authored
Add READ & NOTIFY Permissions to Battery Service
This change allowed me to be able to read the battery service characteristic from nRF Connect as well as a forked version of GadgetBridge. The unmodified code has properties equal to 0 for this service. Reference this forum post: https://forums.adafruit.com/viewtopic.php?f=60&t=167056.
1 parent f4bd530 commit 000126d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adafruit_ble/services/standard/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
from .. import Service
3131
from ...uuid import StandardUUID
32+
from ...characteristics import Characteristic
3233
from ...characteristics.string import StringCharacteristic
3334
from ...characteristics import StructCharacteristic
3435
from ...characteristics.int import Uint8Characteristic
@@ -69,7 +70,7 @@ class BatteryService(Service):
6970
"""Provides battery level information"""
7071

7172
uuid = StandardUUID(0x180F)
72-
level = Uint8Characteristic(max_value=100, uuid=StandardUUID(0x2A19))
73+
level = Uint8Characteristic(max_value=100, properties=Characteristic.READ | Characteristic.NOTIFY, uuid=StandardUUID(0x2A19))
7374

7475

7576
class CurrentTimeService(Service):

0 commit comments

Comments
 (0)