mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-24 22:20:55 +01:00
Update NimBLEAdvertising.cpp
Null terminate the m_name vector because for some reason if you shorten the advertising name it will keep the length the same as the longest name that has been set until the uP is restarted. This means that if you set the name to "longest" and then set it to "short" it will advertise as "shortst" (note two letters from the end of "longest".
This commit is contained in:
parent
4e65ce5d32
commit
6b555d763b
1 changed files with 1 additions and 0 deletions
|
@ -138,6 +138,7 @@ void NimBLEAdvertising::addTxPower() {
|
||||||
*/
|
*/
|
||||||
void NimBLEAdvertising::setName(const std::string &name) {
|
void NimBLEAdvertising::setName(const std::string &name) {
|
||||||
m_name.assign(name.begin(), name.end());
|
m_name.assign(name.begin(), name.end());
|
||||||
|
m_name[name.length()] = 0;
|
||||||
m_advData.name = &m_name[0];
|
m_advData.name = &m_name[0];
|
||||||
m_advData.name_len = m_name.size();
|
m_advData.name_len = m_name.size();
|
||||||
m_advDataSet = false;
|
m_advDataSet = false;
|
||||||
|
|
Loading…
Reference in a new issue