Ekayaa
Ekayaa

Reputation: 179

How to get ATT HANDLE of UUID on BLE Advertiser

I have created a simple BLE advertiser using Python's dbus Library (Bluez 5.48). This sample application adds one service, and and this service has 2 characteristics. On starting advertiser, all services and Characterictic UUID will be assigned a 16 bit long ATT Handle so that Client can directly read or write on those UUIDs using HANDLEs.

Advertiser works perfectly fine, and Client can subscribe to UUIDs. However Client expects a fixed ATT Handle for both UUIDs. But Advertiser swaps the ATT Handles when reconnected.

So is there any way by which I can either 1- Keep my ATT Handles static. 2- Or Advertiser should know ATT handles assigned to UUIDs.

I have spent good amount of time in finding this out, but got no success so far.

Using this code to create advertiser. https://github.com/ukBaz/python-bluezero/blob/master/bluezero/peripheral.py

Upvotes: 0

Views: 510

Answers (1)

ukBaz
ukBaz

Reputation: 7954

I think that BlueZ tries to do the right thing looking at this:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/settings-storage.txt

The issue is likely to be that it only does it with paired devices and that example has security turned off. I can't remember how to turn it on off the top of my head. I'll try to find some time later to take a look.

Upvotes: 0

Related Questions