Reduce flash usage up to 214k in one click (#2929)

* std::stringstream -> std::string

* Fix small issues

* Small fix 2
This commit is contained in:
Roman Savrulin
2019-07-09 19:31:17 +03:00
committed by Me No Dev
parent 20498cf8b1
commit a22ec4a978
20 changed files with 229 additions and 205 deletions

View File

@ -55,7 +55,8 @@ std::string BLERemoteDescriptor::readValue() {
// Check to see that we are connected.
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
log_e("Disconnected");
throw BLEDisconnectedException();
// throw BLEDisconnectedException(); TODO:: think about error reporting mechanism
return std::string();
}
m_semaphoreReadDescrEvt.take("readValue");
@ -113,9 +114,12 @@ uint32_t BLERemoteDescriptor::readUInt32() {
* @retun A string representation of this BLE Remote Descriptor.
*/
std::string BLERemoteDescriptor::toString() {
std::stringstream ss;
ss << "handle: " << getHandle() << ", uuid: " << getUUID().toString();
return ss.str();
char val[6];
snprintf(val, sizeof(val), "%d", getHandle());
std::string res = "handle: ";
res += val;
res += ", uuid: " + getUUID().toString();
return res;
} // toString
@ -130,7 +134,8 @@ void BLERemoteDescriptor::writeValue(uint8_t* data, size_t length, bool response
// Check to see that we are connected.
if (!getRemoteCharacteristic()->getRemoteService()->getClient()->isConnected()) {
log_e("Disconnected");
throw BLEDisconnectedException();
// throw BLEDisconnectedException(); TODO:: think about error reporting mechanism
return;
}
esp_err_t errRc = ::esp_ble_gattc_write_char_descr(