Skip to content

Fix discovery of descriptors #99

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 1 commit into from
Aug 17, 2020
Merged

Conversation

polldo
Copy link
Contributor

@polldo polldo commented Jul 21, 2020

The 'nextCharacteristic' selection was wrong.
Thus, when using nextCharacteristic for taking the end handle for the request, the end handle of the current characteristic was taken.
This resulted in the following condition to be true: (reqStartHandle > reqEndHandle)
For such reason, in many cases the descriptors were not retrieved. Specifically, all the characteristics of a service, except the last one, will result without descriptors.
This will result in an error where trying to subscribe to a characteristic which has a descriptor before the CCCD one. (for instance the User Description Descriptor)
In case the subscription is made on a characteristic having the CCCD as first descriptor there are no errors, because if no descriptors are found the write request, needed for the subscription, will be made to the char value handle + 1.

The 'nextCharacteristic' selection was wrong.
Thus, when using nextCharacteristic for taking the end handle for the request, the end handle of the current characteristic was taken.
This resulted in the following condition to be true: (reqStartHandle > reqEndHandle)
For such reason, in many cases the descriptors were not retrieved. Specifically, all the characteristics of a service, except the last one, will result without descriptors.
This will result in an error where trying to subscribe to a characteristic which has a descriptor before the CCCD one. (for instance the User Description Descriptor)
In case the subscription is made on a characteristic having the CCCD as first descriptor there are no errors, because if no descriptors are found the write request, needed for the subscription, will be made to the char value handle + 1.
@polldo polldo force-pushed the master branch 2 times, most recently from 6f057e9 to 3074107 Compare July 28, 2020 17:17
@facchinm facchinm self-requested a review August 17, 2020 09:10
@facchinm facchinm merged commit 5978985 into arduino-libraries:master Aug 17, 2020
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.

3 participants