Update documentation.

* typo fix
This commit is contained in:
h2zero 2020-09-13 20:02:15 -06:00
parent 8add6e86c4
commit 1a52245012
4 changed files with 16 additions and 19 deletions

View file

@ -209,12 +209,19 @@ This can be changed to use passkey authentication or numeric comparison. See [Se
<a name="advertising-api"></a> <a name="advertising-api"></a>
## Advertising API ## 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::setMinPreferred
> BLEAdvertising::setMaxPreferred > BLEAdvertising::setMaxPreferred
These methods were found to not provide useful functionality and consumed valuable advertising space (6 bytes of 31) if used unknowingly. 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`).
<br/>
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.
<br/> <br/>
<a name="client-api"></a> <a name="client-api"></a>

View file

@ -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. * @brief Set the advertisement data that is to be published in a regular advertisement.
* @param [in] advertisementData The data to be advertised. * @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) { 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. * @brief Set the advertisement data that is to be published in a scan response.
* @param [in] advertisementData The data to be advertised. * @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) { void NimBLEAdvertising::setScanResponseData(NimBLEAdvertisementData& advertisementData) {
NIMBLE_LOGD(LOG_TAG, ">> setScanResponseData"); NIMBLE_LOGD(LOG_TAG, ">> setScanResponseData");
@ -227,11 +232,6 @@ void NimBLEAdvertising::start() {
if(pServer != nullptr) { if(pServer != nullptr) {
if(!pServer->m_gattsStarted){ if(!pServer->m_gattsStarted){
pServer->start(); 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) { } else if(pServer->getConnectedCount() >= NIMBLE_MAX_CONNECTIONS) {
NIMBLE_LOGW(LOG_TAG, "Max connections reached - not advertising"); NIMBLE_LOGW(LOG_TAG, "Max connections reached - not advertising");
return; return;

View file

@ -84,7 +84,7 @@ public:
void setMaxInterval(uint16_t maxinterval); void setMaxInterval(uint16_t maxinterval);
void setMinInterval(uint16_t mininterval); void setMinInterval(uint16_t mininterval);
void setAdvertisementData(NimBLEAdvertisementData& advertisementData); void setAdvertisementData(NimBLEAdvertisementData& advertisementData);
void setScanFilter(bool scanRequertWhitelistOnly, bool connectWhitelistOnly); void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly);
void setScanResponseData(NimBLEAdvertisementData& advertisementData); void setScanResponseData(NimBLEAdvertisementData& advertisementData);
void setScanResponse(bool); void setScanResponse(bool);

View file

@ -101,17 +101,7 @@
*/ */
#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL 1 #define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL 1
/** /** @brief Sets the number of simultaneous connections (esp controller max is 9) */
* @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`
*/
#define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3 #define CONFIG_BT_NIMBLE_MAX_CONNECTIONS 3
/** @brief Sets the number of devices allowed to store/bond with */ /** @brief Sets the number of devices allowed to store/bond with */