From 1a52245012f19c98edd08007c33a3b2d2c2319ea Mon Sep 17 00:00:00 2001 From: h2zero Date: Sun, 13 Sep 2020 20:02:15 -0600 Subject: [PATCH] Update documentation. * typo fix --- docs/Migration_guide.md | 11 +++++++++-- src/NimBLEAdvertising.cpp | 10 +++++----- src/NimBLEAdvertising.h | 2 +- src/nimconfig.h | 12 +----------- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/docs/Migration_guide.md b/docs/Migration_guide.md index 9ed81ce..b88de5f 100644 --- a/docs/Migration_guide.md +++ b/docs/Migration_guide.md @@ -209,12 +209,19 @@ This can be changed to use passkey authentication or numeric comparison. See [Se ## Advertising API -Advertising works the same as the original API except with the removal of: +Advertising works the same as the original API except: > BLEAdvertising::setMinPreferred > BLEAdvertising::setMaxPreferred These methods were found to not provide useful functionality and consumed valuable advertising space (6 bytes of 31) if used unknowingly. -If you wish to advertise these parameters you can still do so manually via `NimBLEAdvertisementData::addData`. +If you wish to advertise these parameters you can still do so manually via `BLEAdvertisementData::addData` (`NimBLEAdvertisementData::addData`). +
+ +Calling `NimBLEAdvertising::setAdvertisementData` will entirely replace any data set with `NimBLEAdvertising::addServiceUUID`, or +`NimBLEAdvertising::setAppearance`. You should set all the data you wish to advertise within the `NimBLEAdvertisementData` instead. + +Calling `NimBLEAdvertising::setScanResponseData` without also calling `NimBLEAdvertising::setAdvertisementData` will have no effect. +When using custom scan response data you must also use custom advertisement data.
diff --git a/src/NimBLEAdvertising.cpp b/src/NimBLEAdvertising.cpp index ee9789a..6b5cee7 100644 --- a/src/NimBLEAdvertising.cpp +++ b/src/NimBLEAdvertising.cpp @@ -178,6 +178,9 @@ void NimBLEAdvertising::setScanFilter(bool scanRequestWhitelistOnly, bool connec /** * @brief Set the advertisement data that is to be published in a regular advertisement. * @param [in] advertisementData The data to be advertised. + * @details The use of this function will replace any data set with addServiceUUID\n + * or setAppearance. If you wish for these to be advertised you must include them\n + * in the advertisementData parameter sent. */ void NimBLEAdvertising::setAdvertisementData(NimBLEAdvertisementData& advertisementData) { @@ -196,6 +199,8 @@ void NimBLEAdvertising::setAdvertisementData(NimBLEAdvertisementData& advertisem /** * @brief Set the advertisement data that is to be published in a scan response. * @param [in] advertisementData The data to be advertised. + * @details Calling this without also using setAdvertisementData will have no effect.\n + * When using custom scan response data you must also use custom advertisement data. */ void NimBLEAdvertising::setScanResponseData(NimBLEAdvertisementData& advertisementData) { NIMBLE_LOGD(LOG_TAG, ">> setScanResponseData"); @@ -227,11 +232,6 @@ void NimBLEAdvertising::start() { if(pServer != nullptr) { if(!pServer->m_gattsStarted){ pServer->start(); - // When the server instance is created it resets GATT which - // seems to put the controller in a sleep loop? This causes a delay when - // advertising is started the first time. To avoid this we call ble_gap_adv_stop - // to get the controller ready. - ble_gap_adv_stop(); } else if(pServer->getConnectedCount() >= NIMBLE_MAX_CONNECTIONS) { NIMBLE_LOGW(LOG_TAG, "Max connections reached - not advertising"); return; diff --git a/src/NimBLEAdvertising.h b/src/NimBLEAdvertising.h index 8f8ca17..a8c86ef 100644 --- a/src/NimBLEAdvertising.h +++ b/src/NimBLEAdvertising.h @@ -84,7 +84,7 @@ public: void setMaxInterval(uint16_t maxinterval); void setMinInterval(uint16_t mininterval); void setAdvertisementData(NimBLEAdvertisementData& advertisementData); - void setScanFilter(bool scanRequertWhitelistOnly, bool connectWhitelistOnly); + void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly); void setScanResponseData(NimBLEAdvertisementData& advertisementData); void setScanResponse(bool); diff --git a/src/nimconfig.h b/src/nimconfig.h index 391a381..a425216 100644 --- a/src/nimconfig.h +++ b/src/nimconfig.h @@ -101,17 +101,7 @@ */ #define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL 1 -/** - * @brief Sets the number of simultaneous connections (esp controller max is 9) - * @details To increase max connections in Arduino it is also required to change the - * controller max connections defined in sdkconfig.h.\n - * - * This is located in your Arduino/hardware/espressif/esp32/tools/sdk/include/config folder.\n\n - * - * The values in sdkconfig.h you will need to change are:\n\n - * `CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN 3`\n - * `CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF 3` - */ +/** @brief Sets the number of simultaneous connections (esp controller max is 9) */ #define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3 /** @brief Sets the number of devices allowed to store/bond with */