From 96459073a44664eb39d385166a8001894212e3e9 Mon Sep 17 00:00:00 2001 From: h2zero Date: Wed, 29 Dec 2021 07:51:57 -0700 Subject: [PATCH] Initialize advertising complete callback in NimBLEAdvertising constructor. * cleanup advertising start return. --- src/NimBLEAdvertising.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/NimBLEAdvertising.cpp b/src/NimBLEAdvertising.cpp index 6457dd8..a804130 100644 --- a/src/NimBLEAdvertising.cpp +++ b/src/NimBLEAdvertising.cpp @@ -69,6 +69,7 @@ void NimBLEAdvertising::reset() { m_advDataSet = false; // Set this to non-zero to prevent auto start if host reset before started by app. m_duration = BLE_HS_FOREVER; + m_advCompCB = nullptr; } // reset @@ -654,12 +655,8 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv break; } - if(rc != 0) { - return false; - } - NIMBLE_LOGD(LOG_TAG, "<< Advertising start"); - return true; + return (rc == 0); } // start