Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix find info resp when called on non-descriptor attributes#148

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
polldo merged 1 commit intoarduino-libraries:masterfrompolldo:fix-find-info-resp
Dec 14, 2020

Conversation

polldo
Copy link
Contributor

Before this fix, if theATT information request was called on an handle belonging to a non-descriptor attribute, then the response would contain the uuid of the actual attribute's type but with the format of the attribute uuid (0x01 for 16 bit length, 0x02 for 128 bit length).
So, for instance, if the info request was performed on an handle belonging to a service with a uuid of 128 bit, then the response would have been malformed because the size of the attribute's type is 16 bit.

From issue discovered by@ThomasGerstenberg
#147

@@ -683,7 +683,8 @@ void ATTClass::findInfoReq(uint16_t connectionHandle, uint16_t mtu, uint8_t dlen
BLELocalAttribute* attribute = GATT.attribute(i);
uint16_t handle = (i + 1);
bool isValueHandle = (attribute->type() == BLETypeCharacteristic) && (((BLELocalCharacteristic*)attribute)->valueHandle() == handle);
int uuidLen = isValueHandle ? 2 : attribute->uuidLength();
bool isDescriptor = attribute->type() == BLETypeDescriptor;
int uuidLen = isValueHandle ? 2 : (isDescriptor ? attribute->uuidLength() : BLE_ATTRIBUTE_TYPE_SIZE);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't think this is correct. If it's a value handle, it should use the attribute's UUID length right?

If we align it with theif logic on 703, value and descriptor handles memcpy the UUID data, so the uuidLen should reflect as such. Otherwise use the type size of 2

intuuidLen= (isValueHandle||isDescriptor) ?attribute->uuidLength() :BLE_ATTRIBUTE_TYPE_SIZE;// also can update the if on 703 to matchif (isValueHandle||isDescriptor) {// add the UUID}else {// add the type}

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes you're definitely right!
I'm going to update the PR

Before this fix, if the 'ATT information request' was called on an handle belonging to a non-descriptor attribute, then the response would contain the uuid of the actual attribute's type but with the format of the attribute uuid (0x01 for 16 bit length, 0x02 for 128 bit length).So, for instance, if the info request was performed on an handle belonging to a service with a uuid of 128 bit, then the response would have been malformed because the size of the attribute's type is 16 bit.
Copy link

@ThomasGerstenbergThomasGerstenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Tested fix and it works 👍

Capture of handle0x0e being discovered as a 16-bit uuid
image

@polldopolldo merged commit953f973 intoarduino-libraries:masterDec 14, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ThomasGerstenbergThomasGerstenbergThomasGerstenberg approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@polldo@ThomasGerstenberg

[8]ページ先頭

©2009-2025 Movatter.jp