Skip to content

Commit 3081bc1

Browse files
authored
Fix characteristic discovery with no descriptors. (#863)
Avoid discovery of descriptors if there are no handles remaining. This reinstates the check removed in 853241b.
1 parent 4464e3f commit 3081bc1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/NimBLERemoteCharacteristic.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ int NimBLERemoteCharacteristic::descriptorDiscCB(
101101
bool NimBLERemoteCharacteristic::retrieveDescriptors(const NimBLEUUID* uuidFilter) const {
102102
NIMBLE_LOGD(LOG_TAG, ">> retrieveDescriptors() for characteristic: %s", getUUID().toString().c_str());
103103

104+
// If this is the last handle then there are no descriptors
105+
if (getHandle() == getRemoteService()->getEndHandle()) {
106+
NIMBLE_LOGD(LOG_TAG, "<< retrieveDescriptors(): found 0 descriptors.");
107+
return true;
108+
}
109+
104110
NimBLETaskData taskData(const_cast<NimBLERemoteCharacteristic*>(this));
105111
desc_filter_t filter = {uuidFilter, &taskData};
106112

0 commit comments

Comments
 (0)