Initialize advertising complete callback in NimBLEAdvertising constructor.

* cleanup advertising start return.
This commit is contained in:
h2zero 2021-12-29 07:51:57 -07:00
parent a4403fe6b8
commit 96459073a4

View file

@ -69,6 +69,7 @@ void NimBLEAdvertising::reset() {
m_advDataSet = false; m_advDataSet = false;
// Set this to non-zero to prevent auto start if host reset before started by app. // Set this to non-zero to prevent auto start if host reset before started by app.
m_duration = BLE_HS_FOREVER; m_duration = BLE_HS_FOREVER;
m_advCompCB = nullptr;
} // reset } // reset
@ -654,12 +655,8 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv
break; break;
} }
if(rc != 0) {
return false;
}
NIMBLE_LOGD(LOG_TAG, "<< Advertising start"); NIMBLE_LOGD(LOG_TAG, "<< Advertising start");
return true; return (rc == 0);
} // start } // start