Closed OlegGirko closed 4 days ago
The BLECharacteristic::getValue() method returns std::string in older versions of Arduino core for the ESP32 and String in newer versions.
BLECharacteristic::getValue()
std::string
String
However, the return value is used in a way that both classes support: using only length() and c_str() methods.
length()
c_str()
Hence, replacing explicit type name with auto keyword makes the code compatible with older and newer versions.
awesome, thank you!
The
BLECharacteristic::getValue()
method returnsstd::string
in older versions of Arduino core for the ESP32 andString
in newer versions.However, the return value is used in a way that both classes support: using only
length()
andc_str()
methods.Hence, replacing explicit type name with auto keyword makes the code compatible with older and newer versions.