Release 1.4.0

* Fix typos

* Update docs
This commit is contained in:
h2zero 2022-07-31 11:00:12 -06:00
parent 70ed6e293f
commit efa48c0d57
27 changed files with 159 additions and 164 deletions

View file

@ -2,6 +2,27 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [1.4.0] - 2022-07-31
### Fixed
- Fixed missing data from long notification values.
- Fixed NimbleCharacteristicCallbacks::onRead not being called when a non-long read command is received.
- Prevent a potential crash when retrieving characteristics from a service if the result was successful but no characteristics found.
- logs/typos.
### Changed
- AD flags are no longer set in the advertisements of non-connectable beacons, freeing up 3 bytes of advertisement room.
- Save resources when retrieving descriptors if the characteristic handle is the same as the end handle (no descriptors).
- Subscribing to characteristic notifications/indications will now always use write with response, as per BLE specifications.
- `NimBLEClient::discoverAttributes` now returns a bool value to indicate success/failure.
- Scan result callbacks are no longer called when the scan response data is updated in order to reduce duplicates.
### Added
- Preliminary support for non-esp devices, NRF51 and NRF52 devices supported with [n-able arduino core](https://github.com/h2zero/n-able-Arduino)
- Alias added for `NimBLEServerCallbacks::onMTUChange` to `onMtuChanged` in order to support porting code from original library.
- `NimBLEAttValue` Class added to reduce and control RAM footprint of characteristic/descriptor values and support conversions from Arduino Strings and many other data types.
- Bluetooth 5 extended advertising support for capable devices. CODED Phy, 2M Phy, extended advertising data, and multi-advertising are supported, periodic advertising will be implemented in the future.
## [1.3.3] - 2022-02-15 ## [1.3.3] - 2022-02-15
### Changed ### Changed

View file

@ -42,7 +42,7 @@ config NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT
messages in the debug log. This will use approximately 1kB messages in the debug log. This will use approximately 1kB
of flash memory. of flash memory.
config NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT config NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT
bool "Show advertisment types as text in debug log." bool "Show advertisment types as text in debug log."
default "n" default "n"
help help

View file

@ -38,7 +38,7 @@ PROJECT_NAME = esp-nimble-cpp
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 1.3.2 PROJECT_NUMBER = 1.4.0
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
@ -2267,7 +2267,8 @@ PREDEFINED = _DOXYGEN_ \
CONFIG_BT_NIMBLE_ROLE_CENTRAL \ CONFIG_BT_NIMBLE_ROLE_CENTRAL \
CONFIG_BT_NIMBLE_ROLE_OBSERVER \ CONFIG_BT_NIMBLE_ROLE_OBSERVER \
CONFIG_BT_NIMBLE_ROLE_PERIPHERAL \ CONFIG_BT_NIMBLE_ROLE_PERIPHERAL \
CONFIG_BT_NIMBLE_ROLE_BROADCASTER CONFIG_BT_NIMBLE_ROLE_BROADCASTER \
CONFIG_BT_NIMBLE_EXT_ADV
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The # tag can be used to specify a list of macro names that should be expanded. The

View file

@ -4,7 +4,7 @@ This guide describes the required changes to existing projects migrating from th
**The changes listed here are only the required changes that must be made**, and a short overview of options for migrating existing applications. **The changes listed here are only the required changes that must be made**, and a short overview of options for migrating existing applications.
For more information on the improvements and additions please refer to the [class documentation](https://h2zero.github.io/esp-nimble-cpp/annotated.html) and [Improvements and updates](Improvements_and_updates.md) For more information on the improvements and additions please refer to the [class documentation](https://h2zero.github.io/NimBLE-Arduino/annotated.html) and [Improvements and updates](Improvements_and_updates.md)
* [General Changes](#general-information) * [General Changes](#general-information)
* [Server](#server-api) * [Server](#server-api)
@ -18,7 +18,7 @@ For more information on the improvements and additions please refer to the [clas
* [Remote characteristics](#remote-characteristics) * [Remote characteristics](#remote-characteristics)
* [Security](#client-security) * [Security](#client-security)
* [General Security](#security-api) * [General Security](#security-api)
* [Configuration](#arduino-configuration) * [Configuration](#arduino-configuration)
<br/> <br/>
<a name="general-information"></a> <a name="general-information"></a>
@ -27,25 +27,25 @@ For more information on the improvements and additions please refer to the [clas
### Header Files ### Header Files
All classes are accessible by including `NimBLEDevice.h` in your application, no further headers need to be included. All classes are accessible by including `NimBLEDevice.h` in your application, no further headers need to be included.
(Mainly for Arduino) You may choose to include `NimBLELog.h` in your appplication if you want to use the `NIMBLE_LOGx` macros for debugging. These macros are used the same way as the `ESP_LOGx` macros. (Mainly for Arduino) You may choose to include `NimBLELog.h` in your application if you want to use the `NIMBLE_LOGx` macros for debugging. These macros are used the same way as the `ESP_LOGx` macros.
<br/> <br/>
### Class Names ### Class Names
Class names remain the same as the original with the addition of a "Nim" prefix. Class names remain the same as the original with the addition of a "Nim" prefix.
For example `BLEDevice` is now `NimBLEDevice` and `BLEServer` is now `NimBLEServer` etc. For example `BLEDevice` is now `NimBLEDevice` and `BLEServer` is now `NimBLEServer` etc.
For convienience definitions have been added to allow applications to use either name for all classes this means **no class names need to be changed in existing code** and makes migrating easier. For convenience definitions have been added to allow applications to use either name for all classes this means **no class names need to be changed in existing code** and makes migrating easier.
<br/> <br/>
### BLE Addresses ### BLE Addresses
`BLEAddress` (`NimBLEAddress`) When constructing an address the constructor now takes an *(optional)* `uint8_t type` paramameter to specify the address type. Default is (0) Public static address. `BLEAddress` (`NimBLEAddress`) When constructing an address the constructor now takes an *(optional)* `uint8_t type` parameter to specify the address type. Default is (0) Public static address.
For example `BLEAddress addr(11:22:33:44:55:66, 1)` will create the address object with an address type of: 1 (Random). For example `BLEAddress addr(11:22:33:44:55:66, 1)` will create the address object with an address type of: 1 (Random).
As this paramameter is optional no changes to existing code are needed, it is mentioned here for information. As this parameter is optional no changes to existing code are needed, it is mentioned here for information.
`BLEAddress::getNative` (`NimBLEAddress::getNative`) returns a uint8_t pointer to the native address byte array. In this library the address bytes are stored in reverse order from the original library. This is due to the way the NimBLE stack expects addresses to be presented to it. All other functions such as `toString` are `BLEAddress::getNative` (`NimBLEAddress::getNative`) returns a uint8_t pointer to the native address byte array. In this library the address bytes are stored in reverse order from the original library. This is due to the way the NimBLE stack expects addresses to be presented to it. All other functions such as `toString` are
not affected as the endian change is made within them. not affected as the endian change is made within them.
<br/> <br/>
<a name="server-api"></a> <a name="server-api"></a>
@ -53,8 +53,8 @@ not affected as the endian change is made within them.
Creating a `BLEServer` instance is the same as original, no changes required. Creating a `BLEServer` instance is the same as original, no changes required.
For example `BLEDevice::createServer()` will work just as it did before. For example `BLEDevice::createServer()` will work just as it did before.
`BLEServerCallbacks` (`NimBLEServerCallbacks`) has new methods for handling security operations. `BLEServerCallbacks` (`NimBLEServerCallbacks`) has new methods for handling security operations.
**Note:** All callback methods have default implementations which allows the application to implement only the methods applicable. **Note:** All callback methods have default implementations which allows the application to implement only the methods applicable.
<br/> <br/>
<a name="services"></a> <a name="services"></a>
@ -69,26 +69,26 @@ For example `BLEServer::createService(SERVICE_UUID)` will work just as it did be
When creating a characteristic the properties are now set with `NIMBLE_PROPERTY::XXXX` instead of `BLECharacteristic::XXXX`. When creating a characteristic the properties are now set with `NIMBLE_PROPERTY::XXXX` instead of `BLECharacteristic::XXXX`.
#### Originally #### Originally
> BLECharacteristic::PROPERTY_READ | > BLECharacteristic::PROPERTY_READ |
> BLECharacteristic::PROPERTY_WRITE > BLECharacteristic::PROPERTY_WRITE
#### Is Now #### Is Now
> NIMBLE_PROPERTY::READ | > NIMBLE_PROPERTY::READ |
> NIMBLE_PROPERTY::WRITE > NIMBLE_PROPERTY::WRITE
<br/> <br/>
#### The full list of properties #### The full list of properties
> NIMBLE_PROPERTY::READ > NIMBLE_PROPERTY::READ
> NIMBLE_PROPERTY::READ_ENC > NIMBLE_PROPERTY::READ_ENC
> NIMBLE_PROPERTY::READ_AUTHEN > NIMBLE_PROPERTY::READ_AUTHEN
> NIMBLE_PROPERTY::READ_AUTHOR > NIMBLE_PROPERTY::READ_AUTHOR
> NIMBLE_PROPERTY::WRITE > NIMBLE_PROPERTY::WRITE
> NIMBLE_PROPERTY::WRITE_NR > NIMBLE_PROPERTY::WRITE_NR
> NIMBLE_PROPERTY::WRITE_ENC > NIMBLE_PROPERTY::WRITE_ENC
> NIMBLE_PROPERTY::WRITE_AUTHEN > NIMBLE_PROPERTY::WRITE_AUTHEN
> NIMBLE_PROPERTY::WRITE_AUTHOR > NIMBLE_PROPERTY::WRITE_AUTHOR
> NIMBLE_PROPERTY::BROADCAST > NIMBLE_PROPERTY::BROADCAST
> NIMBLE_PROPERTY::NOTIFY > NIMBLE_PROPERTY::NOTIFY
> NIMBLE_PROPERTY::INDICATE > NIMBLE_PROPERTY::INDICATE
<br/> <br/>
@ -114,7 +114,7 @@ BLECharacteristic *pCharacteristic = pService->createCharacteristic(
`BLECharacteristicCallbacks` (`NimBLECharacteristicCallbacks`) has a new method `NimBLECharacteristicCallbacks::onSubscribe` which is called when a client subscribes to notifications/indications. `BLECharacteristicCallbacks` (`NimBLECharacteristicCallbacks`) has a new method `NimBLECharacteristicCallbacks::onSubscribe` which is called when a client subscribes to notifications/indications.
**Note:** All callback methods have default implementations which allows the application to implement only the methods applicable. **Note:** All callback methods have default implementations which allows the application to implement only the methods applicable.
<br/> <br/>
> BLECharacteristic::getData > BLECharacteristic::getData
@ -172,7 +172,7 @@ pDescriptor = pCharacteristic->createDescriptor("ABCD",
NIMBLE_PROPERTY::WRITE_ENC, NIMBLE_PROPERTY::WRITE_ENC,
25); 25);
``` ```
Would create a descriptor with the UUID 0xABCD, publicly readable but only writable if paired/bonded (encrypted) and has a max value length of 25 bytes. Would create a descriptor with the UUID 0xABCD, publicly readable but only writable if paired/bonded (encrypted) and has a max value length of 25 bytes.
<br/> <br/>
For the 0x2904, there is a special class that is created when you call `createDescriptor("2904"). For the 0x2904, there is a special class that is created when you call `createDescriptor("2904").
@ -189,18 +189,18 @@ p2904 = (NimBLE2904*)pCharacteristic->createDescriptor("2904");
<a name="server-security"></a> <a name="server-security"></a>
### Server Security ### Server Security
Security is set on the characteristic or descriptor properties by applying one of the following: Security is set on the characteristic or descriptor properties by applying one of the following:
> NIMBLE_PROPERTY::READ_ENC > NIMBLE_PROPERTY::READ_ENC
> NIMBLE_PROPERTY::READ_AUTHEN > NIMBLE_PROPERTY::READ_AUTHEN
> NIMBLE_PROPERTY::READ_AUTHOR > NIMBLE_PROPERTY::READ_AUTHOR
> NIMBLE_PROPERTY::WRITE_ENC > NIMBLE_PROPERTY::WRITE_ENC
> NIMBLE_PROPERTY::WRITE_AUTHEN > NIMBLE_PROPERTY::WRITE_AUTHEN
> NIMBLE_PROPERTY::WRITE_AUTHOR > NIMBLE_PROPERTY::WRITE_AUTHOR
<br/> <br/>
When a peer wants to read or write a characteristic or descriptor with any of these properties applied it will trigger the pairing process. By default the "just-works" pairing will be performed automatically. When a peer wants to read or write a characteristic or descriptor with any of these properties applied it will trigger the pairing process. By default the "just-works" pairing will be performed automatically.
This can be changed to use passkey authentication or numeric comparison. See [Security API](#security-api) for details. This can be changed to use passkey authentication or numeric comparison. See [Security API](#security-api) for details.
<br/> <br/>
<a name="advertising-api"></a> <a name="advertising-api"></a>
@ -208,13 +208,13 @@ This can be changed to use passkey authentication or numeric comparison. See [Se
Advertising works the same as the original API except: Advertising works the same as the original API except:
Calling `NimBLEAdvertising::setAdvertisementData` will entirely replace any data set with `NimBLEAdvertising::addServiceUUID`, or Calling `NimBLEAdvertising::setAdvertisementData` will entirely replace any data set with `NimBLEAdvertising::addServiceUUID`, or
`NimBLEAdvertising::setAppearance` or similar methods. You should set all the data you wish to advertise within the `NimBLEAdvertisementData` instead. `NimBLEAdvertising::setAppearance` or similar methods. You should set all the data you wish to advertise within the `NimBLEAdvertisementData` instead.
<br/> <br/>
> BLEAdvertising::start (NimBLEAdvertising::start) > BLEAdvertising::start (NimBLEAdvertising::start)
Now takes 2 optional parameters, the first is the duration to advertise for (in seconds), the second is a callback that is invoked when advertsing ends and takes a pointer to a `NimBLEAdvertising` object (similar to the `NimBLEScan::start` API). Now takes 2 optional parameters, the first is the duration to advertise for (in seconds), the second is a callback that is invoked when advertising ends and takes a pointer to a `NimBLEAdvertising` object (similar to the `NimBLEScan::start` API).
This provides an opportunity to update the advertisment data if desired. This provides an opportunity to update the advertisement data if desired.
<br/> <br/>
<a name="client-api"></a> <a name="client-api"></a>
@ -226,26 +226,26 @@ Multiple client instances can be created, up to the maximum number of connection
`BLEClient::connect`(`NimBLEClient::connect`) Has had it's parameters altered. `BLEClient::connect`(`NimBLEClient::connect`) Has had it's parameters altered.
Defined as: Defined as:
> NimBLEClient::connect(bool deleteServices = true); > NimBLEClient::connect(bool deleteServices = true);
> NimBLEClient::connect(NimBLEAdvertisedDevice\* device, bool deleteServices = true); > NimBLEClient::connect(NimBLEAdvertisedDevice\* device, bool deleteServices = true);
> NimBLEClient::connect(NimBLEAddress address, bool deleteServices = true); > NimBLEClient::connect(NimBLEAddress address, bool deleteServices = true);
The type parameter has been removed and a new bool parameter has been added to indicate if the client should delete the attribute database previously retrieved (if applicable) for the peripheral, default value is true. The type parameter has been removed and a new bool parameter has been added to indicate if the client should delete the attribute database previously retrieved (if applicable) for the peripheral, default value is true.
If set to false the client will use the attribute database it retrieved from the peripheral when previously connected. If set to false the client will use the attribute database it retrieved from the peripheral when previously connected.
This allows for faster connections and power saving if the devices dropped connection and are reconnecting. This allows for faster connections and power saving if the devices dropped connection and are reconnecting.
<br/> <br/>
> `BLEClient::getServices` (`NimBLEClient::getServices`) > `BLEClient::getServices` (`NimBLEClient::getServices`)
This method now takes an optional (bool) parameter to indicate if the services should be retrieved from the server (true) or the currently known database returned (false : default). This method now takes an optional (bool) parameter to indicate if the services should be retrieved from the server (true) or the currently known database returned (false : default).
Also now returns a pointer to `std::vector` instead of `std::map`. Also now returns a pointer to `std::vector` instead of `std::map`.
<br/> <br/>
**Removed:** the automatic discovery of all peripheral attributes as they consumed time and resources for data the user may not be interested in. **Removed:** the automatic discovery of all peripheral attributes as they consumed time and resources for data the user may not be interested in.
**Added:** `NimBLEClient::discoverAttributes` for the user to discover all the peripheral attributes to replace the the removed automatic functionality. **Added:** `NimBLEClient::discoverAttributes` for the user to discover all the peripheral attributes to replace the the removed automatic functionality.
<br/> <br/>
<a name="remote-services"></a> <a name="remote-services"></a>
@ -254,50 +254,50 @@ Also now returns a pointer to `std::vector` instead of `std::map`.
> BLERemoteService::getCharacteristicsByHandle > BLERemoteService::getCharacteristicsByHandle
This method has been removed. This method has been removed.
<br/> <br/>
> `BLERemoteService::getCharacteristics` (`NimBLERemoteService::getCharacteristics`) > `BLERemoteService::getCharacteristics` (`NimBLERemoteService::getCharacteristics`)
This method now takes an optional (bool) parameter to indicate if the characteristics should be retrieved from the server (true) or This method now takes an optional (bool) parameter to indicate if the characteristics should be retrieved from the server (true) or
the currently known database returned (false : default). the currently known database returned (false : default).
Also now returns a pointer to `std::vector` instead of `std::map`. Also now returns a pointer to `std::vector` instead of `std::map`.
<br/> <br/>
<a name="remote-characteristics"></a> <a name="remote-characteristics"></a>
### Remote Characteristics ### Remote Characteristics
`BLERemoteCharacteristic` (`NimBLERemoteCharacteristic`) `BLERemoteCharacteristic` (`NimBLERemoteCharacteristic`)
There have been a few changes to the methods in this class: There have been a few changes to the methods in this class:
> `BLERemoteCharacteristic::writeValue` (`NimBLERemoteCharacteristic::writeValue`) > `BLERemoteCharacteristic::writeValue` (`NimBLERemoteCharacteristic::writeValue`)
> `BLERemoteCharacteristic::registerForNotify` (`NimBLERemoteCharacteristic::registerForNotify`) > `BLERemoteCharacteristic::registerForNotify` (`NimBLERemoteCharacteristic::registerForNotify`)
Now return true or false to indicate success or failure so you can choose to disconnect or try again. Now return true or false to indicate success or failure so you can choose to disconnect or try again.
<br/> <br/>
> `BLERemoteCharacteristic::registerForNotify` (`NimBLERemoteCharacteristic::registerForNotify`) > `BLERemoteCharacteristic::registerForNotify` (`NimBLERemoteCharacteristic::registerForNotify`)
Is now **deprecated**. Is now **deprecated**.
> `NimBLERemoteCharacteristic::subscribe` > `NimBLERemoteCharacteristic::subscribe`
> `NimBLERemoteCharacteristic::unsubscribe` > `NimBLERemoteCharacteristic::unsubscribe`
Are the new methods added to replace it. Are the new methods added to replace it.
<br/> <br/>
> `BLERemoteCharacteristic::readUInt8` (`NimBLERemoteCharacteristic::readUInt8`) > `BLERemoteCharacteristic::readUInt8` (`NimBLERemoteCharacteristic::readUInt8`)
> `BLERemoteCharacteristic::readUInt16` (`NimBLERemoteCharacteristic::readUInt16`) > `BLERemoteCharacteristic::readUInt16` (`NimBLERemoteCharacteristic::readUInt16`)
> `BLERemoteCharacteristic::readUInt32` (`NimBLERemoteCharacteristic::readUInt32`) > `BLERemoteCharacteristic::readUInt32` (`NimBLERemoteCharacteristic::readUInt32`)
> `BLERemoteCharacteristic::readFloat` (`NimBLERemoteCharacteristic::readFloat`) > `BLERemoteCharacteristic::readFloat` (`NimBLERemoteCharacteristic::readFloat`)
Are **deprecated** a template: `NimBLERemoteCharacteristic::readValue<type\>(time_t\*, bool)` has been added to replace them. Are **deprecated** a template: `NimBLERemoteCharacteristic::readValue<type\>(time_t\*, bool)` has been added to replace them.
<br/> <br/>
> `BLERemoteCharacteristic::readRawData` > `BLERemoteCharacteristic::readRawData`
**Has been removed from the API** **Has been removed from the API**
Originally it stored an unnecessary copy of the data and was returning a `uint8_t` pointer to volatile internal data. Originally it stored an unnecessary copy of the data and was returning a `uint8_t` pointer to volatile internal data.
The user application should use `NimBLERemoteCharacteristic::readValue` or `NimBLERemoteCharacteristic::getValue`. The user application should use `NimBLERemoteCharacteristic::readValue` or `NimBLERemoteCharacteristic::getValue`.
To obatain a copy of the data, then cast the returned std::string to the type required such as: To obtain a copy of the data, then cast the returned std::string to the type required such as:
``` ```
std::string value = pChr->readValue(); std::string value = pChr->readValue();
uint8_t *data = (uint8_t*)value.data(); uint8_t *data = (uint8_t*)value.data();
@ -311,61 +311,61 @@ my_struct_t myStruct = pChr->readValue<my_struct_t>();
> `BLERemoteCharacteristic::getDescriptors` (`NimBLERemoteCharacteristic::getDescriptors`) > `BLERemoteCharacteristic::getDescriptors` (`NimBLERemoteCharacteristic::getDescriptors`)
This method now takes an optional (bool) parameter to indicate if the descriptors should be retrieved from the server (true) or This method now takes an optional (bool) parameter to indicate if the descriptors should be retrieved from the server (true) or
the currently known database returned (false : default). the currently known database returned (false : default).
Also now returns a pointer to `std::vector` instead of `std::map`. Also now returns a pointer to `std::vector` instead of `std::map`.
<br/> <br/>
<a name="client-security"></a> <a name="client-security"></a>
### Client Security ### Client Security
The client will automatically initiate security when the peripheral responds that it's required. The client will automatically initiate security when the peripheral responds that it's required.
The default configuration will use "just-works" pairing with no bonding, if you wish to enable bonding see below. The default configuration will use "just-works" pairing with no bonding, if you wish to enable bonding see below.
<br/> <br/>
<a name="security-api"></a> <a name="security-api"></a>
## Security API ## Security API
Security operations have been moved to `BLEDevice` (`NimBLEDevice`). Security operations have been moved to `BLEDevice` (`NimBLEDevice`).
Also security callback methods are now incorporated in the `NimBLEServerCallbacks` / `NimBLEClientCallbacks` classes. Also security callback methods are now incorporated in the `NimBLEServerCallbacks` / `NimBLEClientCallbacks` classes.
However backward compatibility with the original `BLESecurity` (`NimBLESecurity`) class is retained to minimize application code changes. However backward compatibility with the original `BLESecurity` (`NimBLESecurity`) class is retained to minimize application code changes.
The callback methods are: The callback methods are:
> `bool onConfirmPIN(uint32_t pin)` > `bool onConfirmPIN(uint32_t pin)`
Receives the pin when using numeric comparison authentication, `return true;` to accept. Receives the pin when using numeric comparison authentication, `return true;` to accept.
<br/> <br/>
> `uint32_t onPassKeyRequest()` > `uint32_t onPassKeyRequest()`
For server callback; return the passkey expected from the client. For server callback; return the passkey expected from the client.
For client callback; return the passkey to send to the server. For client callback; return the passkey to send to the server.
<br/> <br/>
> `void onAuthenticationComplete(ble_gap_conn_desc\* desc)` > `void onAuthenticationComplete(ble_gap_conn_desc\* desc)`
Authentication complete, success or failed information is in `desc`. Authentication complete, success or failed information is in `desc`.
<br/> <br/>
Security settings and IO capabilities are now set by the following methods of NimBLEDevice. Security settings and IO capabilities are now set by the following methods of NimBLEDevice.
> `NimBLEDevice::setSecurityAuth(bool bonding, bool mitm, bool sc)` > `NimBLEDevice::setSecurityAuth(bool bonding, bool mitm, bool sc)`
> `NimBLEDevice::setSecurityAuth(uint8_t auth_req)` > `NimBLEDevice::setSecurityAuth(uint8_t auth_req)`
Sets the authorization mode for this device. Sets the authorization mode for this device.
<br/> <br/>
> `NimBLEDevice::setSecurityIOCap(uint8_t iocap)` > `NimBLEDevice::setSecurityIOCap(uint8_t iocap)`
Sets the Input/Output capabilities of this device. Sets the Input/Output capabilities of this device.
<br/> <br/>
> `NimBLEDevice::setSecurityInitKey(uint8_t init_key)` > `NimBLEDevice::setSecurityInitKey(uint8_t init_key)`
If we are the initiator of the security procedure this sets the keys we will distribute. If we are the initiator of the security procedure this sets the keys we will distribute.
<br/> <br/>
> `NimBLEDevice::setSecurityRespKey(uint8_t resp_key)` > `NimBLEDevice::setSecurityRespKey(uint8_t resp_key)`
Sets the keys we are willing to accept from the peer during pairing. Sets the keys we are willing to accept from the peer during pairing.
<br/> <br/>
<a name="arduino-configuration"></a> <a name="arduino-configuration"></a>
@ -375,5 +375,5 @@ Unlike the original library pre-packaged in the esp32-arduino, this library has
This allows Arduino users to fully customize the build, such as increasing max connections or loading the BLE stack into external PSRAM. This allows Arduino users to fully customize the build, such as increasing max connections or loading the BLE stack into external PSRAM.
For details on the options, they are fully commented in *nimconfig.h* For details on the options, they are fully commented in *nimconfig.h*
<br/> <br/>

View file

@ -13,18 +13,6 @@ NimBLE is a completely open source Bluetooth Low Energy stack produced by [Apach
It is more suited to resource constrained devices than bluedroid and has now been ported to the ESP32 by Espressif. It is more suited to resource constrained devices than bluedroid and has now been ported to the ESP32 by Espressif.
<br/> <br/>
# Arduino Installation
**Arduino Library manager:** Go to `sketch` -> `Include Library` -> `Manage Libraries` and search for NimBLE and install.
**Alternatively:** Download as .zip and extract to Arduino/libraries folder, or in Arduino IDE from Sketch menu -> Include library -> Add .Zip library.
`#include "NimBLEDevice.h"` at the beginning of your sketch.
Call `NimBLEDevice::init` in `setup`.
Tested and working with esp32-arduino in Arduino IDE and platform IO.
<br/>
# ESP-IDF Installation # ESP-IDF Installation
### v4.0+ ### v4.0+
Download as .zip and extract or clone into the components folder in your esp-idf project. Download as .zip and extract or clone into the components folder in your esp-idf project.
@ -57,21 +45,6 @@ Also see [Improvements and updates](Improvements_and_updates.md) for information
For more advanced usage see [Usage tips](Usage_tips.md) for more performance and optimization. For more advanced usage see [Usage tips](Usage_tips.md) for more performance and optimization.
<br/> <br/>
### Arduino specific
See the Refactored_original_examples in the examples folder for highlights of the differences with the original library.
More advanced examples highlighting many available features are in examples/NimBLE_Server, NimBLE_Client.
Beacon examples provided by [beegee-tokyo](https://github.com/beegee-tokyo) are in examples/BLE_Beacon_Scanner, BLE_EddystoneTLM_Beacon, BLE_EddystoneURL_Beacon.
Change the settings in the nimconfig.h file to customize NimBLE to your project, such as increasing max connections (default is 3).
<br/>
### Arduino command line and platformio
As an alternative to changing the configuration in nimconfig.h, Arduino command line and platformio.ini options are available.
See the command line configuration options available in [Command line config](Command_line_config.md).
<br/>
# Need help? Have a question or suggestion? # Need help? Have a question or suggestion?
Come chat on [gitter](https://gitter.im/NimBLE-Arduino/community?utm_source=share-link&utm_medium=link&utm_campaign=share-link) or open an issue at [NimBLE-Arduino](https://github.com/h2zero/NimBLE-Arduino/issues) or [esp-nimble-cpp](https://github.com/h2zero/esp-nimble-cpp/issues) Come chat on [gitter](https://gitter.im/NimBLE-Arduino/community?utm_source=share-link&utm_medium=link&utm_campaign=share-link) or open an issue at [NimBLE-Arduino](https://github.com/h2zero/NimBLE-Arduino/issues) or [esp-nimble-cpp](https://github.com/h2zero/esp-nimble-cpp/issues)
<br/> <br/>

View file

@ -22,11 +22,11 @@
#include "NimBLE2904.h" #include "NimBLE2904.h"
NimBLE2904::NimBLE2904(NimBLECharacteristic* pCharacterisitic) NimBLE2904::NimBLE2904(NimBLECharacteristic* pCharacteristic)
: NimBLEDescriptor(NimBLEUUID((uint16_t) 0x2904), : NimBLEDescriptor(NimBLEUUID((uint16_t) 0x2904),
BLE_GATT_CHR_F_READ, BLE_GATT_CHR_F_READ,
sizeof(BLE2904_Data), sizeof(BLE2904_Data),
pCharacterisitic) pCharacteristic)
{ {
m_data.m_format = 0; m_data.m_format = 0;
m_data.m_exponent = 0; m_data.m_exponent = 0;

View file

@ -156,7 +156,7 @@ std::string NimBLEAddress::toString() const {
/** /**
* @brief Convienience operator to check if this address is equal to another. * @brief Convenience operator to check if this address is equal to another.
*/ */
bool NimBLEAddress::operator ==(const NimBLEAddress & rhs) const { bool NimBLEAddress::operator ==(const NimBLEAddress & rhs) const {
return memcmp(rhs.m_address, m_address, sizeof m_address) == 0; return memcmp(rhs.m_address, m_address, sizeof m_address) == 0;
@ -164,7 +164,7 @@ bool NimBLEAddress::operator ==(const NimBLEAddress & rhs) const {
/** /**
* @brief Convienience operator to check if this address is not equal to another. * @brief Convenience operator to check if this address is not equal to another.
*/ */
bool NimBLEAddress::operator !=(const NimBLEAddress & rhs) const { bool NimBLEAddress::operator !=(const NimBLEAddress & rhs) const {
return !this->operator==(rhs); return !this->operator==(rhs);
@ -186,7 +186,7 @@ NimBLEAddress::operator std::string() const {
/** /**
* @brief Convienience operator to convert the native address representation to uint_64. * @brief Convenience operator to convert the native address representation to uint_64.
*/ */
NimBLEAddress::operator uint64_t() const { NimBLEAddress::operator uint64_t() const {
uint64_t address = 0; uint64_t address = 0;

View file

@ -52,9 +52,9 @@ NimBLEAddress NimBLEAdvertisedDevice::getAddress() {
* @brief Get the advertisement type. * @brief Get the advertisement type.
* @return The advertising type the device is reporting: * @return The advertising type the device is reporting:
* * BLE_HCI_ADV_TYPE_ADV_IND (0) - indirect advertising * * BLE_HCI_ADV_TYPE_ADV_IND (0) - indirect advertising
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertisng - high duty cycle * * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertising - high duty cycle
* * BLE_HCI_ADV_TYPE_ADV_SCAN_IND (2) - indirect scan response * * BLE_HCI_ADV_TYPE_ADV_SCAN_IND (2) - indirect scan response
* * BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertisng - not connectable * * BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertising - not connectable
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD (4) - direct advertising - low duty cycle * * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD (4) - direct advertising - low duty cycle
*/ */
uint8_t NimBLEAdvertisedDevice::getAdvType() { uint8_t NimBLEAdvertisedDevice::getAdvType() {
@ -66,7 +66,7 @@ uint8_t NimBLEAdvertisedDevice::getAdvType() {
* @brief Get the appearance. * @brief Get the appearance.
* *
* A %BLE device can declare its own appearance. The appearance is how it would like to be shown to an end user * A %BLE device can declare its own appearance. The appearance is how it would like to be shown to an end user
* typcially in the form of an icon. * typically in the form of an icon.
* *
* @return The appearance of the advertised device. * @return The appearance of the advertised device.
*/ */
@ -308,7 +308,7 @@ std::string NimBLEAdvertisedDevice::getServiceData(const NimBLEUUID &uuid) {
/** /**
* @brief Get the UUID of the serice data at the index. * @brief Get the UUID of the service data at the index.
* @param [in] index The index of the service data UUID requested. * @param [in] index The index of the service data UUID requested.
* @return The advertised service data UUID or an empty UUID if not found. * @return The advertised service data UUID or an empty UUID if not found.
*/ */
@ -448,7 +448,7 @@ uint8_t NimBLEAdvertisedDevice::getServiceUUIDCount() {
/** /**
* @brief Check advertised services for existance of the required UUID * @brief Check advertised services for existence of the required UUID
* @param [in] uuid The service uuid to look for in the advertisement. * @param [in] uuid The service uuid to look for in the advertisement.
* @return Return true if service is advertised * @return Return true if service is advertised
*/ */
@ -794,7 +794,7 @@ void NimBLEAdvertisedDevice::setPayload(const uint8_t *payload, uint8_t length,
/** /**
* @brief Get the length of the advertisement data in the payload. * @brief Get the length of the advertisement data in the payload.
* @return The number of bytes in the payload that is from the advertisment. * @return The number of bytes in the payload that is from the advertisement.
*/ */
uint8_t NimBLEAdvertisedDevice::getAdvLength() { uint8_t NimBLEAdvertisedDevice::getAdvLength() {
return m_advLength; return m_advLength;

View file

@ -758,7 +758,7 @@ int NimBLEAdvertising::handleGapEvent(struct ble_gap_event *event, void *arg) {
*/ */
void NimBLEAdvertisementData::addData(const std::string &data) { void NimBLEAdvertisementData::addData(const std::string &data) {
if ((m_payload.length() + data.length()) > BLE_HS_ADV_MAX_SZ) { if ((m_payload.length() + data.length()) > BLE_HS_ADV_MAX_SZ) {
NIMBLE_LOGE(LOG_TAG, "Advertisement data length exceded"); NIMBLE_LOGE(LOG_TAG, "Advertisement data length exceeded");
return; return;
} }
m_payload.append(data); m_payload.append(data);

View file

@ -54,7 +54,7 @@ struct Has_c_str_len<T, decltype(void(std::declval<T &>().c_str())),
/** /**
* @brief A specialized container class to hold BLE attribute values. * @brief A specialized container class to hold BLE attribute values.
* @details This class is designed to be more memory efficient than using\n * @details This class is designed to be more memory efficient than using\n
* standard container types for value storage, while being convertable to\n * standard container types for value storage, while being convertible to\n
* many different container classes. * many different container classes.
*/ */
class NimBLEAttValue class NimBLEAttValue

View file

@ -130,7 +130,7 @@ void NimBLEBeacon::setManufacturerId(uint16_t manufacturerId) {
*/ */
void NimBLEBeacon::setMinor(uint16_t minor) { void NimBLEBeacon::setMinor(uint16_t minor) {
m_beaconData.minor = ENDIAN_CHANGE_U16(minor); m_beaconData.minor = ENDIAN_CHANGE_U16(minor);
} // setMinior } // setMinor
/** /**

View file

@ -126,8 +126,8 @@ void NimBLECharacteristic::addDescriptor(NimBLEDescriptor *pDescriptor) {
/** /**
* @brief Remove a descriptor from the characterisitc. * @brief Remove a descriptor from the characteristic.
* @param[in] pDescriptor A pointer to the descriptor instance to remove from the characterisitc. * @param[in] pDescriptor A pointer to the descriptor instance to remove from the characteristic.
* @param[in] deleteDsc If true it will delete the descriptor instance and free it's resources. * @param[in] deleteDsc If true it will delete the descriptor instance and free it's resources.
*/ */
void NimBLECharacteristic::removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc) { void NimBLECharacteristic::removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc) {
@ -442,7 +442,7 @@ void NimBLECharacteristic::notify(const uint8_t* value, size_t length, bool is_n
!(m_properties & NIMBLE_PROPERTY::INDICATE)) !(m_properties & NIMBLE_PROPERTY::INDICATE))
{ {
NIMBLE_LOGE(LOG_TAG, NIMBLE_LOGE(LOG_TAG,
"<< notify-Error; Notify/indicate not enabled for characterisitc: %s", "<< notify-Error; Notify/indicate not enabled for characteristic: %s",
std::string(getUUID()).c_str()); std::string(getUUID()).c_str());
} }

View file

@ -157,35 +157,35 @@ size_t NimBLEClient::deleteService(const NimBLEUUID &uuid) {
/** /**
* @brief Connect to the BLE Server. * @brief Connect to the BLE Server.
* @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n * @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
* have created and clears the vectors after successful connection. * have created and clears the vectors after successful connection.
* @return True on success. * @return True on success.
*/ */
bool NimBLEClient::connect(bool deleteAttibutes) { bool NimBLEClient::connect(bool deleteAttributes) {
return connect(m_peerAddress, deleteAttibutes); return connect(m_peerAddress, deleteAttributes);
} }
/** /**
* @brief Connect to an advertising device. * @brief Connect to an advertising device.
* @param [in] device The device to connect to. * @param [in] device The device to connect to.
* @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n * @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
* have created and clears the vectors after successful connection. * have created and clears the vectors after successful connection.
* @return True on success. * @return True on success.
*/ */
bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) { bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttributes) {
NimBLEAddress address(device->getAddress()); NimBLEAddress address(device->getAddress());
return connect(address, deleteAttibutes); return connect(address, deleteAttributes);
} }
/** /**
* @brief Connect to the BLE Server. * @brief Connect to the BLE Server.
* @param [in] address The address of the server. * @param [in] address The address of the server.
* @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n * @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
* have created and clears the vectors after successful connection. * have created and clears the vectors after successful connection.
* @return True on success. * @return True on success.
*/ */
bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) { bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes) {
NIMBLE_LOGD(LOG_TAG, ">> connect(%s)", address.toString().c_str()); NIMBLE_LOGD(LOG_TAG, ">> connect(%s)", address.toString().c_str());
if(!NimBLEDevice::m_synced) { if(!NimBLEDevice::m_synced) {
@ -259,7 +259,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
break; break;
case BLE_HS_EALREADY: case BLE_HS_EALREADY:
// Already attemting to connect to this device, cancel the previous // Already attempting to connect to this device, cancel the previous
// attempt and report failure here so we don't get 2 connections. // attempt and report failure here so we don't get 2 connections.
NIMBLE_LOGE(LOG_TAG, "Already attempting to connect to %s - cancelling", NIMBLE_LOGE(LOG_TAG, "Already attempting to connect to %s - cancelling",
std::string(m_peerAddress).c_str()); std::string(m_peerAddress).c_str());
@ -317,7 +317,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
NIMBLE_LOGI(LOG_TAG, "Connection established"); NIMBLE_LOGI(LOG_TAG, "Connection established");
} }
if(deleteAttibutes) { if(deleteAttributes) {
deleteServices(); deleteServices();
} }
@ -390,8 +390,8 @@ int NimBLEClient::disconnect(uint8_t reason) {
// We use a timer to detect a controller error in the event that it does // We use a timer to detect a controller error in the event that it does
// not inform the stack when disconnection is complete. // not inform the stack when disconnection is complete.
// This is a common error in certain esp-idf versions. // This is a common error in certain esp-idf versions.
// The disconnect timeout time is the supervison timeout time + 1 second. // The disconnect timeout time is the supervision timeout time + 1 second.
// In the case that the event happenss shortly after the supervision timeout // In the case that the event happens shortly after the supervision timeout
// we don't want to prematurely reset the host. // we don't want to prematurely reset the host.
ble_npl_time_t ticks; ble_npl_time_t ticks;
ble_npl_time_ms_to_ticks((desc.supervision_timeout + 100) * 10, &ticks); ble_npl_time_ms_to_ticks((desc.supervision_timeout + 100) * 10, &ticks);
@ -431,7 +431,7 @@ void NimBLEClient::setConnectPhy(uint8_t mask) {
/** /**
* @brief Set the connection paramaters to use when connecting to a server. * @brief Set the connection parameters to use when connecting to a server.
* @param [in] minInterval The minimum connection interval in 1.25ms units. * @param [in] minInterval The minimum connection interval in 1.25ms units.
* @param [in] maxInterval The maximum connection interval in 1.25ms units. * @param [in] maxInterval The maximum connection interval in 1.25ms units.
* @param [in] latency The number of packets allowed to skip (extends max interval). * @param [in] latency The number of packets allowed to skip (extends max interval).

View file

@ -38,9 +38,9 @@ class NimBLEAdvertisedDevice;
*/ */
class NimBLEClient { class NimBLEClient {
public: public:
bool connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes = true); bool connect(NimBLEAdvertisedDevice* device, bool deleteAttributes = true);
bool connect(const NimBLEAddress &address, bool deleteAttibutes = true); bool connect(const NimBLEAddress &address, bool deleteAttributes = true);
bool connect(bool deleteAttibutes = true); bool connect(bool deleteAttributes = true);
int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM); int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
NimBLEAddress getPeerAddress(); NimBLEAddress getPeerAddress();
void setPeerAddress(const NimBLEAddress &address); void setPeerAddress(const NimBLEAddress &address);
@ -137,7 +137,7 @@ public:
* @brief Called when server requests to update the connection parameters. * @brief Called when server requests to update the connection parameters.
* @param [in] pClient A pointer to the calling client object. * @param [in] pClient A pointer to the calling client object.
* @param [in] params A pointer to the struct containing the connection parameters requested. * @param [in] params A pointer to the struct containing the connection parameters requested.
* @return True to accept the parmeters. * @return True to accept the parameters.
*/ */
virtual bool onConnParamsUpdateRequest(NimBLEClient* pClient, const ble_gap_upd_params* params); virtual bool onConnParamsUpdateRequest(NimBLEClient* pClient, const ble_gap_upd_params* params);

View file

@ -261,7 +261,7 @@ void NimBLEDescriptor::setValue(const std::vector<uint8_t>& vec) {
/** /**
* @brief Set the characteristic this descriptor belongs to. * @brief Set the characteristic this descriptor belongs to.
* @param [in] pChar A pointer to the characteristic this descriptior belongs to. * @param [in] pChar A pointer to the characteristic this descriptor belongs to.
*/ */
void NimBLEDescriptor::setCharacteristic(NimBLECharacteristic* pChar) { void NimBLEDescriptor::setCharacteristic(NimBLECharacteristic* pChar) {
m_pCharacteristic = pChar; m_pCharacteristic = pChar;

View file

@ -802,7 +802,7 @@ void NimBLEDevice::onSync(void)
} }
#endif #endif
// Yield for houskeeping before returning to operations. // Yield for housekeeping before returning to operations.
// Occasionally triggers exception without. // Occasionally triggers exception without.
taskYIELD(); taskYIELD();
@ -851,7 +851,7 @@ void NimBLEDevice::init(const std::string &deviceName) {
esp_err_t errRc = ESP_OK; esp_err_t errRc = ESP_OK;
#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS #ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
// make sure the linker includes esp32-hal-bt.c so ardruino init doesn't release BLE memory. // make sure the linker includes esp32-hal-bt.c so Arduino init doesn't release BLE memory.
btStarted(); btStarted();
#endif #endif

View file

@ -85,8 +85,8 @@ float NimBLEEddystoneTLM::getTemp() {
} // getTemp } // getTemp
/** /**
* @brief Get the count of advertisments sent. * @brief Get the count of advertisements sent.
* @return The number of advertisments. * @return The number of advertisements.
*/ */
uint32_t NimBLEEddystoneTLM::getCount() { uint32_t NimBLEEddystoneTLM::getCount() {
return ENDIAN_CHANGE_U32(m_eddystoneData.advCount); return ENDIAN_CHANGE_U32(m_eddystoneData.advCount);
@ -94,8 +94,8 @@ uint32_t NimBLEEddystoneTLM::getCount() {
/** /**
* @brief Get the advertisment time. * @brief Get the advertisement time.
* @return The advertisment time. * @return The advertisement time.
*/ */
uint32_t NimBLEEddystoneTLM::getTime() { uint32_t NimBLEEddystoneTLM::getTime() {
return (ENDIAN_CHANGE_U32(m_eddystoneData.tmil)) / 10; return (ENDIAN_CHANGE_U32(m_eddystoneData.tmil)) / 10;
@ -158,7 +158,7 @@ std::string NimBLEEddystoneTLM::toString() {
/** /**
* @brief Set the raw data for the beacon advertisment. * @brief Set the raw data for the beacon advertisement.
* @param [in] data The raw data to advertise. * @param [in] data The raw data to advertise.
*/ */
void NimBLEEddystoneTLM::setData(const std::string &data) { void NimBLEEddystoneTLM::setData(const std::string &data) {
@ -208,8 +208,8 @@ void NimBLEEddystoneTLM::setTemp(float temp) {
/** /**
* @brief Set the advertisment count. * @brief Set the advertisement count.
* @param [in] advCount The advertisment number. * @param [in] advCount The advertisement number.
*/ */
void NimBLEEddystoneTLM::setCount(uint32_t advCount) { void NimBLEEddystoneTLM::setCount(uint32_t advCount) {
m_eddystoneData.advCount = advCount; m_eddystoneData.advCount = advCount;
@ -217,8 +217,8 @@ void NimBLEEddystoneTLM::setCount(uint32_t advCount) {
/** /**
* @brief Set the advertisment time. * @brief Set the advertisement time.
* @param [in] tmil The advertisment time in milliseconds. * @param [in] tmil The advertisement time in milliseconds.
*/ */
void NimBLEEddystoneTLM::setTime(uint32_t tmil) { void NimBLEEddystoneTLM::setTime(uint32_t tmil) {
m_eddystoneData.tmil = tmil; m_eddystoneData.tmil = tmil;

View file

@ -152,7 +152,7 @@ std::string NimBLEEddystoneURL::getDecodedURL() {
/** /**
* @brief Set the raw data for the beacon advertisment. * @brief Set the raw data for the beacon advertisement.
* @param [in] data The raw data to advertise. * @param [in] data The raw data to advertise.
*/ */
void NimBLEEddystoneURL::setData(const std::string &data) { void NimBLEEddystoneURL::setData(const std::string &data) {

View file

@ -272,7 +272,7 @@ bool NimBLEExtAdvertising::stop() {
/** /**
* @brief Set a callback to call when the advertisement stops. * @brief Set a callback to call when the advertisement stops.
* @param [in] pCallbacks A pointer to a callback to be invoked when an advertisment stops. * @param [in] pCallbacks A pointer to a callback to be invoked when an advertisement stops.
* @param [in] deleteCallbacks if true callback class will be deleted when advertising is destructed. * @param [in] deleteCallbacks if true callback class will be deleted when advertising is destructed.
*/ */
void NimBLEExtAdvertising::setCallbacks(NimBLEExtAdvertisingCallbacks* pCallbacks, void NimBLEExtAdvertising::setCallbacks(NimBLEExtAdvertisingCallbacks* pCallbacks,

View file

@ -99,7 +99,7 @@ void NimBLEHIDDevice::manufacturer(std::string name) {
} }
/** /**
* @brief Sets the Plug n Play characterisc value. * @brief Sets the Plug n Play characteristic value.
* @param [in] sig The vendor ID source number. * @param [in] sig The vendor ID source number.
* @param [in] vid The vendor ID number. * @param [in] vid The vendor ID number.
* @param [in] pid The product ID number. * @param [in] pid The product ID number.

View file

@ -165,7 +165,7 @@ std::vector<NimBLERemoteCharacteristic*>* NimBLERemoteService::getCharacteristic
/** /**
* @brief Callback for Characterisic discovery. * @brief Callback for Characteristic discovery.
* @return success == 0 or error code. * @return success == 0 or error code.
*/ */
int NimBLERemoteService::characteristicDiscCB(uint16_t conn_handle, int NimBLERemoteService::characteristicDiscCB(uint16_t conn_handle,

View file

@ -164,7 +164,7 @@ NimBLEScan::~NimBLEScan() {
NIMBLE_LOGD(LOG_TAG, "discovery complete; reason=%d", NIMBLE_LOGD(LOG_TAG, "discovery complete; reason=%d",
event->disc_complete.reason); event->disc_complete.reason);
// If a device advertised with scan reponse available and it was not received // If a device advertised with scan response available and it was not received
// the callback would not have been invoked, so do it here. // the callback would not have been invoked, so do it here.
if(pScan->m_pAdvertisedDeviceCallbacks) { if(pScan->m_pAdvertisedDeviceCallbacks) {
for(auto &it : pScan->m_scanResults.m_advertisedDevicesVector) { for(auto &it : pScan->m_scanResults.m_advertisedDevicesVector) {
@ -211,7 +211,7 @@ void NimBLEScan::setActiveScan(bool active) {
* from devices it has not already seen. * from devices it has not already seen.
* @param [in] enabled If true, scanned devices will only be reported once. * @param [in] enabled If true, scanned devices will only be reported once.
* @details The controller has a limited buffer and will start reporting * @details The controller has a limited buffer and will start reporting
* dupicate devices once the limit is reached. * duplicate devices once the limit is reached.
*/ */
void NimBLEScan::setDuplicateFilter(bool enabled) { void NimBLEScan::setDuplicateFilter(bool enabled) {
m_scan_params.filter_duplicates = enabled; m_scan_params.filter_duplicates = enabled;
@ -236,7 +236,7 @@ void NimBLEScan::setLimitedOnly(bool enabled) {
* directed, connectable advertising packets not sent to the scanner. * directed, connectable advertising packets not sent to the scanner.
* * BLE_HCI_SCAN_FILT_USE_WL (1) * * BLE_HCI_SCAN_FILT_USE_WL (1)
* Scanner processes advertisements from white list only. A connectable,\n * Scanner processes advertisements from white list only. A connectable,\n
* directed advertisment is ignored unless it contains scanners address. * directed advertisement is ignored unless it contains scanners address.
* * BLE_HCI_SCAN_FILT_NO_WL_INITA (2) * * BLE_HCI_SCAN_FILT_NO_WL_INITA (2)
* Scanner process all advertising packets (white list not used). A\n * Scanner process all advertising packets (white list not used). A\n
* connectable, directed advertisement shall not be ignored if the InitA * connectable, directed advertisement shall not be ignored if the InitA

View file

@ -61,8 +61,8 @@ void NimBLESecurity::setCapability(esp_ble_io_cap_t iocap) {
/** /**
* @brief Sets the keys we will distibute during encryption. * @brief Sets the keys we will distribute during encryption.
* @param [in] init_key A bitmask of the keys we will distibute.\n * @param [in] init_key A bitmask of the keys we will distribute.\n
* Can be one or more of: * Can be one or more of:
* * ESP_BLE_ENC_KEY_MASK (1 << 0) * * ESP_BLE_ENC_KEY_MASK (1 << 0)
* * ESP_BLE_ID_KEY_MASK (1 << 1) * * ESP_BLE_ID_KEY_MASK (1 << 1)

View file

@ -373,7 +373,7 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
case BLE_GAP_EVENT_DISCONNECT: { case BLE_GAP_EVENT_DISCONNECT: {
// If Host reset tell the device now before returning to prevent // If Host reset tell the device now before returning to prevent
// any errors caused by calling host functions before resyncing. // any errors caused by calling host functions before resync.
switch(event->disconnect.reason) { switch(event->disconnect.reason) {
case BLE_HS_ETIMEOUT_HCI: case BLE_HS_ETIMEOUT_HCI:
case BLE_HS_EOS: case BLE_HS_EOS:
@ -636,7 +636,7 @@ void NimBLEServer::setCallbacks(NimBLEServerCallbacks* pCallbacks, bool deleteCa
* @brief Remove a service from the server. * @brief Remove a service from the server.
* *
* @details Immediately removes access to the service by clients, sends a service changed indication, * @details Immediately removes access to the service by clients, sends a service changed indication,
* and removes the service (if applicable) from the advertisments. * and removes the service (if applicable) from the advertisements.
* The service is not deleted unless the deleteSvc parameter is true, otherwise the service remains * The service is not deleted unless the deleteSvc parameter is true, otherwise the service remains
* available and can be re-added in the future. If desired a removed but not deleted service can * available and can be re-added in the future. If desired a removed but not deleted service can
* be deleted later by calling this method with deleteSvc set to true. * be deleted later by calling this method with deleteSvc set to true.

View file

@ -151,7 +151,7 @@ public:
* @brief Handle a client disconnection. * @brief Handle a client disconnection.
* This is called when a client discconnects. * This is called when a client discconnects.
* @param [in] pServer A pointer to the %BLE server that received the client disconnection. * @param [in] pServer A pointer to the %BLE server that received the client disconnection.
* @param [in] desc A pointer to the connection description structure containig information * @param [in] desc A pointer to the connection description structure containing information
* about the connection. * about the connection.
*/ */
virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc* desc); virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc* desc);
@ -159,7 +159,7 @@ public:
/** /**
* @brief Called when the connection MTU changes. * @brief Called when the connection MTU changes.
* @param [in] MTU The new MTU value. * @param [in] MTU The new MTU value.
* @param [in] desc A pointer to the connection description structure containig information * @param [in] desc A pointer to the connection description structure containing information
* about the connection. * about the connection.
*/ */
virtual void onMTUChange(uint16_t MTU, ble_gap_conn_desc* desc); virtual void onMTUChange(uint16_t MTU, ble_gap_conn_desc* desc);

View file

@ -297,7 +297,7 @@ std::string NimBLEUUID::toString() const {
/** /**
* @brief Convienience operator to check if this UUID is equal to another. * @brief Convenience operator to check if this UUID is equal to another.
*/ */
bool NimBLEUUID::operator ==(const NimBLEUUID & rhs) const { bool NimBLEUUID::operator ==(const NimBLEUUID & rhs) const {
if(m_valueSet && rhs.m_valueSet) { if(m_valueSet && rhs.m_valueSet) {
@ -336,7 +336,7 @@ bool NimBLEUUID::operator ==(const NimBLEUUID & rhs) const {
/** /**
* @brief Convienience operator to check if this UUID is not equal to another. * @brief Convenience operator to check if this UUID is not equal to another.
*/ */
bool NimBLEUUID::operator !=(const NimBLEUUID & rhs) const { bool NimBLEUUID::operator !=(const NimBLEUUID & rhs) const {
return !this->operator==(rhs); return !this->operator==(rhs);
@ -344,7 +344,7 @@ bool NimBLEUUID::operator !=(const NimBLEUUID & rhs) const {
/** /**
* @brief Convienience operator to convert this UUID to string representation. * @brief Convenience operator to convert this UUID to string representation.
* @details This allows passing NimBLEUUID to functions * @details This allows passing NimBLEUUID to functions
* that accept std::string and/or or it's methods as a parameter. * that accept std::string and/or or it's methods as a parameter.
*/ */

View file

@ -355,7 +355,7 @@ const char* NimBLEUtils::returnCodeToString(int rc) {
* @return A string representation of the advertising flags. * @return A string representation of the advertising flags.
*/ */
const char* NimBLEUtils::advTypeToString(uint8_t advType) { const char* NimBLEUtils::advTypeToString(uint8_t advType) {
#if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT) #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT)
switch(advType) { switch(advType) {
case BLE_HCI_ADV_TYPE_ADV_IND : //0 case BLE_HCI_ADV_TYPE_ADV_IND : //0
return "Undirected - Connectable / Scannable"; return "Undirected - Connectable / Scannable";
@ -370,10 +370,10 @@ const char* NimBLEUtils::advTypeToString(uint8_t advType) {
default: default:
return "Unknown flag"; return "Unknown flag";
} }
#else // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT) #else // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT)
(void)advType; (void)advType;
return ""; return "";
#endif // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT) #endif // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT)
} // adFlagsToString } // adFlagsToString