Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

RFC: Service discovery and characteristic permissions#278

Open
andreamerello wants to merge 3 commits intopeplin:masterfrom
andreamerello:service_discovery
Open

RFC: Service discovery and characteristic permissions#278
andreamerello wants to merge 3 commits intopeplin:masterfrom
andreamerello:service_discovery

Conversation

@andreamerello
Copy link
Copy Markdown
Contributor

Hi!

Disclaimer: I open this PR to see if we can discuss a bit on this, indeed I don't expect it to be ready for merge yet..

Context: I'm working on a demo application written with Kivy (that should work on both Linux PCs and android devices) that scans and explores BLE devices (similar to those APPs you can find on google play market); on Linux PC platform I use pygatt for communicating with BLE.

While I found easy to get tree view of services and characteristics with android APIs, I couldn't do this with pygatt: I could only get a flat list of characteristics, but I didn't found a way to get a clue about primary services.. So my first commit in this PR adds a method to enumerate primary services. I match them with child characteristics by checking for handles numeric order outside pygatt, but maybe there is some better way to do this..

The other thing that I didn't find a way to achieve with pygatt is to detect the characteristics permissions (i.e. which could be read, which could be written, which can be subscribed for notifications, etc..). My second patch in this PR tries to add this information to the characteristics objects; it reads the characteristic declarations attributes from BLE after discovering the characteristics.

One of the problem I faced doing this, is that, while inquiring for the characteristic declarations, I got the same events flavour used also for regular characteristic reads, so I tried to workaround on this in my 3rd patch, but, again there might be better way for achieving my goal..

Indeed even if I have had already putted my hand a bit in pygatt code, I'm not very familiar with its design (and I'm mostly an embedded, low-level, C software guy), so any comment would be extremely appreciated..

Oh, I'm working on bluegiga dongles, but I would like to expand this also to the gatttool wrapper in future...

Thanks,
Andrea

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant