Skip to content

Commit e4b8c36

Browse files
committed
2 parents 7b6bc85 + 658339b commit e4b8c36

File tree

4 files changed

+33
-7
lines changed

4 files changed

+33
-7
lines changed

src/NimBLEClient.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ NimBLEClient::~NimBLEClient() {
9494
delete m_pClientCallbacks;
9595
}
9696

97+
ble_npl_callout_deinit(&m_dcTimer);
98+
9799
} // ~NimBLEClient
98100

99101

@@ -618,15 +620,23 @@ NimBLERemoteService* NimBLEClient::getService(const NimBLEUUID &uuid) {
618620
{
619621
NimBLEUUID uuid128(uuid);
620622
uuid128.to128();
621-
return getService(uuid128);
623+
if(retrieveServices(&uuid128)) {
624+
if(m_servicesVector.size() > prev_size) {
625+
return m_servicesVector.back();
626+
}
627+
}
622628
} else {
623629
// If the request was successful but the 128 bit uuid not found
624630
// try again with the 16 bit uuid.
625631
NimBLEUUID uuid16(uuid);
626632
uuid16.to16();
627633
// if the uuid was 128 bit but not of the BLE base type this check will fail
628634
if (uuid16.bitSize() == BLE_UUID_TYPE_16) {
629-
return getService(uuid16);
635+
if(retrieveServices(&uuid16)) {
636+
if(m_servicesVector.size() > prev_size) {
637+
return m_servicesVector.back();
638+
}
639+
}
630640
}
631641
}
632642
}

src/NimBLERemoteCharacteristic.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,15 +323,23 @@ NimBLERemoteDescriptor* NimBLERemoteCharacteristic::getDescriptor(const NimBLEUU
323323
{
324324
NimBLEUUID uuid128(uuid);
325325
uuid128.to128();
326-
return getDescriptor(uuid128);
326+
if(retrieveDescriptors(&uuid128)) {
327+
if(m_descriptorVector.size() > prev_size) {
328+
return m_descriptorVector.back();
329+
}
330+
}
327331
} else {
328332
// If the request was successful but the 128 bit uuid not found
329333
// try again with the 16 bit uuid.
330334
NimBLEUUID uuid16(uuid);
331335
uuid16.to16();
332336
// if the uuid was 128 bit but not of the BLE base type this check will fail
333337
if (uuid16.bitSize() == BLE_UUID_TYPE_16) {
334-
return getDescriptor(uuid16);
338+
if(retrieveDescriptors(&uuid16)) {
339+
if(m_descriptorVector.size() > prev_size) {
340+
return m_descriptorVector.back();
341+
}
342+
}
335343
}
336344
}
337345
}

src/NimBLERemoteService.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

src/nimconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
#define CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE 2
247247
#endif
248248

249-
#if !defined(CONFIG_IDF_TARGET_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3)
249+
#if !defined(CONFIG_IDF_TARGET_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
250250
#define CONFIG_IDF_TARGET_ESP32 1
251251
#endif
252252
#endif

0 commit comments

Comments
 (0)