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

Commit4589b0e

Browse files
committed
Fix find info resp when called on non-descriptor attributes
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.
1 parent840501e commit4589b0e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

‎src/local/BLELocalAttribute.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#include"utility/BLEUuid.h"
2424

25+
#defineBLE_ATTRIBUTE_TYPE_SIZE2
26+
2527
enum BLEAttributeType {
2628
BLETypeUnknown =0x0000,
2729

‎src/utility/ATT.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,8 @@ void ATTClass::findInfoReq(uint16_t connectionHandle, uint16_t mtu, uint8_t dlen
683683
BLELocalAttribute* attribute = GATT.attribute(i);
684684
uint16_t handle = (i +1);
685685
bool isValueHandle = (attribute->type() == BLETypeCharacteristic) && (((BLELocalCharacteristic*)attribute)->valueHandle() == handle);
686-
int uuidLen = isValueHandle ?2 : attribute->uuidLength();
686+
bool isDescriptor = attribute->type() == BLETypeDescriptor;
687+
int uuidLen = isValueHandle ?2 : (isDescriptor ? attribute->uuidLength() : BLE_ATTRIBUTE_TYPE_SIZE);
687688
int infoType = (uuidLen ==2) ?0x01 :0x02;
688689

689690
if (response[1] ==0) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp