File tree 3 files changed +30
-6
lines changed 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) {
596
596
{
597
597
NimBLEUUID uuid128 (uuid);
598
598
uuid128.to128 ();
599
- return getService (uuid128);
599
+ if (retrieveServices (&uuid128)) {
600
+ if (m_servicesVector.size () > prev_size) {
601
+ return m_servicesVector.back ();
602
+ }
603
+ }
600
604
} else {
601
605
// If the request was successful but the 128 bit uuid not found
602
606
// try again with the 16 bit uuid.
603
607
NimBLEUUID uuid16 (uuid);
604
608
uuid16.to16 ();
605
609
// if the uuid was 128 bit but not of the BLE base type this check will fail
606
610
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
+ }
608
616
}
609
617
}
610
618
}
Original file line number Diff line number Diff line change @@ -326,15 +326,23 @@ NimBLERemoteDescriptor* NimBLERemoteCharacteristic::getDescriptor(const NimBLEUU
326
326
{
327
327
NimBLEUUID uuid128 (uuid);
328
328
uuid128.to128 ();
329
- return getDescriptor (uuid128);
329
+ if (retrieveDescriptors (&uuid128)) {
330
+ if (m_descriptorVector.size () > prev_size) {
331
+ return m_descriptorVector.back ();
332
+ }
333
+ }
330
334
} else {
331
335
// If the request was successful but the 128 bit uuid not found
332
336
// try again with the 16 bit uuid.
333
337
NimBLEUUID uuid16 (uuid);
334
338
uuid16.to16 ();
335
339
// if the uuid was 128 bit but not of the BLE base type this check will fail
336
340
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
+ }
338
346
}
339
347
}
340
348
}
Original file line number Diff line number Diff line change @@ -116,15 +116,23 @@ NimBLERemoteCharacteristic* NimBLERemoteService::getCharacteristic(const NimBLEU
116
116
{
117
117
NimBLEUUID uuid128 (uuid);
118
118
uuid128.to128 ();
119
- return getCharacteristic (uuid128);
119
+ if (retrieveCharacteristics (&uuid128)) {
120
+ if (m_characteristicVector.size () > prev_size) {
121
+ return m_characteristicVector.back ();
122
+ }
123
+ }
120
124
} else {
121
125
// If the request was successful but the 128 bit uuid not found
122
126
// try again with the 16 bit uuid.
123
127
NimBLEUUID uuid16 (uuid);
124
128
uuid16.to16 ();
125
129
// if the uuid was 128 bit but not of the BLE base type this check will fail
126
130
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
+ }
128
136
}
129
137
}
130
138
}
You can’t perform that action at this time.
0 commit comments