File tree Expand file tree Collapse file tree 3 files changed +30
-6
lines changed
Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -596,15 +596,23 @@ NimBLERemoteService* NimBLEClient::getService(const NimBLEUUID &uuid) {
596596 {
597597 NimBLEUUID uuid128 (uuid);
598598 uuid128.to128 ();
599- return getService (uuid128);
599+ if (retrieveServices (&uuid128)) {
600+ if (m_servicesVector.size () > prev_size) {
601+ return m_servicesVector.back ();
602+ }
603+ }
600604 } else {
601605 // If the request was successful but the 128 bit uuid not found
602606 // try again with the 16 bit uuid.
603607 NimBLEUUID uuid16 (uuid);
604608 uuid16.to16 ();
605609 // if the uuid was 128 bit but not of the BLE base type this check will fail
606610 if (uuid16.bitSize () == BLE_UUID_TYPE_16) {
607- return getService (uuid16);
611+ if (retrieveServices (&uuid16)) {
612+ if (m_servicesVector.size () > prev_size) {
613+ return m_servicesVector.back ();
614+ }
615+ }
608616 }
609617 }
610618 }
Original file line number Diff line number Diff line change @@ -326,15 +326,23 @@ NimBLERemoteDescriptor* NimBLERemoteCharacteristic::getDescriptor(const NimBLEUU
326326 {
327327 NimBLEUUID uuid128 (uuid);
328328 uuid128.to128 ();
329- return getDescriptor (uuid128);
329+ if (retrieveDescriptors (&uuid128)) {
330+ if (m_descriptorVector.size () > prev_size) {
331+ return m_descriptorVector.back ();
332+ }
333+ }
330334 } else {
331335 // If the request was successful but the 128 bit uuid not found
332336 // try again with the 16 bit uuid.
333337 NimBLEUUID uuid16 (uuid);
334338 uuid16.to16 ();
335339 // if the uuid was 128 bit but not of the BLE base type this check will fail
336340 if (uuid16.bitSize () == BLE_UUID_TYPE_16) {
337- return getDescriptor (uuid16);
341+ if (retrieveDescriptors (&uuid16)) {
342+ if (m_descriptorVector.size () > prev_size) {
343+ return m_descriptorVector.back ();
344+ }
345+ }
338346 }
339347 }
340348 }
Original file line number Diff line number Diff line change @@ -116,15 +116,23 @@ NimBLERemoteCharacteristic* NimBLERemoteService::getCharacteristic(const NimBLEU
116116 {
117117 NimBLEUUID uuid128 (uuid);
118118 uuid128.to128 ();
119- return getCharacteristic (uuid128);
119+ if (retrieveCharacteristics (&uuid128)) {
120+ if (m_characteristicVector.size () > prev_size) {
121+ return m_characteristicVector.back ();
122+ }
123+ }
120124 } else {
121125 // If the request was successful but the 128 bit uuid not found
122126 // try again with the 16 bit uuid.
123127 NimBLEUUID uuid16 (uuid);
124128 uuid16.to16 ();
125129 // if the uuid was 128 bit but not of the BLE base type this check will fail
126130 if (uuid16.bitSize () == BLE_UUID_TYPE_16) {
127- return getCharacteristic (uuid16);
131+ if (retrieveCharacteristics (&uuid16)) {
132+ if (m_characteristicVector.size () > prev_size) {
133+ return m_characteristicVector.back ();
134+ }
135+ }
128136 }
129137 }
130138 }
You can’t perform that action at this time.
0 commit comments