Skip to content

Commit fab6dc8

Browse files
authored
Merge branch 'master' into bugfix/basic_http_client_cert
2 parents 1c58126 + 32def87 commit fab6dc8

8 files changed

+25
-22
lines changed

Diff for: libraries/BLE/src/BLEClient.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ void BLEClient::gattClientEventHandler(esp_gattc_cb_event_t event, esp_gatt_if_t
343343
BLEUUID uuid = BLEUUID(evtParam->search_res.srvc_id);
344344
BLERemoteService *pRemoteService =
345345
new BLERemoteService(evtParam->search_res.srvc_id, this, evtParam->search_res.start_handle, evtParam->search_res.end_handle);
346-
m_servicesMap.insert(std::pair<String, BLERemoteService *>(uuid.toString(), pRemoteService));
346+
m_servicesMap.insert(std::pair<std::string, BLERemoteService *>(uuid.toString().c_str(), pRemoteService));
347347
m_servicesMapByInstID.insert(std::pair<BLERemoteService *, uint16_t>(pRemoteService, evtParam->search_res.srvc_id.inst_id));
348348
break;
349349
} // ESP_GATTC_SEARCH_RES_EVT
@@ -428,7 +428,7 @@ BLERemoteService *BLEClient::getService(BLEUUID uuid) {
428428
if (!m_haveServices) {
429429
getServices();
430430
}
431-
String uuidStr = uuid.toString();
431+
std::string uuidStr = uuid.toString().c_str();
432432
for (auto &myPair : m_servicesMap) {
433433
if (myPair.first == uuidStr) {
434434
log_v("<< getService: found the service with uuid: %s", uuid.toString().c_str());
@@ -445,7 +445,7 @@ BLERemoteService *BLEClient::getService(BLEUUID uuid) {
445445
* services and wait until we have received them all.
446446
* @return N/A
447447
*/
448-
std::map<String, BLERemoteService *> *BLEClient::getServices() {
448+
std::map<std::string, BLERemoteService *> *BLEClient::getServices() {
449449
/*
450450
* Design
451451
* ------

Diff for: libraries/BLE/src/BLEClient.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class BLEClient {
4242
void disconnect(); // Disconnect from the remote BLE Server
4343
BLEAddress getPeerAddress(); // Get the address of the remote BLE Server
4444
int getRssi(); // Get the RSSI of the remote BLE Server
45-
std::map<String, BLERemoteService *> *getServices(); // Get a map of the services offered by the remote BLE Server
45+
std::map<std::string, BLERemoteService *> *getServices(); // Get a map of the services offered by the remote BLE Server
4646
BLERemoteService *getService(const char *uuid); // Get a reference to a specified service offered by the remote BLE server.
4747
BLERemoteService *getService(BLEUUID uuid); // Get a reference to a specified service offered by the remote BLE server.
4848
String getValue(BLEUUID serviceUUID, BLEUUID characteristicUUID); // Get the value of a given characteristic at a given service.
@@ -82,7 +82,7 @@ class BLEClient {
8282
FreeRTOS::Semaphore m_semaphoreOpenEvt = FreeRTOS::Semaphore("OpenEvt");
8383
FreeRTOS::Semaphore m_semaphoreSearchCmplEvt = FreeRTOS::Semaphore("SearchCmplEvt");
8484
FreeRTOS::Semaphore m_semaphoreRssiCmplEvt = FreeRTOS::Semaphore("RssiCmplEvt");
85-
std::map<String, BLERemoteService *> m_servicesMap;
85+
std::map<std::string, BLERemoteService *> m_servicesMap;
8686
std::map<BLERemoteService *, uint16_t> m_servicesMapByInstID;
8787
void clearServices(); // Clear any existing services.
8888
uint16_t m_mtu = 23;

Diff for: libraries/BLE/src/BLERemoteCharacteristic.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ void BLERemoteCharacteristic::retrieveDescriptors() {
297297
// We now have a new characteristic ... let us add that to our set of known characteristics
298298
BLERemoteDescriptor *pNewRemoteDescriptor = new BLERemoteDescriptor(result.handle, BLEUUID(result.uuid), this);
299299

300-
m_descriptorMap.insert(std::pair<String, BLERemoteDescriptor *>(pNewRemoteDescriptor->getUUID().toString(), pNewRemoteDescriptor));
300+
m_descriptorMap.insert(std::pair<std::string, BLERemoteDescriptor *>(pNewRemoteDescriptor->getUUID().toString().c_str(), pNewRemoteDescriptor));
301301

302302
offset++;
303303
} // while true
@@ -308,7 +308,7 @@ void BLERemoteCharacteristic::retrieveDescriptors() {
308308
/**
309309
* @brief Retrieve the map of descriptors keyed by UUID.
310310
*/
311-
std::map<String, BLERemoteDescriptor *> *BLERemoteCharacteristic::getDescriptors() {
311+
std::map<std::string, BLERemoteDescriptor *> *BLERemoteCharacteristic::getDescriptors() {
312312
return &m_descriptorMap;
313313
} // getDescriptors
314314

@@ -329,7 +329,7 @@ uint16_t BLERemoteCharacteristic::getHandle() {
329329
*/
330330
BLERemoteDescriptor *BLERemoteCharacteristic::getDescriptor(BLEUUID uuid) {
331331
log_v(">> getDescriptor: uuid: %s", uuid.toString().c_str());
332-
String v = uuid.toString();
332+
std::string v = uuid.toString().c_str();
333333
for (auto &myPair : m_descriptorMap) {
334334
if (myPair.first == v) {
335335
log_v("<< getDescriptor: found");

Diff for: libraries/BLE/src/BLERemoteCharacteristic.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class BLERemoteCharacteristic {
3939
bool canWrite();
4040
bool canWriteNoResponse();
4141
BLERemoteDescriptor *getDescriptor(BLEUUID uuid);
42-
std::map<String, BLERemoteDescriptor *> *getDescriptors();
42+
std::map<std::string, BLERemoteDescriptor *> *getDescriptors();
4343
BLERemoteService *getRemoteService();
4444
uint16_t getHandle();
4545
BLEUUID getUUID();
@@ -82,7 +82,7 @@ class BLERemoteCharacteristic {
8282
notify_callback m_notifyCallback;
8383

8484
// We maintain a map of descriptors owned by this characteristic keyed by a string representation of the UUID.
85-
std::map<String, BLERemoteDescriptor *> m_descriptorMap;
85+
std::map<std::string, BLERemoteDescriptor *> m_descriptorMap;
8686
}; // BLERemoteCharacteristic
8787

8888
#endif /* CONFIG_BLUEDROID_ENABLED */

Diff for: libraries/BLE/src/BLERemoteService.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ void BLERemoteService::gattClientEventHandler(esp_gattc_cb_event_t event, esp_ga
7979
8080
// This is an indication that we now have the characteristic details for a characteristic owned
8181
// by this service so remember it.
82-
m_characteristicMap.insert(std::pair<String, BLERemoteCharacteristic*>(
83-
BLEUUID(evtParam->get_char.char_id.uuid).toString(),
82+
m_characteristicMap.insert(std::pair<std::string, BLERemoteCharacteristic*>(
83+
BLEUUID(evtParam->get_char.char_id.uuid).toString().c_str(),
8484
new BLERemoteCharacteristic(evtParam->get_char.char_id, evtParam->get_char.char_prop, this) ));
8585
8686
@@ -134,7 +134,7 @@ BLERemoteCharacteristic *BLERemoteService::getCharacteristic(BLEUUID uuid) {
134134
if (!m_haveCharacteristics) {
135135
retrieveCharacteristics();
136136
}
137-
String v = uuid.toString();
137+
std::string v = uuid.toString().c_str();
138138
for (auto &myPair : m_characteristicMap) {
139139
if (myPair.first == v) {
140140
return myPair.second;
@@ -179,7 +179,9 @@ void BLERemoteService::retrieveCharacteristics() {
179179
// We now have a new characteristic ... let us add that to our set of known characteristics
180180
BLERemoteCharacteristic *pNewRemoteCharacteristic = new BLERemoteCharacteristic(result.char_handle, BLEUUID(result.uuid), result.properties, this);
181181

182-
m_characteristicMap.insert(std::pair<String, BLERemoteCharacteristic *>(pNewRemoteCharacteristic->getUUID().toString(), pNewRemoteCharacteristic));
182+
m_characteristicMap.insert(
183+
std::pair<std::string, BLERemoteCharacteristic *>(pNewRemoteCharacteristic->getUUID().toString().c_str(), pNewRemoteCharacteristic)
184+
);
183185
m_characteristicMapByHandle.insert(std::pair<uint16_t, BLERemoteCharacteristic *>(result.char_handle, pNewRemoteCharacteristic));
184186
offset++; // Increment our count of number of descriptors found.
185187
} // Loop forever (until we break inside the loop).
@@ -192,7 +194,7 @@ void BLERemoteService::retrieveCharacteristics() {
192194
* @brief Retrieve a map of all the characteristics of this service.
193195
* @return A map of all the characteristics of this service.
194196
*/
195-
std::map<String, BLERemoteCharacteristic *> *BLERemoteService::getCharacteristics() {
197+
std::map<std::string, BLERemoteCharacteristic *> *BLERemoteService::getCharacteristics() {
196198
log_v(">> getCharacteristics() for service: %s", getUUID().toString().c_str());
197199
// If is possible that we have not read the characteristics associated with the service so do that
198200
// now. The request to retrieve the characteristics by calling "retrieveCharacteristics" is a blocking

Diff for: libraries/BLE/src/BLERemoteService.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class BLERemoteService {
3434
BLERemoteCharacteristic *getCharacteristic(const char *uuid); // Get the specified characteristic reference.
3535
BLERemoteCharacteristic *getCharacteristic(BLEUUID uuid); // Get the specified characteristic reference.
3636
BLERemoteCharacteristic *getCharacteristic(uint16_t uuid); // Get the specified characteristic reference.
37-
std::map<String, BLERemoteCharacteristic *> *getCharacteristics();
37+
std::map<std::string, BLERemoteCharacteristic *> *getCharacteristics();
3838
std::map<uint16_t, BLERemoteCharacteristic *> *getCharacteristicsByHandle(); // Get the characteristics map.
3939
void getCharacteristics(std::map<uint16_t, BLERemoteCharacteristic *> **pCharacteristicMap);
4040

@@ -66,7 +66,7 @@ class BLERemoteService {
6666
// Properties
6767

6868
// We maintain a map of characteristics owned by this service keyed by a string representation of the UUID.
69-
std::map<String, BLERemoteCharacteristic *> m_characteristicMap;
69+
std::map<std::string, BLERemoteCharacteristic *> m_characteristicMap;
7070

7171
// We maintain a map of characteristics owned by this service keyed by a handle.
7272
std::map<uint16_t, BLERemoteCharacteristic *> m_characteristicMapByHandle;

Diff for: libraries/BLE/src/BLEScan.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void BLEScan::handleGAPEvent(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_
9999
bool shouldDelete = true;
100100

101101
if (!m_wantDuplicates) {
102-
if (m_scanResults.m_vectorAdvertisedDevices.count(advertisedAddress.toString()) != 0) {
102+
if (m_scanResults.m_vectorAdvertisedDevices.count(advertisedAddress.toString().c_str()) != 0) {
103103
found = true;
104104
}
105105

@@ -130,7 +130,8 @@ void BLEScan::handleGAPEvent(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_
130130
m_pAdvertisedDeviceCallbacks->onResult(*advertisedDevice);
131131
}
132132
if (!m_wantDuplicates && !found) { // if no callback and not want duplicate, and not already in vector, record it
133-
m_scanResults.m_vectorAdvertisedDevices.insert(std::pair<String, BLEAdvertisedDevice *>(advertisedAddress.toString(), advertisedDevice));
133+
m_scanResults.m_vectorAdvertisedDevices.insert(std::pair<std::string, BLEAdvertisedDevice *>(advertisedAddress.toString().c_str(), advertisedDevice)
134+
);
134135
shouldDelete = false;
135136
}
136137
if (shouldDelete) {
@@ -443,8 +444,8 @@ void BLEScan::stop() {
443444
// delete peer device from cache after disconnecting, it is required in case we are connecting to devices with not public address
444445
void BLEScan::erase(BLEAddress address) {
445446
log_i("erase device: %s", address.toString().c_str());
446-
BLEAdvertisedDevice *advertisedDevice = m_scanResults.m_vectorAdvertisedDevices.find(address.toString())->second;
447-
m_scanResults.m_vectorAdvertisedDevices.erase(address.toString());
447+
BLEAdvertisedDevice *advertisedDevice = m_scanResults.m_vectorAdvertisedDevices.find(address.toString().c_str())->second;
448+
m_scanResults.m_vectorAdvertisedDevices.erase(address.toString().c_str());
448449
delete advertisedDevice;
449450
}
450451

Diff for: libraries/BLE/src/BLEScan.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class BLEScanResults {
5353

5454
private:
5555
friend BLEScan;
56-
std::map<String, BLEAdvertisedDevice *> m_vectorAdvertisedDevices;
56+
std::map<std::string, BLEAdvertisedDevice *> m_vectorAdvertisedDevices;
5757
};
5858

5959
/**

0 commit comments

Comments
 (0)