Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/local/BLELocalAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include "utility/BLEUuid.h"

#define BLE_ATTRIBUTE_TYPE_SIZE 2

enum BLEAttributeType {
BLETypeUnknown = 0x0000,

Expand Down
5 changes: 3 additions & 2 deletions src/utility/ATT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 || isDescriptor) ? attribute->uuidLength() : BLE_ATTRIBUTE_TYPE_SIZE;
int infoType = (uuidLen == 2) ? 0x01 : 0x02;

if (response[1] == 0) {
Expand All @@ -699,7 +700,7 @@ void ATTClass::findInfoReq(uint16_t connectionHandle, uint16_t mtu, uint8_t dlen
memcpy(&response[responseLength], &handle, sizeof(handle));
responseLength += sizeof(handle);

if (isValueHandle || attribute->type() == BLETypeDescriptor) {
if (isValueHandle || isDescriptor) {
// add the UUID
memcpy(&response[responseLength], attribute->uuidData(), uuidLen);
responseLength += uuidLen;
Expand Down