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

@ -90,17 +90,18 @@ void BLEDescriptorMap::setByHandle(uint16_t handle, BLEDescriptor* pDescriptor)
* @return A string representation of the descriptor map.
*/
std::string BLEDescriptorMap::toString() {
std::stringstream stringStream;
stringStream << std::hex << std::setfill('0');
std::string res;
char hex[5];
int count = 0;
for (auto &myPair : m_uuidMap) {
if (count > 0) {
stringStream << "\n";
}
if (count > 0) {res += "\n";}
snprintf(hex, sizeof(hex), "%04x", myPair.first->getHandle());
count++;
stringStream << "handle: 0x" << std::setw(2) << myPair.first->getHandle() << ", uuid: " + myPair.first->getUUID().toString();
res += "handle: 0x";
res += hex;
res += ", uuid: " + myPair.first->getUUID().toString();
}
return stringStream.str();
return res;
} // toString