Skip to content

Commit

Permalink
Fix characteristic discovery with no descriptors.
Browse files Browse the repository at this point in the history
Avoid discovery of descriptors if there are no handles remaining.
  • Loading branch information
gkoh authored and h2zero committed Jan 16, 2025
1 parent 57fe9cb commit 8158a16
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 8158a16

Please sign in to comment.