File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -72,19 +72,22 @@ int NimBLERemoteCharacteristic::descriptorDiscCB(
7272 const auto pChr = (NimBLERemoteCharacteristic*)pTaskData->m_pInstance ;
7373 const auto uuid = filter->uuid ; // UUID to filter for
7474
75- if (pChr-> getHandle () != chrHandle) {
76- return 0 ; // Descriptor not for this characteristic
77- }
78- // Return early if not the descriptor we are looking for if filter exists
79- if (rc != 0 || (uuid && ble_uuid_cmp (uuid->getBase (), &dsc->uuid .u ))) {
75+ // Error/Done; or
76+ // Wrong characteristic; or
77+ // Descriptor does not match UUID filter
78+ if (rc != 0 || pChr-> getHandle () != chrHandle
79+ || (uuid && ble_uuid_cmp (uuid->getBase (), &dsc->uuid .u ))) {
8080 goto Done;
8181 }
82-
83- rc = !!uuid * BLE_HS_EDONE; // If found the descriptor, stop the search
82+ // Results added until BLE_HS_EDONE is received
8483 pChr->m_vDescriptors .push_back (new NimBLERemoteDescriptor (pChr, dsc));
84+ // Return BLE_HS_EDONE if the descriptor was found, stop the search
85+ rc = !!uuid * BLE_HS_EDONE;
8586
8687Done:
87- NimBLEUtils::taskRelease (*pTaskData, rc);
88+ if (rc == BLE_HS_EDONE) {
89+ NimBLEUtils::taskRelease (*pTaskData, rc);
90+ }
8891 NIMBLE_LOGD (LOG_TAG, " << Descriptor Discovery" );
8992 return rc;
9093}
You can’t perform that action at this time.
0 commit comments