-
Notifications
You must be signed in to change notification settings - Fork 85
#35 Proposes an extension to access GATT descriptors #36
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
Conversation
This proposes an extension to gatt-python to be able to read out the value of GATT descriptors of characteristics as well. Those descriptors can contain metadata and configuration information for their characteristic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing this MR, it looks great. I have one comment, can you please apply that?
|
||
for desc in managed_descriptors: | ||
self.descriptors.append(Descriptor(self, desc[0], desc[1]['org.bluez.GattDescriptor1']['UUID'])) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's prefer direct assignment to self.descriptors
and we can also avoid the intermediary managed_descriptors
list by synthesizing to:
descriptor_regex = re.compile(self._path + '/desc[0-9abcdef]{4}$')
self.descriptors = [
Descriptor(self, descriptor[0], descriptor[1]['org.bluez.GattDescriptor1']['UUID'])
for descriptor in self._object_manager.GetManagedObjects().items()
if descriptor_regex.match(desc[0])
]
Also, I find reading the descriptors quite obvious when reading your implementation. This said, I find no need to add the comment as your code is self-explaining.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Let me get this great feature merged soon.
This removes to too obvious comment and the use of an intermediary list.
Is it also possible to write a descriptor? I am developing an Android application. There are functions to read and write characteristics and descriptors in Android SDK https://developer.android.com/reference/android/bluetooth/BluetoothGatt . I want to do this in Python as a light-weight proof-of-concept demo first. It will be great if both reading and writing will be supported in future versions :) |
hey @larsblumberg , I am not in a real hurry, but could you merge and release a version with reading descriptors soon? ;) Would be required for the Bluetooth LE part of https://github.com/jlusiardi/homekit_python Thanks in advance! |
It would be really handy to have a release with this PR in if anyone can help, thanks! |
Hi guys, I'm talking to Senic (where I was working and where I wrote this library) as I would like to push an update soon with working Pull Requests. |
Thats great news! ❤️ |
Quick and short update: I met @kelada yesterday who manages Senic's software stack which itself depends on this library. We agreed that I will review and test the open PRs and given they work we can merge them. We agreed that it's very important to add test coverage to this library before accepting any other new PRs (despite the already opened ones, which will still be merged if functioning). Any support from the community in this direction is welcome, though I will start with the groundwork for test coverage soon. |
@larsblumberg when you think the PR is ready; ping me and I'll test it against our stack and make sure it's all good on that side and I'll get @jlusiardi work merged in 👍 |
Hi, |
Sorry for the long silence. Testing the branches is on my to do list for this weekend. Will keep you updated. |
Ok cool thanks! |
@jlusiardi I just tested your Merge Request using Senic's Nuimo Controller. Everything continued to work, nothing breaks (as expected!). I've tested with BlueZ version 5.44 on a Raspberry Pi model 3 B+. @kelada I feel very confident that this MR can be safely merged without affecting performance or functionality of the Nuimo Linux SDK. |
@larsblumberg thank you for this testing, I will try and get this merged in before the end of next week. |
Thank you! |
This proposes an extension to gatt-python to be able to read out
the value of GATT descriptors of characteristics as well. Those
descriptors can contain metadata and configuration information
for their characteristic.
This could fix my request in #35