This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to get the full 128 bit UUID from ble devices using pc-ble-driver-py and literal values?

I am using pc-ble-driver-py to create a custom scanning and connecting application, but I'm running into an issue regarding the UUIDs of a particular service after connecting to it. Here is the code that I currently have:

#Set the scanner parameters
scan_duration = 0xffff
params = BLE.GapScanParams(interval_ms=200, window_ms=150, timeout_s=scan_duration)

#Start the scanner
self.adapter.driver.ble_gap_scan_start(scan_params=params)
new_conn = self.conn_q.get(timeout=scan_duration)

#Discover services of connected device
self.adapter.service_discovery(new_conn)

#print out the device's GATT Table
for s in self.adapter.db_conns[new_conn].services:
    print("Service UUID =", str(s.uuid), " ", str(s.uuid.value))
    for c in s.chars:
        print("--Characteristic UUID =", str(c.uuid), " ", str(c.uuid.value))
        for d in c.descs:
            print("----Description UUID =", str(d.uuid), " ", str(d.uuid.value))

Note that I am running the code on my nRF52 DK, with the nRF52DK running as the central device connecting to a peripheral device.This results in the following output (example):

Service UUID = 0x1801 6145
--Characteristic UUID = 0x2A05 10757
----Description UUID = 0x2A05 10757
Service UUID = 0x1800 6144
--Characteristic UUID = 0x2A00 10752
----Description UUID = 0x2A00 10752
--Characteristic UUID = 0x2A01 10753
----Description UUID = 0x2A01 10753
--Characteristic UUID = 0x2AA6 10918
----Description UUID = 0x2AA6 10918
Service UUID = 0x9999 39321
--Characteristic UUID = 0x9997 39319
----Description UUID = 0x9997 39319
--Characteristic UUID = 0x9996 39318
----Description UUID = 0x9996 39318
----Description UUID = 0x2902 (Standard.cccd) Standard.cccd
----Description UUID = 0x2901 10497

I can confirm that the full GATT table was discovered by manually checking with the GATT table I have on hand. However, the service UUID shown is "0x9999" when it should be something along the lines of "d0611e78-bbb4-4591-a5f8-487910ae4366". How do I go about getting the fill 128-bit value?

Additionally, the Characteristic UUID 0x2A00 (Device name) should be "sample BLE Device" not 10757. What exactly does the 10757 value indicate, and how would I go about getting the actual value of the characteristic?

My setup is as follows:

OS: MacOS

Hardware: nRF52 DK

Software: Using the latest version of pc-ble-driver-py

Parents Reply Children
Related