Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Service discovery and characteristic permissions #278

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

andreamerello
Copy link
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant