Skip to content

#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

Merged
merged 2 commits into from
Apr 1, 2019

Conversation

jlusiardi
Copy link
Contributor

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

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.
Copy link
Contributor

@larsblumberg larsblumberg left a 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']))

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.
@LionNatsu
Copy link

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 :)

@jlusiardi
Copy link
Contributor Author

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!

@Jc2k
Copy link

Jc2k commented Jan 6, 2019

It would be really handy to have a release with this PR in if anyone can help, thanks!

@larsblumberg
Copy link
Contributor

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.

@Jc2k
Copy link

Jc2k commented Jan 7, 2019

Thats great news! ❤️

@larsblumberg
Copy link
Contributor

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.

@kelada
Copy link
Contributor

kelada commented Jan 18, 2019

@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 👍

@jlusiardi
Copy link
Contributor Author

Hi,
I just wanted to ask for any progress here?
Regards Joachim

@larsblumberg
Copy link
Contributor

larsblumberg commented Mar 21, 2019

Sorry for the long silence. Testing the branches is on my to do list for this weekend. Will keep you updated.

@jlusiardi
Copy link
Contributor Author

Ok cool thanks!

@larsblumberg
Copy link
Contributor

@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.

@kelada
Copy link
Contributor

kelada commented Mar 27, 2019

@larsblumberg thank you for this testing, I will try and get this merged in before the end of next week.

@kelada kelada merged commit e1b147d into getsenic:master Apr 1, 2019
@jlusiardi
Copy link
Contributor Author

Thank you!

@jlusiardi jlusiardi deleted the issue_35_read_descriptors branch April 1, 2019 21:15
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.

5 participants