Skip to content

Commit

Permalink
Fix characteristic discovery with no descriptors. (#863)
Browse files Browse the repository at this point in the history
Avoid discovery of descriptors if there are no handles remaining.

This reinstates the check removed in 853241b.
  • Loading branch information
gkoh authored Jan 16, 2025
1 parent 4464e3f commit 3081bc1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/NimBLERemoteCharacteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ int NimBLERemoteCharacteristic::descriptorDiscCB(
bool NimBLERemoteCharacteristic::retrieveDescriptors(const NimBLEUUID* uuidFilter) const {
NIMBLE_LOGD(LOG_TAG, ">> retrieveDescriptors() for characteristic: %s", getUUID().toString().c_str());

// If this is the last handle then there are no descriptors
if (getHandle() == getRemoteService()->getEndHandle()) {
NIMBLE_LOGD(LOG_TAG, "<< retrieveDescriptors(): found 0 descriptors.");
return true;
}

NimBLETaskData taskData(const_cast<NimBLERemoteCharacteristic*>(this));
desc_filter_t filter = {uuidFilter, &taskData};

Expand Down

0 comments on commit 3081bc1

Please sign in to comment.