Skip to content

Commit

Permalink
Lift restriction of UUID length in Client.
Browse files Browse the repository at this point in the history
UUIDS of the 'standard pattern' (12345678-0000-1000-8000-00805f9b34fb) can be supplied as 16 or 32 bit 'short version' (written as string)
  • Loading branch information
MarkusPiotrowski authored May 2, 2024
1 parent 8a534f5 commit c8e6a9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bleekWare/Client.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ def address(self):

def _find_characteristic(self, uuid):
"""Find and return characteristic object by UUID. PRIVATE."""
if len(uuid) == 4:
uuid = f'0000{uuid}-0000-1000-8000-00805f9b34fb'
elif len(uuid) == 8:
uuid = f'{uuid}-0000-1000-8000-00805f9b34fb'

for service in self.services:
if uuid in service.characteristics:
return service.service.getCharacteristic(UUID.fromString(uuid))
Expand Down
1 change: 0 additions & 1 deletion bleekWare/Scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from java import jclass, jint, jvoid, Override, static_proxy
from java.util import HashMap

# from android.bluetooth.le import BluetoothLeScanner
from android.bluetooth.le import ScanCallback, ScanResult, ScanSettings
from android.bluetooth import BluetoothAdapter

Expand Down

0 comments on commit c8e6a9a

Please sign in to comment.