diff --git a/bins/.DS_Store b/bins/.DS_Store
deleted file mode 100644
index 5008ddfc..00000000
Binary files a/bins/.DS_Store and /dev/null differ
diff --git a/bins/esp32_marauder_v1_2_0_20250109_cyd24_gps.bin b/bins/esp32_marauder_v1_2_0_20250109_cyd24_gps.bin
new file mode 100644
index 00000000..9934f378
Binary files /dev/null and b/bins/esp32_marauder_v1_2_0_20250109_cyd24_gps.bin differ
diff --git a/bins/esp32_marauder_v1_2_0_20250109_cyd24_nogps.bin b/bins/esp32_marauder_v1_2_0_20250109_cyd24_nogps.bin
new file mode 100644
index 00000000..d7fdb3f5
Binary files /dev/null and b/bins/esp32_marauder_v1_2_0_20250109_cyd24_nogps.bin differ
diff --git a/bins/esp32_marauder_v1_2_0_20250109_cyd2usb_gps.bin b/bins/esp32_marauder_v1_2_0_20250109_cyd2usb_gps.bin
new file mode 100644
index 00000000..7337ba49
Binary files /dev/null and b/bins/esp32_marauder_v1_2_0_20250109_cyd2usb_gps.bin differ
diff --git a/bins/esp32_marauder_v1_2_0_20250109_cyd2usb_nogps.bin b/bins/esp32_marauder_v1_2_0_20250109_cyd2usb_nogps.bin
new file mode 100644
index 00000000..130263c5
Binary files /dev/null and b/bins/esp32_marauder_v1_2_0_20250109_cyd2usb_nogps.bin differ
diff --git a/bins/esp32_marauder_v1_2_0_20250109_cyd_gps.bin b/bins/esp32_marauder_v1_2_0_20250109_cyd_gps.bin
new file mode 100644
index 00000000..2aae1a18
Binary files /dev/null and b/bins/esp32_marauder_v1_2_0_20250109_cyd_gps.bin differ
diff --git a/bins/esp32_marauder_v1_2_0_20250109_cyd_nogps.bin b/bins/esp32_marauder_v1_2_0_20250109_cyd_nogps.bin
new file mode 100644
index 00000000..c6e9e471
Binary files /dev/null and b/bins/esp32_marauder_v1_2_0_20250109_cyd_nogps.bin differ
diff --git a/esp32_marauder/.DS_Store b/esp32_marauder/.DS_Store
deleted file mode 100644
index 7fdec462..00000000
Binary files a/esp32_marauder/.DS_Store and /dev/null differ
diff --git a/esp32_marauder/Display.cpp b/esp32_marauder/Display.cpp
index 9cb58921..e1177b5d 100644
--- a/esp32_marauder/Display.cpp
+++ b/esp32_marauder/Display.cpp
@@ -37,7 +37,7 @@ void Display::RunSetup()
#ifdef HAS_ILI9341
#ifdef TFT_SHIELD
- uint16_t calData[5] = { 350, 3465, 188, 3431, 2 }; // tft.setRotation(0); // Portrait with TFT Shield
+ uint16_t calData[5] = { 481, 3053, 433, 3296, 3 }; // tft.setRotation(0); // Portrait with TFT Shield
//Serial.println(F("Using TFT Shield"));
#else if defined(TFT_DIY)
uint16_t calData[5] = { 339, 3470, 237, 3438, 2 }; // tft.setRotation(0); // Portrait with DIY TFT
diff --git a/esp32_marauder/EvilPortal.cpp b/esp32_marauder/EvilPortal.cpp
index cd1aa3ad..adec660b 100644
--- a/esp32_marauder/EvilPortal.cpp
+++ b/esp32_marauder/EvilPortal.cpp
@@ -299,7 +299,7 @@ void EvilPortal::main(uint8_t scan_mode) {
String logValue1 =
"u: " + this->user_name;
String logValue2 = "p: " + this->password;
- String full_string = logValue1 + " " + logValue2 + "\n";
+ String full_string = logValue1 + "\n" + logValue2 + "\n";
Serial.print(full_string);
buffer_obj.append(full_string);
#ifdef HAS_SCREEN
diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp
index d2386b27..18694ff2 100644
--- a/esp32_marauder/MenuFunctions.cpp
+++ b/esp32_marauder/MenuFunctions.cpp
@@ -1301,7 +1301,7 @@ void MenuFunctions::orientDisplay()
#ifdef HAS_ILI9341
#ifdef TFT_SHIELD
- uint16_t calData[5] = { 350, 3465, 188, 3431, 2 }; // tft.setRotation(0); // Portrait with TFT Shield
+ uint16_t calData[5] = { 481, 3053, 433, 3296, 3 }; // tft.setRotation(0); // Portrait with TFT Shield
#else if defined(TFT_DIY)
uint16_t calData[5] = { 339, 3470, 237, 3438, 2 }; // tft.setRotation(0); // Portrait with DIY TFT
#endif
@@ -1588,6 +1588,7 @@ void MenuFunctions::RunSetup()
});
#endif
+
// Build Wardriving menu
wardrivingMenu.parentMenu = &wifiMenu; // Main Menu is second menu parent
this->addNodes(&wardrivingMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() {
diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp
index 2464d710..5904540d 100644
--- a/esp32_marauder/WiFiScan.cpp
+++ b/esp32_marauder/WiFiScan.cpp
@@ -1581,7 +1581,7 @@ void WiFiScan::RunAPScan(uint8_t scan_mode, uint16_t color)
display_obj.tft.setRotation(1);
#ifdef TFT_SHIELD
- uint16_t calData[5] = { 188, 3408, 286, 3498, 1 }; // Landscape TFT Shield
+ uint16_t calData[5] = { 410, 3305, 499, 3045, 0 }; // Landscape TFT Shield
Serial.println("Using TFT Shield");
#else if defined(TFT_DIY)
uint16_t calData[5] = { 213, 3469, 320, 3446, 1 }; // Landscape TFT DIY
@@ -1977,7 +1977,7 @@ void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color)
#ifdef HAS_SCREEN
#ifdef TFT_SHIELD
- uint16_t calData[5] = { 188, 3408, 286, 3498, 1 }; // Landscape TFT Shield
+ uint16_t calData[5] = { 410, 3305, 499, 3045, 0 }; // Landscape TFT Shield
Serial.println("Using TFT Shield");
#else if defined(TFT_DIY)
uint16_t calData[5] = { 213, 3469, 320, 3446, 1 }; // Landscape TFT DIY
@@ -2061,7 +2061,7 @@ void WiFiScan::RunEapolScan(uint8_t scan_mode, uint16_t color)
#ifdef HAS_SCREEN
#ifdef TFT_SHIELD
- uint16_t calData[5] = { 188, 3408, 286, 3498, 1 }; // Landscape TFT Shield
+ uint16_t calData[5] = { 410, 3305, 499, 3045, 0 }; // Landscape TFT Shield
//Serial.println("Using TFT Shield");
#else if defined(TFT_DIY)
uint16_t calData[5] = { 213, 3469, 320, 3446, 1 }; // Landscape TFT DIY
diff --git a/libraries/NimBLE-Arduino/CHANGELOG.md b/libraries/NimBLE-Arduino/CHANGELOG.md
index 43fbc62c..b80c3c93 100644
--- a/libraries/NimBLE-Arduino/CHANGELOG.md
+++ b/libraries/NimBLE-Arduino/CHANGELOG.md
@@ -2,71 +2,6 @@
All notable changes to this project will be documented in this file.
-## [1.4.1] - 2022-10-23
-
-### Fixed
- - Compile warning removed for esp32c3
- - NimBLEDevice::getPower incorrect value when power level is -3db.
- - Failed pairing when already in progress.
-
-### Changed
- - Revert previous change that forced writing with response when subscribing in favor of allowing the application to decide.
-
-### Added
- - Added NimBLEHIDDevice::batteryLevel.
- - Added NimBLEDevice::setDeviceName allowing for changing the device name while the BLE stack is active.
- - CI build tests.
- - Missing items in CHANGELOG that were not recorded correctly
-
-## [1.4.0] - 2022-07-10
-
-### Fixed
-- Fixed missing data from long notification values.
-- Fixed NimbleCharacteristicCallbacks::onRead not being called when a non-long read command is received.
-
-### Changed
-- Updated NimBLE core to use the v1.4.0 branch of esp-nimble.
-- AD flags are no longer set in the advertisements of non-connectable beacons, freeing up 3 bytes of advertisement room.
-- Config option CONFIG_BT_NIMBLE_DEBUG replaced with CONFIG_BT_NIMBLE_LOG_LEVEL (see src/nimconfig.h for usage)
-- Config option CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT renamed to CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT
-- Config option CONFIG_BT_NIMBLE_TASK_STACK_SIZE renamed to CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE
-
-### 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.8] - 2022-04-27
-
-### Fixed
-- Fix compile error with ESP32S3.
-- Prevent a potential crash when retrieving characteristics from a service if the result was successful but no characteristics found.
-
-### Changed
-- 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
-
-## [1.3.7] - 2022-02-15
-
-### Fixed
-
-- Crash when retrieving an attribute that does not exist on the peer.
-- Memory leak when deleting client instances.
-- Compilation errors for esp32s3
-
-## [1.3.6] - 2022-01-18
-
-### Changed
-- When retrieving attributes from a server fails with a 128bit UUID containing the ble base UUID another attempt will be made with the 16bit version of the UUID.
-
-### Fixed
-- Memory leak when services are changed on server devices.
-- Rare crashing that occurs when BLE commands are sent from ISR context using IPC.
-- Crashing caused by uninitialized disconnect timer in client.
-- Potential crash due to uninitialized advertising callback pointer.
-
## [1.3.5] - 2022-01-14
### Added
@@ -102,7 +37,7 @@ All notable changes to this project will be documented in this file.
## [1.3.0] - 2021-08-02
### Added
-- `NimBLECharacteristic::removeDescriptor`: Dynamically remove a descriptor from a characteristic. Takes effect after all connections are closed and sends a service changed indication.
+- `NimBLECharacteristic::removeDescriptor`: Dynamically remove a descriptor from a characterisic. Takes effect after all connections are closed and sends a service changed indication.
- `NimBLEService::removeCharacteristic`: Dynamically remove a characteristic from a service. Takes effect after all connections are closed and sends a service changed indication
- `NimBLEServerCallbacks::onMTUChange`: This is callback is called when the MTU is updated after connection with a client.
- ESP32C3 support
@@ -133,12 +68,12 @@ All notable changes to this project will be documented in this file.
### Fixed
- `NimBLECharacteristicCallbacks::onSubscribe` Is now called after the connection is added to the vector.
- Corrected bonding failure when reinitializing the BLE stack.
-- Writing to a characteristic with a std::string value now correctly writes values with null characters.
-- Retrieving remote descriptors now uses the characteristic end handle correctly.
+- Writing to a characterisic with a std::string value now correctly writes values with null characters.
+- Retrieving remote descriptors now uses the characterisic end handle correctly.
- Missing data in long writes to remote descriptors.
- Hanging on task notification when sending an indication from the characteristic callback.
- BLE controller memory could be released when using Arduino as a component.
-- Compile errors with NimBLE release 1.3.0.
+- Complile errors with NimBLE release 1.3.0.
## [1.2.0] - 2021-02-08
@@ -151,7 +86,7 @@ All notable changes to this project will be documented in this file.
- `NimBLEService::getCharacteristicByHandle`: Get a pointer to the characteristic object with the specified handle.
-- `NimBLEService::getCharacteristics`: Get the vector containing pointers to each characteristic associated with this service.
+- `NimBLEService::getCharacteristics`: Get the vector containing pointers to each characteristic associated with this service.
Overloads to get a vector containing pointers to all the characteristics in a service with the UUID. (supports multiple same UUID's in a service)
- `NimBLEService::getCharacteristics(const char *uuid)`
- `NimBLEService::getCharacteristics(const NimBLEUUID &uuid)`
@@ -193,12 +128,12 @@ Overloads to get a vector containing pointers to all the characteristics in a se
- `NimBLEAdvertising` Transmission power is no longer advertised by default and can be added to the advertisement by calling `NimBLEAdvertising::addTxPower`
-- `NimBLEAdvertising` Custom scan response data can now be used without custom advertisement.
+- `NimBLEAdvertising` Custom scan response data can now be used without custom advertisment.
-- `NimBLEScan` Now uses the controller duplicate filter.
+- `NimBLEScan` Now uses the controller duplicate filter.
-- `NimBLEAdvertisedDevice` Has been refactored to store the complete advertisement payload and no longer parses the data from each advertisement.
-Instead the data will be parsed on-demand when the user application asks for specific data.
+- `NimBLEAdvertisedDevice` Has been refactored to store the complete advertisement payload and no longer parses the data from each advertisement.
+Instead the data will be parsed on-demand when the user application asks for specific data.
### Fixed
- `NimBLEHIDDevice` Characteristics now use encryption, this resolves an issue with communicating with devices requiring encryption for HID devices.
@@ -207,84 +142,84 @@ Instead the data will be parsed on-demand when the user application asks for spe
## [1.1.0] - 2021-01-20
### Added
-- `NimBLEDevice::setOwnAddrType` added to enable the use of random and random-resolvable addresses, by asukiaaa
+- `NimBLEDevice::setOwnAddrType` added to enable the use of random and random-resolvable addresses, by asukiaaa
-- New examples for securing and authenticating client/server connections, by mblasee.
+- New examples for securing and authenticating client/server connections, by mblasee.
-- `NimBLEAdvertising::SetMinPreferred` and `NimBLEAdvertising::SetMinPreferred` re-added.
+- `NimBLEAdvertising::SetMinPreferred` and `NimBLEAdvertising::SetMinPreferred` re-added.
-- Conditional checks added for command line config options in `nimconfig.h` to support custom configuration in platformio.
+- Conditional checks added for command line config options in `nimconfig.h` to support custom configuration in platformio.
-- `NimBLEClient::setValue` Now takes an extra bool parameter `response` to enable the use of write with response (default = false).
+- `NimBLEClient::setValue` Now takes an extra bool parameter `response` to enable the use of write with response (default = false).
-- `NimBLEClient::getCharacteristic(uint16_t handle)` Enabling the use of the characteristic handle to be used to find
-the NimBLERemoteCharacteristic object.
+- `NimBLEClient::getCharacteristic(uint16_t handle)` Enabling the use of the characteristic handle to be used to find
+the NimBLERemoteCharacteristic object.
-- `NimBLEHIDDevice` class added by wakwak-koba.
+- `NimBLEHIDDevice` class added by wakwak-koba.
-- `NimBLEServerCallbacks::onDisconnect` overloaded callback added to provide a ble_gap_conn_desc parameter for the application
-to obtain information about the disconnected client.
+- `NimBLEServerCallbacks::onDisconnect` overloaded callback added to provide a ble_gap_conn_desc parameter for the application
+to obtain information about the disconnected client.
-- Conditional checks in `nimconfig.h` for command line defined macros to support platformio config settings.
+- Conditional checks in `nimconfig.h` for command line defined macros to support platformio config settings.
### Changed
-- `NimBLEAdvertising::start` now returns a bool value to indicate success/failure.
+- `NimBLEAdvertising::start` now returns a bool value to indicate success/failure.
-- Some asserts were removed in `NimBLEAdvertising::start` and replaced with better return code handling and logging.
+- Some asserts were removed in `NimBLEAdvertising::start` and replaced with better return code handling and logging.
-- If a host reset event occurs, scanning and advertising will now only be restarted if their previous duration was indefinite.
+- If a host reset event occurs, scanning and advertising will now only be restarted if their previous duration was indefinite.
- `NimBLERemoteCharacteristic::subscribe` and `NimBLERemoteCharacteristic::registerForNotify` will now set the callback
-regardless of the existence of the CCCD and return true unless the descriptor write operation failed.
+regardless of the existance of the CCCD and return true unless the descriptor write operation failed.
-- Advertising tx power level is now sent in the advertisement packet instead of scan response.
+- Advertising tx power level is now sent in the advertisement packet instead of scan response.
-- `NimBLEScan` When the scan ends the scan stopped flag is now set before calling the scan complete callback (if used)
-this allows the starting of a new scan from the callback function.
+- `NimBLEScan` When the scan ends the scan stopped flag is now set before calling the scan complete callback (if used)
+this allows the starting of a new scan from the callback function.
### Fixed
-- Sometimes `NimBLEClient::connect` would hang on the task block if no event arrived to unblock.
-A time limit has been added to timeout appropriately.
-
-- When getting descriptors for a characteristic the end handle of the service was used as a proxy for the characteristic end
-handle. This would be rejected by some devices and has been changed to use the next characteristic handle as the end when possible.
-
-- An exception could occur when deleting a client instance if a notification arrived while the attribute vectors were being
-deleted. A flag has been added to prevent this.
-
-- An exception could occur after a host reset event when the host re-synced if the tasks that were stopped during the event did
-not finish processing. A yield has been added after re-syncing to allow tasks to finish before proceeding.
-
-- Occasionally the controller would fail to send a disconnected event causing the client to indicate it is connected
-and would be unable to reconnect. A timer has been added to reset the host/controller if it expires.
+- Sometimes `NimBLEClient::connect` would hang on the task block if no event arrived to unblock.
+A time limit has been added to timeout appropriately.
-- Occasionally the call to start scanning would get stuck in a loop on BLE_HS_EBUSY, this loop has been removed.
+- When getting descriptors for a characterisic the end handle of the service was used as a proxy for the characteristic end
+handle. This would be rejected by some devices and has been changed to use the next characteristic handle as the end when possible.
-- 16bit and 32bit UUID's in some cases were not discovered or compared correctly if the device
-advertised them as 16/32bit but resolved them to 128bits. Both are now checked.
+- An exception could occur when deleting a client instance if a notification arrived while the attribute vectors were being
+deleted. A flag has been added to prevent this.
+
+- An exception could occur after a host reset event when the host re-synced if the tasks that were stopped during the event did
+not finish processing. A yield has been added after re-syncing to allow tasks to finish before proceeding.
+
+- Occasionally the controller would fail to send a disconnected event causing the client to indicate it is connected
+and would be unable to reconnect. A timer has been added to reset the host/controller if it expires.
+
+- Occasionally the call to start scanning would get stuck in a loop on BLE_HS_EBUSY, this loop has been removed.
-- `FreeRTOS` compile errors resolved in latest Arduino core and IDF v3.3.
+- 16bit and 32bit UUID's in some cases were not discovered or compared correctly if the device
+advertised them as 16/32bit but resolved them to 128bits. Both are now checked.
+
+- `FreeRTOS` compile errors resolved in latest Ardruino core and IDF v3.3.
-- Multiple instances of `time()` called inside critical sections caused sporadic crashes, these have been moved out of critical regions.
+- Multiple instances of `time()` called inside critical sections caused sporadic crashes, these have been moved out of critical regions.
-- Advertisement type now correctly set when using non-connectable (advertiser only) mode.
+- Advertisement type now correctly set when using non-connectable (advertiser only) mode.
-- Advertising payload length correction, now accounts for appearance.
+- Advertising payload length correction, now accounts for appearance.
-- (Arduino) Ensure controller mode is set to BLE Only.
+- (Arduino) Ensure controller mode is set to BLE Only.
## [1.0.2] - 2020-09-13
### Changed
-- `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 advertising ends and takes a pointer to a `NimBLEAdvertising` object (similar to the `NimBLEScan::start` API).
+- `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).
- (Arduino) Maximum BLE connections can now be altered by only changing the value of `CONFIG_BT_NIMBLE_MAX_CONNECTIONS` in `nimconfig.h`.
Any changes to the controller max connection settings in `sdkconfig.h` will now have no effect when using this library.
-- (Arduino) Revert the previous change to fix the advertising start delay. Instead a replacement fix that routes all BLE controller commands from
+- (Arduino) Revert the previous change to fix the advertising start delay. Instead a replacement fix that routes all BLE controller commands from
a task running on core 0 (same as the controller) has been implemented. This improves response times and reliability for all BLE functions.
diff --git a/libraries/NimBLE-Arduino/README.md b/libraries/NimBLE-Arduino/README.md
index 86b28e3f..fd480fd8 100644
--- a/libraries/NimBLE-Arduino/README.md
+++ b/libraries/NimBLE-Arduino/README.md
@@ -1,50 +1,63 @@
[Latest release 
-](https://github.com/h2zero/NimBLE-Arduino/releases/latest/)
+](https://github.com/h2zero/NimBLE-Arduino/releases/latest/)
-Need help? Have questions or suggestions? Join the [](https://gitter.im/NimBLE-Arduino/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
+Need help? Have questions or suggestions? Join the [](https://gitter.im/NimBLE-Arduino/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
# NimBLE-Arduino
-A fork of the NimBLE stack refactored for compilation in the Ardruino IDE.
+A fork of the NimBLE stack restructured for compilation in the Ardruino IDE with a CPP library for use with ESP32.
-**As of release 1.4.0 Nordic Semiconductor nRF51 and nRF52 series devices are now supported**
+**Note for IDF users: This repo will not compile correctly in ESP-IDF. An ESP-IDF component version of this library can be [found here.](https://github.com/h2zero/esp-nimble-cpp)**
-## Supported MCU's
- - Espressif: ESP32, ESP32C3, ESP32S3
- - Nordic: nRF51, nRF52 series (**Requires** using [n-able arduino core](https://github.com/h2zero/n-able-Arduino))
+This library **significantly** reduces resource usage and improves performance for ESP32 BLE applications as compared
+with the bluedroid based library. The goal is to maintain, as much as reasonable, compatibility with the original
+library but refactored to use the NimBLE stack. In addition, this library will be more actively developed and maintained
+to provide improved capabilites and stability over the original.
+
-**Note for ESP-IDF users: This repo will not compile correctly in ESP-IDF. An ESP-IDF component version of this library can be [found here.](https://github.com/h2zero/esp-nimble-cpp)**
+## Resource use improvement
-This library **significantly** reduces resource usage and improves performance for ESP32 BLE applications as compared with the bluedroid based library. The goal is to maintain, as much as reasonable, compatibility with the original library but refactored to use the NimBLE stack. In addition, this library will be more actively developed and maintained to provide improved capabilities and stability over the original.
-
+### (Original) BLE_client example comparison (Debug):
+#### Arduino BLE Library
+Sketch uses **1216377** bytes (58%) of program storage space.
+Memory after connection: Free Heap: **171548**
+
+#### NimBLE-Arduino library
+Sketch uses **617256** bytes (29%) of program storage space.
+Memory after connection: Free Heap: **270336**
+***
+### (Original) BLE_notify example comparison (Debug):
+#### Arduino BLE Library
+Sketch uses **1208409** bytes (57%) of program storage space.
+Memory after connection: Free Heap: **173300**
+
+#### NimBLE-Arduino library
+Sketch uses **603432** bytes (28%) of program storage space.
+Memory after connection: Free Heap: **269792**
-For Nordic devices, this library provides access to a completely open source and configurable BLE stack. No softdevice to work around, allowing for full debugging and resource management, continuous updates, with a cross platform API.
+**As shown: there is nearly a 50% reduction in flash use and approx. 100kB less ram consumed!**
+
-# Arduino installation
-**Arduino Library manager:** Go to `sketch` -> `Include Library` -> `Manage Libraries`, search for NimBLE and install.
+# 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.
-# Platformio installation
-* Open platformio.ini, a project configuration file located in the root of PlatformIO project.
-* Add the following line to the lib_deps option of [env:] section:
-```
-h2zero/NimBLE-Arduino@^1.4.0
-```
-* Build a project, PlatformIO will automatically install dependencies.
+Tested and working with esp32-arduino in Arduino IDE and platform IO.
+
# Using
-This library is intended to be compatible with the original ESP32 BLE functions and types with minor changes.
+This library is intended to be compatible with the original ESP32 BLE functions and types with minor changes.
-If you have not used the original Bluedroid library please refer to the [New user guide](docs/New_user_guide.md).
+If you have not used the original Bluedroid library please refer to the [New user guide](docs/New_user_guide.md).
-If you are familiar with the original library, see: [The migration guide](docs/Migration_guide.md) for details about breaking changes and migration.
+If you are familiar with the original library, see: [The migration guide](docs/Migration_guide.md) for details about breaking changes and migration.
Also see [Improvements_and_updates](docs/Improvements_and_updates.md) for information about non-breaking changes.
-[Full API documentation and class list can be found here.](https://h2zero.github.io/NimBLE-Arduino/)
+[Full API documentation and class list can be found here.](https://h2zero.github.io/esp-nimble-cpp/)
For added performance and optimizations see [Usage tips](docs/Usage_tips.md).
@@ -52,21 +65,21 @@ Check the Refactored_original_examples in the examples folder for highlights of
More advanced examples highlighting many available features are in examples/ NimBLE_Server, NimBLE_Client.
-Beacon examples provided by @beegee-tokyo are in examples/ BLE_Beacon_Scanner, BLE_EddystoneTLM_Beacon, BLE_EddystoneURL_Beacon.
+Beacon examples provided by @beegee-tokyo are in examples/ BLE_Beacon_Scanner, BLE_EddystoneTLM_Beacon, BLE_EddystoneURL_Beacon.
-Change the settings in the `src/nimconfig.h` file to customize NimBLE to your project,
-such as increasing max connections, default is 3, absolute maximum connections is 9.
+Change the settings in the `src/nimconfig.h` file to customize NimBLE to your project,
+such as increasing max connections, default is 3, absolute maximum connections is 9.
# Development Status
-This Library is tracking the esp-nimble repo, nimble-1.4.0-idf branch, currently [@3df0d20.](https://github.com/espressif/esp-nimble)
+This Library is tracking the esp-nimble repo, nimble-1.3.0-idf master branch, currently [@5bb7b40.](https://github.com/espressif/esp-nimble)
-Also tracking the NimBLE related changes in ESP-IDF, master branch, currently [@95db4bb.](https://github.com/espressif/esp-idf/tree/master/components/bt/host/nimble)
+Also tracking the NimBLE related changes in ESP-IDF, master branch, currently [@639e7ad.](https://github.com/espressif/esp-idf/tree/master/components/bt/host/nimble)
# Acknowledgments
* [nkolban](https://github.com/nkolban) and [chegewara](https://github.com/chegewara) for the [original esp32 BLE library](https://github.com/nkolban/esp32-snippets/tree/master/cpp_utils) this project was derived from.
* [beegee-tokyo](https://github.com/beegee-tokyo) for contributing your time to test/debug and contributing the beacon examples.
-* [Jeroen88](https://github.com/Jeroen88) for the amazing help debugging and improving the client code.
-
-
+* [Jeroen88](https://github.com/Jeroen88) for the amazing help debugging and improving the client code.
+
+
diff --git a/libraries/NimBLE-Arduino/docs/Bluetooth 5 features.md b/libraries/NimBLE-Arduino/docs/Bluetooth 5 features.md
deleted file mode 100644
index 3737b0d7..00000000
--- a/libraries/NimBLE-Arduino/docs/Bluetooth 5 features.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# Bluetooth 5.x features
-
-## About extended advertising
-Extended advertising allows for much more capability and flexibility.
-
-* Allows for 251 bytes of advertisement data and up to 1650 bytes when chained (configuration dependant) vs 31.
-
-* New PHY's (physical layers) that allow for faster data rate (2M PHY) or long range/slower data rates (CODED PHY) as well as the original 1M PHY.
-
-* New periodic advertising, allowing the scanning device to sync with the advertisements of a beacon. This allows for the scanning device to sleep or perform other tasks before the next expected advertisement is sent, preserving cpu cycles and power (To be implemented).
-
-
-## Enabling extended advertising
-Extended advertising is supported when enabled with the config option `CONFIG_BT_NIMBLE_EXT_ADV` set to a value of 1. This is done in menuconfig under `Component config > Bluetooth > NimBLE options > Enable extended advertising`, or set in `nimconfig.h` for Arduino, or in `build_flags` in PlatformIO.
-
-When enabled the following will occur:
-* `NimBLEScan::start` method will scan on both the 1M PHY and the coded PHY standards automatically.
-
-* `NimBLEClient::connect` will use the primary PHY the device is listening on, unless specified (see below).
-
-* `NimBLEClient::setConnectPhy` becomes available to specify the PHY's to connect with (default is all).
-
-* `NimBLEAdvertising` is no longer available for use and is replaced by `NimBLEExtAdvertising`. `NimBLEDevice::getAdvertising` will now return an instance of `NimBLEExtAdvertising`.
-
-* `NimBLEAdvertisementData` is no longer available for use and is replaced by `NimBLEExtAdvertisement`. This new class is where everything about the advertisement is configured, including the advertisement intervals and advertisement ended callback.
-
-
-
diff --git a/libraries/NimBLE-Arduino/docs/Command_line_config.md b/libraries/NimBLE-Arduino/docs/Command_line_config.md
index f6f6b5ac..c22565f4 100644
--- a/libraries/NimBLE-Arduino/docs/Command_line_config.md
+++ b/libraries/NimBLE-Arduino/docs/Command_line_config.md
@@ -6,24 +6,6 @@ Sets the number of simultaneous connections (esp controller max is 9)
- Default value is 3
-`CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED`
-
-Enable/disable storing the timestamp when an attribute value is updated
-This allows for checking the last update time using getTimeStamp() or getValue(time_t*)
-If disabled, the timestamp returned from these functions will be 0.
-Disabling timestamps will reduce the memory used for each value.
-1 = Enabled, 0 = Disabled; Default = Disabled
-
-
-`CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH`
-
-Set the default allocation size (bytes) for each attribute.
-If not specified when the constructor is called. This is also the size used when a remote
-characteristic or descriptor is constructed before a value is read/notifed.
-Increasing this will reduce reallocations but increase memory footprint.
-Default value is 20. Range: 1 : 512 (BLE_ATT_ATTR_MAX_LEN)
-
-
`CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU`
Sets the default MTU size.
@@ -42,13 +24,6 @@ If defined, enables debug log messages from the NimBLE host
- Uses approx. 32kB of flash memory.
-`CONFIG_NIMBLE_CPP_LOG_LEVEL`
-
-Define to set the debug log message level from the NimBLE CPP Wrapper.
-If not defined it will use the same value as the Arduino core debug level.
-Values: 0 = NONE, 1 = ERROR, 2 = WARNING, 3 = INFO, 4+ = DEBUG
-
-
`CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT`
If defined, NimBLE host return codes will be printed as text in debug log messages.
@@ -140,41 +115,3 @@ Set the task stack size for the NimBLE core.
- Default is 4096
-`CONFIG_NIMBLE_STACK_USE_MEM_POOLS`
-
- Enable the use of memory pools for stack operations. This will use slightly more RAM but may provide more stability.
-
-- Options: 0 or 1, default is disabled (0)
-
-
-### Extended advertising settings, For use with ESP32C3, ESP32S3, ESP32H2 ONLY!
-
-`CONFIG_BT_NIMBLE_EXT_ADV`
-
-Set to 1 to enable extended advertising features.
-
-
-`CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES`
-
-Sets the max number of extended advertising instances
-- Range: 0 - 4
-- Default is 1
-
-
-`CONFIG_BT_NIMBLE_MAX_EXT_ADV_DATA_LEN`
-
-Set the max extended advertising data size,
-- Range: 31 - 1650
-- Default is 255
-
-
-`CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV`
-
-Set to 1 to enable periodic advertising.
-
-
-`CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS`
-
-Set the maximum number of periodically synced devices.
-- Range: 1 - 8
-- Default is 1
diff --git a/libraries/NimBLE-Arduino/docs/Doxyfile b/libraries/NimBLE-Arduino/docs/Doxyfile
deleted file mode 100644
index d9c43033..00000000
--- a/libraries/NimBLE-Arduino/docs/Doxyfile
+++ /dev/null
@@ -1,2673 +0,0 @@
-# Doxyfile 1.9.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a double hash (##) is considered a comment and is placed in
-# front of the TAG it is preceding.
-#
-# All text after a single hash (#) is considered a comment and will be ignored.
-# The format is:
-# TAG = value [value, ...]
-# For lists, items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (\" \").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the configuration
-# file that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
-# The default value is: UTF-8.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
-# double-quotes, unless you are using Doxywizard) that should identify the
-# project for which the documentation is generated. This name is used in the
-# title of most generated pages and in a few other places.
-# The default value is: My Project.
-
-PROJECT_NAME = NimBLE-Arduino
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
-# could be handy for archiving the generated documentation or if some version
-# control system is used.
-
-PROJECT_NUMBER = 1.4.1
-
-# 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
-# quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF =
-
-# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
-# in the documentation. The maximum height of the logo should not exceed 55
-# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
-# the logo to the output directory.
-
-PROJECT_LOGO =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
-# into which the generated documentation will be written. If a relative path is
-# entered, it will be relative to the location where doxygen was started. If
-# left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = doxydocs
-
-# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
-# directories (in 2 levels) under the output directory of each output format and
-# will distribute the generated files over these directories. Enabling this
-# option can be useful when feeding doxygen a huge amount of source files, where
-# putting all generated files in the same directory would otherwise causes
-# performance problems for the file system.
-# The default value is: NO.
-
-CREATE_SUBDIRS = NO
-
-# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
-# characters to appear in the names of generated files. If set to NO, non-ASCII
-# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
-# U+3044.
-# The default value is: NO.
-
-ALLOW_UNICODE_NAMES = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
-# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
-# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
-# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
-# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
-# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
-# Ukrainian and Vietnamese.
-# The default value is: English.
-
-OUTPUT_LANGUAGE = English
-
-# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all generated output in the proper direction.
-# Possible values are: None, LTR, RTL and Context.
-# The default value is: None.
-
-OUTPUT_TEXT_DIRECTION = None
-
-# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
-# descriptions after the members that are listed in the file and class
-# documentation (similar to Javadoc). Set to NO to disable this.
-# The default value is: YES.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
-# description of a member or function before the detailed description
-#
-# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-# The default value is: YES.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator that is
-# used to form the text in various listings. Each string in this list, if found
-# as the leading text of the brief description, will be stripped from the text
-# and the result, after processing the whole list, is used as the annotated
-# text. Otherwise, the brief description is used as-is. If left blank, the
-# following values are used ($name is automatically replaced with the name of
-# the entity):The $name class, The $name widget, The $name file, is, provides,
-# specifies, contains, represents, a, an and the.
-
-ABBREVIATE_BRIEF = "The $name class" \
- "The $name widget" \
- "The $name file" \
- is \
- provides \
- specifies \
- contains \
- represents \
- a \
- an \
- the
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# doxygen will generate a detailed section even if there is only a brief
-# description.
-# The default value is: NO.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-# The default value is: NO.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
-# before files name in the file list and in the header files. If set to NO the
-# shortest path that makes the file name unique will be used
-# The default value is: YES.
-
-FULL_PATH_NAMES = YES
-
-# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
-# Stripping is only done if one of the specified strings matches the left-hand
-# part of the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the path to
-# strip.
-#
-# Note that you can specify absolute paths here, but also relative paths, which
-# will be relative from the directory where doxygen is started.
-# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
-# path mentioned in the documentation of a class, which tells the reader which
-# header file to include in order to use a class. If left blank only the name of
-# the header file containing the class definition is used. Otherwise one should
-# specify the list of include paths that are normally passed to the compiler
-# using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
-# less readable) file names. This can be useful is your file systems doesn't
-# support long names like on DOS, Mac, or CD-ROM.
-# The default value is: NO.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
-# first line (until the first dot) of a Javadoc-style comment as the brief
-# description. If set to NO, the Javadoc-style will behave just like regular Qt-
-# style comments (thus requiring an explicit @brief command for a brief
-# description.)
-# The default value is: NO.
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
-# such as
-# /***************
-# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
-# Javadoc-style will behave just like regular comments and it will not be
-# interpreted by doxygen.
-# The default value is: NO.
-
-JAVADOC_BANNER = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
-# line (until the first dot) of a Qt-style comment as the brief description. If
-# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
-# requiring an explicit \brief command for a brief description.)
-# The default value is: NO.
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
-# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
-# a brief description. This used to be the default behavior. The new default is
-# to treat a multi-line C++ comment block as a detailed description. Set this
-# tag to YES if you prefer the old behavior instead.
-#
-# Note that setting this tag to YES also means that rational rose comments are
-# not recognized any more.
-# The default value is: NO.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# By default Python docstrings are displayed as preformatted text and doxygen's
-# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
-# doxygen's special commands can be used and the contents of the docstring
-# documentation blocks is shown as doxygen documentation.
-# The default value is: YES.
-
-PYTHON_DOCSTRING = YES
-
-# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
-# documentation from any documented member that it re-implements.
-# The default value is: YES.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
-# page for each member. If set to NO, the documentation of a member will be part
-# of the file/class/namespace that contains it.
-# The default value is: NO.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
-# uses this value to replace tabs by spaces in code fragments.
-# Minimum value: 1, maximum value: 16, default value: 4.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that act as commands in
-# the documentation. An alias has the form:
-# name=value
-# For example adding
-# "sideeffect=@par Side Effects:\n"
-# will allow you to put the command \sideeffect (or @sideeffect) in the
-# documentation, which will result in a user-defined paragraph with heading
-# "Side Effects:". You can put \n's in the value part of an alias to insert
-# newlines (in the resulting output). You can put ^^ in the value part of an
-# alias to insert a newline as if a physical newline was in the original file.
-# When you need a literal { or } or , in the value part of an alias you have to
-# escape them by means of a backslash (\), this can lead to conflicts with the
-# commands \{ and \} for these it is advised to use the version @{ and @} or use
-# a double escape (\\{ and \\})
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C. For
-# instance, some of the names that are used will be different. The list of all
-# members will be omitted, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
-# Python sources only. Doxygen will then generate output that is more tailored
-# for that language. For instance, namespaces will be presented as packages,
-# qualified scopes will look different, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources. Doxygen will then generate output that is tailored for Fortran.
-# The default value is: NO.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for VHDL.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
-# sources only. Doxygen will then generate output that is more tailored for that
-# language. For instance, namespaces will be presented as modules, types will be
-# separated into more groups, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_SLICE = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given
-# extension. Doxygen has a built-in mapping, but you can override or extend it
-# using this tag. The format is ext=language, where ext is a file extension, and
-# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
-# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
-# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
-# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
-# tries to guess whether the code is fixed or free formatted code, this is the
-# default for Fortran type files). For instance to make doxygen treat .inc files
-# as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C.
-#
-# Note: For files without extension you can use no_extension as a placeholder.
-#
-# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
-# the files are not read by doxygen. When specifying no_extension you should add
-# * to the FILE_PATTERNS.
-#
-# Note see also the list of default file extension mappings.
-
-EXTENSION_MAPPING =
-
-# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
-# according to the Markdown format, which allows for more readable
-# documentation. See https://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you can
-# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
-# case of backward compatibilities issues.
-# The default value is: YES.
-
-MARKDOWN_SUPPORT = YES
-
-# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
-# to that level are automatically included in the table of contents, even if
-# they do not have an id attribute.
-# Note: This feature currently applies only to Markdown headings.
-# Minimum value: 0, maximum value: 99, default value: 5.
-# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
-
-TOC_INCLUDE_HEADINGS = 5
-
-# When enabled doxygen tries to link words that correspond to documented
-# classes, or namespaces to their corresponding documentation. Such a link can
-# be prevented in individual cases by putting a % sign in front of the word or
-# globally by setting AUTOLINK_SUPPORT to NO.
-# The default value is: YES.
-
-AUTOLINK_SUPPORT = YES
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should set this
-# tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string);
-# versus func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-# The default value is: NO.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-# The default value is: NO.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
-# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
-# will parse them like normal C++ but will assume all classes use public instead
-# of private inheritance when no explicit protection keyword is present.
-# The default value is: NO.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES will make
-# doxygen to replace the get and set methods by a property in the documentation.
-# This will only work if the methods are indeed getting or setting a simple
-# type. If this is not the case, or you want to show the methods anyway, you
-# should set this option to NO.
-# The default value is: YES.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-# The default value is: NO.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# If one adds a struct or class to a group and this option is enabled, then also
-# any nested class or struct is added to the same group. By default this option
-# is disabled and one has to add nested compounds explicitly via \ingroup.
-# The default value is: NO.
-
-GROUP_NESTED_COMPOUNDS = NO
-
-# Set the SUBGROUPING tag to YES to allow class member groups of the same type
-# (for instance a group of public functions) to be put as a subgroup of that
-# type (e.g. under the Public Functions section). Set it to NO to prevent
-# subgrouping. Alternatively, this can be done per class using the
-# \nosubgrouping command.
-# The default value is: YES.
-
-SUBGROUPING = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
-# are shown inside the group in which they are included (e.g. using \ingroup)
-# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
-# and RTF).
-#
-# Note that this feature does not work in combination with
-# SEPARATE_MEMBER_PAGES.
-# The default value is: NO.
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
-# with only public data fields or simple typedef fields will be shown inline in
-# the documentation of the scope in which they are defined (i.e. file,
-# namespace, or group documentation), provided this scope is documented. If set
-# to NO, structs, classes, and unions are shown on a separate page (for HTML and
-# Man pages) or section (for LaTeX and RTF).
-# The default value is: NO.
-
-INLINE_SIMPLE_STRUCTS = NO
-
-# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
-# enum is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically be
-# useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-# The default value is: NO.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
-# cache is used to resolve symbols given their name and scope. Since this can be
-# an expensive process and often the same symbol appears multiple times in the
-# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
-# doxygen will become slower. If the cache is too large, memory is wasted. The
-# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
-# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
-# symbols. At the end of a run doxygen will report the cache usage and suggest
-# the optimal cache size from a speed point of view.
-# Minimum value: 0, maximum value: 9, default value: 0.
-
-LOOKUP_CACHE_SIZE = 0
-
-# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use
-# during processing. When set to 0 doxygen will based this on the number of
-# cores available in the system. You can set it explicitly to a value larger
-# than 0 to get more control over the balance between CPU load and processing
-# speed. At this moment only the input processing can be done using multiple
-# threads. Since this is still an experimental feature the default is set to 1,
-# which efficively disables parallel processing. Please report any issues you
-# encounter. Generating dot graphs in parallel is controlled by the
-# DOT_NUM_THREADS setting.
-# Minimum value: 0, maximum value: 32, default value: 1.
-
-NUM_PROC_THREADS = 1
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
-# documentation are documented, even if no documentation was available. Private
-# class members and static file members will be hidden unless the
-# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
-# Note: This will also disable the warnings about undocumented members that are
-# normally produced when WARNINGS is set to YES.
-# The default value is: NO.
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
-# be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
-# methods of a class will be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PRIV_VIRTUAL = NO
-
-# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
-# scope will be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PACKAGE = NO
-
-# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
-# included in the documentation.
-# The default value is: NO.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
-# locally in source files will be included in the documentation. If set to NO,
-# only classes defined in header files are included. Does not have any effect
-# for Java sources.
-# The default value is: YES.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. If set to YES, local methods,
-# which are defined in the implementation section but not in the interface are
-# included in the documentation. If set to NO, only methods in the interface are
-# included.
-# The default value is: NO.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base name of
-# the file that contains the anonymous namespace. By default anonymous namespace
-# are hidden.
-# The default value is: NO.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If this flag is set to YES, the name of an unnamed parameter in a declaration
-# will be determined by the corresponding definition. By default unnamed
-# parameters remain unnamed in the output.
-# The default value is: YES.
-
-RESOLVE_UNNAMED_PARAMS = YES
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
-# undocumented members inside documented classes or files. If set to NO these
-# members will be included in the various overviews, but no documentation
-# section is generated. This option has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_MEMBERS = YES
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy. If set
-# to NO, these classes will be included in the various overviews. This option
-# has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_CLASSES = YES
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
-# declarations. If set to NO, these declarations will be included in the
-# documentation.
-# The default value is: NO.
-
-HIDE_FRIEND_COMPOUNDS = YES
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
-# documentation blocks found inside the body of a function. If set to NO, these
-# blocks will be appended to the function's detailed documentation block.
-# The default value is: NO.
-
-HIDE_IN_BODY_DOCS = YES
-
-# The INTERNAL_DOCS tag determines if documentation that is typed after a
-# \internal command is included. If the tag is set to NO then the documentation
-# will be excluded. Set it to YES to include the internal documentation.
-# The default value is: NO.
-
-INTERNAL_DOCS = NO
-
-# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
-# able to match the capabilities of the underlying filesystem. In case the
-# filesystem is case sensitive (i.e. it supports files in the same directory
-# whose names only differ in casing), the option must be set to YES to properly
-# deal with such files in case they appear in the input. For filesystems that
-# are not case sensitive the option should be be set to NO to properly deal with
-# output files written for symbols that only differ in casing, such as for two
-# classes, one named CLASS and the other named Class, and to also support
-# references to files without having to specify the exact matching casing. On
-# Windows (including Cygwin) and MacOS, users should typically set this option
-# to NO, whereas on Linux or other Unix flavors it should typically be set to
-# YES.
-# The default value is: system dependent.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
-# their full class and namespace scopes in the documentation. If set to YES, the
-# scope will be hidden.
-# The default value is: NO.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
-# append additional text to a page's title, such as Class Reference. If set to
-# YES the compound reference will be hidden.
-# The default value is: NO.
-
-HIDE_COMPOUND_REFERENCE= NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
-# the files that are included by a file in the documentation of that file.
-# The default value is: YES.
-
-SHOW_INCLUDE_FILES = NO
-
-# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
-# grouped member an include statement to the documentation, telling the reader
-# which file to include in order to use the member.
-# The default value is: NO.
-
-SHOW_GROUPED_MEMB_INC = NO
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
-# files with double quotes in the documentation rather than with sharp brackets.
-# The default value is: NO.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
-# documentation for inline members.
-# The default value is: YES.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
-# (detailed) documentation of file and class members alphabetically by member
-# name. If set to NO, the members will appear in declaration order.
-# The default value is: YES.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
-# descriptions of file, namespace and class members alphabetically by member
-# name. If set to NO, the members will appear in declaration order. Note that
-# this will also influence the order of the classes in the class list.
-# The default value is: NO.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
-# (brief and detailed) documentation of class members so that constructors and
-# destructors are listed first. If set to NO the constructors will appear in the
-# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
-# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
-# member documentation.
-# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
-# detailed member documentation.
-# The default value is: NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
-# of group names into alphabetical order. If set to NO the group names will
-# appear in their defined order.
-# The default value is: NO.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
-# fully-qualified names, including namespaces. If set to NO, the class list will
-# be sorted only by class name, not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the alphabetical
-# list.
-# The default value is: NO.
-
-SORT_BY_SCOPE_NAME = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
-# type resolution of all parameters of a function it will reject a match between
-# the prototype and the implementation of a member function even if there is
-# only one candidate or it is obvious which candidate to choose by doing a
-# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
-# accept a match between prototype and implementation in such cases.
-# The default value is: NO.
-
-STRICT_PROTO_MATCHING = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
-# list. This list is created by putting \todo commands in the documentation.
-# The default value is: YES.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
-# list. This list is created by putting \test commands in the documentation.
-# The default value is: YES.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
-# list. This list is created by putting \bug commands in the documentation.
-# The default value is: YES.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
-# the deprecated list. This list is created by putting \deprecated commands in
-# the documentation.
-# The default value is: YES.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional documentation
-# sections, marked by \if ... \endif and \cond
-# ... \endcond blocks.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
-# initial value of a variable or macro / define can have for it to appear in the
-# documentation. If the initializer consists of more lines than specified here
-# it will be hidden. Use a value of 0 to hide initializers completely. The
-# appearance of the value of individual variables and macros / defines can be
-# controlled using \showinitializer or \hideinitializer command in the
-# documentation regardless of this setting.
-# Minimum value: 0, maximum value: 10000, default value: 30.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
-# the bottom of the documentation of classes and structs. If set to YES, the
-# list will mention the files that were used to generate the documentation.
-# The default value is: YES.
-
-SHOW_USED_FILES = NO
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
-# will remove the Files entry from the Quick Index and from the Folder Tree View
-# (if specified).
-# The default value is: YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
-# page. This will remove the Namespaces entry from the Quick Index and from the
-# Folder Tree View (if specified).
-# The default value is: YES.
-
-SHOW_NAMESPACES = NO
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command command input-file, where command is the value of the
-# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
-# by doxygen. Whatever the program writes to standard output is used as the file
-# version. For an example see the documentation.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option. You can
-# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
-#
-# Note that if you run doxygen from a directory containing a file called
-# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
-# tag is left empty.
-
-LAYOUT_FILE =
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
-# the reference definitions. This must be a list of .bib files. The .bib
-# extension is automatically appended if omitted. This requires the bibtex tool
-# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
-# For LaTeX the style of the bibliography can be controlled using
-# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
-# search path. See also \cite for info how to create references.
-
-CITE_BIB_FILES =
-
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated to
-# standard output by doxygen. If QUIET is set to YES this implies that the
-# messages are off.
-# The default value is: NO.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
-# this implies that the warnings are on.
-#
-# Tip: Turn warnings on while writing the documentation.
-# The default value is: YES.
-
-WARNINGS = YES
-
-# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
-# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
-# will automatically be disabled.
-# The default value is: YES.
-
-WARN_IF_UNDOCUMENTED = YES
-
-# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some parameters
-# in a documented function, or documenting parameters that don't exist or using
-# markup commands wrongly.
-# The default value is: YES.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
-# are documented, but have no documentation for their parameters or return
-# value. If set to NO, doxygen will only warn about wrong or incomplete
-# parameter documentation, but not about the absence of documentation. If
-# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
-# The default value is: NO.
-
-WARN_NO_PARAMDOC = NO
-
-# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
-# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
-# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
-# at the end of the doxygen process doxygen will return with a non-zero status.
-# Possible values are: NO, YES and FAIL_ON_WARNINGS.
-# The default value is: NO.
-
-WARN_AS_ERROR = YES
-
-# The WARN_FORMAT tag determines the format of the warning messages that doxygen
-# can produce. The string should contain the $file, $line, and $text tags, which
-# will be replaced by the file and line number from which the warning originated
-# and the warning text. Optionally the format may contain $version, which will
-# be replaced by the version of the file (if it could be obtained via
-# FILE_VERSION_FILTER)
-# The default value is: $file:$line: $text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning and error
-# messages should be written. If left blank the output is written to standard
-# error (stderr).
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag is used to specify the files and/or directories that contain
-# documented source files. You may enter file names like myfile.cpp or
-# directories like /usr/src/myproject. Separate the files or directories with
-# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
-# Note: If this tag is empty the current directory is searched.
-
-INPUT = . \
- ../src
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
-# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see:
-# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
-# The default value is: UTF-8.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
-# *.h) to filter out the source-files in the directories.
-#
-# Note that for custom extensions or not directly supported extensions you also
-# need to set EXTENSION_MAPPING for the extension otherwise the files are not
-# read by doxygen.
-#
-# Note the list of default checked file patterns might differ from the list of
-# default file extension mappings.
-#
-# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
-# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
-# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
-# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
-# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl,
-# *.ucf, *.qsf and *.ice.
-
-FILE_PATTERNS = *.c \
- *.cc \
- *.cxx \
- *.cpp \
- *.c++ \
- *.java \
- *.ii \
- *.ixx \
- *.ipp \
- *.i++ \
- *.inl \
- *.idl \
- *.ddl \
- *.odl \
- *.h \
- *.hh \
- *.hxx \
- *.hpp \
- *.h++ \
- *.cs \
- *.d \
- *.php \
- *.php4 \
- *.php5 \
- *.phtml \
- *.inc \
- *.m \
- *.markdown \
- *.md \
- *.mm \
- *.dox \
- *.doc \
- *.txt \
- *.py \
- *.pyw \
- *.f90 \
- *.f95 \
- *.f03 \
- *.f08 \
- *.f18 \
- *.f \
- *.for \
- *.vhd \
- *.vhdl \
- *.ucf \
- *.qsf \
- *.ice
-
-# The RECURSIVE tag can be used to specify whether or not subdirectories should
-# be searched for input files as well.
-# The default value is: NO.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-#
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-EXCLUDE = ./README.md \
- ./examples \
- ./CMakelists.txt \
- ../src/nimconfig_rename.h \
- ../src/nimble
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-# The default value is: NO.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories use the pattern */test/*
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or directories
-# that contain example code fragments that are included (see the \include
-# command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank all
-# files are included.
-
-EXAMPLE_PATTERNS = *
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude commands
-# irrespective of the value of the RECURSIVE tag.
-# The default value is: NO.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or directories
-# that contain images that are to be included in the documentation (see the
-# \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command:
-#
-#
-#
-# where is the value of the INPUT_FILTER tag, and is the
-# name of an input file. Doxygen will then use the output that the filter
-# program writes to standard output. If FILTER_PATTERNS is specified, this tag
-# will be ignored.
-#
-# Note that the filter must not add or remove lines; it is applied before the
-# code is scanned, but not when the output code is generated. If lines are added
-# or removed, the anchors will not be placed correctly.
-#
-# Note that for custom extensions or not directly supported extensions you also
-# need to set EXTENSION_MAPPING for the extension otherwise the files are not
-# properly processed by doxygen.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form: pattern=filter
-# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
-# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
-# patterns match the file name, INPUT_FILTER is applied.
-#
-# Note that for custom extensions or not directly supported extensions you also
-# need to set EXTENSION_MAPPING for the extension otherwise the files are not
-# properly processed by doxygen.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will also be used to filter the input files that are used for
-# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
-# The default value is: NO.
-
-FILTER_SOURCE_FILES = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
-# it is also possible to disable source filtering for a specific pattern using
-# *.ext= (so without naming a filter).
-# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-
-FILTER_SOURCE_PATTERNS =
-
-# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
-# is part of the input, its contents will be placed on the main page
-# (index.html). This can be useful if you have a project on for instance GitHub
-# and want to reuse the introduction page also for the doxygen output.
-
-USE_MDFILE_AS_MAINPAGE = index.md
-
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
-# generated. Documented entities will be cross-referenced with these sources.
-#
-# Note: To get rid of all source code in the generated output, make sure that
-# also VERBATIM_HEADERS is set to NO.
-# The default value is: NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body of functions,
-# classes and enums directly into the documentation.
-# The default value is: NO.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
-# special comment blocks from generated source code fragments. Normal C, C++ and
-# Fortran comments will always remain visible.
-# The default value is: YES.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
-# entity all documented functions referencing it will be listed.
-# The default value is: NO.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES then for each documented function
-# all documented entities called/used by that function will be listed.
-# The default value is: NO.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
-# to YES then the hyperlinks from functions in REFERENCES_RELATION and
-# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
-# link to the documentation.
-# The default value is: YES.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
-# source code will show a tooltip with additional information such as prototype,
-# brief description and links to the definition and documentation. Since this
-# will make the HTML file larger and loading of large files a bit slower, you
-# can opt to disable this feature.
-# The default value is: YES.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-SOURCE_TOOLTIPS = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code will
-# point to the HTML generated by the htags(1) tool instead of doxygen built-in
-# source browser. The htags tool is part of GNU's global source tagging system
-# (see https://www.gnu.org/software/global/global.html). You will need version
-# 4.8.6 or higher.
-#
-# To use it do the following:
-# - Install the latest version of global
-# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
-# - Make sure the INPUT points to the root of the source tree
-# - Run doxygen as normal
-#
-# Doxygen will invoke htags (and that will in turn invoke gtags), so these
-# tools must be available from the command line (i.e. in the search path).
-#
-# The result: instead of the source browser generated by doxygen, the links to
-# source code will now point to the output of htags.
-# The default value is: NO.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
-# verbatim copy of the header file for each class for which an include is
-# specified. Set to NO to disable this.
-# See also: Section \class.
-# The default value is: YES.
-
-VERBATIM_HEADERS = YES
-
-# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
-# clang parser (see:
-# http://clang.llvm.org/) for more accurate parsing at the cost of reduced
-# performance. This can be particularly helpful with template rich C++ code for
-# which doxygen's built-in parser lacks the necessary type information.
-# Note: The availability of this option depends on whether or not doxygen was
-# generated with the -Duse_libclang=ON option for CMake.
-# The default value is: NO.
-
-CLANG_ASSISTED_PARSING = NO
-
-# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to
-# YES then doxygen will add the directory of each input to the include path.
-# The default value is: YES.
-
-CLANG_ADD_INC_PATHS = YES
-
-# If clang assisted parsing is enabled you can provide the compiler with command
-# line options that you would normally use when invoking the compiler. Note that
-# the include paths will already be set by doxygen for the files and directories
-# specified with INPUT and INCLUDE_PATH.
-# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-
-CLANG_OPTIONS =
-
-# If clang assisted parsing is enabled you can provide the clang parser with the
-# path to the directory containing a file called compile_commands.json. This
-# file is the compilation database (see:
-# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the
-# options used when the source files were built. This is equivalent to
-# specifying the -p option to a clang tool, such as clang-check. These options
-# will then be passed to the parser. Any options specified with CLANG_OPTIONS
-# will be added as well.
-# Note: The availability of this option depends on whether or not doxygen was
-# generated with the -Duse_libclang=ON option for CMake.
-
-CLANG_DATABASE_PATH =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
-# compounds will be generated. Enable this if the project contains a lot of
-# classes, structs, unions or interfaces.
-# The default value is: YES.
-
-ALPHABETICAL_INDEX = YES
-
-# In case all classes in a project start with a common prefix, all classes will
-# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
-# can be used to specify a prefix (or a list of prefixes) that should be ignored
-# while generating the index headers.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
-# The default value is: YES.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
-# generated HTML page (for example: .htm, .php, .asp).
-# The default value is: .html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
-# each generated HTML page. If the tag is left blank doxygen will generate a
-# standard header.
-#
-# To get valid HTML the header file that includes any scripts and style sheets
-# that doxygen needs, which is dependent on the configuration options used (e.g.
-# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
-# default header using
-# doxygen -w html new_header.html new_footer.html new_stylesheet.css
-# YourConfigFile
-# and then modify the file new_header.html. See also section "Doxygen usage"
-# for information on how to generate the default header that doxygen normally
-# uses.
-# Note: The header is subject to change so you typically have to regenerate the
-# default header when upgrading to a newer version of doxygen. For a description
-# of the possible markers and block names see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
-# generated HTML page. If the tag is left blank doxygen will generate a standard
-# footer. See HTML_HEADER for more information on how to generate a default
-# footer and what special commands can be used inside the footer. See also
-# section "Doxygen usage" for information on how to generate the default footer
-# that doxygen normally uses.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
-# sheet that is used by each HTML page. It can be used to fine-tune the look of
-# the HTML output. If left blank doxygen will generate a default style sheet.
-# See also section "Doxygen usage" for information on how to generate the style
-# sheet that doxygen normally uses.
-# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
-# it is more robust and this tag (HTML_STYLESHEET) will in the future become
-# obsolete.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_STYLESHEET =
-
-# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
-# cascading style sheets that are included after the standard style sheets
-# created by doxygen. Using this option one can overrule certain style aspects.
-# This is preferred over using HTML_STYLESHEET since it does not replace the
-# standard style sheet and is therefore more robust against future updates.
-# Doxygen will copy the style sheet files to the output directory.
-# Note: The order of the extra style sheet files is of importance (e.g. the last
-# style sheet in the list overrules the setting of the previous ones in the
-# list). For an example see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_STYLESHEET =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
-# files will be copied as-is; there are no commands or markers available.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_FILES =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
-# will adjust the colors in the style sheet and background images according to
-# this color. Hue is specified as an angle on a colorwheel, see
-# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
-# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
-# purple, and 360 is red again.
-# Minimum value: 0, maximum value: 359, default value: 220.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_HUE = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
-# in the HTML output. For a value of 0 the output will use grayscales only. A
-# value of 255 will produce the most vivid colors.
-# Minimum value: 0, maximum value: 255, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_SAT = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
-# luminance component of the colors in the HTML output. Values below 100
-# gradually make the output lighter, whereas values above 100 make the output
-# darker. The value divided by 100 is the actual gamma applied, so 80 represents
-# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
-# change the gamma.
-# Minimum value: 40, maximum value: 240, default value: 80.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_GAMMA = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting this
-# to YES can help to show when doxygen was last run and thus if the
-# documentation is up to date.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_TIMESTAMP = NO
-
-# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
-# documentation will contain a main index with vertical navigation menus that
-# are dynamically created via JavaScript. If disabled, the navigation index will
-# consists of multiple levels of tabs that are statically embedded in every HTML
-# page. Disable this option to support browsers that do not have JavaScript,
-# like the Qt help browser.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_DYNAMIC_MENUS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_DYNAMIC_SECTIONS = NO
-
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
-# shown in the various tree structured indices initially; the user can expand
-# and collapse entries dynamically later on. Doxygen will expand the tree to
-# such a level that at most the specified number of entries are visible (unless
-# a fully collapsed tree already exceeds this amount). So setting the number of
-# entries 1 will produce a full collapsed tree by default. 0 is a special value
-# representing an infinite number of entries and will result in a full expanded
-# tree by default.
-# Minimum value: 0, maximum value: 9999, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files will be
-# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment (see:
-# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
-# create a documentation set, doxygen will generate a Makefile in the HTML
-# output directory. Running make will produce the docset in that directory and
-# running make install will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
-# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
-# genXcode/_index.html for more information.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_DOCSET = NO
-
-# This tag determines the name of the docset feed. A documentation feed provides
-# an umbrella under which multiple documentation sets from a single provider
-# (such as a company or product suite) can be grouped.
-# The default value is: Doxygen generated docs.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# This tag specifies a string that should uniquely identify the documentation
-# set bundle. This should be a reverse domain-name style string, e.g.
-# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-# The default value is: org.doxygen.Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_ID = org.doxygen.Publisher
-
-# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
-# The default value is: Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_NAME = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
-# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
-# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
-# (see:
-# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows.
-#
-# The HTML Help Workshop contains a compiler that can convert all HTML output
-# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
-# files are now used as the Windows 98 help format, and will replace the old
-# Windows help format (.hlp) on all Windows platforms in the future. Compressed
-# HTML files also contain an index, a table of contents, and you can search for
-# words in the documentation. The HTML workshop also contains a viewer for
-# compressed HTML files.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_HTMLHELP = NO
-
-# The CHM_FILE tag can be used to specify the file name of the resulting .chm
-# file. You can add a path in front of the file if the result should not be
-# written to the html output directory.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_FILE =
-
-# The HHC_LOCATION tag can be used to specify the location (absolute path
-# including file name) of the HTML help compiler (hhc.exe). If non-empty,
-# doxygen will try to run the HTML help compiler on the generated index.hhp.
-# The file has to be specified with full path.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-HHC_LOCATION =
-
-# The GENERATE_CHI flag controls if a separate .chi index file is generated
-# (YES) or that it should be included in the main .chm file (NO).
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-GENERATE_CHI = NO
-
-# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
-# and project file content.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_INDEX_ENCODING =
-
-# The BINARY_TOC flag controls whether a binary table of contents is generated
-# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
-# enables the Previous and Next buttons.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members to
-# the table of contents of the HTML help documentation and to the tree view.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-TOC_EXPAND = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
-# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
-# (.qch) of the generated HTML documentation.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
-# the file name of the resulting .qch file. The path specified is relative to
-# the HTML output folder.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
-# Project output. For more information please see Qt Help Project / Namespace
-# (see:
-# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
-# Help Project output. For more information please see Qt Help Project / Virtual
-# Folders (see:
-# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
-# The default value is: doc.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
-# filter to add. For more information please see Qt Help Project / Custom
-# Filters (see:
-# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see Qt Help Project / Custom
-# Filters (see:
-# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's filter section matches. Qt Help Project / Filter Attributes (see:
-# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_SECT_FILTER_ATTRS =
-
-# The QHG_LOCATION tag can be used to specify the location (absolute path
-# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
-# run qhelpgenerator on the generated .qhp file.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
-# generated, together with the HTML files, they form an Eclipse help plugin. To
-# install this plugin and make it available under the help contents menu in
-# Eclipse, the contents of the directory containing the HTML and XML files needs
-# to be copied into the plugins directory of eclipse. The name of the directory
-# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
-# After copying Eclipse needs to be restarted before the help appears.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the Eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have this
-# name. Each documentation set should have its own identifier.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# If you want full control over the layout of the generated HTML pages it might
-# be necessary to disable the index and replace it with your own. The
-# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
-# of each HTML page. A value of NO enables the index and the value YES disables
-# it. Since the tabs in the index contain the same information as the navigation
-# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-DISABLE_INDEX = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information. If the tag
-# value is set to YES, a side panel will be generated containing a tree-like
-# index structure (just like the one that is generated for HTML Help). For this
-# to work a browser that supports JavaScript, DHTML, CSS and frames is required
-# (i.e. any modern browser). Windows users are probably better off using the
-# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
-# further fine-tune the look of the index. As an example, the default style
-# sheet generated by doxygen has an example that shows how to put an image at
-# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
-# the same information as the tab index, you could consider setting
-# DISABLE_INDEX to YES when enabling this option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_TREEVIEW = YES
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
-# doxygen will group on one line in the generated HTML documentation.
-#
-# Note that a value of 0 will completely suppress the enum values from appearing
-# in the overview section.
-# Minimum value: 0, maximum value: 20, default value: 4.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
-# to set the initial width (in pixels) of the frame in which the tree is shown.
-# Minimum value: 0, maximum value: 1500, default value: 250.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-TREEVIEW_WIDTH = 250
-
-# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
-# external symbols imported via tag files in a separate window.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-EXT_LINKS_IN_WINDOW = NO
-
-# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
-# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
-# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
-# the HTML output. These images will generally look nicer at scaled resolutions.
-# Possible values are: png (the default) and svg (looks nicer but requires the
-# pdf2svg or inkscape tool).
-# The default value is: png.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FORMULA_FORMAT = png
-
-# Use this tag to change the font size of LaTeX formulas included as images in
-# the HTML documentation. When you change the font size after a successful
-# doxygen run you need to manually remove any form_*.png images from the HTML
-# output directory to force them to be regenerated.
-# Minimum value: 8, maximum value: 50, default value: 10.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_FONTSIZE = 10
-
-# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are not
-# supported properly for IE 6.0, but are supported on all modern browsers.
-#
-# Note that when changing this option you need to delete any form_*.png files in
-# the HTML output directory before the changes have effect.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_TRANSPARENT = YES
-
-# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
-# to create new LaTeX commands to be used in formulas as building blocks. See
-# the section "Including formulas" for details.
-
-FORMULA_MACROFILE =
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
-# https://www.mathjax.org) which uses client side JavaScript for the rendering
-# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
-# installed or if you want to formulas look prettier in the HTML output. When
-# enabled you may also need to install MathJax separately and configure the path
-# to it using the MATHJAX_RELPATH option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-USE_MATHJAX = NO
-
-# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. See the MathJax site (see:
-# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details.
-# Possible values are: HTML-CSS (which is slower, but has the best
-# compatibility), NativeMML (i.e. MathML) and SVG.
-# The default value is: HTML-CSS.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_FORMAT = HTML-CSS
-
-# When MathJax is enabled you need to specify the location relative to the HTML
-# output directory using the MATHJAX_RELPATH option. The destination directory
-# should contain the MathJax.js script. For instance, if the mathjax directory
-# is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
-# Content Delivery Network so you can quickly see the result without installing
-# MathJax. However, it is strongly recommended to install a local copy of
-# MathJax from https://www.mathjax.org before deployment.
-# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
-# extension names that should be enabled during MathJax rendering. For example
-# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_EXTENSIONS =
-
-# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
-# of code that will be used on startup of the MathJax code. See the MathJax site
-# (see:
-# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
-# example see the documentation.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_CODEFILE =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
-# the HTML output. The underlying search engine uses javascript and DHTML and
-# should work on any modern browser. Note that when using HTML help
-# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
-# there is already a search function so this one should typically be disabled.
-# For large projects the javascript based search engine can be slow, then
-# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
-# search using the keyboard; to jump to the search box use + S
-# (what the is depends on the OS and browser, but it is typically
-# , /, or both). Inside the search box use the to jump into the search results window, the results can be navigated
-# using the . Press to select an item or to cancel
-# the search. The filter options can be selected when the cursor is inside the
-# search box by pressing +. Also here use the
-# to select a filter and or to activate or cancel the filter
-# option.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-SEARCHENGINE = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using JavaScript. There
-# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
-# setting. When disabled, doxygen will generate a PHP script for searching and
-# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
-# and searching needs to be provided by external tools. See the section
-# "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SERVER_BASED_SEARCH = NO
-
-# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
-# script for searching. Instead the search results are written to an XML file
-# which needs to be processed by an external indexer. Doxygen will invoke an
-# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
-# search results.
-#
-# Doxygen ships with an example indexer (doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see:
-# https://xapian.org/).
-#
-# See the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH = NO
-
-# The SEARCHENGINE_URL should point to a search engine hosted by a web server
-# which will return the search results when EXTERNAL_SEARCH is enabled.
-#
-# Doxygen ships with an example indexer (doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see:
-# https://xapian.org/). See the section "External Indexing and Searching" for
-# details.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHENGINE_URL =
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
-# search data is written to a file for indexing by an external tool. With the
-# SEARCHDATA_FILE tag the name of this file can be specified.
-# The default file is: searchdata.xml.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHDATA_FILE = searchdata.xml
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
-# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
-# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
-# projects and redirect the results back to the right project.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH_ID =
-
-# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
-# projects other than the one defined by this configuration file, but that are
-# all added to the same external search index. Each project needs to have a
-# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
-# to a relative location where the documentation can be found. The format is:
-# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTRA_SEARCH_MAPPINGS =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
-# The default value is: YES.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked.
-#
-# Note that when not enabling USE_PDFLATEX the default is latex when enabling
-# USE_PDFLATEX the default is pdflatex and when in the later case latex is
-# chosen this is overwritten by pdflatex. For specific output languages the
-# default can have been set differently, this depends on the implementation of
-# the output language.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_CMD_NAME =
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
-# index for LaTeX.
-# Note: This tag is used in the Makefile / make.bat.
-# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
-# (.tex).
-# The default file is: makeindex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
-# generate index for LaTeX. In case there is no backslash (\) as first character
-# it will be automatically added in the LaTeX code.
-# Note: This tag is used in the generated output file (.tex).
-# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
-# The default value is: makeindex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_MAKEINDEX_CMD = makeindex
-
-# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used by the
-# printer.
-# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
-# 14 inches) and executive (7.25 x 10.5 inches).
-# The default value is: a4.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PAPER_TYPE = a4
-
-# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
-# that should be included in the LaTeX output. The package can be specified just
-# by its name or with the correct syntax as to be used with the LaTeX
-# \usepackage command. To get the times font for instance you can specify :
-# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
-# To use the option intlimits with the amsmath package you can specify:
-# EXTRA_PACKAGES=[intlimits]{amsmath}
-# If left blank no extra packages will be included.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
-# generated LaTeX document. The header should contain everything until the first
-# chapter. If it is left blank doxygen will generate a standard header. See
-# section "Doxygen usage" for information on how to let doxygen write the
-# default header to a separate file.
-#
-# Note: Only use a user-defined header if you know what you are doing! The
-# following commands have a special meaning inside the header: $title,
-# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
-# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
-# string, for the replacement values of the other commands the user is referred
-# to HTML_HEADER.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HEADER =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
-# generated LaTeX document. The footer should contain everything after the last
-# chapter. If it is left blank doxygen will generate a standard footer. See
-# LATEX_HEADER for more information on how to generate a default footer and what
-# special commands can be used inside the footer.
-#
-# Note: Only use a user-defined footer if you know what you are doing!
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_FOOTER =
-
-# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
-# LaTeX style sheets that are included after the standard style sheets created
-# by doxygen. Using this option one can overrule certain style aspects. Doxygen
-# will copy the style sheet files to the output directory.
-# Note: The order of the extra style sheet files is of importance (e.g. the last
-# style sheet in the list overrules the setting of the previous ones in the
-# list).
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_STYLESHEET =
-
-# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the LATEX_OUTPUT output
-# directory. Note that the files will be copied as-is; there are no commands or
-# markers available.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_FILES =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
-# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
-# contain links (just like the HTML output) instead of page references. This
-# makes the output suitable for online browsing using a PDF viewer.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
-# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
-# files. Set this option to YES, to get a higher quality PDF documentation.
-#
-# See also section LATEX_CMD_NAME for selecting the engine.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
-# command to the generated LaTeX files. This will instruct LaTeX to keep running
-# if errors occur, instead of asking the user for help. This option is also used
-# when generating formulas in HTML.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BATCHMODE = NO
-
-# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
-# index chapters (such as File Index, Compound Index, etc.) in the output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HIDE_INDICES = NO
-
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. See
-# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
-# The default value is: plain.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BIB_STYLE = plain
-
-# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
-# page will contain the date and time when the page was generated. Setting this
-# to NO can help when comparing the output of multiple runs.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_TIMESTAMP = NO
-
-# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
-# path from which the emoji images will be read. If a relative path is entered,
-# it will be relative to the LATEX_OUTPUT directory. If left blank the
-# LATEX_OUTPUT directory will be used.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EMOJI_DIRECTORY =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
-# RTF output is optimized for Word 97 and may not look too pretty with other RTF
-# readers/editors.
-# The default value is: NO.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: rtf.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
-# contain hyperlink fields. The RTF file will contain links (just like the HTML
-# output) instead of page references. This makes the output suitable for online
-# browsing using Word or some other Word compatible readers that support those
-# fields.
-#
-# Note: WordPad (write) and others do not support links.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# configuration file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-#
-# See also section "Doxygen usage" for information on how to generate the
-# default style sheet that doxygen normally uses.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an RTF document. Syntax is
-# similar to doxygen's configuration file. A template extensions file can be
-# generated using doxygen -e rtf extensionFile.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_EXTENSIONS_FILE =
-
-# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
-# with syntax highlighting in the RTF output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_SOURCE_CODE = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
-# classes and files.
-# The default value is: NO.
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it. A directory man3 will be created inside the directory specified by
-# MAN_OUTPUT.
-# The default directory is: man.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to the generated
-# man pages. In case the manual section does not start with a number, the number
-# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
-# optional.
-# The default value is: .3.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_EXTENSION = .3
-
-# The MAN_SUBDIR tag determines the name of the directory created within
-# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
-# MAN_EXTENSION with the initial . removed.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_SUBDIR =
-
-# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
-# will generate one additional man file for each entity documented in the real
-# man page(s). These additional files only source the real man page, but without
-# them the man command would be unable to find the correct page.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
-# captures the structure of the code including all documentation.
-# The default value is: NO.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: xml.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_OUTPUT = xml
-
-# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
-# listings (including syntax highlighting and cross-referencing information) to
-# the XML output. Note that enabling this will significantly increase the size
-# of the XML output.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_PROGRAMLISTING = NO
-
-# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
-# namespace members in file scope as well, matching the HTML output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_NS_MEMB_FILE_SCOPE = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
-# that can be used to generate PDF.
-# The default value is: NO.
-
-GENERATE_DOCBOOK = NO
-
-# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
-# front of it.
-# The default directory is: docbook.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_OUTPUT = docbook
-
-# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
-# program listings (including syntax highlighting and cross-referencing
-# information) to the DOCBOOK output. Note that enabling this will significantly
-# increase the size of the DOCBOOK output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_PROGRAMLISTING = NO
-
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
-# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
-# the structure of the code including all documentation. Note that this feature
-# is still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to Sqlite3 output
-#---------------------------------------------------------------------------
-
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
-# file that captures the structure of the code including all documentation.
-#
-# Note that this feature is still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
-# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
-# output from the Perl module output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
-# formatted so it can be parsed by a human reader. This is useful if you want to
-# understand what is going on. On the other hand, if this tag is set to NO, the
-# size of the Perl module output will be much smaller and Perl will parse it
-# just the same.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file are
-# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
-# so different doxyrules.make files included by the same Makefile don't
-# overwrite each other's variables.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
-# C-preprocessor directives found in the sources and include files.
-# The default value is: YES.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
-# in the source code. If set to NO, only conditional compilation will be
-# performed. Macro expansion can be done in a controlled way by setting
-# EXPAND_ONLY_PREDEF to YES.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
-# the macro expansion is limited to the macros specified with the PREDEFINED and
-# EXPAND_AS_DEFINED tags.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES, the include files in the
-# INCLUDE_PATH will be searched if a #include is found.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by the
-# preprocessor.
-# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will be
-# used.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that are
-# defined before the preprocessor is started (similar to the -D option of e.g.
-# gcc). The argument of the tag is a list of macros of the form: name or
-# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
-# is assumed. To prevent a macro definition from being undefined via #undef or
-# recursively expanded use the := operator instead of the = operator.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-PREDEFINED = _DOXYGEN_ \
- CONFIG_BT_ENABLED \
- CONFIG_BT_NIMBLE_ROLE_CENTRAL \
- CONFIG_BT_NIMBLE_ROLE_OBSERVER \
- CONFIG_BT_NIMBLE_ROLE_PERIPHERAL \
- 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
-# tag can be used to specify a list of macro names that should be expanded. The
-# macro definition that is found in the sources will be used. Use the PREDEFINED
-# tag if you want to use a different macro definition that overrules the
-# definition found in the source code.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
-# remove all references to function-like macros that are alone on a line, have
-# an all uppercase name, and do not end with a semicolon. Such function macros
-# are typically used for boiler-plate code, and will confuse the parser if not
-# removed.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tag files. For each tag
-# file the location of the external documentation should be added. The format of
-# a tag file without this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where loc1 and loc2 can be relative or absolute paths or URLs. See the
-# section "Linking to external documentation" for more information about the use
-# of tag files.
-# Note: Each tag file must have a unique name (where the name does NOT include
-# the path). If a tag file is not located in the directory in which doxygen is
-# run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
-# tag file that is based on the input files it reads. See section "Linking to
-# external documentation" for more information about the usage of tag files.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
-# the class index. If set to NO, only the inherited external classes will be
-# listed.
-# The default value is: NO.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will be
-# listed.
-# The default value is: YES.
-
-EXTERNAL_GROUPS = YES
-
-# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
-# the related pages index. If set to NO, only the current project's pages will
-# be listed.
-# The default value is: YES.
-
-EXTERNAL_PAGES = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
-# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
-# NO turns the diagrams off. Note that this option also works with HAVE_DOT
-# disabled, but it is recommended to install and use dot, since it yields more
-# powerful graphs.
-# The default value is: YES.
-
-CLASS_DIAGRAMS = NO
-
-# You can include diagrams made with dia in doxygen documentation. Doxygen will
-# then run dia to produce the diagram and insert it in the documentation. The
-# DIA_PATH tag allows you to specify the directory where the dia binary resides.
-# If left empty dia is assumed to be found in the default search path.
-
-DIA_PATH =
-
-# If set to YES the inheritance and collaboration graphs will hide inheritance
-# and usage relations if the target is undocumented or is not a class.
-# The default value is: YES.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz (see:
-# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
-# Bell Labs. The other options in this section have no effect if this option is
-# set to NO
-# The default value is: NO.
-
-HAVE_DOT = NO
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
-# to run in parallel. When set to 0 doxygen will base this on the number of
-# processors available in the system. You can set it explicitly to a value
-# larger than 0 to get control over the balance between CPU load and processing
-# speed.
-# Minimum value: 0, maximum value: 32, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_NUM_THREADS = 0
-
-# When you want a differently looking font in the dot files that doxygen
-# generates you can specify the font name using DOT_FONTNAME. You need to make
-# sure dot is able to find the font, which can be done by putting it in a
-# standard location or by setting the DOTFONTPATH environment variable or by
-# setting DOT_FONTPATH to the directory containing the font.
-# The default value is: Helvetica.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTNAME = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
-# dot graphs.
-# Minimum value: 4, maximum value: 24, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the default font as specified with
-# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
-# the path where dot can find it using this tag.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
-# each documented class showing the direct and indirect inheritance relations.
-# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
-# graph for each documented class showing the direct and indirect implementation
-# dependencies (inheritance, containment, and class references variables) of the
-# class with other documented classes.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
-# groups, showing the direct groups dependencies.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LOOK = NO
-
-# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
-# class node. If there are many fields or methods and many nodes the graph may
-# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
-# number of items for each type to make the size more manageable. Set this to 0
-# for no limit. Note that the threshold may be exceeded by 50% before the limit
-# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
-# but if the number exceeds 15, the total amount of fields shown is limited to
-# 10.
-# Minimum value: 0, maximum value: 100, default value: 10.
-# This tag requires that the tag UML_LOOK is set to YES.
-
-UML_LIMIT_NUM_FIELDS = 10
-
-# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
-# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
-# tag is set to YES, doxygen will add type and arguments for attributes and
-# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
-# will not generate fields with class member information in the UML graphs. The
-# class diagrams will look similar to the default class diagrams but using UML
-# notation for the relationships.
-# Possible values are: NO, YES and NONE.
-# The default value is: NO.
-# This tag requires that the tag UML_LOOK is set to YES.
-
-DOT_UML_DETAILS = NO
-
-# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
-# to display on a single line. If the actual line length exceeds this threshold
-# significantly it will wrapped across multiple lines. Some heuristics are apply
-# to avoid ugly line breaks.
-# Minimum value: 0, maximum value: 1000, default value: 17.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_WRAP_THRESHOLD = 17
-
-# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
-# collaboration graphs will show the relations between templates and their
-# instances.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-TEMPLATE_RELATIONS = NO
-
-# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
-# YES then doxygen will generate a graph for each documented file showing the
-# direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDE_GRAPH = YES
-
-# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
-# set to YES then doxygen will generate a graph for each documented file showing
-# the direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command. Disabling a call graph can be
-# accomplished by means of the command \hidecallgraph.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable caller graphs for selected
-# functions only using the \callergraph command. Disabling a caller graph can be
-# accomplished by means of the command \hidecallergraph.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
-# hierarchy of all classes instead of a textual one.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
-# dependencies a directory has on other directories in a graphical way. The
-# dependency relations are determined by the #include relations between the
-# files in the directories.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. For an explanation of the image formats see the section
-# output formats in the documentation of the dot tool (Graphviz (see:
-# http://www.graphviz.org/)).
-# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
-# to make the SVG files visible in IE 9+ (other browsers do not have this
-# requirement).
-# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
-# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
-# png:gdiplus:gdiplus.
-# The default value is: png.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_IMAGE_FORMAT = png
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-#
-# Note that this requires a modern browser other than Internet Explorer. Tested
-# and working are Firefox, Chrome, Safari, and Opera.
-# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
-# the SVG files visible. Older versions of IE do not have SVG support.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INTERACTIVE_SVG = NO
-
-# The DOT_PATH tag can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the \dotfile
-# command).
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOTFILE_DIRS =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the \mscfile
-# command).
-
-MSCFILE_DIRS =
-
-# The DIAFILE_DIRS tag can be used to specify one or more directories that
-# contain dia files that are included in the documentation (see the \diafile
-# command).
-
-DIAFILE_DIRS =
-
-# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
-# path where java can find the plantuml.jar file. If left blank, it is assumed
-# PlantUML is not used or called during a preprocessing step. Doxygen will
-# generate a warning when it encounters a \startuml command in this case and
-# will not generate output for the diagram.
-
-PLANTUML_JAR_PATH =
-
-# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
-# configuration file for plantuml.
-
-PLANTUML_CFG_FILE =
-
-# When using plantuml, the specified paths are searched for files specified by
-# the !include statement in a plantuml block.
-
-PLANTUML_INCLUDE_PATH =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
-# that will be shown in the graph. If the number of nodes in a graph becomes
-# larger than this value, doxygen will truncate the graph, which is visualized
-# by representing a node as a red box. Note that doxygen if the number of direct
-# children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
-# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-# Minimum value: 0, maximum value: 10000, default value: 50.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
-# generated by dot. A depth value of 3 means that only nodes reachable from the
-# root by following a path via at most 3 edges will be shown. Nodes that lay
-# further from the root node will be omitted. Note that setting this option to 1
-# or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-# Minimum value: 0, maximum value: 1000, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not seem
-# to support this out of the box.
-#
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10) support
-# this, this feature is disabled by default.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
-# explaining the meaning of the various boxes and arrows in the dot generated
-# graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
-# files that are used to generate the various graphs.
-#
-# Note: This setting is not only used for dot files but also for msc and
-# plantuml temporary files.
-# The default value is: YES.
-
-DOT_CLEANUP = YES
diff --git a/libraries/NimBLE-Arduino/docs/Improvements_and_updates.md b/libraries/NimBLE-Arduino/docs/Improvements_and_updates.md
index e353f6d1..245defd2 100644
--- a/libraries/NimBLE-Arduino/docs/Improvements_and_updates.md
+++ b/libraries/NimBLE-Arduino/docs/Improvements_and_updates.md
@@ -1,6 +1,7 @@
# Improvements and updates
-Many improvements have been made to this library vs the original, this is a brief overview of the most significant changes. Refer to the [class documentation](https://h2zero.github.io/esp-nimble-cpp/annotated.html) for further information on class specifics.
+Many improvements have been made to this library vs the original, this is a brief overview of the most significant changes.
+Refer to the [class documentation](https://h2zero.github.io/esp-nimble-cpp/annotated.html) for futher information on class specifics.
* [Server](#server)
* [Advertising](#advertising)
@@ -9,26 +10,23 @@ Many improvements have been made to this library vs the original, this is a brie
-# Server
+# Server
-`NimBLEService::NimBLEService::createCharacteristic` takes a 3rd parameter to specify the maximum data size that can be stored by the characteristic. This allows for limiting the RAM use of the characteristic in cases where small amounts of data are expected.
-
-
-`NimBLECharacteristic::setValue(const T &s)`
-`NimBLEDescriptor::setValue(const T &s)`
+`NimBLECharacteristic::setValue(const T &s)`
+`NimBLEDescriptor::setValue(const T &s)`
-Now use the `NimbleAttValue` class and templates to accommodate standard and custom types/values.
+Now use a template to accomodate standard and custom types/values.
**Example**
```
-struct my_struct {
+struct my_struct{
uint8_t one;
uint16_t two;
uint32_t four;
uint64_t eight;
float flt;
-} myStruct;
-
+}myStruct;
+
myStruct.one = 1;
myStruct.two = 2;
myStruct.four = 4;
@@ -36,14 +34,12 @@ struct my_struct {
myStruct.flt = 1234.56;
pCharacteristic->setValue(myStruct);
-
- // Arduino String support
- String myString = "Hello";
- pCharacteristic->setValue(myString);
```
-This will send the struct to the receiving client when read or a notification sent.
+This will send the struct to the recieving client when read or a notification sent.
-`NimBLECharacteristic::getValue` now takes an optional timestamp parameter which will update it's value with the time the last value was received. In addition an overloaded template has been added to retrieve the value as a type specified by the user.
+`NimBLECharacteristic::getValue` now takes an optional timestamp parameter which will update it's value with
+the time the last value was recieved. In addition an overloaded template has been added to retrieve the value
+as a type specified by the user.
**Example**
```
@@ -52,34 +48,36 @@ This will send the struct to the receiving client when read or a notification se
```
-**Advertising will automatically start when a client disconnects.**
+**Advertising will automatically start when a client disconnects.**
A new method `NimBLEServer::advertiseOnDisconnect(bool)` has been implemented to control this, true(default) = enabled.
-`NimBLEServer::removeService` takes an additional parameter `bool deleteSvc` that if true will delete the service and all characteristics / descriptors belonging to it and invalidating any pointers to them.
+`NimBLEServer::removeService` takes an additional parameter `bool deleteSvc` that if true will delete the service
+and all characteristics / descriptors belonging to it and invalidating any pointers to them.
-If false the service is only removed from visibility by clients. The pointers to the service and it's characteristics / descriptors will remain valid and the service can be re-added in the future using `NimBLEServer::addService`.
+If false the service is only removed from visibility by clients. The pointers to the service and
+it's characteristics / descriptors will remain valid and the service can be re-added in the future
+using `NimBLEServer::addService`.
# Advertising
`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 advertising 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 advertsing ends and takes a pointer to a `NimBLEAdvertising` object (similar to the `NimBLEScan::start` API).
-This provides an opportunity to update the advertisement data if desired.
-
-Also now returns a bool value to indicate if advertising successfully started or not.
+This provides an opportunity to update the advertisment data if desired.
-# Client
+# Client
-`NimBLERemoteCharacteristic::readValue(time_t\*, bool)`
-`NimBLERemoteDescriptor::readValue(bool)`
+`NimBLERemoteCharacteristic::readValue(time_t\*, bool)`
+`NimBLERemoteDescriptor::readValue(bool)`
-Have been added as templates to allow reading the values as any specified type.
+Have been added as templates to allow reading the values as any specified type.
**Example**
```
@@ -93,56 +91,46 @@ struct my_struct{
time_t timestamp;
myStruct = pRemoteCharacteristic->readValue(×tamp); // timestamp optional
-```
+```
-`NimBLERemoteCharacteristic::registerForNotify`
-Has been **deprecated** as now the internally stored characteristic value is updated when notification/indication is received.
+`NimBLERemoteCharacteristic::registerForNotify`
+Has been **deprecated** as now the internally stored characteristic value is updated when notification/indication is recieved.
-`NimBLERemoteCharacteristic::subscribe` and `NimBLERemoteCharacteristic::unsubscribe` have been implemented to replace it.
-A callback is no longer required to get the most recent value unless timing is important. Instead, the application can call `NimBLERemoteCharacteristic::getValue` to get the last updated value any time.
-
-
-The `notify_callback` function is now defined as a `std::function` to take advantage of using `std::bind` to specify a class member function for the callback.
+`NimBLERemoteCharacteristic::subscribe` and `NimBLERemoteCharacteristic::unsubscribe` have been implemented to replace it.
+A callback is no longer requred to get the most recent value unless timing is important. Instead, the application can call `NimBLERemoteCharacteristic::getValue` to
+get the last updated value any time.
-Example:
-```
-using namespace std::placeholders;
-notify_callback callback = std::bind(&::, this, _1, _2, _3, _4);
-
-->subscribe(true, callback);
-```
-
-`NimBLERemoteCharacteristic::readValue` and `NimBLERemoteCharacteristic::getValue` take an optional timestamp parameter which will update it's value with
-the time the last value was received.
+In addition `NimBLERemoteCharacteristic::readValue` and `NimBLERemoteCharacteristic::getValue` take an optional timestamp parameter which will update it's value with
+the time the last value was recieved.
> NimBLEClient::getService
> NimBLERemoteService::getCharacteristic
-> NimBLERemoteCharacteristic::getDescriptor
+> NimBLERemoteCharacteristic::getDescriptor
-These methods will now check the respective vectors for the attribute object and, if not found, will retrieve (only)
-the specified attribute from the peripheral.
+These methods will now check the respective vectors for the attribute object and, if not found, will retrieve (only)
+the specified attribute from the peripheral.
-These changes allow more control for the user to manage the resources used for the attributes.
+These changes allow more control for the user to manage the resources used for the attributes.
-`NimBLEClient::connect()` can now be called without an address or advertised device parameter. This will connect to the device with the address previously set when last connected or set with `NimBLEDevice::setPeerAddress()`.
+`NimBLEClient::connect()` can now be called without an address or advertised device parameter. This will connect to the
+device with the address previously set when last connected or set with `NimBLEDevice::setPeerAddress()`.
-# General
-To reduce resource use all instances of `std::map` have been replaced with `std::vector`.
+# General
+To reduce resource use all instances of `std::map` have been replaced with `std::vector`.
-Use of `FreeRTOS::Semaphore` has been removed as it was consuming too much ram, the related files have been left in place to accomodate application use.
+Use of `FreeRTOS::Semaphore` has been removed as it was consuming too much ram, the related files have been left in place to accomodate application use.
-Operators `==`, `!=` and `std::string` have been added to `NimBLEAddress` and `NimBLEUUID` for easier comparison and logging.
+Operators `==`, `!=` and `std::string` have been added to `NimBLEAddress` and `NimBLEUUID` for easier comparison and logging.
-New constructor for `NimBLEUUID(uint32_t, uint16_t, uint16_t, uint64_t)` added to lower memory use vs string construction. See: [#21](https://github.com/h2zero/NimBLE-Arduino/pull/21).
+New constructor for `NimBLEUUID(uint32_t, uint16_t, uint16_t, uint64_t)` added to lower memory use vs string construction. See: [#21](https://github.com/h2zero/NimBLE-Arduino/pull/21).
-Security/pairing operations are now handled in the respective `NimBLEClientCallbacks` and `NimBLEServerCallbacks` classes, `NimBLESecurity`(deprecated) remains for backward compatibility.
+Security/pairing operations are now handled in the respective `NimBLEClientCallbacks` and `NimBLEServerCallbacks` classes, `NimBLESecurity`(deprecated) remains for backward compatibility.
-Configuration options have been added to add or remove debugging information, when disabled (default) significantly reduces binary size.
+Configuration options have been added to add or remove debugging information, when disabled (default) significatly reduces binary size.
In ESP-IDF the options are in menuconfig: `Main menu -> ESP-NimBLE-cpp configuration`.
-For Arduino the options must be commented / uncommented in nimconfig.h.
-
-Characteristics and descriptors now use the `NimBLEAttValue` class to store their data. This is a polymorphic container class capable of converting to/from many different types efficiently. See: [#286](https://github.com/h2zero/NimBLE-Arduino/pull/286)
+For Arduino the options must be commented / uncommented in nimconfig.h.
+
diff --git a/libraries/NimBLE-Arduino/docs/Migration_guide.md b/libraries/NimBLE-Arduino/docs/Migration_guide.md
index 2ddc1b3c..62406c62 100644
--- a/libraries/NimBLE-Arduino/docs/Migration_guide.md
+++ b/libraries/NimBLE-Arduino/docs/Migration_guide.md
@@ -1,10 +1,10 @@
# Migrating from Bluedroid to NimBLE
-This guide describes the required changes to existing projects migrating from the original bluedroid API to NimBLE.
+This guide describes the required changes to existing projects migrating from the original bluedroid API to NimBLE.
-**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/NimBLE-Arduino/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/esp-nimble-cpp/annotated.html) and [Improvements and updates](Improvements_and_updates.md)
* [General Changes](#general-information)
* [Server](#server-api)
@@ -19,78 +19,82 @@ For more information on the improvements and additions please refer to the [clas
* [Security](#client-security)
* [General Security](#security-api)
* [Configuration](#arduino-configuration)
-
+
## General Information
### 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 application 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 appplication if you want to use the `NIMBLE_LOGx` macros for debugging.
+These macros are used the same way as the `ESP_LOGx` macros.
### Class Names
-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.
+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 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.
+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.
### BLE Addresses
-`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).
+`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.
-As this parameter is optional no changes to existing code are needed, it is mentioned here for information.
+For example `BLEAddress addr(11:22:33:44:55:66, 1)` will create the address object with an address type of: 1 (Random).
-`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.
+As this paramameter 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
+not affected as the endian change is made within them.
## Server API
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.
-**Note:** All callback methods have default implementations which allows the application to implement only the methods applicable.
+`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.
### Services
-Creating a `BLEService` (`NimBLEService`) instance is the same as original, no changes required.
-For example `BLEServer::createService(SERVICE_UUID)` will work just as it did before.
+Creating a `BLEService` (`NimBLEService`) instance is the same as original, no changes required.
+For example `BLEServer::createService(SERVICE_UUID)` will work just as it did before.
### Characteristics
-`BLEService::createCharacteristic` (`NimBLEService::createCharacteristic`) is used the same way as originally except the properties parameter has changed.
+`BLEService::createCharacteristic` (`NimBLEService::createCharacteristic`) is used the same way as originally except the properties parameter has changed.
When creating a characteristic the properties are now set with `NIMBLE_PROPERTY::XXXX` instead of `BLECharacteristic::XXXX`.
#### Originally
-> BLECharacteristic::PROPERTY_READ |
-> BLECharacteristic::PROPERTY_WRITE
+> BLECharacteristic::PROPERTY_READ |
+> BLECharacteristic::PROPERTY_WRITE
#### Is Now
-> NIMBLE_PROPERTY::READ |
-> NIMBLE_PROPERTY::WRITE
+> NIMBLE_PROPERTY::READ |
+> NIMBLE_PROPERTY::WRITE
#### The full list of properties
-> NIMBLE_PROPERTY::READ
-> NIMBLE_PROPERTY::READ_ENC
-> NIMBLE_PROPERTY::READ_AUTHEN
-> NIMBLE_PROPERTY::READ_AUTHOR
-> NIMBLE_PROPERTY::WRITE
-> NIMBLE_PROPERTY::WRITE_NR
-> NIMBLE_PROPERTY::WRITE_ENC
-> NIMBLE_PROPERTY::WRITE_AUTHEN
-> NIMBLE_PROPERTY::WRITE_AUTHOR
-> NIMBLE_PROPERTY::BROADCAST
-> NIMBLE_PROPERTY::NOTIFY
-> NIMBLE_PROPERTY::INDICATE
-
+> NIMBLE_PROPERTY::READ
+> NIMBLE_PROPERTY::READ_ENC
+> NIMBLE_PROPERTY::READ_AUTHEN
+> NIMBLE_PROPERTY::READ_AUTHOR
+> NIMBLE_PROPERTY::WRITE
+> NIMBLE_PROPERTY::WRITE_NR
+> NIMBLE_PROPERTY::WRITE_ENC
+> NIMBLE_PROPERTY::WRITE_AUTHEN
+> NIMBLE_PROPERTY::WRITE_AUTHOR
+> NIMBLE_PROPERTY::BROADCAST
+> NIMBLE_PROPERTY::NOTIFY
+> NIMBLE_PROPERTY::INDICATE
**Example:**
@@ -98,7 +102,7 @@ When creating a characteristic the properties are now set with `NIMBLE_PROPERTY:
BLECharacteristic *pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ |
- BLECharacteristic::PROPERTY_WRITE
+ BLECharacteristic::PROPERTY_WRITE
);
```
@@ -107,22 +111,23 @@ Needs to be changed to:
BLECharacteristic *pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
NIMBLE_PROPERTY::READ |
- NIMBLE_PROPERTY::WRITE
+ NIMBLE_PROPERTY::WRITE
);
```
-`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.
-> BLECharacteristic::getData
+> BLECharacteristic::getData
-**Has been removed from the API.**
-Originally this returned a `uint8_t*` to the internal data, which is volatile.
-To prevent possibly throwing exceptions this has been removed and `NimBLECharacteristic::getValue` should be used
-to get a copy of the data first which can then safely be accessed via pointer.
+**Has been removed from the API.**
+Originally this returned a `uint8_t*` to the internal data, which is volatile.
+To prevent possibly throwing exceptions this has been removed and `NimBLECharacteristic::getValue` should be used
+to get a copy of the data first which can then safely be accessed via pointer.
**Example:**
```
@@ -137,47 +142,48 @@ my_struct_t myStruct = pChr->getValue();
### Descriptors
+The previous method `BLECharacteristic::addDescriptor()` has been removed.
Descriptors are now created using the `NimBLECharacteristic::createDescriptor` method.
+
+BLE2902 or NimBLE2902 class has been removed.
+NimBLE automatically creates the 0x2902 descriptor if a characteristic has a notification or indication property assigned to it.
-BLE2902 or NimBLE2902 class has been removed.
-NimBLE automatically creates the 0x2902 descriptor if a characteristic has a notification or indication property assigned to it.
+It was no longer useful to have a class for the 0x2902 descriptor as a new callback `NimBLECharacteristicCallbacks::onSubscribe` was added
+to handle callback functionality and the client subscription status is handled internally.
-It was no longer useful to have a class for the 0x2902 descriptor as a new callback `NimBLECharacteristicCallbacks::onSubscribe` was added
-to handle callback functionality and the client subscription status is handled internally.
-
-**Note:** Attempting to create a 0x2902 descriptor will trigger an assert to notify the error,
+**Note:** Attempting to create a 0x2902 descriptor will trigger an assert to notify the error,
allowing the creation of it would cause a fault in the NimBLE stack.
-All other descriptors are now created just as characteristics are by using the `NimBLECharacteristic::createDescriptor` method (except 0x2904, see below).
+All other descriptors are now created just as characteristics are by using the `NimBLECharacteristic::createDescriptor` method (except 0x2904, see below).
Which are defined as:
```
NimBLEDescriptor* createDescriptor(const char* uuid,
- uint32_t properties =
+ uint32_t properties =
NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE,
uint16_t max_len = 100);
-
+
NimBLEDescriptor* createDescriptor(NimBLEUUID uuid,
- uint32_t properties =
+ uint32_t properties =
NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE,
uint16_t max_len = 100);
```
##### Example
```
-pDescriptor = pCharacteristic->createDescriptor("ABCD",
- NIMBLE_PROPERTY::READ |
+pDescriptor = pCharacteristic->createDescriptor("ABCD",
+ NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE |
NIMBLE_PROPERTY::WRITE_ENC,
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.
For the 0x2904, there is a special class that is created when you call `createDescriptor("2904").
-The pointer returned is of the base class `NimBLEDescriptor` but the call will create the derived class of `NimBLE2904` so you must cast the returned pointer to
+The pointer returned is of the base class `NimBLEDescriptor` but the call will create the derived class of `NimBLE2904` so you must cast the returned pointer to
`NimBLE2904` to access the specific class methods.
##### Example
@@ -189,115 +195,127 @@ p2904 = (NimBLE2904*)pCharacteristic->createDescriptor("2904");
### Server Security
Security is set on the characteristic or descriptor properties by applying one of the following:
-> NIMBLE_PROPERTY::READ_ENC
-> NIMBLE_PROPERTY::READ_AUTHEN
-> NIMBLE_PROPERTY::READ_AUTHOR
-> NIMBLE_PROPERTY::WRITE_ENC
-> NIMBLE_PROPERTY::WRITE_AUTHEN
-> NIMBLE_PROPERTY::WRITE_AUTHOR
+> NIMBLE_PROPERTY::READ_ENC
+> NIMBLE_PROPERTY::READ_AUTHEN
+> NIMBLE_PROPERTY::READ_AUTHOR
+> NIMBLE_PROPERTY::WRITE_ENC
+> NIMBLE_PROPERTY::WRITE_AUTHEN
+> NIMBLE_PROPERTY::WRITE_AUTHOR
+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.
-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.
+
+## Advertising API
+Advertising works the same as the original API except:
+> BLEAdvertising::setMinPreferred
+> BLEAdvertising::setMaxPreferred
-This can be changed to use passkey authentication or numeric comparison. See [Security API](#security-api) for details.
+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 `BLEAdvertisementData::addData` (`NimBLEAdvertisementData::addData`).
-
-## Advertising API
-Advertising works the same as the original API except:
+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.
-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.
+~~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.~~
+No longer true as of release 1.2.0 and above, custom scan response is now supported without custom advertisement data.
> 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 advertising ends and takes a pointer to a `NimBLEAdvertising` object (similar to the `NimBLEScan::start` API).
-This provides an opportunity to update the advertisement data if desired.
+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).
+
+This provides an opportunity to update the advertisment data if desired.
## Client API
-Client instances are created just as before with `BLEDevice::createClient` (`NimBLEDevice::createClient`).
+Client instances are created just as before with `BLEDevice::createClient` (`NimBLEDevice::createClient`).
-Multiple client instances can be created, up to the maximum number of connections set in the config file (default: 3). To delete a client instance you must use `NimBLEDevice::deleteClient`.
+Multiple client instances can be created, up to the maximum number of connections set in the config file (default: 3).
+To delete a client instance you must use `NimBLEDevice::deleteClient`.
-`BLEClient::connect`(`NimBLEClient::connect`) Has had it's parameters altered.
+`BLEClient::connect`(`NimBLEClient::connect`) Has had it's parameters altered.
Defined as:
-> NimBLEClient::connect(bool deleteServices = true);
-> NimBLEClient::connect(NimBLEAdvertisedDevice\* device, 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.
+> NimBLEClient::connect(bool deleteServices = true);
+> NimBLEClient::connect(NimBLEAdvertisedDevice\* device, bool deleteServices = true);
+> NimBLEClient::connect(NimBLEAddress address, bool deleteServices = true);
-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.
+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.
+This allows for faster connections and power saving if the devices dropped connection and are reconnecting.
-> `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).
-Also now returns a pointer to `std::vector` instead of `std::map`.
+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`.
-**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.
+**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.
### Remote Services
-`BLERemoteService` (`NimBLERemoteService`) Methods remain mostly unchanged with the exceptions of:
+`BLERemoteService` (`NimBLERemoteService`) Methods remain mostly unchanged with the exceptions of:
> BLERemoteService::getCharacteristicsByHandle
-This method has been removed.
+This method has been removed.
-> `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
-the currently known database returned (false : default).
-Also now returns a pointer to `std::vector` instead of `std::map`.
+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).
+Also now returns a pointer to `std::vector` instead of `std::map`.
### Remote Characteristics
-`BLERemoteCharacteristic` (`NimBLERemoteCharacteristic`)
- There have been a few changes to the methods in this class:
+`BLERemoteCharacteristic` (`NimBLERemoteCharacteristic`) There have been a few changes to the methods in this class:
-> `BLERemoteCharacteristic::writeValue` (`NimBLERemoteCharacteristic::writeValue`)
-> `BLERemoteCharacteristic::registerForNotify` (`NimBLERemoteCharacteristic::registerForNotify`)
+> `BLERemoteCharacteristic::writeValue` (`NimBLERemoteCharacteristic::writeValue`)
+> `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.
-> `BLERemoteCharacteristic::registerForNotify` (`NimBLERemoteCharacteristic::registerForNotify`)
+> `BLERemoteCharacteristic::registerForNotify` (`NimBLERemoteCharacteristic::registerForNotify`)
-Is now **deprecated**.
-> `NimBLERemoteCharacteristic::subscribe`
-> `NimBLERemoteCharacteristic::unsubscribe`
+Is now **deprecated**.
+> `NimBLERemoteCharacteristic::subscribe`
+> `NimBLERemoteCharacteristic::unsubscribe`
-Are the new methods added to replace it.
+Are the new methods added to replace it.
-> `BLERemoteCharacteristic::readUInt8` (`NimBLERemoteCharacteristic::readUInt8`)
-> `BLERemoteCharacteristic::readUInt16` (`NimBLERemoteCharacteristic::readUInt16`)
-> `BLERemoteCharacteristic::readUInt32` (`NimBLERemoteCharacteristic::readUInt32`)
-> `BLERemoteCharacteristic::readFloat` (`NimBLERemoteCharacteristic::readFloat`)
+> `BLERemoteCharacteristic::readUInt8` (`NimBLERemoteCharacteristic::readUInt8`)
+> `BLERemoteCharacteristic::readUInt16` (`NimBLERemoteCharacteristic::readUInt16`)
+> `BLERemoteCharacteristic::readUInt32` (`NimBLERemoteCharacteristic::readUInt32`)
+> `BLERemoteCharacteristic::readFloat` (`NimBLERemoteCharacteristic::readFloat`)
-Are **deprecated** a template: `NimBLERemoteCharacteristic::readValue(time_t\*, bool)` has been added to replace them.
+Are **deprecated** a template: NimBLERemoteCharacteristic::readValue(time_t\*, bool) has been added to replace them.
-> `BLERemoteCharacteristic::readRawData`
+> `BLERemoteCharacteristic::readRawData`
-**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.
-The user application should use `NimBLERemoteCharacteristic::readValue` or `NimBLERemoteCharacteristic::getValue`.
-To obtain a copy of the data, then cast the returned std::string to the type required such as:
+**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.
+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:
```
std::string value = pChr->readValue();
uint8_t *data = (uint8_t*)value.data();
@@ -307,73 +325,75 @@ Alternatively use the `readValue` template:
my_struct_t myStruct = pChr->readValue();
```
+
+> `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
-the currently known database returned (false : default).
-Also now returns a pointer to `std::vector` instead of `std::map`.
+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).
+Also now returns a pointer to `std::vector` instead of `std::map`.
### Client Security
-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 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.
## Security API
Security operations have been moved to `BLEDevice` (`NimBLEDevice`).
-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.
+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.
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.
-> `uint32_t onPassKeyRequest()`
+> `uint32_t onPassKeyRequest()`
-For server callback; return the passkey expected from the client.
-For client callback; return the passkey to send to the server.
+For server callback; return the passkey expected from the client.
+For client callback; return the passkey to send to the server.
-> `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`.
Security settings and IO capabilities are now set by the following methods of NimBLEDevice.
-> `NimBLEDevice::setSecurityAuth(bool bonding, bool mitm, bool sc)`
-> `NimBLEDevice::setSecurityAuth(uint8_t auth_req)`
+> `NimBLEDevice::setSecurityAuth(bool bonding, bool mitm, bool sc)`
+> `NimBLEDevice::setSecurityAuth(uint8_t auth_req)`
-Sets the authorization mode for this device.
+Sets the authorization mode for this device.
-> `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.
-> `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.
-> `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.
## Arduino Configuration
-Unlike the original library pre-packaged in the esp32-arduino, this library has all the configuration options that are normally set in menuconfig available in the *src/nimconfig.h* file.
+Unlike the original library pre-packaged in the esp32-arduino, this library has all the configuration
+options that are normally set in menuconfig available in the *src/nimconfig.h* file.
-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*
diff --git a/libraries/NimBLE-Arduino/docs/New_user_guide.md b/libraries/NimBLE-Arduino/docs/New_user_guide.md
index ce02efe7..9f0eeee7 100644
--- a/libraries/NimBLE-Arduino/docs/New_user_guide.md
+++ b/libraries/NimBLE-Arduino/docs/New_user_guide.md
@@ -23,7 +23,7 @@ This can be called any time you wish to use BLE functions and does not need to b
## Creating a Server
-BLE servers perform 2 tasks, they advertise their existence for clients to find them and they provide services which contain information for the connecting client.
+BLE servers perform 2 tasks, they advertise their existance for clients to find them and they provide services which contain information for the connecting client.
After initializing the NimBLE stack we create a server by calling `NimBLEDevice::createServer()`, this will create a server instance and return a pointer to it.
@@ -91,7 +91,7 @@ void app_main(void)
}
```
-All that's left to do now is start the service, give the characteristic a value and start advertising for clients.
+All that's left to do now is start the sevice, give the characteristic a value and start advertising for clients.
Fist we start the service by calling `NimBLEService::start()`.
@@ -214,7 +214,7 @@ for(int i = 0; i < results.getCount(); i++) {
}
}
```
-As shown, the call to `NimBLEClient::connect` should have it's return value tested to make sure it succeeded before proceeding to get data.
+As shown, the call to `NimBLEClient::connect` should have it's eturn value tested to make sure it succeeded before proceeding to get data.
Next we need to access the servers data by asking it for the service and the characteristic we are interested in, then read the characteristic value.
@@ -222,7 +222,7 @@ Next we need to access the servers data by asking it for the service and the cha
To do this we call `NimBLEClient::getService`, which takes as a parameter the UUID of the service and returns
a pointer an instance to `NimBLERemoteService` or `nullptr` if the service was not found.
-Next we will call `NimBLERemoteService::getCharacteristic` which takes as a parameter the UUID of the service and returns
+Next we will call `NimBLERemoteService::getCharateristic` which takes as a parameter the UUID of the service and returns
a pointer to an instance of `NimBLERemoteCharacteristic` or `nullptr` if not found.
Finally we will read the characteristic value with `NimBLERemoteCharacteristic::readValue()`.
diff --git a/libraries/NimBLE-Arduino/docs/Usage_tips.md b/libraries/NimBLE-Arduino/docs/Usage_tips.md
index 8a60ef24..b8edde2d 100644
--- a/libraries/NimBLE-Arduino/docs/Usage_tips.md
+++ b/libraries/NimBLE-Arduino/docs/Usage_tips.md
@@ -2,7 +2,7 @@
## Put BLE functions in a task running on the NimBLE stack core
-When commands are sent to the stack from a different core they can experience delays in execution.
+When commands are sent to the stack from a differnt core they can experience delays in execution.
This library detects this and invokes the esp32 IPC to reroute these commands through the correct core but this also increases overhead.
Therefore it is highly recommended to create tasks for BLE to run on the same core, the macro `CONFIG_BT_NIMBLE_PINNED_TO_CORE` can be used to set the core.
@@ -13,12 +13,12 @@ When a client instance has been created and has connected to a peer device and i
If you are periodically connecting to the same devices and you have deleted the client instance or the services when connecting again it will cause a retrieval of that information from the peer again.
This results in significant energy drain on the battery of the devices, fragments heap, and reduces connection performance.
-Client instances in this library use approximately 20% of the original bluedroid library, deleting them will provide much less gain than it did before.
+Client instances in this library use approximately 20% of the original bluedroid library, deleteing them will provide much less gain than it did before.
It is recommended to retain the client instance in cases where the time between connecting to the same device is less than 5 minutes.
-## Only retrieve the services and characteristics needed
+## Only retrieve the services and characteriscs needed
As a client the use of `NimBLEClient::getServices` or `NimBLERemoteService::getCharacteristics` and using `true` for the parameter should be limited to devices that are not known.
Instead `NimBLEClient::getService(NimBLEUUID)` or `NimBLERemoteService::getCharacteristic(NimBLEUUID)` should be used to access certain attributes that are useful to the application.
diff --git a/libraries/NimBLE-Arduino/docs/index.md b/libraries/NimBLE-Arduino/docs/index.md
deleted file mode 100644
index 2f1af75a..00000000
--- a/libraries/NimBLE-Arduino/docs/index.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# Overview
-
-This is a C++ BLE library for Espressif ESP32 and Nordic nRF51/nRF52 devices that uses the NimBLE BLE stack.
-The aim is to maintain, as much as reasonable, the original ESP32 Arduino BLE API by while adding new features and making improvements in performance, resource use, and stability.
-
-
-# What is NimBLE?
-NimBLE is a completely open source Bluetooth Low Energy stack produced by [Apache](https://github.com/apache/mynewt-nimble).
-
-
-# Arduino installation
-**NOTE:** Nordic devices require using [n-able arduino core](https://github.com/h2zero/n-able-Arduino)
-
-**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`.
-
-
-# Platformio installation
-* Open platformio.ini, a project configuration file located in the root of PlatformIO project.
-* Add the following line to the lib_deps option of [env:] section:
-```
-h2zero/NimBLE-Arduino@^1.4.0
-```
-* Build a project, PlatformIO will automatically install dependencies.
-
-
-# Using
-This library is intended to be compatible with the original ESP32 BLE library functions and types with minor changes.
-
-If you have not used the original BLE library please refer to the [New user guide](New_user_guide.md).
-
-If you are familiar with the original library, see: [The migration guide](Migration_guide.md) for details.
-
-Also see [Improvements and updates](Improvements_and_updates.md) for information about non-breaking changes.
-
-For more advanced usage see [Usage tips](Usage_tips.md) for more performance and optimization.
-
-
-## Examples
-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).
-
-
-## 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).
-
-
-# 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)
-
-
-# Acknowledgments
-
-* [nkolban](https://github.com/nkolban) and [chegewara](https://github.com/chegewara) for the [original esp32 BLE library](https://github.com/nkolban/esp32-snippets/tree/master/cpp_utils) this project was derived from.
-* [beegee-tokyo](https://github.com/beegee-tokyo) for contributing your time to test/debug and contributing the beacon examples.
-* [Jeroen88](https://github.com/Jeroen88) for the amazing help debugging and improving the client code.
-
-
diff --git a/libraries/NimBLE-Arduino/examples/Bluetooth_5/NimBLE_extended_client/NimBLE_extended_client.ino b/libraries/NimBLE-Arduino/examples/Bluetooth_5/NimBLE_extended_client/NimBLE_extended_client.ino
deleted file mode 100644
index 91a1e626..00000000
--- a/libraries/NimBLE-Arduino/examples/Bluetooth_5/NimBLE_extended_client/NimBLE_extended_client.ino
+++ /dev/null
@@ -1,171 +0,0 @@
-
-/** NimBLE Extended Client Demo:
- *
- * Demonstrates the Bluetooth 5.x client capabilities.
- *
- * Created: on April 2 2022
- * Author: H2zero
- *
-*/
-
-/****************************************************
- * For use with ESP32C3, ESP32S3, ESP32H2 ONLY! *
- /**************************************************/
-
-#include
-#if !CONFIG_BT_NIMBLE_EXT_ADV
-# error Must enable extended advertising, see nimconfig.h file.
-#endif
-
-void scanEndedCB(NimBLEScanResults results);
-
-#define SERVICE_UUID "ABCD"
-#define CHARACTERISTIC_UUID "1234"
-
-static NimBLEAdvertisedDevice* advDevice;
-static bool doConnect = false;
-static uint32_t scanTime = 10; /* 0 = scan forever */
-
-/* Define the PHY's to use when connecting to peer devices, can be 1, 2, or all 3 (default).*/
-static uint8_t connectPhys = BLE_GAP_LE_PHY_CODED_MASK | BLE_GAP_LE_PHY_1M_MASK /*| BLE_GAP_LE_PHY_2M_MASK */ ;
-
-/* Define a class to handle the callbacks for client connection events */
-class ClientCallbacks : public NimBLEClientCallbacks {
- void onConnect(NimBLEClient* pClient) {
- Serial.printf("Connected\n");
- };
-
- void onDisconnect(NimBLEClient* pClient) {
- Serial.printf("%s Disconnected - Starting scan\n", pClient->getPeerAddress().toString().c_str());
- NimBLEDevice::getScan()->start(scanTime, scanEndedCB);
- };
-};
-
-
-/* Define a class to handle the callbacks when advertisements are received */
-class AdvertisedDeviceCallbacks: public NimBLEAdvertisedDeviceCallbacks {
-
- void onResult(NimBLEAdvertisedDevice* advertisedDevice) {
- Serial.printf("Advertised Device found: %s\n", advertisedDevice->toString().c_str());
- if(advertisedDevice->isAdvertisingService(NimBLEUUID("ABCD")))
- {
- Serial.printf("Found Our Service\n");
- /* Ready to connect now */
- doConnect = true;
- /* Save the device reference in a global for the client to use*/
- advDevice = advertisedDevice;
- /* stop scan before connecting */
- NimBLEDevice::getScan()->stop();
- }
- };
-};
-
-
-/* Callback to process the results of the last scan or restart it */
-void scanEndedCB(NimBLEScanResults results){
- Serial.printf("Scan Ended\n");
- if (!doConnect) { /* Don't start the scan while connecting */
- NimBLEDevice::getScan()->start(scanTime, scanEndedCB);
- }
-}
-
-
-/* Handles the provisioning of clients and connects / interfaces with the server */
-bool connectToServer() {
- NimBLEClient* pClient = nullptr;
-
- pClient = NimBLEDevice::createClient();
- pClient->setClientCallbacks(new ClientCallbacks, false);
-
- /* Set the PHY's to use for this connection. This is a bitmask that represents the PHY's:
- * * 0x01 BLE_GAP_LE_PHY_1M_MASK
- * * 0x02 BLE_GAP_LE_PHY_2M_MASK
- * * 0x04 BLE_GAP_LE_PHY_CODED_MASK
- * Combine these with OR ("|"), eg BLE_GAP_LE_PHY_1M_MASK | BLE_GAP_LE_PHY_2M_MASK | BLE_GAP_LE_PHY_CODED_MASK;
- */
- pClient->setConnectPhy(connectPhys);
-
- /** Set how long we are willing to wait for the connection to complete (seconds), default is 30. */
- pClient->setConnectTimeout(10);
-
- if (!pClient->connect(advDevice)) {
- /* Created a client but failed to connect, don't need to keep it as it has no data */
- NimBLEDevice::deleteClient(pClient);
- Serial.printf("Failed to connect, deleted client\n");
- return false;
- }
-
- Serial.printf("Connected to: %s RSSI: %d\n",
- pClient->getPeerAddress().toString().c_str(),
- pClient->getRssi());
-
- /* Now we can read/write/subscribe the charateristics of the services we are interested in */
- NimBLERemoteService* pSvc = nullptr;
- NimBLERemoteCharacteristic* pChr = nullptr;
-
- pSvc = pClient->getService(SERVICE_UUID);
-
- if (pSvc) {
- pChr = pSvc->getCharacteristic(CHARACTERISTIC_UUID);
-
- if (pChr) {
- // Read the value of the characteristic.
- if (pChr->canRead()) {
- std::string value = pChr->readValue();
- Serial.printf("Characteristic value: %s\n", value.c_str());
- }
- }
-
- } else {
- Serial.printf("ABCD service not found.\n");
- }
-
- NimBLEDevice::deleteClient(pClient);
- Serial.printf("Done with this device!\n");
- return true;
-}
-
-void setup () {
- Serial.begin(115200);
- Serial.printf("Starting NimBLE Client\n");
-
- /* Initialize NimBLE, no device name specified as we are not advertising */
- NimBLEDevice::init("");
- NimBLEScan* pScan = NimBLEDevice::getScan();
-
- /* create a callback that gets called when advertisers are found */
- pScan->setAdvertisedDeviceCallbacks(new AdvertisedDeviceCallbacks());
-
- /* Set scan interval (how often) and window (how long) in milliseconds */
- pScan->setInterval(97);
- pScan->setWindow(67);
-
- /* Active scan will gather scan response data from advertisers
- * but will use more energy from both devices
- */
- pScan->setActiveScan(true);
-
- /* Start scanning for advertisers for the scan time specified (in seconds) 0 = forever
- * Optional callback for when scanning stops.
- */
- pScan->start(scanTime, scanEndedCB);
-
- Serial.printf("Scanning for peripherals\n");
-}
-
-void loop () {
- /* Loop here until we find a device we want to connect to */
- if (doConnect) {
- /* Found a device we want to connect to, do it now */
- if (connectToServer()) {
- Serial.printf("Success!, scanning for more!\n");
- } else {
- Serial.printf("Failed to connect, starting scan\n");
- }
-
- doConnect = false;
- NimBLEDevice::getScan()->start(scanTime, scanEndedCB);
- }
-
- delay(10);
-}
diff --git a/libraries/NimBLE-Arduino/examples/Bluetooth_5/NimBLE_extended_server/NimBLE_extended_server.ino b/libraries/NimBLE-Arduino/examples/Bluetooth_5/NimBLE_extended_server/NimBLE_extended_server.ino
deleted file mode 100644
index 4bcd1b10..00000000
--- a/libraries/NimBLE-Arduino/examples/Bluetooth_5/NimBLE_extended_server/NimBLE_extended_server.ino
+++ /dev/null
@@ -1,150 +0,0 @@
-/** NimBLE Extended Advertiser Demo:
- *
- * Demonstrates the Bluetooth 5.x extended advertising capabilities.
- *
- * This demo will advertise a long data string on the CODED and 1M Phy's and
- * starts a server allowing connection over either PHY's. It will advertise for
- * 5 seconds then sleep for 20 seconds, if a client connects it will sleep once
- * it has disconnected then repeats.
- *
- * Created: on April 2 2022
- * Author: H2zero
- *
-*/
-
-/****************************************************
- * For use with ESP32C3, ESP32S3, ESP32H2 ONLY! *
- /**************************************************/
-
-#include "NimBLEDevice.h"
-#if !CONFIG_BT_NIMBLE_EXT_ADV
-# error Must enable extended advertising, see nimconfig.h file.
-#endif
-
-#include "esp_sleep.h"
-
-#define SERVICE_UUID "ABCD"
-#define CHARACTERISTIC_UUID "1234"
-
-/* Time in milliseconds to advertise */
-static uint32_t advTime = 5000;
-
-/* Time to sleep between advertisements */
-static uint32_t sleepSeconds = 20;
-
-/* Primary PHY used for advertising, can be one of BLE_HCI_LE_PHY_1M or BLE_HCI_LE_PHY_CODED */
-static uint8_t primaryPhy = BLE_HCI_LE_PHY_CODED;
-
-/* Secondary PHY used for advertising and connecting,
- * can be one of BLE_HCI_LE_PHY_1M, BLE_HCI_LE_PHY_2M or BLE_HCI_LE_PHY_CODED
- */
-static uint8_t secondaryPhy = BLE_HCI_LE_PHY_1M;
-
-
-/* Handler class for server events */
-class ServerCallbacks: public NimBLEServerCallbacks {
- void onConnect(NimBLEServer* pServer, ble_gap_conn_desc* desc) {
- Serial.printf("Client connected:: %s\n", NimBLEAddress(desc->peer_ota_addr).toString().c_str());
- };
-
- void onDisconnect(NimBLEServer* pServer) {
- Serial.printf("Client disconnected - sleeping for %u seconds\n", sleepSeconds);
- esp_deep_sleep_start();
- };
-};
-
-/* Callback class to handle advertising events */
-class advertisingCallbacks: public NimBLEExtAdvertisingCallbacks {
- void onStopped(NimBLEExtAdvertising* pAdv, int reason, uint8_t inst_id) {
- /* Check the reason advertising stopped, don't sleep if client is connecting */
- printf("Advertising instance %u stopped\n", inst_id);
- switch (reason) {
- case 0:
- printf("Client connecting\n");
- return;
- case BLE_HS_ETIMEOUT:
- printf("Time expired - sleeping for %u seconds\n", sleepSeconds);
- break;
- default:
- break;
- }
-
- esp_deep_sleep_start();
- }
-};
-
-void setup () {
- Serial.begin(115200);
-
- NimBLEDevice::init("Extended advertiser");
-
- /* Create the server and add the services/characteristics/descriptors */
- NimBLEServer *pServer = NimBLEDevice::createServer();
- pServer->setCallbacks(new ServerCallbacks);
-
- NimBLEService *pService = pServer->createService(SERVICE_UUID);
- NimBLECharacteristic *pCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID,
- NIMBLE_PROPERTY::READ |
- NIMBLE_PROPERTY::WRITE |
- NIMBLE_PROPERTY::NOTIFY);
-
- pCharacteristic->setValue("Hello World");
-
- /* Start the services */
- pService->start();
-
- /*
- * Create an extended advertisement with the instance ID 0 and set the PHY's.
- * Multiple instances can be added as long as the instance ID is incremented.
- */
- NimBLEExtAdvertisement extAdv(primaryPhy, secondaryPhy);
-
- /* Set the advertisement as connectable */
- extAdv.setConnectable(true);
-
- /* As per Bluetooth specification, extended advertising cannot be both scannable and connectable */
- extAdv.setScannable(false); // The default is false, set here for demonstration.
-
- /* Extended advertising allows for 251 bytes (minus header bytes ~20) in a single advertisement or up to 1650 if chained */
- extAdv.setServiceData(NimBLEUUID(SERVICE_UUID), std::string("Extended Advertising Demo.\r\n"
- "Extended advertising allows for "
- "251 bytes of data in a single advertisement,\r\n"
- "or up to 1650 bytes with chaining.\r\n"
- "This example message is 226 bytes long "
- "and is using CODED_PHY for long range."));
-
- extAdv.setCompleteServices16({NimBLEUUID(SERVICE_UUID)});
-
- /* When extended advertising is enabled `NimBLEDevice::getAdvertising` returns a pointer to `NimBLEExtAdvertising */
- NimBLEExtAdvertising* pAdvertising = NimBLEDevice::getAdvertising();
-
- /* Set the callbacks for advertising events */
- pAdvertising->setCallbacks(new advertisingCallbacks);
-
- /*
- * NimBLEExtAdvertising::setInstanceData takes the instance ID and
- * a reference to a `NimBLEExtAdvertisement` object. This sets the data
- * that will be advertised for this instance ID, returns true if successful.
- *
- * Note: It is safe to create the advertisement as a local variable if setInstanceData
- * is called before exiting the code block as the data will be copied.
- */
- if (pAdvertising->setInstanceData(0, extAdv)) {
- /*
- * `NimBLEExtAdvertising::start` takes the advertisement instance ID to start
- * and a duration in milliseconds or a max number of advertisements to send (or both).
- */
- if (pAdvertising->start(0, advTime)) {
- Serial.printf("Started advertising\n");
- } else {
- Serial.printf("Failed to start advertising\n");
- }
- } else {
- Serial.printf("Failed to register advertisment data\n");
- }
-
- esp_sleep_enable_timer_wakeup(sleepSeconds * 1000000);
-}
-
-void loop () {
-}
\ No newline at end of file
diff --git a/libraries/NimBLE-Arduino/examples/Bluetooth_5/NimBLE_multi_advertiser/NimBLE_multi_advertiser.ino b/libraries/NimBLE-Arduino/examples/Bluetooth_5/NimBLE_multi_advertiser/NimBLE_multi_advertiser.ino
deleted file mode 100644
index 73b7c89a..00000000
--- a/libraries/NimBLE-Arduino/examples/Bluetooth_5/NimBLE_multi_advertiser/NimBLE_multi_advertiser.ino
+++ /dev/null
@@ -1,181 +0,0 @@
-/** NimBLE Multi Advertiser Demo:
- *
- * Demonstrates the Bluetooth 5.x extended advertising capabilities.
- *
- * This demo will advertise 2 advertisements, and extended scannable instance
- * and a connectable legacy instance. They will advertise for 5 seconds then
- * sleep for 20 seconds. The extended scannable instance will use the scan
- * request callback to update it's data when a scan response is requested.
- *
- * Created: on April 9 2022
- * Author: H2zero
- *
-*/
-
-/****************************************************
- * For use with ESP32C3, ESP32S3, ESP32H2 ONLY! *
- /**************************************************/
-
-#include
-#if !CONFIG_BT_NIMBLE_EXT_ADV
-# error Must enable extended advertising, see nimconfig.h file.
-#endif
-
-#include "esp_sleep.h"
-
-#define SERVICE_UUID "ABCD"
-#define CHARACTERISTIC_UUID "1234"
-
-/* Time in milliseconds to advertise */
-static uint32_t advTime = 5000;
-
-/* Time to sleep between advertisements */
-static uint32_t sleepTime = 20;
-
-/* Primary PHY used for advertising, can be one of BLE_HCI_LE_PHY_1M or BLE_HCI_LE_PHY_CODED */
-static uint8_t primaryPhy = BLE_HCI_LE_PHY_CODED;
-
-/* Secondary PHY used for advertising and connecting,
- * can be one of BLE_HCI_LE_PHY_1M, BLE_HCI_LE_PHY_2M or BLE_HCI_LE_PHY_CODED
- */
-static uint8_t secondaryPhy = BLE_HCI_LE_PHY_1M;
-
-
-/* Handler class for server events */
-class ServerCallbacks: public NimBLEServerCallbacks {
- void onConnect(NimBLEServer* pServer, ble_gap_conn_desc* desc) {
- Serial.printf("Client connected: %s\n", NimBLEAddress(desc->peer_ota_addr).toString().c_str());
- };
-
- void onDisconnect(NimBLEServer* pServer) {
- Serial.printf("Client disconnected\n");
- // if still advertising we won't sleep yet.
- if (!pServer->getAdvertising()->isAdvertising()) {
- Serial.printf("Sleeping for %u seconds\n", sleepTime);
- esp_deep_sleep_start();
- }
- };
-};
-
-/* Callback class to handle advertising events */
-class advCallbacks: public NimBLEExtAdvertisingCallbacks {
- void onStopped(NimBLEExtAdvertising* pAdv, int reason, uint8_t inst_id) {
- /* Check the reason advertising stopped, don't sleep if client is connecting */
- Serial.printf("Advertising instance %u stopped\n", inst_id);
- switch (reason) {
- case 0:
- Serial.printf(" client connecting\n");
- return;
- case BLE_HS_ETIMEOUT:
- Serial.printf("Time expired - sleeping for %u seconds\n", sleepTime);
- break;
- default:
- break;
- }
-
- esp_deep_sleep_start();
- }
-
- bool m_updatedSR = false;
-
- void onScanRequest(NimBLEExtAdvertising* pAdv, uint8_t inst_id, NimBLEAddress addr) {
- Serial.printf("Scan request for instance %u\n", inst_id);
- // if the data has already been updated we don't need to change it again.
- if (!m_updatedSR) {
- Serial.printf("Updating scan data\n");
- NimBLEExtAdvertisement sr;
- sr.setServiceData(NimBLEUUID(SERVICE_UUID), std::string("Hello from scan response!"));
- pAdv->setScanResponseData(inst_id, sr);
- m_updatedSR = true;
- }
- }
-};
-
-void setup () {
- Serial.begin(115200);
-
- NimBLEDevice::init("Multi advertiser");
-
- /* Create a server for our legacy advertiser */
- NimBLEServer *pServer = NimBLEDevice::createServer();
- pServer->setCallbacks(new ServerCallbacks);
-
- NimBLEService *pService = pServer->createService(SERVICE_UUID);
- NimBLECharacteristic *pCharacteristic = pService->createCharacteristic(CHARACTERISTIC_UUID,
- NIMBLE_PROPERTY::READ |
- NIMBLE_PROPERTY::WRITE |
- NIMBLE_PROPERTY::NOTIFY);
-
- pCharacteristic->setValue("Hello World");
-
- /* Start the service */
- pService->start();
-
- /* Create our multi advertising instances */
-
- // extended scannable instance advertising on coded and 1m PHY's.
- NimBLEExtAdvertisement extScannable(primaryPhy, secondaryPhy);
-
- // Legacy advertising as a connectable device.
- NimBLEExtAdvertisement legacyConnectable;
-
- // Optional scan response data.
- NimBLEExtAdvertisement legacyScanResponse;
-
- /* As per Bluetooth specification, extended advertising cannot be both scannable and connectable */
- extScannable.setScannable(true);
- extScannable.setConnectable(false);
-
- /* Set the initial data */
- extScannable.setServiceData(NimBLEUUID(SERVICE_UUID), std::string("Scan me!"));
-
- /* enable the scan response callback, we will use this to update the data. */
- extScannable.enableScanRequestCallback(true);
-
- /* Optional custom address for this advertisment. */
- legacyConnectable.setAddress(NimBLEAddress("DE:AD:BE:EF:BA:AD"));
-
- /* Set the advertising data. */
- legacyConnectable.setName("Legacy");
- legacyConnectable.setCompleteServices16({NimBLEUUID(SERVICE_UUID)});
-
- /* Set the legacy and connectable flags. */
- legacyConnectable.setLegacyAdvertising(true);
- legacyConnectable.setConnectable(true);
-
- /* Put some data in the scan response if desired. */
- legacyScanResponse.setServiceData(NimBLEUUID(SERVICE_UUID), "Legacy SR");
-
- /* Get the advertising ready */
- NimBLEExtAdvertising* pAdvertising = NimBLEDevice::getAdvertising();
-
- /* Set the callbacks to handle advertising events */
- pAdvertising->setCallbacks(new advCallbacks);
-
- /* Set instance data.
- * Up to 5 instances can be used if configured in menuconfig, instance 0 is always available.
- *
- * We will set the extended scannable data on instance 0 and the legacy data on instance 1.
- * Note that the legacy scan response data needs to be set to the same instance (1).
- */
- if (pAdvertising->setInstanceData( 0, extScannable ) &&
- pAdvertising->setInstanceData( 1, legacyConnectable ) &&
- pAdvertising->setScanResponseData( 1, legacyScanResponse )) {
- /*
- * `NimBLEExtAdvertising::start` takes the advertisement instance ID to start
- * and a duration in milliseconds or a max number of advertisements to send (or both).
- */
- if (pAdvertising->start(0, advTime) && pAdvertising->start(1, advTime)) {
- Serial.printf("Started advertising\n");
- } else {
- Serial.printf("Failed to start advertising\n");
- }
- } else {
- Serial.printf("Failed to register advertisment data\n");
- }
-
- esp_sleep_enable_timer_wakeup(sleepTime * 1000000);
-}
-
-void loop(){
-}
diff --git a/libraries/NimBLE-Arduino/examples/NimBLE_Client/NimBLE_Client.ino b/libraries/NimBLE-Arduino/examples/NimBLE_Client/NimBLE_Client.ino
index 577f67ff..a3899cdd 100644
--- a/libraries/NimBLE-Arduino/examples/NimBLE_Client/NimBLE_Client.ino
+++ b/libraries/NimBLE-Arduino/examples/NimBLE_Client/NimBLE_Client.ino
@@ -347,11 +347,7 @@ void setup (){
NimBLEDevice::setSecurityAuth(/*BLE_SM_PAIR_AUTHREQ_BOND | BLE_SM_PAIR_AUTHREQ_MITM |*/ BLE_SM_PAIR_AUTHREQ_SC);
/** Optional: set the transmit power, default is 3db */
-#ifdef ESP_PLATFORM
NimBLEDevice::setPower(ESP_PWR_LVL_P9); /** +9db */
-#else
- NimBLEDevice::setPower(9); /** +9db */
-#endif
/** Optional: set any devices you don't want to get advertisments from */
// NimBLEDevice::addIgnored(NimBLEAddress ("aa:bb:cc:dd:ee:ff"));
diff --git a/libraries/NimBLE-Arduino/examples/NimBLE_Secure_Client/NimBLE_Secure_Client.ino b/libraries/NimBLE-Arduino/examples/NimBLE_Secure_Client/NimBLE_Secure_Client.ino
index bfa956a3..6f9af4f7 100644
--- a/libraries/NimBLE-Arduino/examples/NimBLE_Secure_Client/NimBLE_Secure_Client.ino
+++ b/libraries/NimBLE-Arduino/examples/NimBLE_Secure_Client/NimBLE_Secure_Client.ino
@@ -1,5 +1,5 @@
/** NimBLE_Secure_Client Demo:
- *
+ *
* This example demonstrates the secure passkey protected conenction and communication between an esp32 server and an esp32 client.
* Please note that esp32 stores auth info in nvs memory. After a successful connection it is possible that a passkey change will be ineffective.
* To avoid this clear the memory of the esp32's between security testings. esptool.py is capable of this, example: esptool.py --port /dev/ttyUSB0 erase_flash.
@@ -7,7 +7,7 @@
* Created: on Jan 08 2021
* Author: mblasee
*/
-
+
#include
class ClientCallbacks : public NimBLEClientCallbacks
@@ -28,11 +28,7 @@ void setup()
Serial.println("Starting NimBLE Client");
NimBLEDevice::init("");
-#ifdef ESP_PLATFORM
- NimBLEDevice::setPower(ESP_PWR_LVL_P9); /** +9db */
-#else
- NimBLEDevice::setPower(9); /** +9db */
-#endif
+ NimBLEDevice::setPower(ESP_PWR_LVL_P9);
NimBLEDevice::setSecurityAuth(true, true, true);
NimBLEDevice::setSecurityIOCap(BLE_HS_IO_KEYBOARD_ONLY);
NimBLEScan *pScan = NimBLEDevice::getScan();
@@ -57,7 +53,7 @@ void setup()
if (pService != nullptr)
{
NimBLERemoteCharacteristic *pNonSecureCharacteristic = pService->getCharacteristic("1234");
-
+
if (pNonSecureCharacteristic != nullptr)
{
// Testing to read a non secured characteristic, you should be able to read this even if you have mismatching passkeys.
@@ -72,11 +68,11 @@ void setup()
{
// Testing to read a secured characteristic, you should be able to read this only if you have matching passkeys, otherwise you should
// get an error like this. E NimBLERemoteCharacteristic: "<< readValue rc=261"
- // This means you are trying to do something without the proper permissions.
+ // This means you are trying to do something without the proper permissions.
std::string value = pSecureCharacteristic->readValue();
// print or do whatever you need with the value
Serial.println(value.c_str());
- }
+ }
}
}
else
diff --git a/libraries/NimBLE-Arduino/examples/NimBLE_Secure_Server/NimBLE_Secure_Server.ino b/libraries/NimBLE-Arduino/examples/NimBLE_Secure_Server/NimBLE_Secure_Server.ino
index b2aff626..f63cbc16 100644
--- a/libraries/NimBLE-Arduino/examples/NimBLE_Secure_Server/NimBLE_Secure_Server.ino
+++ b/libraries/NimBLE-Arduino/examples/NimBLE_Secure_Server/NimBLE_Secure_Server.ino
@@ -1,5 +1,5 @@
/** NimBLE_Secure_Server Demo:
- *
+ *
* This example demonstrates the secure passkey protected conenction and communication between an esp32 server and an esp32 client.
* Please note that esp32 stores auth info in nvs memory. After a successful connection it is possible that a passkey change will be ineffective.
* To avoid this clear the memory of the esp32's between security testings. esptool.py is capable of this, example: esptool.py --port /dev/ttyUSB0 erase_flash.
@@ -14,11 +14,7 @@ void setup() {
Serial.begin(115200);
Serial.println("Starting NimBLE Server");
NimBLEDevice::init("NimBLE");
-#ifdef ESP_PLATFORM
- NimBLEDevice::setPower(ESP_PWR_LVL_P9); /** +9db */
-#else
- NimBLEDevice::setPower(9); /** +9db */
-#endif
+ NimBLEDevice::setPower(ESP_PWR_LVL_P9);
NimBLEDevice::setSecurityAuth(true, true, true);
NimBLEDevice::setSecurityPasskey(123456);
diff --git a/libraries/NimBLE-Arduino/examples/NimBLE_Server/NimBLE_Server.ino b/libraries/NimBLE-Arduino/examples/NimBLE_Server/NimBLE_Server.ino
index 034fe24d..409ec64d 100644
--- a/libraries/NimBLE-Arduino/examples/NimBLE_Server/NimBLE_Server.ino
+++ b/libraries/NimBLE-Arduino/examples/NimBLE_Server/NimBLE_Server.ino
@@ -2,10 +2,10 @@
/** NimBLE_Server Demo:
*
* Demonstrates many of the available features of the NimBLE server library.
- *
+ *
* Created: on March 22 2020
* Author: H2zero
- *
+ *
*/
#include
@@ -13,16 +13,16 @@
static NimBLEServer* pServer;
/** None of these are required as they will be handled by the library with defaults. **
- ** Remove as you see fit for your needs */
+ ** Remove as you see fit for your needs */
class ServerCallbacks: public NimBLEServerCallbacks {
void onConnect(NimBLEServer* pServer) {
Serial.println("Client connected");
Serial.println("Multi-connect support: start advertising");
NimBLEDevice::startAdvertising();
};
- /** Alternative onConnect() method to extract details of the connection.
+ /** Alternative onConnect() method to extract details of the connection.
* See: src/ble_gap.h for the details of the ble_gap_conn_desc struct.
- */
+ */
void onConnect(NimBLEServer* pServer, ble_gap_conn_desc* desc) {
Serial.print("Client address: ");
Serial.println(NimBLEAddress(desc->peer_ota_addr).toString().c_str());
@@ -31,7 +31,7 @@ class ServerCallbacks: public NimBLEServerCallbacks {
* latency, supervision timeout.
* Units; Min/Max Intervals: 1.25 millisecond increments.
* Latency: number of intervals allowed to skip.
- * Timeout: 10 millisecond increments, try for 5x interval time for best results.
+ * Timeout: 10 millisecond increments, try for 5x interval time for best results.
*/
pServer->updateConnParams(desc->conn_handle, 24, 48, 0, 60);
};
@@ -42,25 +42,25 @@ class ServerCallbacks: public NimBLEServerCallbacks {
void onMTUChange(uint16_t MTU, ble_gap_conn_desc* desc) {
Serial.printf("MTU updated: %u for connection ID: %u\n", MTU, desc->conn_handle);
};
-
+
/********************* Security handled here **********************
****** Note: these are the same return values as defaults ********/
uint32_t onPassKeyRequest(){
Serial.println("Server Passkey Request");
- /** This should return a random 6 digit number for security
+ /** This should return a random 6 digit number for security
* or make your own static passkey as done here.
*/
- return 123456;
+ return 123456;
};
bool onConfirmPIN(uint32_t pass_key){
Serial.print("The passkey YES/NO number: ");Serial.println(pass_key);
/** Return false if passkeys don't match. */
- return true;
+ return true;
};
void onAuthenticationComplete(ble_gap_conn_desc* desc){
- /** Check that encryption was successful, if not we disconnect the client */
+ /** Check that encryption was successful, if not we disconnect the client */
if(!desc->sec_state.encrypted) {
NimBLEDevice::getServer()->disconnect(desc->conn_handle);
Serial.println("Encrypt connection failed - disconnecting client");
@@ -83,7 +83,7 @@ class CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
Serial.print(": onWrite(), value: ");
Serial.println(pCharacteristic->getValue().c_str());
};
- /** Called before notification or indication is sent,
+ /** Called before notification or indication is sent,
* the value can be changed here before sending if desired.
*/
void onNotify(NimBLECharacteristic* pCharacteristic) {
@@ -99,7 +99,7 @@ class CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
str += status;
str += ", return code: ";
str += code;
- str += ", ";
+ str += ", ";
str += NimBLEUtils::returnCodeToString(code);
Serial.println(str);
};
@@ -123,11 +123,11 @@ class CharacteristicCallbacks: public NimBLECharacteristicCallbacks {
Serial.println(str);
};
};
-
-/** Handler class for descriptor actions */
+
+/** Handler class for descriptor actions */
class DescriptorCallbacks : public NimBLEDescriptorCallbacks {
void onWrite(NimBLEDescriptor* pDescriptor) {
- std::string dscVal = pDescriptor->getValue();
+ std::string dscVal((char*)pDescriptor->getValue(), pDescriptor->getLength());
Serial.print("Descriptor witten value:");
Serial.println(dscVal.c_str());
};
@@ -139,7 +139,7 @@ class DescriptorCallbacks : public NimBLEDescriptorCallbacks {
};
-/** Define callback instances globally to use for multiple Charateristics \ Descriptors */
+/** Define callback instances globally to use for multiple Charateristics \ Descriptors */
static DescriptorCallbacks dscCallbacks;
static CharacteristicCallbacks chrCallbacks;
@@ -152,12 +152,8 @@ void setup() {
NimBLEDevice::init("NimBLE-Arduino");
/** Optional: set the transmit power, default is 3db */
-#ifdef ESP_PLATFORM
NimBLEDevice::setPower(ESP_PWR_LVL_P9); /** +9db */
-#else
- NimBLEDevice::setPower(9); /** +9db */
-#endif
-
+
/** Set the IO capabilities of the device, each option will trigger a different pairing method.
* BLE_HS_IO_DISPLAY_ONLY - Passkey pairing
* BLE_HS_IO_DISPLAY_YESNO - Numeric comparison pairing
@@ -168,10 +164,10 @@ void setup() {
/** 2 different ways to set security - both calls achieve the same result.
* no bonding, no man in the middle protection, secure connections.
- *
- * These are the default values, only shown here for demonstration.
- */
- //NimBLEDevice::setSecurityAuth(false, false, true);
+ *
+ * These are the default values, only shown here for demonstration.
+ */
+ //NimBLEDevice::setSecurityAuth(false, false, true);
NimBLEDevice::setSecurityAuth(/*BLE_SM_PAIR_AUTHREQ_BOND | BLE_SM_PAIR_AUTHREQ_MITM |*/ BLE_SM_PAIR_AUTHREQ_SC);
pServer = NimBLEDevice::createServer();
@@ -186,7 +182,7 @@ void setup() {
NIMBLE_PROPERTY::READ_ENC | // only allow reading if paired / encrypted
NIMBLE_PROPERTY::WRITE_ENC // only allow writing if paired / encrypted
);
-
+
pBeefCharacteristic->setValue("Burger");
pBeefCharacteristic->setCallbacks(&chrCallbacks);
@@ -195,10 +191,10 @@ void setup() {
* However we must cast the returned reference to the correct type as the method
* only returns a pointer to the base NimBLEDescriptor class.
*/
- NimBLE2904* pBeef2904 = (NimBLE2904*)pBeefCharacteristic->createDescriptor("2904");
+ NimBLE2904* pBeef2904 = (NimBLE2904*)pBeefCharacteristic->createDescriptor("2904");
pBeef2904->setFormat(NimBLE2904::FORMAT_UTF8);
pBeef2904->setCallbacks(&dscCallbacks);
-
+
NimBLEService* pBaadService = pServer->createService("BAAD");
NimBLECharacteristic* pFoodCharacteristic = pBaadService->createCharacteristic(
@@ -218,7 +214,7 @@ void setup() {
/** Custom descriptor: Arguments are UUID, Properties, max length in bytes of the value */
NimBLEDescriptor* pC01Ddsc = pFoodCharacteristic->createDescriptor(
"C01D",
- NIMBLE_PROPERTY::READ |
+ NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE|
NIMBLE_PROPERTY::WRITE_ENC, // only allow writing if paired / encrypted
20
@@ -226,7 +222,7 @@ void setup() {
pC01Ddsc->setValue("Send it back!");
pC01Ddsc->setCallbacks(&dscCallbacks);
- /** Start the services when finished creating all Characteristics and Descriptors */
+ /** Start the services when finished creating all Characteristics and Descriptors */
pDeadService->start();
pBaadService->start();
@@ -255,6 +251,6 @@ void loop() {
}
}
}
-
+
delay(2000);
}
\ No newline at end of file
diff --git a/libraries/NimBLE-Arduino/library.properties b/libraries/NimBLE-Arduino/library.properties
index d1b32b9c..cbea51f6 100644
--- a/libraries/NimBLE-Arduino/library.properties
+++ b/libraries/NimBLE-Arduino/library.properties
@@ -1,10 +1,10 @@
name=NimBLE-Arduino
-version=1.4.1
+version=1.3.5
author=h2zero
maintainer=h2zero
sentence=Bluetooth low energy (BLE) library for arduino-esp32 based on NimBLE.
paragraph=This is a more updated and lower resource alternative to the original bluedroid BLE library for esp32. Uses 50% less flash space and approximately 100KB less ram with the same functionality. Nearly 100% compatible with existing application code, migration guide included.
url=https://github.com/h2zero/NimBLE-Arduino
category=Communication
-architectures=esp32,arm-ble
+architectures=esp32
includes=NimBLEDevice.h
\ No newline at end of file
diff --git a/libraries/NimBLE-Arduino/src/nimble/CODING_STANDARDS.md b/libraries/NimBLE-Arduino/src/CODING_STANDARDS.md
similarity index 100%
rename from libraries/NimBLE-Arduino/src/nimble/CODING_STANDARDS.md
rename to libraries/NimBLE-Arduino/src/CODING_STANDARDS.md
diff --git a/libraries/NimBLE-Arduino/src/HIDTypes.h b/libraries/NimBLE-Arduino/src/HIDTypes.h
index 8ee31dae..726b84be 100644
--- a/libraries/NimBLE-Arduino/src/HIDTypes.h
+++ b/libraries/NimBLE-Arduino/src/HIDTypes.h
@@ -45,8 +45,13 @@
/* of data as per HID Class standard */
/* Main items */
-#define HIDINPUT(size) (0x80 | size)
-#define HIDOUTPUT(size) (0x90 | size)
+#ifdef ARDUINO_ARCH_ESP32
+#define HIDINPUT(size) (0x80 | size)
+#define HIDOUTPUT(size) (0x90 | size)
+#else
+#define INPUT(size) (0x80 | size)
+#define OUTPUT(size) (0x90 | size)
+#endif
#define FEATURE(size) (0xb0 | size)
#define COLLECTION(size) (0xa0 | size)
#define END_COLLECTION(size) (0xc0 | size)
diff --git a/libraries/NimBLE-Arduino/src/nimble/NOTICE b/libraries/NimBLE-Arduino/src/NOTICE
similarity index 61%
rename from libraries/NimBLE-Arduino/src/nimble/NOTICE
rename to libraries/NimBLE-Arduino/src/NOTICE
index 02fe5929..fc24c6ab 100644
--- a/libraries/NimBLE-Arduino/src/nimble/NOTICE
+++ b/libraries/NimBLE-Arduino/src/NOTICE
@@ -1,6 +1,5 @@
Apache Mynewt NimBLE
-Copyright 2015-2020 The Apache Software Foundation
-Modifications Copyright 2017-2020 Espressif Systems (Shanghai) CO., LTD.
+Copyright 2015-2018 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
diff --git a/libraries/NimBLE-Arduino/src/NimBLE2904.cpp b/libraries/NimBLE-Arduino/src/NimBLE2904.cpp
index b518d9b0..80318b5b 100644
--- a/libraries/NimBLE-Arduino/src/NimBLE2904.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLE2904.cpp
@@ -16,17 +16,20 @@
* See also:
* https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
#include "NimBLE2904.h"
-NimBLE2904::NimBLE2904(NimBLECharacteristic* pCharacteristic)
+NimBLE2904::NimBLE2904(NimBLECharacteristic* pCharacterisitic)
: NimBLEDescriptor(NimBLEUUID((uint16_t) 0x2904),
BLE_GATT_CHR_F_READ,
sizeof(BLE2904_Data),
- pCharacteristic)
+ pCharacterisitic)
{
m_data.m_format = 0;
m_data.m_exponent = 0;
@@ -83,4 +86,5 @@ void NimBLE2904::setUnit(uint16_t unit) {
setValue((uint8_t*) &m_data, sizeof(m_data));
} // setUnit
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif
diff --git a/libraries/NimBLE-Arduino/src/NimBLE2904.h b/libraries/NimBLE-Arduino/src/NimBLE2904.h
index 29dde51e..d8800dd2 100644
--- a/libraries/NimBLE-Arduino/src/NimBLE2904.h
+++ b/libraries/NimBLE-Arduino/src/NimBLE2904.h
@@ -14,8 +14,11 @@
#ifndef MAIN_NIMBLE2904_H_
#define MAIN_NIMBLE2904_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
#include "NimBLEDescriptor.h"
@@ -79,5 +82,6 @@ class NimBLE2904: public NimBLEDescriptor {
BLE2904_Data m_data;
}; // BLE2904
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif /* CONFIG_BT_ENABLED */
#endif /* MAIN_NIMBLE2904_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEAddress.cpp b/libraries/NimBLE-Arduino/src/NimBLEAddress.cpp
index d8ce5e88..e1d3e548 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEAddress.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEAddress.cpp
@@ -11,7 +11,7 @@
* Created on: Jul 2, 2017
* Author: kolban
*/
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include
@@ -156,7 +156,7 @@ std::string NimBLEAddress::toString() const {
/**
- * @brief Convenience operator to check if this address is equal to another.
+ * @brief Convienience operator to check if this address is equal to another.
*/
bool NimBLEAddress::operator ==(const NimBLEAddress & rhs) const {
return memcmp(rhs.m_address, m_address, sizeof m_address) == 0;
@@ -164,7 +164,7 @@ bool NimBLEAddress::operator ==(const NimBLEAddress & rhs) const {
/**
- * @brief Convenience operator to check if this address is not equal to another.
+ * @brief Convienience operator to check if this address is not equal to another.
*/
bool NimBLEAddress::operator !=(const NimBLEAddress & rhs) const {
return !this->operator==(rhs);
@@ -186,7 +186,7 @@ NimBLEAddress::operator std::string() const {
/**
- * @brief Convenience operator to convert the native address representation to uint_64.
+ * @brief Convienience operator to convert the native address representation to uint_64.
*/
NimBLEAddress::operator uint64_t() const {
uint64_t address = 0;
diff --git a/libraries/NimBLE-Arduino/src/NimBLEAddress.h b/libraries/NimBLE-Arduino/src/NimBLEAddress.h
index a6e10a09..50f9231f 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEAddress.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEAddress.h
@@ -14,15 +14,10 @@
#ifndef COMPONENTS_NIMBLEADDRESS_H_
#define COMPONENTS_NIMBLEADDRESS_H_
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "nimble/ble.h"
-#else
-#include "nimble/nimble/include/nimble/ble.h"
-#endif
-
/**** FIX COMPILATION ****/
#undef min
#undef max
diff --git a/libraries/NimBLE-Arduino/src/NimBLEAdvertisedDevice.cpp b/libraries/NimBLE-Arduino/src/NimBLEAdvertisedDevice.cpp
index b4fb0f4d..ecfd4981 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEAdvertisedDevice.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEAdvertisedDevice.cpp
@@ -11,17 +11,17 @@
* Created on: Jul 3, 2017
* Author: kolban
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
+#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
#include "NimBLEDevice.h"
#include "NimBLEAdvertisedDevice.h"
#include "NimBLEUtils.h"
#include "NimBLELog.h"
-#include
-
static const char* LOG_TAG = "NimBLEAdvertisedDevice";
@@ -52,9 +52,9 @@ NimBLEAddress NimBLEAdvertisedDevice::getAddress() {
* @brief Get the advertisement type.
* @return The advertising type the device is reporting:
* * BLE_HCI_ADV_TYPE_ADV_IND (0) - indirect advertising
- * * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertising - high duty cycle
+ * * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_HD (1) - direct advertisng - high duty cycle
* * BLE_HCI_ADV_TYPE_ADV_SCAN_IND (2) - indirect scan response
- * * BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertising - not connectable
+ * * BLE_HCI_ADV_TYPE_ADV_NONCONN_IND (3) - indirect advertisng - not connectable
* * BLE_HCI_ADV_TYPE_ADV_DIRECT_IND_LD (4) - direct advertising - low duty cycle
*/
uint8_t NimBLEAdvertisedDevice::getAdvType() {
@@ -66,12 +66,12 @@ uint8_t NimBLEAdvertisedDevice::getAdvType() {
* @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
- * typically in the form of an icon.
+ * typcially in the form of an icon.
*
* @return The appearance of the advertised device.
*/
uint16_t NimBLEAdvertisedDevice::getAppearance() {
- size_t data_loc = 0;
+ uint8_t data_loc = 0;
if(findAdvField(BLE_HS_ADV_TYPE_APPEARANCE, 0, &data_loc) > 0) {
ble_hs_adv_field *field = (ble_hs_adv_field *)&m_payload[data_loc];
@@ -89,7 +89,7 @@ uint16_t NimBLEAdvertisedDevice::getAppearance() {
* @return The advertisement interval in 0.625ms units.
*/
uint16_t NimBLEAdvertisedDevice::getAdvInterval() {
- size_t data_loc = 0;
+ uint8_t data_loc = 0;
if(findAdvField(BLE_HS_ADV_TYPE_ADV_ITVL, 0, &data_loc) > 0) {
ble_hs_adv_field *field = (ble_hs_adv_field *)&m_payload[data_loc];
@@ -107,7 +107,7 @@ uint16_t NimBLEAdvertisedDevice::getAdvInterval() {
* @return The preferred min connection interval in 1.25ms units.
*/
uint16_t NimBLEAdvertisedDevice::getMinInterval() {
- size_t data_loc = 0;
+ uint8_t data_loc = 0;
if(findAdvField(BLE_HS_ADV_TYPE_SLAVE_ITVL_RANGE, 0, &data_loc) > 0) {
ble_hs_adv_field *field = (ble_hs_adv_field *)&m_payload[data_loc];
@@ -125,7 +125,7 @@ uint16_t NimBLEAdvertisedDevice::getMinInterval() {
* @return The preferred max connection interval in 1.25ms units.
*/
uint16_t NimBLEAdvertisedDevice::getMaxInterval() {
- size_t data_loc = 0;
+ uint8_t data_loc = 0;
if(findAdvField(BLE_HS_ADV_TYPE_SLAVE_ITVL_RANGE, 0, &data_loc) > 0) {
ble_hs_adv_field *field = (ble_hs_adv_field *)&m_payload[data_loc];
@@ -143,7 +143,7 @@ uint16_t NimBLEAdvertisedDevice::getMaxInterval() {
* @return The manufacturer data of the advertised device.
*/
std::string NimBLEAdvertisedDevice::getManufacturerData() {
- size_t data_loc = 0;
+ uint8_t data_loc = 0;
if(findAdvField(BLE_HS_ADV_TYPE_MFG_DATA, 0, &data_loc) > 0) {
ble_hs_adv_field *field = (ble_hs_adv_field *)&m_payload[data_loc];
@@ -161,7 +161,7 @@ std::string NimBLEAdvertisedDevice::getManufacturerData() {
* @return The URI data.
*/
std::string NimBLEAdvertisedDevice::getURI() {
- size_t data_loc = 0;
+ uint8_t data_loc = 0;
if(findAdvField(BLE_HS_ADV_TYPE_URI, 0, &data_loc) > 0) {
ble_hs_adv_field *field = (ble_hs_adv_field *)&m_payload[data_loc];
@@ -179,7 +179,7 @@ std::string NimBLEAdvertisedDevice::getURI() {
* @return The name of the advertised device.
*/
std::string NimBLEAdvertisedDevice::getName() {
- size_t data_loc = 0;
+ uint8_t data_loc = 0;
if(findAdvField(BLE_HS_ADV_TYPE_COMP_NAME, 0, &data_loc) > 0 ||
findAdvField(BLE_HS_ADV_TYPE_INCOMP_NAME, 0, &data_loc) > 0)
@@ -216,7 +216,7 @@ NimBLEScan* NimBLEAdvertisedDevice::getScan() {
* @brief Get the number of target addresses.
* @return The number of addresses.
*/
-uint8_t NimBLEAdvertisedDevice::getTargetAddressCount() {
+size_t NimBLEAdvertisedDevice::getTargetAddressCount() {
uint8_t count = 0;
count = findAdvField(BLE_HS_ADV_TYPE_PUBLIC_TGT_ADDR);
@@ -234,7 +234,7 @@ uint8_t NimBLEAdvertisedDevice::getTargetAddressCount() {
NimBLEAddress NimBLEAdvertisedDevice::getTargetAddress(uint8_t index) {
ble_hs_adv_field *field = nullptr;
uint8_t count = 0;
- size_t data_loc = ULONG_MAX;
+ uint8_t data_loc = 0xFF;
index++;
count = findAdvField(BLE_HS_ADV_TYPE_PUBLIC_TGT_ADDR, index, &data_loc);
@@ -244,7 +244,7 @@ NimBLEAddress NimBLEAdvertisedDevice::getTargetAddress(uint8_t index) {
count = findAdvField(BLE_HS_ADV_TYPE_RANDOM_TGT_ADDR, index, &data_loc);
}
- if(count > 0 && data_loc != ULONG_MAX) {
+ if(count > 0 && data_loc != 0xFF) {
field = (ble_hs_adv_field *)&m_payload[data_loc];
if(field->length < index * BLE_HS_ADV_PUBLIC_TGT_ADDR_ENTRY_LEN) {
index -= count - field->length / BLE_HS_ADV_PUBLIC_TGT_ADDR_ENTRY_LEN;
@@ -266,9 +266,9 @@ NimBLEAddress NimBLEAdvertisedDevice::getTargetAddress(uint8_t index) {
std::string NimBLEAdvertisedDevice::getServiceData(uint8_t index) {
ble_hs_adv_field *field = nullptr;
uint8_t bytes;
- size_t data_loc = findServiceData(index, &bytes);
+ uint8_t data_loc = findServiceData(index, &bytes);
- if(data_loc != ULONG_MAX) {
+ if(data_loc != 0xFF) {
field = (ble_hs_adv_field *)&m_payload[data_loc];
if(field->length > bytes) {
return std::string((char*)(field->value + bytes), field->length - bytes - 1);
@@ -288,9 +288,9 @@ std::string NimBLEAdvertisedDevice::getServiceData(const NimBLEUUID &uuid) {
ble_hs_adv_field *field = nullptr;
uint8_t bytes;
uint8_t index = 0;
- size_t data_loc = findServiceData(index, &bytes);
- size_t plSize = m_payload.size() - 2;
+ uint8_t data_loc = findServiceData(index, &bytes);
uint8_t uuidBytes = uuid.bitSize() / 8;
+ uint8_t plSize = m_payload.size() - 2;
while(data_loc < plSize) {
field = (ble_hs_adv_field *)&m_payload[data_loc];
@@ -308,16 +308,16 @@ std::string NimBLEAdvertisedDevice::getServiceData(const NimBLEUUID &uuid) {
/**
- * @brief Get the UUID of the service data at the index.
+ * @brief Get the UUID of the serice data at the index.
* @param [in] index The index of the service data UUID requested.
* @return The advertised service data UUID or an empty UUID if not found.
*/
NimBLEUUID NimBLEAdvertisedDevice::getServiceDataUUID(uint8_t index) {
ble_hs_adv_field *field = nullptr;
uint8_t bytes;
- size_t data_loc = findServiceData(index, &bytes);
+ uint8_t data_loc = findServiceData(index, &bytes);
- if(data_loc != ULONG_MAX) {
+ if(data_loc != 0xFF) {
field = (ble_hs_adv_field *)&m_payload[data_loc];
if(field->length >= bytes) {
return NimBLEUUID(field->value, bytes, false);
@@ -332,10 +332,10 @@ NimBLEUUID NimBLEAdvertisedDevice::getServiceDataUUID(uint8_t index) {
* @brief Find the service data at the index.
* @param [in] index The index of the service data to find.
* @param [in] bytes A pointer to storage for the number of the bytes in the UUID.
- * @return The index in the vector where the data is located, ULONG_MAX if not found.
+ * @return The index in the vector where the data is located, 0xFF if not found.
*/
-size_t NimBLEAdvertisedDevice::findServiceData(uint8_t index, uint8_t *bytes) {
- size_t data_loc = 0;
+uint8_t NimBLEAdvertisedDevice::findServiceData(uint8_t index, uint8_t *bytes) {
+ uint8_t data_loc = 0;
uint8_t found = 0;
*bytes = 0;
@@ -360,7 +360,7 @@ size_t NimBLEAdvertisedDevice::findServiceData(uint8_t index, uint8_t *bytes) {
return data_loc;
}
- return ULONG_MAX;
+ return 0xFF;
}
@@ -368,7 +368,7 @@ size_t NimBLEAdvertisedDevice::findServiceData(uint8_t index, uint8_t *bytes) {
* @brief Get the count of advertised service data UUIDS
* @return The number of service data UUIDS in the vector.
*/
-uint8_t NimBLEAdvertisedDevice::getServiceDataCount() {
+size_t NimBLEAdvertisedDevice::getServiceDataCount() {
uint8_t count = 0;
count += findAdvField(BLE_HS_ADV_TYPE_SVC_DATA_UUID16);
@@ -386,7 +386,7 @@ uint8_t NimBLEAdvertisedDevice::getServiceDataCount() {
*/
NimBLEUUID NimBLEAdvertisedDevice::getServiceUUID(uint8_t index) {
uint8_t count = 0;
- size_t data_loc = 0;
+ uint8_t data_loc = 0;
uint8_t uuidBytes = 0;
uint8_t type = BLE_HS_ADV_TYPE_INCOMP_UUIDS16;
ble_hs_adv_field *field = nullptr;
@@ -433,7 +433,7 @@ NimBLEUUID NimBLEAdvertisedDevice::getServiceUUID(uint8_t index) {
* @brief Get the number of services advertised
* @return The count of services in the advertising packet.
*/
-uint8_t NimBLEAdvertisedDevice::getServiceUUIDCount() {
+size_t NimBLEAdvertisedDevice::getServiceUUIDCount() {
uint8_t count = 0;
count += findAdvField(BLE_HS_ADV_TYPE_INCOMP_UUIDS16);
@@ -448,7 +448,7 @@ uint8_t NimBLEAdvertisedDevice::getServiceUUIDCount() {
/**
- * @brief Check advertised services for existence of the required UUID
+ * @brief Check advertised services for existance of the required UUID
* @param [in] uuid The service uuid to look for in the advertisement.
* @return Return true if service is advertised
*/
@@ -469,7 +469,7 @@ bool NimBLEAdvertisedDevice::isAdvertisingService(const NimBLEUUID &uuid) {
* @return The TX Power of the advertised device.
*/
int8_t NimBLEAdvertisedDevice::getTXPower() {
- size_t data_loc = 0;
+ uint8_t data_loc = 0;
if(findAdvField(BLE_HS_ADV_TYPE_TX_PWR_LVL, 0, &data_loc) > 0) {
ble_hs_adv_field *field = (ble_hs_adv_field *)&m_payload[data_loc];
@@ -583,60 +583,17 @@ bool NimBLEAdvertisedDevice::haveTXPower() {
} // haveTXPower
-#if CONFIG_BT_NIMBLE_EXT_ADV
-/**
- * @brief Get the set ID of the extended advertisement.
- * @return The set ID.
- */
-uint8_t NimBLEAdvertisedDevice::getSetId() {
- return m_sid;
-} // getSetId
-
-
-/**
- * @brief Get the primary PHY used by this advertisement.
- * @return The PHY type, one of:
- * * BLE_HCI_LE_PHY_1M
- * * BLE_HCI_LE_PHY_CODED
- */
-uint8_t NimBLEAdvertisedDevice::getPrimaryPhy() {
- return m_primPhy;
-} // getPrimaryPhy
-
-
-/**
- * @brief Get the primary PHY used by this advertisement.
- * @return The PHY type, one of:
- * * BLE_HCI_LE_PHY_1M
- * * BLE_HCI_LE_PHY_2M
- * * BLE_HCI_LE_PHY_CODED
- */
-uint8_t NimBLEAdvertisedDevice::getSecondaryPhy() {
- return m_secPhy;
-} // getSecondaryPhy
-
-
-/**
- * @brief Get the periodic interval of the advertisement.
- * @return The periodic advertising interval, 0 if not periodic advertising.
- */
-uint16_t NimBLEAdvertisedDevice::getPeriodicInterval() {
- return m_periodicItvl;
-} // getPeriodicInterval
-#endif
-
-
-uint8_t NimBLEAdvertisedDevice::findAdvField(uint8_t type, uint8_t index, size_t * data_loc) {
+uint8_t NimBLEAdvertisedDevice::findAdvField(uint8_t type, uint8_t index, uint8_t *data_loc) {
ble_hs_adv_field *field = nullptr;
- size_t length = m_payload.size();
- size_t data = 0;
- uint8_t count = 0;
+ uint8_t data = 0;
+ uint8_t length = m_payload.size();
+ uint8_t count = 0;
- if (length < 3) {
+ if(length < 2) {
return count;
}
- while (length > 2) {
+ while (length > 1) {
field = (ble_hs_adv_field*)&m_payload[data];
if (field->length >= length) {
@@ -644,7 +601,7 @@ uint8_t NimBLEAdvertisedDevice::findAdvField(uint8_t type, uint8_t index, size_t
}
if (field->type == type) {
- switch (type) {
+ switch(type) {
case BLE_HS_ADV_TYPE_INCOMP_UUIDS16:
case BLE_HS_ADV_TYPE_COMP_UUIDS16:
count += field->length / 2;
@@ -670,8 +627,8 @@ uint8_t NimBLEAdvertisedDevice::findAdvField(uint8_t type, uint8_t index, size_t
break;
}
- if (data_loc != nullptr) {
- if (index == 0 || count >= index) {
+ if(data_loc != nullptr) {
+ if(index == 0 || count >= index) {
break;
}
}
@@ -681,7 +638,7 @@ uint8_t NimBLEAdvertisedDevice::findAdvField(uint8_t type, uint8_t index, size_t
data += 1 + field->length;
}
- if (data_loc != nullptr && field != nullptr) {
+ if(data_loc != nullptr && field != nullptr) {
*data_loc = data;
}
@@ -702,13 +659,8 @@ void NimBLEAdvertisedDevice::setAddress(NimBLEAddress address) {
* @brief Set the adFlag for this device.
* @param [in] advType The advertisement flag data from the advertisement.
*/
-void NimBLEAdvertisedDevice::setAdvType(uint8_t advType, bool isLegacyAdv) {
+void NimBLEAdvertisedDevice::setAdvType(uint8_t advType) {
m_advType = advType;
-#if CONFIG_BT_NIMBLE_EXT_ADV
- m_isLegacyAdv = isLegacyAdv;
-#else
- (void)isLegacyAdv;
-#endif
} // setAdvType
@@ -753,10 +705,10 @@ std::string NimBLEAdvertisedDevice::toString() {
res += val;
}
- if (haveServiceData()) {
- uint8_t count = getServiceDataCount();
+ if(haveServiceData()) {
+ size_t count = getServiceDataCount();
res += "\nService Data:";
- for(uint8_t i = 0; i < count; i++) {
+ for(size_t i = 0; i < count; i++) {
res += "\nUUID: " + std::string(getServiceDataUUID(i));
res += ", Data: " + getServiceData(i);
}
@@ -794,7 +746,7 @@ void NimBLEAdvertisedDevice::setPayload(const uint8_t *payload, uint8_t length,
/**
* @brief Get the length of the advertisement data in the payload.
- * @return The number of bytes in the payload that is from the advertisement.
+ * @return The number of bytes in the payload that is from the advertisment.
*/
uint8_t NimBLEAdvertisedDevice::getAdvLength() {
return m_advLength;
@@ -832,33 +784,6 @@ size_t NimBLEAdvertisedDevice::getPayloadLength() {
} // getPayloadLength
-/**
- * @brief Check if this device is advertising as connectable.
- * @return True if the device is connectable.
- */
-bool NimBLEAdvertisedDevice::isConnectable() {
-#if CONFIG_BT_NIMBLE_EXT_ADV
- if (m_isLegacyAdv) {
- return m_advType == BLE_HCI_ADV_RPT_EVTYPE_ADV_IND ||
- m_advType == BLE_HCI_ADV_RPT_EVTYPE_DIR_IND;
- }
-#endif
- return (m_advType & BLE_HCI_ADV_CONN_MASK) ||
- (m_advType & BLE_HCI_ADV_DIRECT_MASK);
-} // isConnectable
-
-
-/**
- * @brief Check if this advertisement is a legacy or extended type
- * @return True if legacy (Bluetooth 4.x), false if extended (bluetooth 5.x).
- */
-bool NimBLEAdvertisedDevice::isLegacyAdvertisement() {
-#if CONFIG_BT_NIMBLE_EXT_ADV
- return m_isLegacyAdv;
-# else
- return true;
-#endif
-} // isLegacyAdvertisement
-
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif /* CONFIG_BT_ENABLED */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEAdvertisedDevice.h b/libraries/NimBLE-Arduino/src/NimBLEAdvertisedDevice.h
index 772bab91..7d378ed0 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEAdvertisedDevice.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEAdvertisedDevice.h
@@ -14,22 +14,20 @@
#ifndef COMPONENTS_NIMBLEADVERTISEDDEVICE_H_
#define COMPONENTS_NIMBLEADVERTISEDDEVICE_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
+#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
#include "NimBLEAddress.h"
#include "NimBLEScan.h"
#include "NimBLEUUID.h"
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "host/ble_hs_adv.h"
-#else
-#include "nimble/nimble/host/include/host/ble_hs_adv.h"
-#endif
#include
#include
-#include
class NimBLEScan;
@@ -71,7 +69,7 @@ class NimBLEAdvertisedDevice {
std::string getName();
int getRSSI();
NimBLEScan* getScan();
- uint8_t getServiceDataCount();
+ size_t getServiceDataCount();
std::string getServiceData(uint8_t index = 0);
std::string getServiceData(const NimBLEUUID &uuid);
@@ -111,9 +109,9 @@ class NimBLEAdvertisedDevice {
NimBLEUUID getServiceDataUUID(uint8_t index = 0);
NimBLEUUID getServiceUUID(uint8_t index = 0);
- uint8_t getServiceUUIDCount();
+ size_t getServiceUUIDCount();
NimBLEAddress getTargetAddress(uint8_t index = 0);
- uint8_t getTargetAddressCount();
+ size_t getTargetAddressCount();
int8_t getTXPower();
uint8_t* getPayload();
uint8_t getAdvLength();
@@ -133,30 +131,16 @@ class NimBLEAdvertisedDevice {
bool haveTargetAddress();
bool haveURI();
std::string toString();
- bool isConnectable();
- bool isLegacyAdvertisement();
-#if CONFIG_BT_NIMBLE_EXT_ADV
- uint8_t getSetId();
- uint8_t getPrimaryPhy();
- uint8_t getSecondaryPhy();
- uint16_t getPeriodicInterval();
-#endif
private:
friend class NimBLEScan;
void setAddress(NimBLEAddress address);
- void setAdvType(uint8_t advType, bool isLegacyAdv);
+ void setAdvType(uint8_t advType);
void setPayload(const uint8_t *payload, uint8_t length, bool append);
void setRSSI(int rssi);
-#if CONFIG_BT_NIMBLE_EXT_ADV
- void setSetId(uint8_t sid) { m_sid = sid; }
- void setPrimaryPhy(uint8_t phy) { m_primPhy = phy; }
- void setSecondaryPhy(uint8_t phy) { m_secPhy = phy; }
- void setPeriodicInterval(uint16_t itvl) { m_periodicItvl = itvl; }
-#endif
- uint8_t findAdvField(uint8_t type, uint8_t index = 0, size_t * data_loc = nullptr);
- size_t findServiceData(uint8_t index, uint8_t* bytes);
+ uint8_t findAdvField(uint8_t type, uint8_t index = 0, uint8_t *data_loc = nullptr);
+ uint8_t findServiceData(uint8_t index, uint8_t* bytes);
NimBLEAddress m_address = NimBLEAddress("");
uint8_t m_advType;
@@ -164,13 +148,6 @@ class NimBLEAdvertisedDevice {
time_t m_timestamp;
bool m_callbackSent;
uint8_t m_advLength;
-#if CONFIG_BT_NIMBLE_EXT_ADV
- bool m_isLegacyAdv;
- uint8_t m_sid;
- uint8_t m_primPhy;
- uint8_t m_secPhy;
- uint16_t m_periodicItvl;
-#endif
std::vector m_payload;
};
@@ -194,5 +171,6 @@ class NimBLEAdvertisedDeviceCallbacks {
virtual void onResult(NimBLEAdvertisedDevice* advertisedDevice) = 0;
};
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER */
+#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif /* CONFIG_BT_ENABLED */
#endif /* COMPONENTS_NIMBLEADVERTISEDDEVICE_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEAdvertising.cpp b/libraries/NimBLE-Arduino/src/NimBLEAdvertising.cpp
index e45316d6..3112efff 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEAdvertising.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEAdvertising.cpp
@@ -13,16 +13,13 @@
* Author: kolban
*
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if (defined(CONFIG_BT_ENABLED) && \
- defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && \
- !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
+#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "services/gap/ble_svc_gap.h"
-#else
-#include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
-#endif
#include "NimBLEAdvertising.h"
#include "NimBLEDevice.h"
#include "NimBLEServer.h"
@@ -71,7 +68,6 @@ 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
@@ -414,7 +410,7 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv
// If already advertising just return
if(ble_gap_adv_active()) {
NIMBLE_LOGW(LOG_TAG, "Advertising already active");
- return true;
+ return false;
}
// Save the duration incase of host reset so we can restart with the same params
@@ -434,16 +430,15 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv
if(m_advParams.conn_mode == BLE_GAP_CONN_MODE_NON) {
if(!m_scanResp) {
m_advParams.disc_mode = BLE_GAP_DISC_MODE_NON;
- // non-connectable advertising does not require AD flags.
- m_advData.flags = 0;
+ m_advData.flags = BLE_HS_ADV_F_BREDR_UNSUP;
}
}
int rc = 0;
if (!m_customAdvData && !m_advDataSet) {
- //start with 3 bytes for the flags data if required
- uint8_t payloadLen = (m_advData.flags > 0) ? (2 + 1) : 0;
+ //start with 3 bytes for the flags data
+ uint8_t payloadLen = (2 + 1);
if(m_advData.mfg_data_len > 0)
payloadLen += (2 + m_advData.mfg_data_len);
@@ -628,7 +623,7 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv
&m_advParams,
(pServer != nullptr) ? NimBLEServer::handleGapEvent :
NimBLEAdvertising::handleGapEvent,
- (void*)this);
+ (pServer != nullptr) ? (void*)pServer : (void*)this);
#else
rc = ble_gap_adv_start(NimBLEDevice::m_own_addr_type, NULL, duration,
&m_advParams, NimBLEAdvertising::handleGapEvent, this);
@@ -637,10 +632,6 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv
case 0:
break;
- case BLE_HS_EALREADY:
- NIMBLE_LOGI(LOG_TAG, "Advertisement Already active");
- break;
-
case BLE_HS_EINVAL:
NIMBLE_LOGE(LOG_TAG, "Unable to advertise - Duration too long");
break;
@@ -662,27 +653,29 @@ bool NimBLEAdvertising::start(uint32_t duration, void (*advCompleteCB)(NimBLEAdv
break;
}
+ if(rc != 0) {
+ return false;
+ }
+
NIMBLE_LOGD(LOG_TAG, "<< Advertising start");
- return (rc == 0 || rc == BLE_HS_EALREADY);
+ return true;
} // start
/**
* @brief Stop advertising.
- * @return True if advertising stopped successfully.
*/
-bool NimBLEAdvertising::stop() {
+void NimBLEAdvertising::stop() {
NIMBLE_LOGD(LOG_TAG, ">> stop");
int rc = ble_gap_adv_stop();
if (rc != 0 && rc != BLE_HS_EALREADY) {
NIMBLE_LOGE(LOG_TAG, "ble_gap_adv_stop rc=%d %s",
rc, NimBLEUtils::returnCodeToString(rc));
- return false;
+ return;
}
NIMBLE_LOGD(LOG_TAG, "<< stop");
- return true;
} // stop
@@ -758,7 +751,7 @@ int NimBLEAdvertising::handleGapEvent(struct ble_gap_event *event, void *arg) {
*/
void NimBLEAdvertisementData::addData(const std::string &data) {
if ((m_payload.length() + data.length()) > BLE_HS_ADV_MAX_SZ) {
- NIMBLE_LOGE(LOG_TAG, "Advertisement data length exceeded");
+ NIMBLE_LOGE(LOG_TAG, "Advertisement data length exceded");
return;
}
m_payload.append(data);
@@ -1035,4 +1028,5 @@ std::string NimBLEAdvertisementData::getPayload() {
return m_payload;
} // getPayload
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif /* CONFIG_BT_ENABLED */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEAdvertising.h b/libraries/NimBLE-Arduino/src/NimBLEAdvertising.h
index dd72ede4..17a86656 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEAdvertising.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEAdvertising.h
@@ -14,17 +14,13 @@
#ifndef MAIN_BLEADVERTISING_H_
#define MAIN_BLEADVERTISING_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if (defined(CONFIG_BT_ENABLED) && \
- defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && \
- !CONFIG_BT_NIMBLE_EXT_ADV) || defined(_DOXYGEN_)
+#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "host/ble_gap.h"
-#else
-#include "nimble/nimble/host/include/host/ble_gap.h"
-#endif
-
/**** FIX COMPILATION ****/
#undef min
#undef max
@@ -91,7 +87,7 @@ class NimBLEAdvertising {
void addServiceUUID(const char* serviceUUID);
void removeServiceUUID(const NimBLEUUID &serviceUUID);
bool start(uint32_t duration = 0, void (*advCompleteCB)(NimBLEAdvertising *pAdv) = nullptr);
- bool stop();
+ void stop();
void setAppearance(uint16_t appearance);
void setName(const std::string &name);
void setManufacturerData(const std::string &data);
@@ -113,7 +109,6 @@ class NimBLEAdvertising {
private:
friend class NimBLEDevice;
- friend class NimBLEServer;
void onHostSync();
static int handleGapEvent(struct ble_gap_event *event, void *arg);
@@ -137,5 +132,6 @@ class NimBLEAdvertising {
std::vector m_uri;
};
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && !CONFIG_BT_NIMBLE_EXT_ADV */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif /* CONFIG_BT_ENABLED */
#endif /* MAIN_BLEADVERTISING_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEAttValue.h b/libraries/NimBLE-Arduino/src/NimBLEAttValue.h
deleted file mode 100644
index be346d50..00000000
--- a/libraries/NimBLE-Arduino/src/NimBLEAttValue.h
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * NimBLEAttValue.h
- *
- * Created: on March 18, 2021
- * Author H2zero
- *
- */
-
-#ifndef MAIN_NIMBLEATTVALUE_H_
-#define MAIN_NIMBLEATTVALUE_H_
-#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED)
-
-#ifdef NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
-#include
-#endif
-
-#include "NimBLELog.h"
-
-/**** FIX COMPILATION ****/
-#undef min
-#undef max
-/**************************/
-
-#include
-#include
-
-#ifndef CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
-# define CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED 0
-#endif
-
-#if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
-# include
-#endif
-
-#if !defined(CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH)
-# define CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH 20
-#elif CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH > BLE_ATT_ATTR_MAX_LEN
-# error CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH cannot be larger than 512 (BLE_ATT_ATTR_MAX_LEN)
-#elif CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH < 1
-# error CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH cannot be less than 1; Range = 1 : 512
-#endif
-
-
-/* Used to determine if the type passed to a template has a c_str() and length() method. */
-template
-struct Has_c_str_len : std::false_type {};
-
-template
-struct Has_c_str_len().c_str())),
- decltype(void(std::declval().length()))> : std::true_type {};
-
-
-/**
- * @brief A specialized container class to hold BLE attribute values.
- * @details This class is designed to be more memory efficient than using\n
- * standard container types for value storage, while being convertible to\n
- * many different container classes.
- */
-class NimBLEAttValue
-{
- uint8_t* m_attr_value = nullptr;
- uint16_t m_attr_max_len = 0;
- uint16_t m_attr_len = 0;
- uint16_t m_capacity = 0;
-#if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
- time_t m_timestamp = 0;
-#endif
- void deepCopy(const NimBLEAttValue & source);
-
-public:
- /**
- * @brief Default constructor.
- * @param[in] init_len The initial size in bytes.
- * @param[in] max_len The max size in bytes that the value can be.
- */
- NimBLEAttValue(uint16_t init_len = CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH,
- uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
-
- /**
- * @brief Construct with an initial value from a buffer.
- * @param value A pointer to the initial value to set.
- * @param[in] len The size in bytes of the value to set.
- * @param[in] max_len The max size in bytes that the value can be.
- */
- NimBLEAttValue(const uint8_t *value, uint16_t len,
- uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
-
- /**
- * @brief Construct with an initializer list.
- * @param list An initializer list containing the initial value to set.
- * @param[in] max_len The max size in bytes that the value can be.
- */
- NimBLEAttValue(std::initializer_list list,
- uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
- :NimBLEAttValue(list.begin(), (uint16_t)list.size(), max_len){}
-
- /**
- * @brief Construct with an initial value from a const char string.
- * @param value A pointer to the initial value to set.
- * @param[in] max_len The max size in bytes that the value can be.
- */
- NimBLEAttValue(const char *value, uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
- :NimBLEAttValue((uint8_t*)value, (uint16_t)strlen(value), max_len){}
-
- /**
- * @brief Construct with an initial value from a std::string.
- * @param str A std::string containing to the initial value to set.
- * @param[in] max_len The max size in bytes that the value can be.
- */
- NimBLEAttValue(const std::string str, uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
- :NimBLEAttValue((uint8_t*)str.data(), (uint16_t)str.length(), max_len){}
-
- /**
- * @brief Construct with an initial value from a std::vector.
- * @param vec A std::vector containing to the initial value to set.
- * @param[in] max_len The max size in bytes that the value can be.
- */
- NimBLEAttValue(const std::vector vec, uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
- :NimBLEAttValue(&vec[0], (uint16_t)vec.size(), max_len){}
-
-#ifdef NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
- /**
- * @brief Construct with an initial value from an Arduino String.
- * @param str An Arduino String containing to the initial value to set.
- * @param[in] max_len The max size in bytes that the value can be.
- */
- NimBLEAttValue(const String str, uint16_t max_len = BLE_ATT_ATTR_MAX_LEN)
- :NimBLEAttValue((uint8_t*)str.c_str(), str.length(), max_len){}
-#endif
-
- /** @brief Copy constructor */
- NimBLEAttValue(const NimBLEAttValue & source) { deepCopy(source); }
-
- /** @brief Move constructor */
- NimBLEAttValue(NimBLEAttValue && source) { *this = std::move(source); }
-
- /** @brief Destructor */
- ~NimBLEAttValue();
-
- /** @brief Returns the max size in bytes */
- uint16_t max_size() const { return m_attr_max_len; }
-
- /** @brief Returns the currently allocated capacity in bytes */
- uint16_t capacity() const { return m_capacity; }
-
- /** @brief Returns the current length of the value in bytes */
- uint16_t length() const { return m_attr_len; }
-
- /** @brief Returns the current size of the value in bytes */
- uint16_t size() const { return m_attr_len; }
-
- /** @brief Returns a pointer to the internal buffer of the value */
- const uint8_t* data() const { return m_attr_value; }
-
- /** @brief Returns a pointer to the internal buffer of the value as a const char* */
- const char* c_str() const { return (const char*)m_attr_value; }
-
- /** @brief Iterator begin */
- const uint8_t* begin() const { return m_attr_value; }
-
- /** @brief Iterator end */
- const uint8_t* end() const { return m_attr_value + m_attr_len; }
-
-#if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
- /** @brief Returns a timestamp of when the value was last updated */
- time_t getTimeStamp() const { return m_timestamp; }
-
- /** @brief Set the timestamp to the current time */
- void setTimeStamp() { m_timestamp = time(nullptr); }
-
- /**
- * @brief Set the timestamp to the specified time
- * @param[in] t The timestamp value to set
- */
- void setTimeStamp(time_t t) { m_timestamp = t; }
-#else
- time_t getTimeStamp() const { return 0; }
- void setTimeStamp() { }
- void setTimeStamp(time_t t) { }
-#endif
-
- /**
- * @brief Set the value from a buffer
- * @param[in] value A ponter to a buffer containing the value.
- * @param[in] len The length of the value in bytes.
- * @returns True if successful.
- */
- bool setValue(const uint8_t *value, uint16_t len);
-
- /**
- * @brief Set value to the value of const char*.
- * @param [in] s A ponter to a const char value to set.
- */
- bool setValue(const char* s) {
- return setValue((uint8_t*)s, (uint16_t)strlen(s)); }
-
- /**
- * @brief Get a pointer to the value buffer with timestamp.
- * @param[in] timestamp A ponter to a time_t variable to store the timestamp.
- * @returns A pointer to the internal value buffer.
- */
- const uint8_t* getValue(time_t *timestamp);
-
- /**
- * @brief Append data to the value.
- * @param[in] value A ponter to a data buffer with the value to append.
- * @param[in] len The length of the value to append in bytes.
- * @returns A reference to the appended NimBLEAttValue.
- */
- NimBLEAttValue& append(const uint8_t *value, uint16_t len);
-
-
- /*********************** Template Functions ************************/
-
- /**
- * @brief Template to set value to the value of val.
- * @param [in] s The value to set.
- * @details Only used for types without a `c_str()` method.
- */
- template
-#ifdef _DOXYGEN_
- bool
-#else
- typename std::enable_if::value, bool>::type
-#endif
- setValue(const T &s) {
- return setValue((uint8_t*)&s, sizeof(T));
- }
-
- /**
- * @brief Template to set value to the value of val.
- * @param [in] s The value to set.
- * @details Only used if the has a `c_str()` method.
- */
- template
-#ifdef _DOXYGEN_
- bool
-#else
- typename std::enable_if::value, bool>::type
-#endif
- setValue(const T & s) {
- return setValue((uint8_t*)s.c_str(), (uint16_t)s.length());
- }
-
- /**
- * @brief Template to return the value as a .
- * @tparam T The type to convert the data to.
- * @param [in] timestamp A pointer to a time_t struct to store the time the value was read.
- * @param [in] skipSizeCheck If true it will skip checking if the data size is less than\n
- * sizeof() .
- * @return The data converted to or NULL if skipSizeCheck is false and the data is\n
- * less than sizeof() .
- * @details Use: getValue(×tamp, skipSizeCheck);
- */
- template
- T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
- if(!skipSizeCheck && size() < sizeof(T)) {
- return T();
- }
- return *((T *)getValue(timestamp));
- }
-
-
- /*********************** Operators ************************/
-
- /** @brief Subscript operator */
- uint8_t operator [](int pos) const {
- assert(pos < m_attr_len && "out of range"); return m_attr_value[pos]; }
-
- /** @brief Operator; Get the value as a std::vector. */
- operator std::vector() const {
- return std::vector(m_attr_value, m_attr_value + m_attr_len); }
-
- /** @brief Operator; Get the value as a std::string. */
- operator std::string() const {
- return std::string((char*)m_attr_value, m_attr_len); }
-
- /** @brief Operator; Get the value as a const uint8_t*. */
- operator const uint8_t*() const { return m_attr_value; }
-
- /** @brief Operator; Append another NimBLEAttValue. */
- NimBLEAttValue& operator +=(const NimBLEAttValue & source) {
- return append(source.data(), source.size()); }
-
- /** @brief Operator; Set the value from a std::string source. */
- NimBLEAttValue& operator =(const std::string & source) {
- setValue((uint8_t*)source.data(), (uint16_t)source.size()); return *this; }
-
- /** @brief Move assignment operator */
- NimBLEAttValue& operator =(NimBLEAttValue && source);
-
- /** @brief Copy assignment operator */
- NimBLEAttValue& operator =(const NimBLEAttValue & source);
-
- /** @brief Equality operator */
- bool operator ==(const NimBLEAttValue & source) {
- return (m_attr_len == source.size()) ?
- memcmp(m_attr_value, source.data(), m_attr_len) == 0 : false; }
-
- /** @brief Inequality operator */
- bool operator !=(const NimBLEAttValue & source){ return !(*this == source); }
-
-#ifdef NIMBLE_CPP_ARDUINO_STRING_AVAILABLE
- /** @brief Operator; Get the value as an Arduino String value. */
- operator String() const { return String((char*)m_attr_value); }
-#endif
-
-};
-
-
-inline NimBLEAttValue::NimBLEAttValue(uint16_t init_len, uint16_t max_len) {
- m_attr_value = (uint8_t*)calloc(init_len + 1, 1);
- assert(m_attr_value && "No Mem");
- m_attr_max_len = std::min(BLE_ATT_ATTR_MAX_LEN, (int)max_len);
- m_attr_len = 0;
- m_capacity = init_len;
- setTimeStamp(0);
-}
-
-inline NimBLEAttValue::NimBLEAttValue(const uint8_t *value, uint16_t len, uint16_t max_len)
-: NimBLEAttValue(len, max_len) {
- memcpy(m_attr_value, value, len);
- m_attr_value[len] = '\0';
- m_attr_len = len;
-}
-
-inline NimBLEAttValue::~NimBLEAttValue() {
- if(m_attr_value != nullptr) {
- free(m_attr_value);
- }
-}
-
-inline NimBLEAttValue& NimBLEAttValue::operator =(NimBLEAttValue && source) {
- if (this != &source){
- free(m_attr_value);
-
- m_attr_value = source.m_attr_value;
- m_attr_max_len = source.m_attr_max_len;
- m_attr_len = source.m_attr_len;
- m_capacity = source.m_capacity;
- setTimeStamp(source.getTimeStamp());
- source.m_attr_value = nullptr;
- }
- return *this;
-}
-
-inline NimBLEAttValue& NimBLEAttValue::operator =(const NimBLEAttValue & source) {
- if (this != &source) {
- deepCopy(source);
- }
- return *this;
-}
-
-inline void NimBLEAttValue::deepCopy(const NimBLEAttValue & source) {
- uint8_t* res = (uint8_t*)realloc( m_attr_value, source.m_capacity + 1);
- assert(res && "deepCopy: realloc failed");
-
- ble_npl_hw_enter_critical();
- m_attr_value = res;
- m_attr_max_len = source.m_attr_max_len;
- m_attr_len = source.m_attr_len;
- m_capacity = source.m_capacity;
- setTimeStamp(source.getTimeStamp());
- memcpy(m_attr_value, source.m_attr_value, m_attr_len + 1);
- ble_npl_hw_exit_critical(0);
-}
-
-inline const uint8_t* NimBLEAttValue::getValue(time_t *timestamp) {
- if(timestamp != nullptr) {
-#if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
- *timestamp = m_timestamp;
-#else
- *timestamp = 0;
-#endif
- }
- return m_attr_value;
-}
-
-inline bool NimBLEAttValue::setValue(const uint8_t *value, uint16_t len) {
- if (len > m_attr_max_len) {
- NIMBLE_LOGE("NimBLEAttValue", "value exceeds max, len=%u, max=%u",
- len, m_attr_max_len);
- return false;
- }
-
- uint8_t *res = m_attr_value;
- if (len > m_capacity) {
- res = (uint8_t*)realloc(m_attr_value, (len + 1));
- m_capacity = len;
- }
- assert(res && "setValue: realloc failed");
-
-#if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
- time_t t = time(nullptr);
-#else
- time_t t = 0;
-#endif
-
- ble_npl_hw_enter_critical();
- m_attr_value = res;
- memcpy(m_attr_value, value, len);
- m_attr_value[len] = '\0';
- m_attr_len = len;
- setTimeStamp(t);
- ble_npl_hw_exit_critical(0);
- return true;
-}
-
-inline NimBLEAttValue& NimBLEAttValue::append(const uint8_t *value, uint16_t len) {
- if (len < 1) {
- return *this;
- }
-
- if ((m_attr_len + len) > m_attr_max_len) {
- NIMBLE_LOGE("NimBLEAttValue", "val > max, len=%u, max=%u",
- len, m_attr_max_len);
- return *this;
- }
-
- uint8_t* res = m_attr_value;
- uint16_t new_len = m_attr_len + len;
- if (new_len > m_capacity) {
- res = (uint8_t*)realloc(m_attr_value, (new_len + 1));
- m_capacity = new_len;
- }
- assert(res && "append: realloc failed");
-
-#if CONFIG_NIMBLE_CPP_ATT_VALUE_TIMESTAMP_ENABLED
- time_t t = time(nullptr);
-#else
- time_t t = 0;
-#endif
-
- ble_npl_hw_enter_critical();
- m_attr_value = res;
- memcpy(m_attr_value + m_attr_len, value, len);
- m_attr_len = new_len;
- m_attr_value[m_attr_len] = '\0';
- setTimeStamp(t);
- ble_npl_hw_exit_critical(0);
-
- return *this;
-}
-
-#endif /*(CONFIG_BT_ENABLED) */
-#endif /* MAIN_NIMBLEATTVALUE_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEBeacon.cpp b/libraries/NimBLE-Arduino/src/NimBLEBeacon.cpp
index df24ced9..8c4574bc 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEBeacon.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEBeacon.cpp
@@ -11,7 +11,7 @@
* Created on: Jan 4, 2018
* Author: kolban
*/
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include
@@ -130,7 +130,7 @@ void NimBLEBeacon::setManufacturerId(uint16_t manufacturerId) {
*/
void NimBLEBeacon::setMinor(uint16_t minor) {
m_beaconData.minor = ENDIAN_CHANGE_U16(minor);
-} // setMinor
+} // setMinior
/**
diff --git a/libraries/NimBLE-Arduino/src/NimBLECharacteristic.cpp b/libraries/NimBLE-Arduino/src/NimBLECharacteristic.cpp
index 03d8c55d..e81fdbcd 100644
--- a/libraries/NimBLE-Arduino/src/NimBLECharacteristic.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLECharacteristic.cpp
@@ -9,9 +9,11 @@
* Created on: Jun 22, 2017
* Author: kolban
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
#include "NimBLECharacteristic.h"
#include "NimBLE2904.h"
@@ -30,29 +32,27 @@ static const char* LOG_TAG = "NimBLECharacteristic";
* @brief Construct a characteristic
* @param [in] uuid - UUID (const char*) for the characteristic.
* @param [in] properties - Properties for the characteristic.
- * @param [in] max_len - The maximum length in bytes that the characteristic value can hold. (Default: 512 bytes for esp32, 20 for all others).
* @param [in] pService - pointer to the service instance this characteristic belongs to.
*/
-NimBLECharacteristic::NimBLECharacteristic(const char* uuid, uint16_t properties,
- uint16_t max_len, NimBLEService* pService)
-: NimBLECharacteristic(NimBLEUUID(uuid), properties, max_len, pService) {
+NimBLECharacteristic::NimBLECharacteristic(const char* uuid, uint16_t properties, NimBLEService* pService)
+: NimBLECharacteristic(NimBLEUUID(uuid), properties, pService) {
}
/**
* @brief Construct a characteristic
* @param [in] uuid - UUID for the characteristic.
* @param [in] properties - Properties for the characteristic.
- * @param [in] max_len - The maximum length in bytes that the characteristic value can hold. (Default: 512 bytes for esp32, 20 for all others).
* @param [in] pService - pointer to the service instance this characteristic belongs to.
*/
-NimBLECharacteristic::NimBLECharacteristic(const NimBLEUUID &uuid, uint16_t properties,
- uint16_t max_len, NimBLEService* pService)
-: m_value(std::min(CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH , (int)max_len), max_len) {
+NimBLECharacteristic::NimBLECharacteristic(const NimBLEUUID &uuid, uint16_t properties, NimBLEService* pService) {
m_uuid = uuid;
m_handle = NULL_HANDLE;
m_properties = properties;
m_pCallbacks = &defaultCallback;
m_pService = pService;
+ m_value = "";
+ m_valMux = portMUX_INITIALIZER_UNLOCKED;
+ m_timestamp = 0;
m_removed = 0;
} // NimBLECharacteristic
@@ -126,8 +126,8 @@ void NimBLECharacteristic::addDescriptor(NimBLEDescriptor *pDescriptor) {
/**
- * @brief Remove a descriptor from the characteristic.
- * @param[in] pDescriptor A pointer to the descriptor instance to remove from the characteristic.
+ * @brief Remove a descriptor from the characterisitc.
+ * @param[in] pDescriptor A pointer to the descriptor instance to remove from the characterisitc.
* @param[in] deleteDsc If true it will delete the descriptor instance and free it's resources.
*/
void NimBLECharacteristic::removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc) {
@@ -234,14 +234,17 @@ NimBLEUUID NimBLECharacteristic::getUUID() {
/**
* @brief Retrieve the current value of the characteristic.
- * @return The NimBLEAttValue containing the current characteristic value.
+ * @return A std::string containing the current characteristic value.
*/
-NimBLEAttValue NimBLECharacteristic::getValue(time_t *timestamp) {
+std::string NimBLECharacteristic::getValue(time_t *timestamp) {
+ portENTER_CRITICAL(&m_valMux);
+ std::string retVal = m_value;
if(timestamp != nullptr) {
- m_value.getValue(timestamp);
+ *timestamp = m_timestamp;
}
+ portEXIT_CRITICAL(&m_valMux);
- return m_value;
+ return retVal;
} // getValue
@@ -250,7 +253,11 @@ NimBLEAttValue NimBLECharacteristic::getValue(time_t *timestamp) {
* @return The length of the current characteristic data.
*/
size_t NimBLECharacteristic::getDataLength() {
- return m_value.size();
+ portENTER_CRITICAL(&m_valMux);
+ size_t len = m_value.length();
+ portEXIT_CRITICAL(&m_valMux);
+
+ return len;
}
@@ -273,38 +280,36 @@ int NimBLECharacteristic::handleGapEvent(uint16_t conn_handle, uint16_t attr_han
if(ble_uuid_cmp(uuid, &pCharacteristic->getUUID().getNative()->u) == 0){
switch(ctxt->op) {
case BLE_GATT_ACCESS_OP_READ_CHR: {
- rc = ble_gap_conn_find(conn_handle, &desc);
- assert(rc == 0);
-
- // If the packet header is only 8 bytes this is a follow up of a long read
- // so we don't want to call the onRead() callback again.
- if(ctxt->om->om_pkthdr_len > 8 ||
- pCharacteristic->m_value.size() <= (ble_att_mtu(desc.conn_handle) - 3)) {
+ // If the packet header is only 8 bytes this is a follow up of a long read
+ // so we don't want to call the onRead() callback again.
+ if(ctxt->om->om_pkthdr_len > 8) {
+ rc = ble_gap_conn_find(conn_handle, &desc);
+ assert(rc == 0);
pCharacteristic->m_pCallbacks->onRead(pCharacteristic);
pCharacteristic->m_pCallbacks->onRead(pCharacteristic, &desc);
}
- ble_npl_hw_enter_critical();
- rc = os_mbuf_append(ctxt->om, pCharacteristic->m_value.data(), pCharacteristic->m_value.size());
- ble_npl_hw_exit_critical(0);
+ portENTER_CRITICAL(&pCharacteristic->m_valMux);
+ rc = os_mbuf_append(ctxt->om, (uint8_t*)pCharacteristic->m_value.data(),
+ pCharacteristic->m_value.length());
+ portEXIT_CRITICAL(&pCharacteristic->m_valMux);
+
return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
}
case BLE_GATT_ACCESS_OP_WRITE_CHR: {
- uint16_t att_max_len = pCharacteristic->m_value.max_size();
-
- if (ctxt->om->om_len > att_max_len) {
+ if (ctxt->om->om_len > BLE_ATT_ATTR_MAX_LEN) {
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
}
- uint8_t buf[att_max_len];
+ uint8_t buf[BLE_ATT_ATTR_MAX_LEN];
size_t len = ctxt->om->om_len;
memcpy(buf, ctxt->om->om_data,len);
os_mbuf *next;
next = SLIST_NEXT(ctxt->om, om_next);
while(next != NULL){
- if((len + next->om_len) > att_max_len) {
+ if((len + next->om_len) > BLE_ATT_ATTR_MAX_LEN) {
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
}
memcpy(&buf[len], next->om_data, next->om_len);
@@ -384,65 +389,31 @@ void NimBLECharacteristic::setSubscribe(struct ble_gap_event *event) {
/**
- * @brief Send an indication.
+ * @brief Send an indication.\n
+ * An indication is a transmission of up to the first 20 bytes of the characteristic value.\n
+ * An indication will block waiting for a positive confirmation from the client.
*/
void NimBLECharacteristic::indicate() {
+ NIMBLE_LOGD(LOG_TAG, ">> indicate: length: %d", getDataLength());
notify(false);
+ NIMBLE_LOGD(LOG_TAG, "<< indicate");
} // indicate
-
-/**
- * @brief Send an indication.
- * @param[in] value A pointer to the data to send.
- * @param[in] length The length of the data to send.
- */
-void NimBLECharacteristic::indicate(const uint8_t* value, size_t length) {
- notify(value, length, false);
-} // indicate
-
-
-/**
- * @brief Send an indication.
- * @param[in] value A std::vector containing the value to send as the notification value.
- */
-void NimBLECharacteristic::indicate(const std::vector& value) {
- notify(value.data(), value.size(), false);
-} // indicate
-
-
/**
- * @brief Send a notification or indication.
+ * @brief Send a notification.\n
+ * A notification is a transmission of up to the first 20 bytes of the characteristic value.\n
+ * A notification will not block; it is a fire and forget.
* @param[in] is_notification if true sends a notification, false sends an indication.
*/
void NimBLECharacteristic::notify(bool is_notification) {
- notify(m_value.data(), m_value.length(), is_notification);
-} // notify
-
-
-/**
- * @brief Send a notification or indication.
- * @param[in] value A std::vector containing the value to send as the notification value.
- * @param[in] is_notification if true sends a notification, false sends an indication.
- */
-void NimBLECharacteristic::notify(const std::vector& value, bool is_notification) {
- notify(value.data(), value.size(), is_notification);
-} // notify
+ NIMBLE_LOGD(LOG_TAG, ">> notify: length: %d", getDataLength());
-/**
- * @brief Send a notification or indication.
- * @param[in] value A pointer to the data to send.
- * @param[in] length The length of the data to send.
- * @param[in] is_notification if true sends a notification, false sends an indication.
- */
-void NimBLECharacteristic::notify(const uint8_t* value, size_t length, bool is_notification) {
- NIMBLE_LOGD(LOG_TAG, ">> notify: length: %d", length);
-
if(!(m_properties & NIMBLE_PROPERTY::NOTIFY) &&
!(m_properties & NIMBLE_PROPERTY::INDICATE))
{
NIMBLE_LOGE(LOG_TAG,
- "<< notify-Error; Notify/indicate not enabled for characteristic: %s",
+ "<< notify-Error; Notify/indicate not enabled for characterisitc: %s",
std::string(getUUID()).c_str());
}
@@ -453,13 +424,15 @@ void NimBLECharacteristic::notify(const uint8_t* value, size_t length, bool is_n
m_pCallbacks->onNotify(this);
+ std::string value = getValue();
+ size_t length = value.length();
bool reqSec = (m_properties & BLE_GATT_CHR_F_READ_AUTHEN) ||
(m_properties & BLE_GATT_CHR_F_READ_AUTHOR) ||
(m_properties & BLE_GATT_CHR_F_READ_ENC);
int rc = 0;
for (auto &it : m_subscribedVec) {
- uint16_t _mtu = getService()->getServer()->getPeerMTU(it.first) - 3;
+ uint16_t _mtu = getService()->getServer()->getPeerMTU(it.first);
// check if connected and subscribed
if(_mtu == 0 || it.second == 0) {
@@ -475,8 +448,8 @@ void NimBLECharacteristic::notify(const uint8_t* value, size_t length, bool is_n
}
}
- if (length > _mtu) {
- NIMBLE_LOGW(LOG_TAG, "- Truncating to %d bytes (maximum notify size)", _mtu);
+ if (length > _mtu - 3) {
+ NIMBLE_LOGW(LOG_TAG, "- Truncating to %d bytes (maximum notify size)", _mtu - 3);
}
if(is_notification && (!(it.second & NIMBLE_SUB_NOTIFY))) {
@@ -494,7 +467,7 @@ void NimBLECharacteristic::notify(const uint8_t* value, size_t length, bool is_n
// don't create the m_buf until we are sure to send the data or else
// we could be allocating a buffer that doesn't get released.
// We also must create it in each loop iteration because it is consumed with each host call.
- os_mbuf *om = ble_hs_mbuf_from_flat(value, length);
+ os_mbuf *om = ble_hs_mbuf_from_flat((uint8_t*)value.data(), length);
if(!is_notification && (m_properties & NIMBLE_PROPERTY::INDICATE)) {
if(!NimBLEDevice::getServer()->setIndicateWait(it.first)) {
@@ -538,30 +511,40 @@ NimBLECharacteristicCallbacks* NimBLECharacteristic::getCallbacks() {
/**
- * @brief Set the value of the characteristic from a data buffer .
- * @param [in] data The data buffer to set for the characteristic.
- * @param [in] length The number of bytes in the data buffer.
+ * @brief Set the value of the characteristic.
+ * @param [in] data The data to set for the characteristic.
+ * @param [in] length The length of the data in bytes.
*/
void NimBLECharacteristic::setValue(const uint8_t* data, size_t length) {
-#if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4
+#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 4
char* pHex = NimBLEUtils::buildHexData(nullptr, data, length);
- NIMBLE_LOGD(LOG_TAG, ">> setValue: length=%d, data=%s, characteristic UUID=%s",
- length, pHex, getUUID().toString().c_str());
+ NIMBLE_LOGD(LOG_TAG, ">> setValue: length=%d, data=%s, characteristic UUID=%s", length, pHex, getUUID().toString().c_str());
free(pHex);
#endif
- m_value.setValue(data, length);
+ if (length > BLE_ATT_ATTR_MAX_LEN) {
+ NIMBLE_LOGE(LOG_TAG, "Size %d too large, must be no bigger than %d", length, BLE_ATT_ATTR_MAX_LEN);
+ return;
+ }
+
+ time_t t = time(nullptr);
+ portENTER_CRITICAL(&m_valMux);
+ m_value = std::string((char*)data, length);
+ m_timestamp = t;
+ portEXIT_CRITICAL(&m_valMux);
+
NIMBLE_LOGD(LOG_TAG, "<< setValue");
} // setValue
/**
- * @brief Set the value of the characteristic from a `std::vector`.\n
- * @param [in] vec The std::vector reference to set the characteristic value from.
+ * @brief Set the value of the characteristic from string data.\n
+ * We set the value of the characteristic from the bytes contained in the string.
+ * @param [in] value the std::string value of the characteristic.
*/
-void NimBLECharacteristic::setValue(const std::vector& vec) {
- return setValue((uint8_t*)&vec[0], vec.size());
-}// setValue
+void NimBLECharacteristic::setValue(const std::string &value) {
+ setValue((uint8_t*)(value.data()), value.length());
+} // setValue
/**
@@ -658,4 +641,6 @@ void NimBLECharacteristicCallbacks::onSubscribe(NimBLECharacteristic* pCharacter
NIMBLE_LOGD("NimBLECharacteristicCallbacks", "onSubscribe: default");
}
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif /* CONFIG_BT_ENABLED */
diff --git a/libraries/NimBLE-Arduino/src/NimBLECharacteristic.h b/libraries/NimBLE-Arduino/src/NimBLECharacteristic.h
index 0f84e2d9..6008d127 100644
--- a/libraries/NimBLE-Arduino/src/NimBLECharacteristic.h
+++ b/libraries/NimBLE-Arduino/src/NimBLECharacteristic.h
@@ -13,15 +13,13 @@
#ifndef MAIN_NIMBLECHARACTERISTIC_H_
#define MAIN_NIMBLECHARACTERISTIC_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "host/ble_hs.h"
-#else
-#include "nimble/nimble/host/include/host/ble_hs.h"
-#endif
-
/**** FIX COMPILATION ****/
#undef min
#undef max
@@ -44,7 +42,6 @@ typedef enum {
#include "NimBLEService.h"
#include "NimBLEDescriptor.h"
-#include "NimBLEAttValue.h"
#include
#include
@@ -66,13 +63,11 @@ class NimBLECharacteristic {
uint16_t properties =
NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE,
- uint16_t max_len = BLE_ATT_ATTR_MAX_LEN,
NimBLEService* pService = nullptr);
NimBLECharacteristic(const NimBLEUUID &uuid,
uint16_t properties =
NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE,
- uint16_t max_len = BLE_ATT_ATTR_MAX_LEN,
NimBLEService* pService = nullptr);
~NimBLECharacteristic();
@@ -80,93 +75,64 @@ class NimBLECharacteristic {
uint16_t getHandle();
NimBLEUUID getUUID();
std::string toString();
+
+ void setCallbacks(NimBLECharacteristicCallbacks* pCallbacks);
+ NimBLECharacteristicCallbacks*
+ getCallbacks();
+
void indicate();
- void indicate(const uint8_t* value, size_t length);
- void indicate(const std::vector& value);
void notify(bool is_notification = true);
- void notify(const uint8_t* value, size_t length, bool is_notification = true);
- void notify(const std::vector& value, bool is_notification = true);
size_t getSubscribedCount();
- void addDescriptor(NimBLEDescriptor *pDescriptor);
- NimBLEDescriptor* getDescriptorByUUID(const char* uuid);
- NimBLEDescriptor* getDescriptorByUUID(const NimBLEUUID &uuid);
- NimBLEDescriptor* getDescriptorByHandle(uint16_t handle);
- void removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc = false);
- NimBLEService* getService();
- uint16_t getProperties();
- NimBLEAttValue getValue(time_t *timestamp = nullptr);
- size_t getDataLength();
- void setValue(const uint8_t* data, size_t size);
- void setValue(const std::vector& vec);
- void setCallbacks(NimBLECharacteristicCallbacks* pCallbacks);
+
NimBLEDescriptor* createDescriptor(const char* uuid,
uint32_t properties =
NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE,
- uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);;
+ uint16_t max_len = 100);
NimBLEDescriptor* createDescriptor(const NimBLEUUID &uuid,
uint32_t properties =
NIMBLE_PROPERTY::READ |
NIMBLE_PROPERTY::WRITE,
- uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
-
- NimBLECharacteristicCallbacks* getCallbacks();
-
-
- /*********************** Template Functions ************************/
+ uint16_t max_len = 100);
- /**
- * @brief Template to set the characteristic value to val.
- * @param [in] s The value to set.
- */
- template
- void setValue(const T &s) { m_value.setValue(s); }
+ void addDescriptor(NimBLEDescriptor *pDescriptor);
+ NimBLEDescriptor* getDescriptorByUUID(const char* uuid);
+ NimBLEDescriptor* getDescriptorByUUID(const NimBLEUUID &uuid);
+ NimBLEDescriptor* getDescriptorByHandle(uint16_t handle);
+ void removeDescriptor(NimBLEDescriptor *pDescriptor, bool deleteDsc = false);
+ std::string getValue(time_t *timestamp = nullptr);
+ size_t getDataLength();
/**
- * @brief Template to convert the characteristic data to .
+ * @brief A template to convert the characteristic data to .
* @tparam T The type to convert the data to.
- * @param [in] timestamp (Optional) A pointer to a time_t struct to store the time the value was read.
- * @param [in] skipSizeCheck (Optional) If true it will skip checking if the data size is less than sizeof() .
- * @return The data converted to or NULL if skipSizeCheck is false and the data is less than sizeof() .
+ * @param [in] timestamp A pointer to a time_t struct to store the time the value was read.
+ * @param [in] skipSizeCheck If true it will skip checking if the data size is less than sizeof() .
+ * @return The data converted to or NULL if skipSizeCheck is false and the data is
+ * less than sizeof() .
* @details Use: getValue(×tamp, skipSizeCheck);
*/
template
- T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
- return m_value.getValue(timestamp, skipSizeCheck);
+ T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
+ std::string value = getValue();
+ if(!skipSizeCheck && value.size() < sizeof(T)) return T();
+ const char *pData = value.data();
+ return *((T *)pData);
}
+ void setValue(const uint8_t* data, size_t size);
+ void setValue(const std::string &value);
/**
- * @brief Template to send a notification from a class type that has a c_str() and length() method.
- * @tparam T The a reference to a class containing the data to send.
- * @param[in] value The value to set.
- * @param[in] is_notification if true sends a notification, false sends an indication.
- * @details Only used if the has a `c_str()` method.
+ * @brief Convenience template to set the characteristic value to val.
+ * @param [in] s The value to set.
*/
template
-#ifdef _DOXYGEN_
- void
-#else
- typename std::enable_if::value, void>::type
-#endif
- notify(const T& value, bool is_notification = true) {
- notify((uint8_t*)value.c_str(), value.length(), is_notification);
+ void setValue(const T &s) {
+ setValue((uint8_t*)&s, sizeof(T));
}
- /**
- * @brief Template to send an indication from a class type that has a c_str() and length() method.
- * @tparam T The a reference to a class containing the data to send.
- * @param[in] value The value to set.
- * @details Only used if the has a `c_str()` method.
- */
- template
-#ifdef _DOXYGEN_
- void
-#else
- typename std::enable_if::value, void>::type
-#endif
- indicate(const T& value) {
- indicate((uint8_t*)value.c_str(), value.length());
- }
+ NimBLEService* getService();
+ uint16_t getProperties();
private:
@@ -183,8 +149,10 @@ class NimBLECharacteristic {
uint16_t m_properties;
NimBLECharacteristicCallbacks* m_pCallbacks;
NimBLEService* m_pService;
- NimBLEAttValue m_value;
+ std::string m_value;
std::vector m_dscVec;
+ portMUX_TYPE m_valMux;
+ time_t m_timestamp;
uint8_t m_removed;
std::vector> m_subscribedVec;
@@ -217,7 +185,7 @@ class NimBLECharacteristicCallbacks {
ERROR_INDICATE_FAILURE
}Status;
- virtual ~NimBLECharacteristicCallbacks();
+ virtual ~NimBLECharacteristicCallbacks();
virtual void onRead(NimBLECharacteristic* pCharacteristic);
virtual void onRead(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc);
virtual void onWrite(NimBLECharacteristic* pCharacteristic);
@@ -227,5 +195,6 @@ class NimBLECharacteristicCallbacks {
virtual void onSubscribe(NimBLECharacteristic* pCharacteristic, ble_gap_conn_desc* desc, uint16_t subValue);
};
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif /* CONFIG_BT_ENABLED */
#endif /*MAIN_NIMBLECHARACTERISTIC_H_*/
diff --git a/libraries/NimBLE-Arduino/src/NimBLEClient.cpp b/libraries/NimBLE-Arduino/src/NimBLEClient.cpp
index a83e23b4..49cda664 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEClient.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEClient.cpp
@@ -11,8 +11,11 @@
* Author: kolban
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
#include "NimBLEClient.h"
#include "NimBLEDevice.h"
@@ -20,13 +23,9 @@
#include
#include
-#include
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "nimble/nimble_port.h"
-#else
-#include "nimble/porting/nimble/include/nimble/nimble_port.h"
-#endif
+
static const char* LOG_TAG = "NimBLEClient";
static NimBLEClientCallbacks defaultCallbacks;
@@ -65,11 +64,6 @@ NimBLEClient::NimBLEClient(const NimBLEAddress &peerAddress) : m_peerAddress(pee
m_pTaskData = nullptr;
m_connEstablished = false;
m_lastErr = 0;
-#if CONFIG_BT_NIMBLE_EXT_ADV
- m_phyMask = BLE_GAP_LE_PHY_1M_MASK |
- BLE_GAP_LE_PHY_2M_MASK |
- BLE_GAP_LE_PHY_CODED_MASK;
-#endif
m_pConnParams.scan_itvl = 16; // Scan interval in 0.625ms units (NimBLE Default)
m_pConnParams.scan_window = 16; // Scan window in 0.625ms units (NimBLE Default)
@@ -80,7 +74,6 @@ NimBLEClient::NimBLEClient(const NimBLEAddress &peerAddress) : m_peerAddress(pee
m_pConnParams.min_ce_len = BLE_GAP_INITIAL_CONN_MIN_CE_LEN; // Minimum length of connection event in 0.625ms units
m_pConnParams.max_ce_len = BLE_GAP_INITIAL_CONN_MAX_CE_LEN; // Maximum length of connection event in 0.625ms units
- memset(&m_dcTimer, 0, sizeof(m_dcTimer));
ble_npl_callout_init(&m_dcTimer, nimble_port_get_dflt_eventq(),
NimBLEClient::dcTimerCb, this);
} // NimBLEClient
@@ -99,8 +92,6 @@ NimBLEClient::~NimBLEClient() {
delete m_pClientCallbacks;
}
- ble_npl_callout_deinit(&m_dcTimer);
-
} // ~NimBLEClient
@@ -157,35 +148,35 @@ size_t NimBLEClient::deleteService(const NimBLEUUID &uuid) {
/**
* @brief Connect to the BLE Server.
- * @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
+ * @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n
* have created and clears the vectors after successful connection.
* @return True on success.
*/
-bool NimBLEClient::connect(bool deleteAttributes) {
- return connect(m_peerAddress, deleteAttributes);
+bool NimBLEClient::connect(bool deleteAttibutes) {
+ return connect(m_peerAddress, deleteAttibutes);
}
/**
* @brief Connect to an advertising device.
* @param [in] device The device to connect to.
- * @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
+ * @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n
* have created and clears the vectors after successful connection.
* @return True on success.
*/
-bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttributes) {
+bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) {
NimBLEAddress address(device->getAddress());
- return connect(address, deleteAttributes);
+ return connect(address, deleteAttibutes);
}
/**
* @brief Connect to the BLE Server.
* @param [in] address The address of the server.
- * @param [in] deleteAttributes If true this will delete any attribute objects this client may already\n
+ * @param [in] deleteAttibutes If true this will delete any attribute objects this client may already\n
* have created and clears the vectors after successful connection.
* @return True on success.
*/
-bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes) {
+bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttibutes) {
NIMBLE_LOGD(LOG_TAG, ">> connect(%s)", address.toString().c_str());
if(!NimBLEDevice::m_synced) {
@@ -225,22 +216,9 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes)
* Loop on BLE_HS_EBUSY if the scan hasn't stopped yet.
*/
do {
-#if CONFIG_BT_NIMBLE_EXT_ADV
- rc = ble_gap_ext_connect(NimBLEDevice::m_own_addr_type,
- &peerAddr_t,
- m_connectTimeout,
- m_phyMask,
- &m_pConnParams,
- &m_pConnParams,
- &m_pConnParams,
- NimBLEClient::handleGapEvent,
- this);
-
-#else
rc = ble_gap_connect(NimBLEDevice::m_own_addr_type, &peerAddr_t,
m_connectTimeout, &m_pConnParams,
NimBLEClient::handleGapEvent, this);
-#endif
switch (rc) {
case 0:
break;
@@ -259,7 +237,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes)
break;
case BLE_HS_EALREADY:
- // Already attempting to connect to this device, cancel the previous
+ // Already attemting to connect to this device, cancel the previous
// attempt and report failure here so we don't get 2 connections.
NIMBLE_LOGE(LOG_TAG, "Already attempting to connect to %s - cancelling",
std::string(m_peerAddress).c_str());
@@ -317,7 +295,7 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes)
NIMBLE_LOGI(LOG_TAG, "Connection established");
}
- if(deleteAttributes) {
+ if(deleteAttibutes) {
deleteServices();
}
@@ -336,7 +314,6 @@ bool NimBLEClient::connect(const NimBLEAddress &address, bool deleteAttributes)
* @return True on success.
*/
bool NimBLEClient::secureConnection() {
- NIMBLE_LOGD(LOG_TAG, ">> secureConnection()");
TaskHandle_t cur_task = xTaskGetCurrentTaskHandle();
ble_task_data_t taskData = {this, cur_task, 0, nullptr};
@@ -346,7 +323,7 @@ bool NimBLEClient::secureConnection() {
m_pTaskData = &taskData;
int rc = NimBLEDevice::startSecurity(m_conn_id);
- if(rc != 0 && rc != BLE_HS_EALREADY){
+ if(rc != 0){
m_lastErr = rc;
m_pTaskData = nullptr;
return false;
@@ -361,11 +338,9 @@ bool NimBLEClient::secureConnection() {
if(taskData.rc != 0){
m_lastErr = taskData.rc;
- NIMBLE_LOGE(LOG_TAG, "secureConnection: failed rc=%d", taskData.rc);
return false;
}
- NIMBLE_LOGD(LOG_TAG, "<< secureConnection: success");
return true;
} // secureConnection
@@ -393,8 +368,8 @@ int NimBLEClient::disconnect(uint8_t reason) {
// We use a timer to detect a controller error in the event that it does
// not inform the stack when disconnection is complete.
// This is a common error in certain esp-idf versions.
- // The disconnect timeout time is the supervision timeout time + 1 second.
- // In the case that the event happens shortly after the supervision timeout
+ // The disconnect timeout time is the supervison timeout time + 1 second.
+ // In the case that the event happenss shortly after the supervision timeout
// we don't want to prematurely reset the host.
ble_npl_time_t ticks;
ble_npl_time_ms_to_ticks((desc.supervision_timeout + 100) * 10, &ticks);
@@ -418,23 +393,8 @@ int NimBLEClient::disconnect(uint8_t reason) {
} // disconnect
-#if CONFIG_BT_NIMBLE_EXT_ADV
/**
- * @brief Set the PHY types to use when connecting to a server.
- * @param [in] mask A bitmask indicating what PHYS to connect with.\n
- * The available bits are:
- * * 0x01 BLE_GAP_LE_PHY_1M_MASK
- * * 0x02 BLE_GAP_LE_PHY_2M_MASK
- * * 0x04 BLE_GAP_LE_PHY_CODED_MASK
- */
-void NimBLEClient::setConnectPhy(uint8_t mask) {
- m_phyMask = mask;
-}
-#endif
-
-
-/**
- * @brief Set the connection parameters to use when connecting to a server.
+ * @brief Set the connection paramaters to use when connecting to a server.
* @param [in] minInterval The minimum 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).
@@ -493,29 +453,6 @@ void NimBLEClient::updateConnParams(uint16_t minInterval, uint16_t maxInterval,
} // updateConnParams
-/**
- * @brief Request an update of the data packet length.
- * * Can only be used after a connection has been established.
- * @details Sends a data length update request to the server the client is connected to.
- * The Data Length Extension (DLE) allows to increase the Data Channel Payload from 27 bytes to up to 251 bytes.
- * The server needs to support the Bluetooth 4.2 specifications, to be capable of DLE.
- * @param [in] tx_octets The preferred number of payload octets to use (Range 0x001B-0x00FB).
- */
-void NimBLEClient::setDataLen(uint16_t tx_octets) {
-#if defined(CONFIG_NIMBLE_CPP_IDF) && !defined(ESP_IDF_VERSION) || \
- (ESP_IDF_VERSION_MAJOR * 100 + ESP_IDF_VERSION_MINOR * 10 + ESP_IDF_VERSION_PATCH) < 432
- return;
-#else
- uint16_t tx_time = (tx_octets + 14) * 8;
-
- int rc = ble_gap_set_data_len(m_conn_id, tx_octets, tx_time);
- if(rc != 0) {
- NIMBLE_LOGE(LOG_TAG, "Set data length error: %d, %s", rc, NimBLEUtils::returnCodeToString(rc));
- }
-#endif
-} // setDataLen
-
-
/**
* @brief Get detailed information about the current peer connection.
*/
@@ -649,31 +586,14 @@ NimBLERemoteService* NimBLEClient::getService(const NimBLEUUID &uuid) {
return m_servicesVector.back();
}
- // If the request was successful but 16/32 bit uuid not found
+ // If the request was successful but 16/32 bit service not found
// try again with the 128 bit uuid.
if(uuid.bitSize() == BLE_UUID_TYPE_16 ||
uuid.bitSize() == BLE_UUID_TYPE_32)
{
NimBLEUUID uuid128(uuid);
uuid128.to128();
- if(retrieveServices(&uuid128)) {
- if(m_servicesVector.size() > prev_size) {
- return m_servicesVector.back();
- }
- }
- } else {
- // If the request was successful but the 128 bit uuid not found
- // try again with the 16 bit uuid.
- NimBLEUUID uuid16(uuid);
- uuid16.to16();
- // if the uuid was 128 bit but not of the BLE base type this check will fail
- if (uuid16.bitSize() == BLE_UUID_TYPE_16) {
- if(retrieveServices(&uuid16)) {
- if(m_servicesVector.size() > prev_size) {
- return m_servicesVector.back();
- }
- }
- }
+ return getService(uuid128);
}
}
@@ -706,29 +626,13 @@ std::vector* NimBLEClient::getServices(bool refresh) {
/**
* @brief Retrieves the full database of attributes that the peripheral has available.
- * @return True if successful.
*/
-bool NimBLEClient::discoverAttributes() {
- deleteServices();
-
- if (!retrieveServices()){
- return false;
- }
-
-
- for(auto svc: m_servicesVector) {
- if (!svc->retrieveCharacteristics()) {
- return false;
- }
-
- for(auto chr: svc->m_characteristicVector) {
- if (!chr->retrieveDescriptors()) {
- return false;
- }
+void NimBLEClient::discoverAttributes() {
+ for(auto svc: *getServices(true)) {
+ for(auto chr: *svc->getCharacteristics(true)) {
+ chr->getDescriptors(true);
}
}
-
- return true;
} // discoverAttributes
@@ -820,7 +724,7 @@ int NimBLEClient::serviceDiscoveredCB(
if(error->status == BLE_HS_EDONE) {
pTaskData->rc = 0;
} else {
- NIMBLE_LOGE(LOG_TAG, "serviceDiscoveredCB() rc=%d %s",
+ NIMBLE_LOGE(LOG_TAG, "characteristicDiscCB() rc=%d %s",
error->status,
NimBLEUtils::returnCodeToString(error->status));
pTaskData->rc = error->status;
@@ -828,7 +732,7 @@ int NimBLEClient::serviceDiscoveredCB(
xTaskNotifyGive(pTaskData->task);
- NIMBLE_LOGD(LOG_TAG,"<< Service Discovered");
+ NIMBLE_LOGD(LOG_TAG,"<< << Service Discovered");
return error->status;
}
@@ -839,11 +743,11 @@ int NimBLEClient::serviceDiscoveredCB(
* @param [in] characteristicUUID The characteristic whose value we wish to read.
* @returns characteristic value or an empty string if not found
*/
-NimBLEAttValue NimBLEClient::getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID) {
+std::string NimBLEClient::getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID) {
NIMBLE_LOGD(LOG_TAG, ">> getValue: serviceUUID: %s, characteristicUUID: %s",
serviceUUID.toString().c_str(), characteristicUUID.toString().c_str());
- NimBLEAttValue ret;
+ std::string ret = "";
NimBLERemoteService* pService = getService(serviceUUID);
if(pService != nullptr) {
@@ -853,7 +757,7 @@ NimBLEAttValue NimBLEClient::getValue(const NimBLEUUID &serviceUUID, const NimBL
}
}
- NIMBLE_LOGD(LOG_TAG, "<< getValue");
+ NIMBLE_LOGD(LOG_TAG, "<> setValue: serviceUUID: %s, characteristicUUID: %s",
serviceUUID.toString().c_str(), characteristicUUID.toString().c_str());
@@ -928,7 +832,7 @@ uint16_t NimBLEClient::getMTU() {
* @param [in] arg A pointer to the client instance that registered for this callback.
*/
/*STATIC*/
-int NimBLEClient::handleGapEvent(struct ble_gap_event *event, void *arg) {
+ int NimBLEClient::handleGapEvent(struct ble_gap_event *event, void *arg) {
NimBLEClient* client = (NimBLEClient*)arg;
int rc;
@@ -1046,14 +950,19 @@ int NimBLEClient::handleGapEvent(struct ble_gap_event *event, void *arg) {
NIMBLE_LOGD(LOG_TAG, "Got Notification for characteristic %s",
(*characteristic)->toString().c_str());
- uint32_t data_len = OS_MBUF_PKTLEN(event->notify_rx.om);
- (*characteristic)->m_value.setValue(event->notify_rx.om->om_data, data_len);
+ time_t t = time(nullptr);
+ portENTER_CRITICAL(&(*characteristic)->m_valMux);
+ (*characteristic)->m_value = std::string((char *)event->notify_rx.om->om_data,
+ event->notify_rx.om->om_len);
+ (*characteristic)->m_timestamp = t;
+ portEXIT_CRITICAL(&(*characteristic)->m_valMux);
if ((*characteristic)->m_notifyCallback != nullptr) {
NIMBLE_LOGD(LOG_TAG, "Invoking callback for notification on characteristic %s",
(*characteristic)->toString().c_str());
(*characteristic)->m_notifyCallback(*characteristic, event->notify_rx.om->om_data,
- data_len, !event->notify_rx.indication);
+ event->notify_rx.om->om_len,
+ !event->notify_rx.indication);
}
break;
}
@@ -1151,7 +1060,7 @@ int NimBLEClient::handleGapEvent(struct ble_gap_event *event, void *arg) {
NIMBLE_LOGD(LOG_TAG, "ble_sm_inject_io result: %d", rc);
} else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) {
- NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %" PRIu32, event->passkey.params.numcmp);
+ NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %d", event->passkey.params.numcmp);
pkey.action = event->passkey.params.action;
// Compatibility only - Do not use, should be removed the in future
if(NimBLEDevice::m_securityCallbacks != nullptr) {
@@ -1296,4 +1205,5 @@ bool NimBLEClientCallbacks::onConfirmPIN(uint32_t pin){
return true;
}
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif // CONFIG_BT_ENABLED
diff --git a/libraries/NimBLE-Arduino/src/NimBLEClient.h b/libraries/NimBLE-Arduino/src/NimBLEClient.h
index d3c16b72..8bb3119d 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEClient.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEClient.h
@@ -14,14 +14,16 @@
#ifndef MAIN_NIMBLECLIENT_H_
#define MAIN_NIMBLECLIENT_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
#include "NimBLEAddress.h"
#include "NimBLEUUID.h"
#include "NimBLEUtils.h"
#include "NimBLEConnInfo.h"
-#include "NimBLEAttValue.h"
#include "NimBLEAdvertisedDevice.h"
#include "NimBLERemoteService.h"
@@ -38,9 +40,9 @@ class NimBLEAdvertisedDevice;
*/
class NimBLEClient {
public:
- bool connect(NimBLEAdvertisedDevice* device, bool deleteAttributes = true);
- bool connect(const NimBLEAddress &address, bool deleteAttributes = true);
- bool connect(bool deleteAttributes = true);
+ bool connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes = true);
+ bool connect(const NimBLEAddress &address, bool deleteAttibutes = true);
+ bool connect(bool deleteAttibutes = true);
int disconnect(uint8_t reason = BLE_ERR_REM_USER_CONN_TERM);
NimBLEAddress getPeerAddress();
void setPeerAddress(const NimBLEAddress &address);
@@ -52,9 +54,9 @@ class NimBLEClient {
NimBLERemoteService* getService(const NimBLEUUID &uuid);
void deleteServices();
size_t deleteService(const NimBLEUUID &uuid);
- NimBLEAttValue getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID);
+ std::string getValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID);
bool setValue(const NimBLEUUID &serviceUUID, const NimBLEUUID &characteristicUUID,
- const NimBLEAttValue &value, bool response = false);
+ const std::string &value, bool response = false);
NimBLERemoteCharacteristic* getCharacteristic(const uint16_t handle);
bool isConnected();
void setClientCallbacks(NimBLEClientCallbacks *pClientCallbacks,
@@ -69,13 +71,9 @@ class NimBLEClient {
uint16_t scanInterval=16, uint16_t scanWindow=16);
void updateConnParams(uint16_t minInterval, uint16_t maxInterval,
uint16_t latency, uint16_t timeout);
- void setDataLen(uint16_t tx_octets);
- bool discoverAttributes();
+ void discoverAttributes();
NimBLEConnInfo getConnInfo();
int getLastError();
-#if CONFIG_BT_NIMBLE_EXT_ADV
- void setConnectPhy(uint8_t mask);
-#endif
private:
NimBLEClient(const NimBLEAddress &peerAddress);
@@ -101,9 +99,6 @@ class NimBLEClient {
NimBLEClientCallbacks* m_pClientCallbacks;
ble_task_data_t* m_pTaskData;
ble_npl_callout m_dcTimer;
-#if CONFIG_BT_NIMBLE_EXT_ADV
- uint8_t m_phyMask;
-#endif
std::vector m_servicesVector;
@@ -137,7 +132,7 @@ class NimBLEClientCallbacks {
* @brief Called when server requests to update the connection parameters.
* @param [in] pClient A pointer to the calling client object.
* @param [in] params A pointer to the struct containing the connection parameters requested.
- * @return True to accept the parameters.
+ * @return True to accept the parmeters.
*/
virtual bool onConnParamsUpdateRequest(NimBLEClient* pClient, const ble_gap_upd_params* params);
@@ -165,5 +160,6 @@ class NimBLEClientCallbacks {
virtual bool onConfirmPIN(uint32_t pin);
};
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif // CONFIG_BT_ENABLED
#endif /* MAIN_NIMBLECLIENT_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEDescriptor.cpp b/libraries/NimBLE-Arduino/src/NimBLEDescriptor.cpp
index e2e6c1bc..f9467660 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEDescriptor.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEDescriptor.cpp
@@ -11,9 +11,11 @@
* Created on: Jun 22, 2017
* Author: kolban
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
#include "NimBLEService.h"
#include "NimBLEDescriptor.h"
@@ -28,32 +30,28 @@ static NimBLEDescriptorCallbacks defaultCallbacks;
/**
- * @brief Construct a descriptor
- * @param [in] uuid - UUID (const char*) for the descriptor.
- * @param [in] properties - Properties for the descriptor.
- * @param [in] max_len - The maximum length in bytes that the descriptor value can hold. (Default: 512 bytes for esp32, 20 for all others).
- * @param [in] pCharacteristic - pointer to the characteristic instance this descriptor belongs to.
+ * @brief NimBLEDescriptor constructor.
*/
NimBLEDescriptor::NimBLEDescriptor(const char* uuid, uint16_t properties, uint16_t max_len,
- NimBLECharacteristic* pCharacteristic)
-: NimBLEDescriptor(NimBLEUUID(uuid), properties, max_len, pCharacteristic) {
+ NimBLECharacteristic* pCharacteristic)
+: NimBLEDescriptor(NimBLEUUID(uuid), max_len, properties, pCharacteristic) {
}
/**
- * @brief Construct a descriptor
- * @param [in] uuid - UUID (const char*) for the descriptor.
- * @param [in] properties - Properties for the descriptor.
- * @param [in] max_len - The maximum length in bytes that the descriptor value can hold. (Default: 512 bytes for esp32, 20 for all others).
- * @param [in] pCharacteristic - pointer to the characteristic instance this descriptor belongs to.
+ * @brief NimBLEDescriptor constructor.
*/
NimBLEDescriptor::NimBLEDescriptor(NimBLEUUID uuid, uint16_t properties, uint16_t max_len,
NimBLECharacteristic* pCharacteristic)
-: m_value(std::min(CONFIG_NIMBLE_CPP_ATT_VALUE_INIT_LENGTH , (int)max_len), max_len) {
+{
m_uuid = uuid;
+ m_value.attr_len = 0; // Initial length is 0.
+ m_value.attr_max_len = max_len; // Maximum length of the data.
m_handle = NULL_HANDLE; // Handle is initially unknown.
m_pCharacteristic = pCharacteristic;
m_pCallbacks = &defaultCallbacks; // No initial callback.
+ m_value.attr_value = (uint8_t*) calloc(max_len,1); // Allocate storage for the value.
+ m_valMux = portMUX_INITIALIZER_UNLOCKED;
m_properties = 0;
m_removed = 0;
@@ -89,6 +87,7 @@ NimBLEDescriptor::NimBLEDescriptor(NimBLEUUID uuid, uint16_t properties, uint16_
* @brief NimBLEDescriptor destructor.
*/
NimBLEDescriptor::~NimBLEDescriptor() {
+ free(m_value.attr_value); // Release the storage we created in the constructor.
} // ~NimBLEDescriptor
/**
@@ -105,7 +104,7 @@ uint16_t NimBLEDescriptor::getHandle() {
* @return The length (in bytes) of the value of this descriptor.
*/
size_t NimBLEDescriptor::getLength() {
- return m_value.size();
+ return m_value.attr_len;
} // getLength
@@ -119,14 +118,10 @@ NimBLEUUID NimBLEDescriptor::getUUID() {
/**
* @brief Get the value of this descriptor.
- * @return The NimBLEAttValue of this descriptor.
+ * @return A pointer to the value of this descriptor.
*/
-NimBLEAttValue NimBLEDescriptor::getValue(time_t *timestamp) {
- if (timestamp != nullptr) {
- m_value.getValue(timestamp);
- }
-
- return m_value;
+uint8_t* NimBLEDescriptor::getValue() {
+ return m_value.attr_value;
} // getValue
@@ -135,7 +130,7 @@ NimBLEAttValue NimBLEDescriptor::getValue(time_t *timestamp) {
* @return A std::string instance containing a copy of the descriptor's value.
*/
std::string NimBLEDescriptor::getStringValue() {
- return std::string(m_value);
+ return std::string((char *) m_value.attr_value, m_value.attr_len);
}
@@ -150,12 +145,8 @@ NimBLECharacteristic* NimBLEDescriptor::getCharacteristic() {
int NimBLEDescriptor::handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
struct ble_gatt_access_ctxt *ctxt, void *arg) {
- (void)conn_handle;
- (void)attr_handle;
-
const ble_uuid_t *uuid;
int rc;
- struct ble_gap_conn_desc desc;
NimBLEDescriptor* pDescriptor = (NimBLEDescriptor*)arg;
NIMBLE_LOGD(LOG_TAG, "Descriptor %s %s event", pDescriptor->getUUID().toString().c_str(),
@@ -165,36 +156,29 @@ int NimBLEDescriptor::handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
if(ble_uuid_cmp(uuid, &pDescriptor->getUUID().getNative()->u) == 0){
switch(ctxt->op) {
case BLE_GATT_ACCESS_OP_READ_DSC: {
- rc = ble_gap_conn_find(conn_handle, &desc);
- assert(rc == 0);
-
- // If the packet header is only 8 bytes this is a follow up of a long read
- // so we don't want to call the onRead() callback again.
- if(ctxt->om->om_pkthdr_len > 8 ||
- pDescriptor->m_value.size() <= (ble_att_mtu(desc.conn_handle) - 3)) {
+ // If the packet header is only 8 bytes this is a follow up of a long read
+ // so we don't want to call the onRead() callback again.
+ if(ctxt->om->om_pkthdr_len > 8) {
pDescriptor->m_pCallbacks->onRead(pDescriptor);
}
-
- ble_npl_hw_enter_critical();
- rc = os_mbuf_append(ctxt->om, pDescriptor->m_value.data(), pDescriptor->m_value.size());
- ble_npl_hw_exit_critical(0);
+ portENTER_CRITICAL(&pDescriptor->m_valMux);
+ rc = os_mbuf_append(ctxt->om, pDescriptor->getValue(), pDescriptor->getLength());
+ portEXIT_CRITICAL(&pDescriptor->m_valMux);
return rc == 0 ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES;
}
case BLE_GATT_ACCESS_OP_WRITE_DSC: {
- uint16_t att_max_len = pDescriptor->m_value.max_size();
-
- if (ctxt->om->om_len > att_max_len) {
+ if (ctxt->om->om_len > pDescriptor->m_value.attr_max_len) {
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
}
- uint8_t buf[att_max_len];
+ uint8_t buf[pDescriptor->m_value.attr_max_len];
size_t len = ctxt->om->om_len;
memcpy(buf, ctxt->om->om_data,len);
os_mbuf *next;
next = SLIST_NEXT(ctxt->om, om_next);
while(next != NULL){
- if((len + next->om_len) > att_max_len) {
+ if((len + next->om_len) > pDescriptor->m_value.attr_max_len) {
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
}
memcpy(&buf[len], next->om_data, next->om_len);
@@ -246,22 +230,28 @@ void NimBLEDescriptor::setHandle(uint16_t handle) {
* @param [in] length The length of the data in bytes.
*/
void NimBLEDescriptor::setValue(const uint8_t* data, size_t length) {
- m_value.setValue(data, length);
+ if (length > m_value.attr_max_len) {
+ NIMBLE_LOGE(LOG_TAG, "Size %d too large, must be no bigger than %d", length, m_value.attr_max_len);
+ return;
+ }
+ portENTER_CRITICAL(&m_valMux);
+ m_value.attr_len = length;
+ memcpy(m_value.attr_value, data, length);
+ portEXIT_CRITICAL(&m_valMux);
} // setValue
/**
- * @brief Set the value of the descriptor from a `std::vector`.\n
- * @param [in] vec The std::vector reference to set the descriptor value from.
+ * @brief Set the value of the descriptor.
+ * @param [in] value The value of the descriptor in string form.
*/
-void NimBLEDescriptor::setValue(const std::vector& vec) {
- return setValue((uint8_t*)&vec[0], vec.size());
+void NimBLEDescriptor::setValue(const std::string &value) {
+ setValue((uint8_t*) value.data(), value.length());
} // setValue
-
/**
* @brief Set the characteristic this descriptor belongs to.
- * @param [in] pChar A pointer to the characteristic this descriptor belongs to.
+ * @param [in] pChar A pointer to the characteristic this descriptior belongs to.
*/
void NimBLEDescriptor::setCharacteristic(NimBLECharacteristic* pChar) {
m_pCharacteristic = pChar;
@@ -287,7 +277,6 @@ NimBLEDescriptorCallbacks::~NimBLEDescriptorCallbacks() {}
* @param [in] pDescriptor The descriptor that is the source of the event.
*/
void NimBLEDescriptorCallbacks::onRead(NimBLEDescriptor* pDescriptor) {
- (void)pDescriptor;
NIMBLE_LOGD("NimBLEDescriptorCallbacks", "onRead: default");
} // onRead
@@ -297,8 +286,8 @@ void NimBLEDescriptorCallbacks::onRead(NimBLEDescriptor* pDescriptor) {
* @param [in] pDescriptor The descriptor that is the source of the event.
*/
void NimBLEDescriptorCallbacks::onWrite(NimBLEDescriptor* pDescriptor) {
- (void)pDescriptor;
NIMBLE_LOGD("NimBLEDescriptorCallbacks", "onWrite: default");
} // onWrite
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif /* CONFIG_BT_ENABLED */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEDescriptor.h b/libraries/NimBLE-Arduino/src/NimBLEDescriptor.h
index 4ee9a624..5dc0ce89 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEDescriptor.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEDescriptor.h
@@ -14,16 +14,25 @@
#ifndef MAIN_NIMBLEDESCRIPTOR_H_
#define MAIN_NIMBLEDESCRIPTOR_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
#include "NimBLECharacteristic.h"
#include "NimBLEUUID.h"
-#include "NimBLEAttValue.h"
#include
+
+typedef struct
+{
+ uint16_t attr_max_len; /*!< attribute max value length */
+ uint16_t attr_len; /*!< attribute current value length */
+ uint8_t *attr_value; /*!< the pointer to attribute value */
+} attr_value_t;
+
class NimBLEService;
class NimBLECharacteristic;
class NimBLEDescriptorCallbacks;
@@ -47,36 +56,24 @@ class NimBLEDescriptor {
uint16_t getHandle();
NimBLEUUID getUUID();
std::string toString();
+
void setCallbacks(NimBLEDescriptorCallbacks* pCallbacks);
- NimBLECharacteristic* getCharacteristic();
size_t getLength();
- NimBLEAttValue getValue(time_t *timestamp = nullptr);
+ uint8_t* getValue();
std::string getStringValue();
void setValue(const uint8_t* data, size_t size);
- void setValue(const std::vector& vec);
-
- /*********************** Template Functions ************************/
+ void setValue(const std::string &value);
+ NimBLECharacteristic* getCharacteristic();
/**
- * @brief Template to set the characteristic value to val.
+ * @brief Convenience template to set the descriptor value to val.
* @param [in] s The value to set.
*/
template
- void setValue(const T &s) { m_value.setValue(s); }
-
- /**
- * @brief Template to convert the descriptor data to .
- * @tparam T The type to convert the data to.
- * @param [in] timestamp (Optional) A pointer to a time_t struct to store the time the value was read.
- * @param [in] skipSizeCheck (Optional) If true it will skip checking if the data size is less than sizeof() .
- * @return The data converted to or NULL if skipSizeCheck is false and the data is less than sizeof() .
- * @details Use: getValue(×tamp, skipSizeCheck);
- */
- template
- T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
- return m_value.getValue(timestamp, skipSizeCheck);
+ void setValue(const T &s) {
+ setValue((uint8_t*)&s, sizeof(T));
}
private:
@@ -94,7 +91,8 @@ class NimBLEDescriptor {
NimBLEDescriptorCallbacks* m_pCallbacks;
NimBLECharacteristic* m_pCharacteristic;
uint8_t m_properties;
- NimBLEAttValue m_value;
+ attr_value_t m_value;
+ portMUX_TYPE m_valMux;
uint8_t m_removed;
}; // NimBLEDescriptor
@@ -115,5 +113,6 @@ class NimBLEDescriptorCallbacks {
#include "NimBLE2904.h"
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif /* CONFIG_BT_ENABLED */
#endif /* MAIN_NIMBLEDESCRIPTOR_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEDevice.cpp b/libraries/NimBLE-Arduino/src/NimBLEDevice.cpp
index 43ba2190..bc253659 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEDevice.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEDevice.cpp
@@ -11,45 +11,27 @@
* Created on: Mar 16, 2017
* Author: kolban
*/
-
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
+#include "nimconfig.h"
#include "NimBLEDevice.h"
#include "NimBLEUtils.h"
-#ifdef ESP_PLATFORM
-# include "esp_err.h"
-# include "esp_bt.h"
-# include "nvs_flash.h"
-# if defined(CONFIG_NIMBLE_CPP_IDF)
-# include "esp_nimble_hci.h"
-# include "nimble/nimble_port.h"
-# include "nimble/nimble_port_freertos.h"
-# include "host/ble_hs.h"
-# include "host/ble_hs_pvcy.h"
-# include "host/util/util.h"
-# include "services/gap/ble_svc_gap.h"
-# include "services/gatt/ble_svc_gatt.h"
-# else
-# include "nimble/esp_port/esp-hci/include/esp_nimble_hci.h"
-# endif
-#else
-# include "nimble/nimble/controller/include/controller/ble_phy.h"
-#endif
+#include "esp_err.h"
+#include "esp_bt.h"
+#include "nvs_flash.h"
+#include "esp_nimble_hci.h"
+#include "nimble/nimble_port.h"
+#include "nimble/nimble_port_freertos.h"
+#include "host/ble_hs.h"
+#include "host/ble_hs_pvcy.h"
+#include "host/util/util.h"
+#include "services/gap/ble_svc_gap.h"
+#include "services/gatt/ble_svc_gatt.h"
-#ifndef CONFIG_NIMBLE_CPP_IDF
-# include "nimble/porting/nimble/include/nimble/nimble_port.h"
-# include "nimble/porting/npl/freertos/include/nimble/nimble_port_freertos.h"
-# include "nimble/nimble/host/include/host/ble_hs.h"
-# include "nimble/nimble/host/include/host/ble_hs_pvcy.h"
-# include "nimble/nimble/host/util/include/host/util/util.h"
-# include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
-# include "nimble/nimble/host/services/gatt/include/services/gatt/ble_svc_gatt.h"
-#endif
-
-#if defined(ESP_PLATFORM) && defined(CONFIG_ENABLE_ARDUINO_DEPENDS)
-# include "esp32-hal-bt.h"
+#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
+#include "esp32-hal-bt.h"
#endif
#include "NimBLELog.h"
@@ -69,11 +51,7 @@ NimBLEServer* NimBLEDevice::m_pServer = nullptr;
uint32_t NimBLEDevice::m_passkey = 123456;
bool NimBLEDevice::m_synced = false;
#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-# if CONFIG_BT_NIMBLE_EXT_ADV
-NimBLEExtAdvertising* NimBLEDevice::m_bleAdvertising = nullptr;
-# else
NimBLEAdvertising* NimBLEDevice::m_bleAdvertising = nullptr;
-# endif
#endif
gap_event_handler NimBLEDevice::m_customGapHandler = nullptr;
@@ -85,10 +63,9 @@ std::list NimBLEDevice::m_ignoreList;
std::vector NimBLEDevice::m_whiteList;
NimBLESecurityCallbacks* NimBLEDevice::m_securityCallbacks = nullptr;
uint8_t NimBLEDevice::m_own_addr_type = BLE_OWN_ADDR_PUBLIC;
-#ifdef ESP_PLATFORM
uint16_t NimBLEDevice::m_scanDuplicateSize = CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE;
uint8_t NimBLEDevice::m_scanFilterMode = CONFIG_BTDM_SCAN_DUPL_TYPE;
-#endif
+
/**
* @brief Create a new instance of a server.
@@ -118,45 +95,6 @@ uint8_t NimBLEDevice::m_scanFilterMode = CONFIG_BTDM_SCAN_DU
#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-# if CONFIG_BT_NIMBLE_EXT_ADV
-/**
- * @brief Get the instance of the advertising object.
- * @return A pointer to the advertising object.
- */
-NimBLEExtAdvertising* NimBLEDevice::getAdvertising() {
- if(m_bleAdvertising == nullptr) {
- m_bleAdvertising = new NimBLEExtAdvertising();
- }
- return m_bleAdvertising;
-}
-
-
-/**
- * @brief Convenience function to begin advertising.
- * @param [in] inst_id The extended advertisement instance ID to start.
- * @param [in] duration How long to advertise for in milliseconds, 0 = forever (default).
- * @param [in] max_events Maximum number of advertisement events to send, 0 = no limit (default).
- * @return True if advertising started successfully.
- */
-bool NimBLEDevice::startAdvertising(uint8_t inst_id,
- int duration,
- int max_events) {
- return getAdvertising()->start(inst_id, duration, max_events);
-} // startAdvertising
-
-
-/**
- * @brief Convenience function to stop advertising a data set.
- * @param [in] inst_id The extended advertisement instance ID to stop advertising.
- * @return True if advertising stopped successfully.
- */
-bool NimBLEDevice::stopAdvertising(uint8_t inst_id) {
- return getAdvertising()->stop(inst_id);
-} // stopAdvertising
-
-# endif
-
-# if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
/**
* @brief Get the instance of the advertising object.
* @return A pointer to the advertising object.
@@ -171,19 +109,17 @@ NimBLEAdvertising* NimBLEDevice::getAdvertising() {
/**
* @brief Convenience function to begin advertising.
- * @return True if advertising started successfully.
*/
-bool NimBLEDevice::startAdvertising() {
- return getAdvertising()->start();
+void NimBLEDevice::startAdvertising() {
+ getAdvertising()->start();
} // startAdvertising
-# endif
+
/**
- * @brief Convenience function to stop all advertising.
- * @return True if advertising stopped successfully.
+ * @brief Convenience function to stop advertising.
*/
-bool NimBLEDevice::stopAdvertising() {
- return getAdvertising()->stop();
+void NimBLEDevice::stopAdvertising() {
+ getAdvertising()->stop();
} // stopAdvertising
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
@@ -194,8 +130,7 @@ bool NimBLEDevice::stopAdvertising() {
* try and release/delete it.
*/
#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
-/* STATIC */
-NimBLEScan* NimBLEDevice::getScan() {
+/* STATIC */ NimBLEScan* NimBLEDevice::getScan() {
if (m_pScan == nullptr) {
m_pScan = new NimBLEScan();
}
@@ -212,8 +147,7 @@ NimBLEScan* NimBLEDevice::getScan() {
* @return A reference to the new client object.
*/
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
-/* STATIC */
-NimBLEClient* NimBLEDevice::createClient(NimBLEAddress peerAddress) {
+/* STATIC */ NimBLEClient* NimBLEDevice::createClient(NimBLEAddress peerAddress) {
if(m_cList.size() >= NIMBLE_MAX_CONNECTIONS) {
NIMBLE_LOGW(LOG_TAG,"Number of clients exceeds Max connections. Cur=%d Max=%d",
m_cList.size(), NIMBLE_MAX_CONNECTIONS);
@@ -231,8 +165,7 @@ NimBLEClient* NimBLEDevice::createClient(NimBLEAddress peerAddress) {
* Checks if it is connected or trying to connect and disconnects/stops it first.
* @param [in] pClient A pointer to the client object.
*/
-/* STATIC */
-bool NimBLEDevice::deleteClient(NimBLEClient* pClient) {
+/* STATIC */ bool NimBLEDevice::deleteClient(NimBLEClient* pClient) {
if(pClient == nullptr) {
return false;
}
@@ -276,8 +209,7 @@ bool NimBLEDevice::deleteClient(NimBLEClient* pClient) {
* @brief Get the list of created client objects.
* @return A pointer to the list of clients.
*/
-/* STATIC */
-std::list* NimBLEDevice::getClientList() {
+/* STATIC */std::list* NimBLEDevice::getClientList() {
return &m_cList;
} // getClientList
@@ -286,8 +218,7 @@ std::list* NimBLEDevice::getClientList() {
* @brief Get the number of created client objects.
* @return Number of client objects created.
*/
-/* STATIC */
-size_t NimBLEDevice::getClientListSize() {
+/* STATIC */size_t NimBLEDevice::getClientListSize() {
return m_cList.size();
} // getClientList
@@ -297,8 +228,7 @@ size_t NimBLEDevice::getClientListSize() {
* @param [in] conn_id The client connection ID to search for.
* @return A pointer to the client object with the spcified connection ID.
*/
-/* STATIC */
-NimBLEClient* NimBLEDevice::getClientByID(uint16_t conn_id) {
+/* STATIC */NimBLEClient* NimBLEDevice::getClientByID(uint16_t conn_id) {
for(auto it = m_cList.cbegin(); it != m_cList.cend(); ++it) {
if((*it)->getConnId() == conn_id) {
return (*it);
@@ -314,8 +244,7 @@ NimBLEClient* NimBLEDevice::getClientByID(uint16_t conn_id) {
* @param [in] peer_addr The address of the peer to search for.
* @return A pointer to the client object with the peer address.
*/
-/* STATIC */
-NimBLEClient* NimBLEDevice::getClientByPeerAddress(const NimBLEAddress &peer_addr) {
+/* STATIC */NimBLEClient* NimBLEDevice::getClientByPeerAddress(const NimBLEAddress &peer_addr) {
for(auto it = m_cList.cbegin(); it != m_cList.cend(); ++it) {
if((*it)->getPeerAddress().equals(peer_addr)) {
return (*it);
@@ -329,8 +258,7 @@ NimBLEClient* NimBLEDevice::getClientByPeerAddress(const NimBLEAddress &peer_add
* @brief Finds the first disconnected client in the list.
* @return A pointer to the first client object that is not connected to a peer.
*/
-/* STATIC */
-NimBLEClient* NimBLEDevice::getDisconnectedClient() {
+/* STATIC */NimBLEClient* NimBLEDevice::getDisconnectedClient() {
for(auto it = m_cList.cbegin(); it != m_cList.cend(); ++it) {
if(!(*it)->isConnected()) {
return (*it);
@@ -341,7 +269,7 @@ NimBLEClient* NimBLEDevice::getDisconnectedClient() {
#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
-#ifdef ESP_PLATFORM
+
/**
* @brief Set the transmission power.
* @param [in] powerLevel The power level to set, can be one of:
@@ -367,15 +295,12 @@ NimBLEClient* NimBLEDevice::getDisconnectedClient() {
* * ESP_BLE_PWR_TYPE_SCAN = 10, For scan
* * ESP_BLE_PWR_TYPE_DEFAULT = 11, For default, if not set other, it will use default value
*/
-/* STATIC */
-void NimBLEDevice::setPower(esp_power_level_t powerLevel, esp_ble_power_type_t powerType) {
+/* STATIC */ void NimBLEDevice::setPower(esp_power_level_t powerLevel, esp_ble_power_type_t powerType) {
NIMBLE_LOGD(LOG_TAG, ">> setPower: %d (type: %d)", powerLevel, powerType);
-
esp_err_t errRc = esp_ble_tx_power_set(powerType, powerLevel);
if (errRc != ESP_OK) {
NIMBLE_LOGE(LOG_TAG, "esp_ble_tx_power_set: rc=%d", errRc);
}
-
NIMBLE_LOGD(LOG_TAG, "<< setPower");
} // setPower
@@ -397,8 +322,9 @@ void NimBLEDevice::setPower(esp_power_level_t powerLevel, esp_ble_power_type_t p
* * ESP_BLE_PWR_TYPE_DEFAULT = 11, For default, if not set other, it will use default value
* @return the power level currently used by the type specified.
*/
-/* STATIC */
-int NimBLEDevice::getPower(esp_ble_power_type_t powerType) {
+
+/* STATIC */ int NimBLEDevice::getPower(esp_ble_power_type_t powerType) {
+
switch(esp_ble_tx_power_get(powerType)) {
case ESP_PWR_LVL_N12:
return -12;
@@ -407,7 +333,7 @@ int NimBLEDevice::getPower(esp_ble_power_type_t powerType) {
case ESP_PWR_LVL_N6:
return -6;
case ESP_PWR_LVL_N3:
- return -3;
+ return -6;
case ESP_PWR_LVL_N0:
return 0;
case ESP_PWR_LVL_P3:
@@ -421,25 +347,13 @@ int NimBLEDevice::getPower(esp_ble_power_type_t powerType) {
}
} // getPower
-#else
-
-void NimBLEDevice::setPower(int dbm) {
- ble_phy_txpwr_set(dbm);
-}
-
-
-int NimBLEDevice::getPower() {
- return ble_phy_txpwr_get();
-}
-#endif
/**
* @brief Get our device address.
* @return A NimBLEAddress object of our public address if we have one,
* if not then our current random address.
*/
-/* STATIC*/
-NimBLEAddress NimBLEDevice::getAddress() {
+/* STATIC*/ NimBLEAddress NimBLEDevice::getAddress() {
ble_addr_t addr = {BLE_ADDR_PUBLIC, 0};
if(BLE_HS_ENOADDR == ble_hs_id_copy_addr(BLE_ADDR_PUBLIC, addr.val, NULL)) {
@@ -456,8 +370,7 @@ NimBLEAddress NimBLEDevice::getAddress() {
* @brief Return a string representation of the address of this device.
* @return A string representation of this device address.
*/
-/* STATIC */
-std::string NimBLEDevice::toString() {
+/* STATIC */ std::string NimBLEDevice::toString() {
return getAddress().toString();
} // toString
@@ -467,8 +380,7 @@ std::string NimBLEDevice::toString() {
* @param [in] mtu Value to set local mtu:
* * This should be larger than 23 and lower or equal to BLE_ATT_MTU_MAX = 527.
*/
-/* STATIC */
-int NimBLEDevice::setMTU(uint16_t mtu) {
+/* STATIC */int NimBLEDevice::setMTU(uint16_t mtu) {
NIMBLE_LOGD(LOG_TAG, ">> setLocalMTU: %d", mtu);
int rc = ble_att_set_preferred_mtu(mtu);
@@ -486,13 +398,11 @@ int NimBLEDevice::setMTU(uint16_t mtu) {
* @brief Get local MTU value set.
* @return The current preferred MTU setting.
*/
-/* STATIC */
-uint16_t NimBLEDevice::getMTU() {
+/* STATIC */uint16_t NimBLEDevice::getMTU() {
return ble_att_preferred_mtu();
}
-#ifdef ESP_PLATFORM
/**
* @brief Set the duplicate filter cache size for filtering scanned devices.
* @param [in] cacheSize The number of advertisements filtered before the cache is reset.\n
@@ -538,7 +448,6 @@ void NimBLEDevice::setScanFilterMode(uint8_t mode) {
m_scanFilterMode = mode;
}
-#endif
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL) || defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
/**
@@ -561,7 +470,7 @@ int NimBLEDevice::getNumBonds() {
/**
* @brief Deletes all bonding information.
*/
-/*STATIC*/
+ /*STATIC*/
void NimBLEDevice::deleteAllBonds() {
ble_store_clear();
}
@@ -641,7 +550,6 @@ NimBLEAddress NimBLEDevice::getBondedAddress(int index) {
* @param [in] address The address to check for in the whitelist.
* @returns true if the address is in the whitelist.
*/
-/*STATIC*/
bool NimBLEDevice::onWhiteList(const NimBLEAddress & address) {
for (auto &it : m_whiteList) {
if (it == address) {
@@ -658,7 +566,6 @@ bool NimBLEDevice::onWhiteList(const NimBLEAddress & address) {
* @param [in] address The address to add to the whitelist.
* @returns true if successful.
*/
-/*STATIC*/
bool NimBLEDevice::whiteListAdd(const NimBLEAddress & address) {
if (NimBLEDevice::onWhiteList(address)) {
return true;
@@ -690,7 +597,6 @@ bool NimBLEDevice::whiteListAdd(const NimBLEAddress & address) {
* @param [in] address The address to remove from the whitelist.
* @returns true if successful.
*/
-/*STATIC*/
bool NimBLEDevice::whiteListRemove(const NimBLEAddress & address) {
if (!NimBLEDevice::onWhiteList(address)) {
return true;
@@ -730,7 +636,6 @@ bool NimBLEDevice::whiteListRemove(const NimBLEAddress & address) {
* @brief Gets the count of addresses in the whitelist.
* @returns The number of addresses in the whitelist.
*/
-/*STATIC*/
size_t NimBLEDevice::getWhiteListCount() {
return m_whiteList.size();
}
@@ -741,7 +646,6 @@ size_t NimBLEDevice::getWhiteListCount() {
* @param [in] index The vector index to retrieve the address from.
* @returns the NimBLEAddress at the whitelist index or nullptr if not found.
*/
-/*STATIC*/
NimBLEAddress NimBLEDevice::getWhiteListAddress(size_t index) {
if (index > m_whiteList.size()) {
NIMBLE_LOGE(LOG_TAG, "Invalid index; %u", index);
@@ -755,8 +659,7 @@ NimBLEAddress NimBLEDevice::getWhiteListAddress(size_t index) {
* @brief Host reset, we pass the message so we don't make calls until resynced.
* @param [in] reason The reason code for the reset.
*/
-/* STATIC */
-void NimBLEDevice::onReset(int reason)
+/* STATIC */ void NimBLEDevice::onReset(int reason)
{
if(!m_synced) {
return;
@@ -780,8 +683,7 @@ void NimBLEDevice::onReset(int reason)
/**
* @brief Host resynced with controller, all clear to make calls to the stack.
*/
-/* STATIC */
-void NimBLEDevice::onSync(void)
+/* STATIC */ void NimBLEDevice::onSync(void)
{
NIMBLE_LOGI(LOG_TAG, "NimBle host synced.");
// This check is needed due to potentially being called multiple times in succession
@@ -794,15 +696,7 @@ void NimBLEDevice::onSync(void)
int rc = ble_hs_util_ensure_addr(0);
assert(rc == 0);
-#ifndef ESP_PLATFORM
- rc = ble_hs_id_infer_auto(m_own_addr_type, &m_own_addr_type);
- if (rc != 0) {
- NIMBLE_LOGE(LOG_TAG, "error determining address type; rc=%d", rc);
- return;
- }
-#endif
-
- // Yield for housekeeping before returning to operations.
+ // Yield for houskeeping before returning to operations.
// Occasionally triggers exception without.
taskYIELD();
@@ -827,11 +721,9 @@ void NimBLEDevice::onSync(void)
/**
* @brief The main host task.
*/
-/* STATIC */
-void NimBLEDevice::host_task(void *param)
+/* STATIC */ void NimBLEDevice::host_task(void *param)
{
NIMBLE_LOGI(LOG_TAG, "BLE Host Task Started");
-
/* This function will return only when nimble_port_stop() is executed */
nimble_port_run();
@@ -843,15 +735,13 @@ void NimBLEDevice::host_task(void *param)
* @brief Initialize the %BLE environment.
* @param [in] deviceName The device name of the device.
*/
-/* STATIC */
-void NimBLEDevice::init(const std::string &deviceName) {
+/* STATIC */ void NimBLEDevice::init(const std::string &deviceName) {
if(!initialized){
int rc=0;
-#ifdef ESP_PLATFORM
esp_err_t errRc = ESP_OK;
#ifdef CONFIG_ENABLE_ARDUINO_DEPENDS
- // make sure the linker includes esp32-hal-bt.c so Arduino init doesn't release BLE memory.
+ // make sure the linker includes esp32-hal-bt.c so ardruino init doesn't release BLE memory.
btStarted();
#endif
@@ -867,7 +757,7 @@ void NimBLEDevice::init(const std::string &deviceName) {
esp_bt_controller_mem_release(ESP_BT_MODE_CLASSIC_BT);
esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT();
-#if defined (CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
+#ifdef CONFIG_IDF_TARGET_ESP32C3
bt_cfg.bluetooth_mode = ESP_BT_MODE_BLE;
#else
bt_cfg.mode = ESP_BT_MODE_BLE;
@@ -879,7 +769,6 @@ void NimBLEDevice::init(const std::string &deviceName) {
ESP_ERROR_CHECK(esp_bt_controller_init(&bt_cfg));
ESP_ERROR_CHECK(esp_bt_controller_enable(ESP_BT_MODE_BLE));
ESP_ERROR_CHECK(esp_nimble_hci_init());
-#endif
nimble_port_init();
// Setup callbacks for host events
@@ -904,10 +793,9 @@ void NimBLEDevice::init(const std::string &deviceName) {
nimble_port_freertos_init(NimBLEDevice::host_task);
}
-
// Wait for host and controller to sync before returning and accepting new tasks
while(!m_synced){
- taskYIELD();
+ vTaskDelay(1 / portTICK_PERIOD_MS);
}
initialized = true; // Set the initialization flag to ensure we are only initialized once.
@@ -919,17 +807,16 @@ void NimBLEDevice::init(const std::string &deviceName) {
* @param [in] clearAll If true, deletes all server/advertising/scan/client objects after deinitializing.
* @note If clearAll is true when called, any references to the created objects become invalid.
*/
-/* STATIC */
-void NimBLEDevice::deinit(bool clearAll) {
+/* STATIC */ void NimBLEDevice::deinit(bool clearAll) {
int ret = nimble_port_stop();
if (ret == 0) {
nimble_port_deinit();
-#ifdef ESP_PLATFORM
+
ret = esp_nimble_hci_and_controller_deinit();
if (ret != ESP_OK) {
NIMBLE_LOGE(LOG_TAG, "esp_nimble_hci_and_controller_deinit() failed with error: %d", ret);
}
-#endif
+
initialized = false;
m_synced = false;
@@ -971,21 +858,11 @@ void NimBLEDevice::deinit(bool clearAll) {
}
} // deinit
-/**
- * @brief Set the BLEDevice's name
- * @param [in] deviceName The device name of the device.
- */
-/* STATIC */
-void NimBLEDevice::setDeviceName(const std::string &deviceName) {
- ble_svc_gap_device_name_set(deviceName.c_str());
-} // setDeviceName
-
/**
* @brief Check if the initialization is complete.
* @return true if initialized.
*/
-/*STATIC*/
bool NimBLEDevice::getInitialized() {
return initialized;
} // getInitialized
@@ -997,8 +874,7 @@ bool NimBLEDevice::getInitialized() {
* @param mitm If true we are capable of man in the middle protection, false if not.
* @param sc If true we will perform secure connection pairing, false we will use legacy pairing.
*/
-/*STATIC*/
-void NimBLEDevice::setSecurityAuth(bool bonding, bool mitm, bool sc) {
+/*STATIC*/ void NimBLEDevice::setSecurityAuth(bool bonding, bool mitm, bool sc) {
NIMBLE_LOGD(LOG_TAG, "Setting bonding: %d, mitm: %d, sc: %d",bonding,mitm,sc);
ble_hs_cfg.sm_bonding = bonding;
ble_hs_cfg.sm_mitm = mitm;
@@ -1015,8 +891,7 @@ void NimBLEDevice::setSecurityAuth(bool bonding, bool mitm, bool sc) {
* * 0x08 BLE_SM_PAIR_AUTHREQ_SC
* * 0x10 BLE_SM_PAIR_AUTHREQ_KEYPRESS - not yet supported.
*/
-/*STATIC*/
-void NimBLEDevice::setSecurityAuth(uint8_t auth_req) {
+/*STATIC*/void NimBLEDevice::setSecurityAuth(uint8_t auth_req) {
NimBLEDevice::setSecurityAuth((auth_req & BLE_SM_PAIR_AUTHREQ_BOND)>0,
(auth_req & BLE_SM_PAIR_AUTHREQ_MITM)>0,
(auth_req & BLE_SM_PAIR_AUTHREQ_SC)>0);
@@ -1032,8 +907,7 @@ void NimBLEDevice::setSecurityAuth(uint8_t auth_req) {
* * 0x03 BLE_HS_IO_NO_INPUT_OUTPUT NoInputNoOutput IO capability
* * 0x04 BLE_HS_IO_KEYBOARD_DISPLAY KeyboardDisplay Only IO capability
*/
-/*STATIC*/
-void NimBLEDevice::setSecurityIOCap(uint8_t iocap) {
+/*STATIC*/ void NimBLEDevice::setSecurityIOCap(uint8_t iocap) {
ble_hs_cfg.sm_io_cap = iocap;
} // setSecurityIOCap
@@ -1047,8 +921,7 @@ void NimBLEDevice::setSecurityIOCap(uint8_t iocap) {
* * 0x04: BLE_SM_PAIR_KEY_DIST_SIGN
* * 0x08: BLE_SM_PAIR_KEY_DIST_LINK
*/
-/*STATIC*/
-void NimBLEDevice::setSecurityInitKey(uint8_t init_key) {
+/*STATIC*/void NimBLEDevice::setSecurityInitKey(uint8_t init_key) {
ble_hs_cfg.sm_our_key_dist = init_key;
} // setsSecurityInitKey
@@ -1062,8 +935,7 @@ void NimBLEDevice::setSecurityInitKey(uint8_t init_key) {
* * 0x04: BLE_SM_PAIR_KEY_DIST_SIGN
* * 0x08: BLE_SM_PAIR_KEY_DIST_LINK
*/
-/*STATIC*/
-void NimBLEDevice::setSecurityRespKey(uint8_t resp_key) {
+/*STATIC*/void NimBLEDevice::setSecurityRespKey(uint8_t resp_key) {
ble_hs_cfg.sm_their_key_dist = resp_key;
} // setsSecurityRespKey
@@ -1072,8 +944,7 @@ void NimBLEDevice::setSecurityRespKey(uint8_t resp_key) {
* @brief Set the passkey the server will ask for when pairing.
* @param [in] pin The passkey to use.
*/
-/*STATIC*/
-void NimBLEDevice::setSecurityPasskey(uint32_t pin) {
+/*STATIC*/void NimBLEDevice::setSecurityPasskey(uint32_t pin) {
m_passkey = pin;
} // setSecurityPasskey
@@ -1082,8 +953,7 @@ void NimBLEDevice::setSecurityPasskey(uint32_t pin) {
* @brief Get the current passkey used for pairing.
* @return The current passkey.
*/
-/*STATIC*/
-uint32_t NimBLEDevice::getSecurityPasskey() {
+/*STATIC*/uint32_t NimBLEDevice::getSecurityPasskey() {
return m_passkey;
} // getSecurityPasskey
@@ -1093,13 +963,11 @@ uint32_t NimBLEDevice::getSecurityPasskey() {
* @param [in] callbacks Pointer to NimBLESecurityCallbacks class
* @deprecated For backward compatibility, New code should use client/server callback methods.
*/
-/*STATIC*/
void NimBLEDevice::setSecurityCallbacks(NimBLESecurityCallbacks* callbacks) {
NimBLEDevice::m_securityCallbacks = callbacks;
} // setSecurityCallbacks
-#ifdef ESP_PLATFORM
/**
* @brief Set the own address type.
* @param [in] own_addr_type Own Bluetooth Device address type.\n
@@ -1110,7 +978,6 @@ void NimBLEDevice::setSecurityCallbacks(NimBLESecurityCallbacks* callbacks) {
* * 0x03: BLE_OWN_ADDR_RPA_RANDOM_DEFAULT
* @param [in] useNRPA If true, and address type is random, uses a non-resolvable random address.
*/
-/*STATIC*/
void NimBLEDevice::setOwnAddrType(uint8_t own_addr_type, bool useNRPA) {
m_own_addr_type = own_addr_type;
switch (own_addr_type) {
@@ -1134,15 +1001,18 @@ void NimBLEDevice::setOwnAddrType(uint8_t own_addr_type, bool useNRPA) {
break;
}
} // setOwnAddrType
-#endif
+
/**
* @brief Start the connection securing and authorization for this connection.
* @param conn_id The connection id of the peer device.
* @returns NimBLE stack return code, 0 = success.
*/
-/* STATIC */
-int NimBLEDevice::startSecurity(uint16_t conn_id) {
+/* STATIC */int NimBLEDevice::startSecurity(uint16_t conn_id) {
+ /* if(m_securityCallbacks != nullptr) {
+ m_securityCallbacks->onSecurityRequest();
+ }
+ */
int rc = ble_gap_security_initiate(conn_id);
if(rc != 0){
NIMBLE_LOGE(LOG_TAG, "ble_gap_security_initiate: rc=%d %s", rc, NimBLEUtils::returnCodeToString(rc));
@@ -1157,8 +1027,7 @@ int NimBLEDevice::startSecurity(uint16_t conn_id) {
* @param [in] address The address to look for.
* @return True if ignoring.
*/
-/*STATIC*/
-bool NimBLEDevice::isIgnored(const NimBLEAddress &address) {
+/*STATIC*/ bool NimBLEDevice::isIgnored(const NimBLEAddress &address) {
for(auto &it : m_ignoreList) {
if(it.equals(address)){
return true;
@@ -1173,8 +1042,7 @@ bool NimBLEDevice::isIgnored(const NimBLEAddress &address) {
* @brief Add a device to the ignore list.
* @param [in] address The address of the device we want to ignore.
*/
-/*STATIC*/
-void NimBLEDevice::addIgnored(const NimBLEAddress &address) {
+/*STATIC*/ void NimBLEDevice::addIgnored(const NimBLEAddress &address) {
m_ignoreList.push_back(address);
}
@@ -1183,8 +1051,7 @@ void NimBLEDevice::addIgnored(const NimBLEAddress &address) {
* @brief Remove a device from the ignore list.
* @param [in] address The address of the device we want to remove from the list.
*/
-/*STATIC*/
-void NimBLEDevice::removeIgnored(const NimBLEAddress &address) {
+/*STATIC*/void NimBLEDevice::removeIgnored(const NimBLEAddress &address) {
for(auto it = m_ignoreList.begin(); it != m_ignoreList.end(); ++it) {
if((*it).equals(address)){
m_ignoreList.erase(it);
@@ -1198,7 +1065,6 @@ void NimBLEDevice::removeIgnored(const NimBLEAddress &address) {
* @brief Set a custom callback for gap events.
* @param [in] handler The function to call when gap events occur.
*/
-/*STATIC*/
void NimBLEDevice::setCustomGapHandler(gap_event_handler handler) {
m_customGapHandler = handler;
int rc = ble_gap_event_listener_register(&m_listener, m_customGapHandler, NULL);
@@ -1210,4 +1076,5 @@ void NimBLEDevice::setCustomGapHandler(gap_event_handler handler) {
}
} // setCustomGapHandler
+
#endif // CONFIG_BT_ENABLED
diff --git a/libraries/NimBLE-Arduino/src/NimBLEDevice.h b/libraries/NimBLE-Arduino/src/NimBLEDevice.h
index 8d4d849e..08a042fc 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEDevice.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEDevice.h
@@ -14,20 +14,17 @@
#ifndef MAIN_NIMBLEDEVICE_H_
#define MAIN_NIMBLEDEVICE_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED)
#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
#include "NimBLEScan.h"
#endif
#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-# if CONFIG_BT_NIMBLE_EXT_ADV
-# include "NimBLEExtAdvertising.h"
-# else
-# include "NimBLEAdvertising.h"
-# endif
+#include "NimBLEAdvertising.h"
#endif
#if defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
@@ -42,9 +39,7 @@
#include "NimBLESecurity.h"
#include "NimBLEAddress.h"
-#ifdef ESP_PLATFORM
-# include "esp_bt.h"
-#endif
+#include "esp_bt.h"
#include
#include
@@ -97,7 +92,6 @@ class NimBLEDevice {
public:
static void init(const std::string &deviceName);
static void deinit(bool clearAll = false);
- static void setDeviceName(const std::string &deviceName);
static bool getInitialized();
static NimBLEAddress getAddress();
static std::string toString();
@@ -116,17 +110,8 @@ class NimBLEDevice {
static NimBLEServer* getServer();
#endif
-#ifdef ESP_PLATFORM
static void setPower(esp_power_level_t powerLevel, esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT);
static int getPower(esp_ble_power_type_t powerType=ESP_BLE_PWR_TYPE_DEFAULT);
- static void setOwnAddrType(uint8_t own_addr_type, bool useNRPA=false);
- static void setScanDuplicateCacheSize(uint16_t cacheSize);
- static void setScanFilterMode(uint8_t type);
-#else
- static void setPower(int dbm);
- static int getPower();
-#endif
-
static void setCustomGapHandler(gap_event_handler handler);
static void setSecurityAuth(bool bonding, bool mitm, bool sc);
static void setSecurityAuth(uint8_t auth_req);
@@ -136,27 +121,20 @@ class NimBLEDevice {
static void setSecurityPasskey(uint32_t pin);
static uint32_t getSecurityPasskey();
static void setSecurityCallbacks(NimBLESecurityCallbacks* pCallbacks);
+ static void setOwnAddrType(uint8_t own_addr_type, bool useNRPA=false);
static int startSecurity(uint16_t conn_id);
static int setMTU(uint16_t mtu);
static uint16_t getMTU();
static bool isIgnored(const NimBLEAddress &address);
static void addIgnored(const NimBLEAddress &address);
static void removeIgnored(const NimBLEAddress &address);
+ static void setScanDuplicateCacheSize(uint16_t cacheSize);
+ static void setScanFilterMode(uint8_t type);
#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-# if CONFIG_BT_NIMBLE_EXT_ADV
- static NimBLEExtAdvertising* getAdvertising();
- static bool startAdvertising(uint8_t inst_id,
- int duration = 0,
- int max_events = 0);
- static bool stopAdvertising(uint8_t inst_id);
- static bool stopAdvertising();
-# endif
-# if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
- static NimBLEAdvertising* getAdvertising();
- static bool startAdvertising();
- static bool stopAdvertising();
-# endif
+ static NimBLEAdvertising* getAdvertising();
+ static void startAdvertising();
+ static void stopAdvertising();
#endif
#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
@@ -193,10 +171,6 @@ class NimBLEDevice {
#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
friend class NimBLEAdvertising;
-# if CONFIG_BT_NIMBLE_EXT_ADV
- friend class NimBLEExtAdvertising;
- friend class NimBLEExtAdvertisement;
-# endif
#endif
static void onReset(int reason);
@@ -213,11 +187,7 @@ class NimBLEDevice {
#endif
#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
-# if CONFIG_BT_NIMBLE_EXT_ADV
- static NimBLEExtAdvertising* m_bleAdvertising;
-# else
static NimBLEAdvertising* m_bleAdvertising;
-# endif
#endif
#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
@@ -229,10 +199,8 @@ class NimBLEDevice {
static ble_gap_event_listener m_listener;
static gap_event_handler m_customGapHandler;
static uint8_t m_own_addr_type;
-#ifdef ESP_PLATFORM
static uint16_t m_scanDuplicateSize;
static uint8_t m_scanFilterMode;
-#endif
static std::vector m_whiteList;
};
diff --git a/libraries/NimBLE-Arduino/src/NimBLEEddystoneTLM.cpp b/libraries/NimBLE-Arduino/src/NimBLEEddystoneTLM.cpp
index 7a9c5102..a0729426 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEEddystoneTLM.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEEddystoneTLM.cpp
@@ -11,14 +11,12 @@
* Created on: Mar 12, 2018
* Author: pcbreflux
*/
-
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include "NimBLEEddystoneTLM.h"
#include "NimBLELog.h"
-#include
#include
#define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00)>>8) + (((x)&0xFF)<<8))
@@ -85,8 +83,8 @@ float NimBLEEddystoneTLM::getTemp() {
} // getTemp
/**
- * @brief Get the count of advertisements sent.
- * @return The number of advertisements.
+ * @brief Get the count of advertisments sent.
+ * @return The number of advertisments.
*/
uint32_t NimBLEEddystoneTLM::getCount() {
return ENDIAN_CHANGE_U32(m_eddystoneData.advCount);
@@ -94,8 +92,8 @@ uint32_t NimBLEEddystoneTLM::getCount() {
/**
- * @brief Get the advertisement time.
- * @return The advertisement time.
+ * @brief Get the advertisment time.
+ * @return The advertisment time.
*/
uint32_t NimBLEEddystoneTLM::getTime() {
return (ENDIAN_CHANGE_U32(m_eddystoneData.tmil)) / 10;
@@ -126,30 +124,30 @@ std::string NimBLEEddystoneTLM::toString() {
out += " C\n";
out += "Adv. Count ";
- snprintf(val, sizeof(val), "%" PRIu32, ENDIAN_CHANGE_U32(m_eddystoneData.advCount));
+ snprintf(val, sizeof(val), "%d", ENDIAN_CHANGE_U32(m_eddystoneData.advCount));
out += val;
out += "\n";
out += "Time in seconds ";
- snprintf(val, sizeof(val), "%" PRIu32, rawsec/10);
+ snprintf(val, sizeof(val), "%d", rawsec/10);
out += val;
out += "\n";
out += "Time ";
- snprintf(val, sizeof(val), "%04" PRIu32, rawsec / 864000);
+ snprintf(val, sizeof(val), "%04d", rawsec / 864000);
out += val;
out += ".";
- snprintf(val, sizeof(val), "%02" PRIu32, (rawsec / 36000) % 24);
+ snprintf(val, sizeof(val), "%02d", (rawsec / 36000) % 24);
out += val;
out += ":";
- snprintf(val, sizeof(val), "%02" PRIu32, (rawsec / 600) % 60);
+ snprintf(val, sizeof(val), "%02d", (rawsec / 600) % 60);
out += val;
out += ":";
- snprintf(val, sizeof(val), "%02" PRIu32, (rawsec / 10) % 60);
+ snprintf(val, sizeof(val), "%02d", (rawsec / 10) % 60);
out += val;
out += "\n";
@@ -158,7 +156,7 @@ std::string NimBLEEddystoneTLM::toString() {
/**
- * @brief Set the raw data for the beacon advertisement.
+ * @brief Set the raw data for the beacon advertisment.
* @param [in] data The raw data to advertise.
*/
void NimBLEEddystoneTLM::setData(const std::string &data) {
@@ -208,8 +206,8 @@ void NimBLEEddystoneTLM::setTemp(float temp) {
/**
- * @brief Set the advertisement count.
- * @param [in] advCount The advertisement number.
+ * @brief Set the advertisment count.
+ * @param [in] advCount The advertisment number.
*/
void NimBLEEddystoneTLM::setCount(uint32_t advCount) {
m_eddystoneData.advCount = advCount;
@@ -217,8 +215,8 @@ void NimBLEEddystoneTLM::setCount(uint32_t advCount) {
/**
- * @brief Set the advertisement time.
- * @param [in] tmil The advertisement time in milliseconds.
+ * @brief Set the advertisment time.
+ * @param [in] tmil The advertisment time in milliseconds.
*/
void NimBLEEddystoneTLM::setTime(uint32_t tmil) {
m_eddystoneData.tmil = tmil;
diff --git a/libraries/NimBLE-Arduino/src/NimBLEEddystoneTLM.h b/libraries/NimBLE-Arduino/src/NimBLEEddystoneTLM.h
index 265c81b4..eb1cb072 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEEddystoneTLM.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEEddystoneTLM.h
@@ -14,7 +14,6 @@
#ifndef _NimBLEEddystoneTLM_H_
#define _NimBLEEddystoneTLM_H_
-
#include "NimBLEUUID.h"
#include
diff --git a/libraries/NimBLE-Arduino/src/NimBLEEddystoneURL.cpp b/libraries/NimBLE-Arduino/src/NimBLEEddystoneURL.cpp
index 73829d79..7c3194c2 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEEddystoneURL.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEEddystoneURL.cpp
@@ -11,7 +11,7 @@
* Created on: Mar 12, 2018
* Author: pcbreflux
*/
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include "NimBLEEddystoneURL.h"
@@ -152,7 +152,7 @@ std::string NimBLEEddystoneURL::getDecodedURL() {
/**
- * @brief Set the raw data for the beacon advertisement.
+ * @brief Set the raw data for the beacon advertisment.
* @param [in] data The raw data to advertise.
*/
void NimBLEEddystoneURL::setData(const std::string &data) {
diff --git a/libraries/NimBLE-Arduino/src/NimBLEExtAdvertising.cpp b/libraries/NimBLE-Arduino/src/NimBLEExtAdvertising.cpp
deleted file mode 100644
index b979c9fd..00000000
--- a/libraries/NimBLE-Arduino/src/NimBLEExtAdvertising.cpp
+++ /dev/null
@@ -1,870 +0,0 @@
-/*
- * NimBLEExtAdvertising.cpp
- *
- * Created: on February 6, 2022
- * Author H2zero
- */
-
-#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && \
- defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && \
- CONFIG_BT_NIMBLE_EXT_ADV
-
-#if defined(CONFIG_NIMBLE_CPP_IDF)
-#include "services/gap/ble_svc_gap.h"
-#else
-#include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
-#endif
-#include "NimBLEExtAdvertising.h"
-#include "NimBLEDevice.h"
-#include "NimBLEServer.h"
-#include "NimBLEUtils.h"
-#include "NimBLELog.h"
-
-static NimBLEExtAdvertisingCallbacks defaultCallbacks;
-static const char* LOG_TAG = "NimBLEExtAdvertising";
-
-
-/**
- * @brief Destructor: deletes callback instances if requested.
- */
-NimBLEExtAdvertising::~NimBLEExtAdvertising() {
- if(m_deleteCallbacks && m_pCallbacks != &defaultCallbacks) {
- delete m_pCallbacks;
- }
-}
-
-
-/**
- * @brief Register the extended advertisement data.
- * @param [in] inst_id The extended advertisement instance ID to assign to this data.
- * @param [in] adv The extended advertisement instance with the data to set.
- * @return True if advertising started successfully.
- */
-bool NimBLEExtAdvertising::setInstanceData(uint8_t inst_id, NimBLEExtAdvertisement& adv) {
- adv.m_params.sid = inst_id;
-
- // Legacy advertising as connectable requires the scannable flag also.
- if (adv.m_params.legacy_pdu && adv.m_params.connectable) {
- adv.m_params.scannable = true;
- }
-
- // If connectable or not scannable disable the callback for scan response requests
- if (adv.m_params.connectable || !adv.m_params.scannable) {
- adv.m_params.scan_req_notif = false;
- }
-
-#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
- NimBLEServer* pServer = NimBLEDevice::getServer();
- if (pServer != nullptr) {
- if (!pServer->m_gattsStarted) {
- pServer->start();
- }
- }
-
- int rc = ble_gap_ext_adv_configure(inst_id,
- &adv.m_params,
- NULL,
- (pServer != nullptr) ? NimBLEServer::handleGapEvent :
- NimBLEExtAdvertising::handleGapEvent,
- NULL);
-#else
- int rc = ble_gap_ext_adv_configure(inst_id,
- &data.m_params,
- NULL,
- NimBLEExtAdvertising::handleGapEvent,
- NULL);
-#endif
-
- if (rc != 0) {
- NIMBLE_LOGE(LOG_TAG, "Advertising config error: rc = %d", rc);
- } else {
- os_mbuf *buf;
- buf = os_msys_get_pkthdr(adv.m_payload.size(), 0);
- if (!buf) {
- NIMBLE_LOGE(LOG_TAG, "Data buffer allocation failed");
- return false;
- }
-
- rc = os_mbuf_append(buf, &adv.m_payload[0], adv.m_payload.size());
- if (rc != 0) {
- NIMBLE_LOGE(LOG_TAG, "Unable to copy data: rc = %d", rc);
- return false;
- } else {
- if (adv.m_params.scannable && !adv.m_params.legacy_pdu) {
- rc = ble_gap_ext_adv_rsp_set_data(inst_id, buf);
- } else {
- rc = ble_gap_ext_adv_set_data(inst_id, buf);
- }
-
- if (rc != 0) {
- NIMBLE_LOGE(LOG_TAG, "Invalid advertisement data: rc = %d", rc);
- } else {
- if (adv.m_advAddress != NimBLEAddress("")) {
- ble_addr_t addr;
- memcpy(&addr.val, adv.m_advAddress.getNative(), 6);
- // Custom advertising address must be random.
- addr.type = BLE_OWN_ADDR_RANDOM;
- rc = ble_gap_ext_adv_set_addr(inst_id, &addr);
- }
-
- if (rc != 0) {
- NIMBLE_LOGE(LOG_TAG, "Error setting advertisement address: rc = %d", rc);
- return false;
- }
- }
- }
- }
-
- return (rc == 0);
-}
-
-
-/**
- * @brief Set the scan response data for a legacy advertisement.
- * @param [in] inst_id The extended advertisement instance ID to assign to this data.
- * @param [in] lsr A reference to a NimBLEExtAdvertisement that contains the data.
- */
-bool NimBLEExtAdvertising::setScanResponseData(uint8_t inst_id, NimBLEExtAdvertisement & lsr) {
- os_mbuf *buf = os_msys_get_pkthdr(lsr.m_payload.size(), 0);
- if (!buf) {
- NIMBLE_LOGE(LOG_TAG, "Data buffer allocation failed");
- return false;
- }
-
- int rc = os_mbuf_append(buf, &lsr.m_payload[0], lsr.m_payload.size());
-
- if (rc != 0) {
- NIMBLE_LOGE(LOG_TAG, "Unable to copy scan data: rc = %d", rc);
- return false;
- } else {
- rc = ble_gap_ext_adv_rsp_set_data(inst_id, buf);
- }
- return (rc == 0);
-}
-
-
-/**
- * @brief Start extended advertising.
- * @param [in] inst_id The extended advertisement instance ID to start.
- * @param [in] duration How long to advertise for in milliseconds, 0 = forever (default).
- * @param [in] max_events Maximum number of advertisement events to send, 0 = no limit (default).
- * @return True if advertising started successfully.
- */
-bool NimBLEExtAdvertising::start(uint8_t inst_id, int duration, int max_events) {
- NIMBLE_LOGD(LOG_TAG, ">> Extended Advertising start");
-
- // If Host is not synced we cannot start advertising.
- if(!NimBLEDevice::m_synced) {
- NIMBLE_LOGE(LOG_TAG, "Host reset, wait for sync.");
- return false;
- }
-
- int rc = ble_gap_ext_adv_start(inst_id, duration / 10, max_events);
-
- switch (rc) {
- case 0:
- m_advStatus[inst_id] = true;
- break;
-
- case BLE_HS_EINVAL:
- NIMBLE_LOGE(LOG_TAG, "Unable to advertise - Value Error");
- break;
-
- case BLE_HS_EALREADY:
- NIMBLE_LOGI(LOG_TAG, "Advertisement Already active");
- break;
-
- case BLE_HS_ETIMEOUT_HCI:
- case BLE_HS_EOS:
- case BLE_HS_ECONTROLLER:
- case BLE_HS_ENOTSYNCED:
- NIMBLE_LOGE(LOG_TAG, "Unable to advertise - Host Reset");
- break;
-
- default:
- NIMBLE_LOGE(LOG_TAG, "Error enabling advertising; rc=%d, %s",
- rc, NimBLEUtils::returnCodeToString(rc));
- break;
- }
-
- NIMBLE_LOGD(LOG_TAG, "<< Extended Advertising start");
- return (rc == 0 || rc == BLE_HS_EALREADY);
-} // start
-
-
-/**
- * @brief Stop and remove this instance data from the advertisement set.
- * @param [in] inst_id The extended advertisement instance to stop advertising.
- * @return True if successful.
- */
-bool NimBLEExtAdvertising::removeInstance(uint8_t inst_id) {
- if (stop(inst_id)) {
- int rc = ble_gap_ext_adv_remove(inst_id);
- if (rc != 0 && rc != BLE_HS_EALREADY) {
- NIMBLE_LOGE(LOG_TAG, "ble_gap_ext_adv_remove rc = %d %s",
- rc, NimBLEUtils::returnCodeToString(rc));
- return false;
- }
- return true;
- }
-
- return false;
-} // removeInstance
-
-
-/**
- * @brief Stop and remove all advertising instance data.
- * @return True if successful.
- */
-bool NimBLEExtAdvertising::removeAll() {
- if (stop()) {
- int rc = ble_gap_ext_adv_clear();
- if (rc == 0 || rc == BLE_HS_EALREADY) {
- return true;
- } else {
- NIMBLE_LOGE(LOG_TAG, "ble_gap_ext_adv_clear rc = %d %s",
- rc, NimBLEUtils::returnCodeToString(rc));
- }
- }
-
- return false;
-} // removeAll
-
-
-/**
- * @brief Stop advertising this instance data.
- * @param [in] inst_id The extended advertisement instance to stop advertising.
- * @return True if successful.
- */
-bool NimBLEExtAdvertising::stop(uint8_t inst_id) {
- int rc = ble_gap_ext_adv_stop(inst_id);
- if (rc != 0 && rc != BLE_HS_EALREADY) {
- NIMBLE_LOGE(LOG_TAG, "ble_gap_ext_adv_stop rc = %d %s",
- rc, NimBLEUtils::returnCodeToString(rc));
- return false;
- }
-
- m_advStatus[inst_id] = false;
- return true;
-} // stop
-
-
-/**
- * @brief Stop all advertisements.
- * @return True if successful.
- */
-bool NimBLEExtAdvertising::stop() {
- int rc = ble_gap_ext_adv_clear();
- if (rc != 0 && rc != BLE_HS_EALREADY) {
- NIMBLE_LOGE(LOG_TAG, "ble_gap_ext_adv_stop rc = %d %s",
- rc, NimBLEUtils::returnCodeToString(rc));
- return false;
- }
-
- for(auto it : m_advStatus) {
- it = false;
- }
-
- return true;
-} // stop
-
-
-/**
- * @brief Set a callback to call when the advertisement 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.
- */
-void NimBLEExtAdvertising::setCallbacks(NimBLEExtAdvertisingCallbacks* pCallbacks,
- bool deleteCallbacks) {
- if (pCallbacks != nullptr){
- m_pCallbacks = pCallbacks;
- m_deleteCallbacks = deleteCallbacks;
- } else {
- m_pCallbacks = &defaultCallbacks;
- }
-} // setCallbacks
-
-
-/**
- * @brief Check if currently advertising.
- * @param [in] inst_id The instance ID of the advertised data to get the status of.
- * @return True if advertising is active.
- */
-bool NimBLEExtAdvertising::isActive(uint8_t inst_id) {
- return m_advStatus[inst_id];
-} // isAdvertising
-
-
-/**
- * @brief Check if any instances are currently advertising.
- * @return True if any instance is active.
- */
-bool NimBLEExtAdvertising::isAdvertising() {
- for (auto it : m_advStatus) {
- if (it) {
- return true;
- }
- }
- return false;
-} // isAdvertising
-
-
-/*
- * Host reset seems to clear advertising data,
- * we need clear the flag so it reloads it.
- */
-void NimBLEExtAdvertising::onHostSync() {
- NIMBLE_LOGD(LOG_TAG, "Host re-synced");
- for(auto it : m_advStatus) {
- it = false;
- }
-} // onHostSync
-
-
-/**
- * @brief Handler for gap events when not using peripheral role.
- * @param [in] event the event data.
- * @param [in] arg pointer to the advertising instance.
- */
-/*STATIC*/
-int NimBLEExtAdvertising::handleGapEvent(struct ble_gap_event *event, void *arg) {
- (void)arg;
- NimBLEExtAdvertising* pAdv = NimBLEDevice::getAdvertising();
-
- switch (event->type) {
- case BLE_GAP_EVENT_ADV_COMPLETE: {
- switch (event->adv_complete.reason) {
- // Don't call the callback if host reset, we want to
- // preserve the active flag until re-sync to restart advertising.
- case BLE_HS_ETIMEOUT_HCI:
- case BLE_HS_EOS:
- case BLE_HS_ECONTROLLER:
- case BLE_HS_ENOTSYNCED:
- NIMBLE_LOGC(LOG_TAG, "host reset, rc = %d", event->adv_complete.reason);
- NimBLEDevice::onReset(event->adv_complete.reason);
- return 0;
- default:
- break;
- }
- pAdv->m_advStatus[event->adv_complete.instance] = false;
- pAdv->m_pCallbacks->onStopped(pAdv, event->adv_complete.reason,
- event->adv_complete.instance);
- break;
- }
-
- case BLE_GAP_EVENT_SCAN_REQ_RCVD: {
- pAdv->m_pCallbacks->onScanRequest(pAdv, event->scan_req_rcvd.instance,
- NimBLEAddress(event->scan_req_rcvd.scan_addr));
- break;
- }
- }
-
- return 0;
-} // handleGapEvent
-
-
-/** Default callback handlers */
-void NimBLEExtAdvertisingCallbacks::onStopped(NimBLEExtAdvertising *pAdv,
- int reason, uint8_t inst_id) {
- NIMBLE_LOGD("NimBLEExtAdvertisingCallbacks", "onStopped: Default");
-} // onStopped
-
-
-void NimBLEExtAdvertisingCallbacks::onScanRequest(NimBLEExtAdvertising *pAdv,
- uint8_t inst_id, NimBLEAddress addr) {
- NIMBLE_LOGD("NimBLEExtAdvertisingCallbacks", "onScanRequest: Default");
-} // onScanRequest
-
-
-/**
- * @brief Construct a BLE extended advertisement.
- * @param [in] priPhy The primary Phy to advertise on, can be one of:
- * * BLE_HCI_LE_PHY_1M
- * * BLE_HCI_LE_PHY_CODED
- * @param [in] secPhy The secondary Phy to advertise on, can be one of:
- * * BLE_HCI_LE_PHY_1M
- * * BLE_HCI_LE_PHY_2M
- * * BLE_HCI_LE_PHY_CODED
- */
-NimBLEExtAdvertisement::NimBLEExtAdvertisement(uint8_t priPhy, uint8_t secPhy)
-: m_advAddress("")
-{
- memset (&m_params, 0, sizeof(m_params));
- m_params.own_addr_type = NimBLEDevice::m_own_addr_type;
- m_params.primary_phy = priPhy;
- m_params.secondary_phy = secPhy;
- m_params.tx_power = 127;
-} // NimBLEExtAdvertisement
-
-
-/**
- * @brief Sets wether the advertisement should use legacy (BLE 4.0, 31 bytes max) advertising.
- * @param [in] val true = using legacy advertising.
- */
-void NimBLEExtAdvertisement::setLegacyAdvertising(bool val) {
- m_params.legacy_pdu = val;
-} // setLegacyAdvertising
-
-
-/**
- * @brief Sets wether the advertisement has scan response data available.
- * @param [in] val true = scan response is available.
- */
-void NimBLEExtAdvertisement::setScannable(bool val) {
- m_params.scannable = val;
-} // setScannable
-
-
-
-/**
- * @brief Sets the transmission power level for this advertisement.
- * @param [in] dbm the transmission power to use in dbm.
- * @details The allowable value range depends on device hardware. \n
- * The ESP32C3 and ESP32S3 have a range of -27 to +18.
- */
-void NimBLEExtAdvertisement::setTxPower(int8_t dbm) {
- m_params.tx_power = dbm;
-}
-
-
-/**
- * @brief Sets wether this advertisement should advertise as a connectable device.
- * @param [in] val True = connectable.
- */
-void NimBLEExtAdvertisement::setConnectable(bool val) {
-#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
- m_params.connectable = val;
-#endif
-} // setConnectable
-
-
-/**
- * @brief Set the address to use for this advertisement.
- * @param [in] addr The address to use.
- */
-void NimBLEExtAdvertisement::setAddress(const NimBLEAddress & addr) {
- m_advAddress = addr;
- // Must use random address type.
- m_params.own_addr_type = BLE_OWN_ADDR_RANDOM;
-}
-
-
-/**
- * @brief Sets The primary channels to advertise on.
- * @param [in] ch37 Advertise on channel 37.
- * @param [in] ch38 Advertise on channel 38.
- * @param [in] ch39 Advertise on channel 39.
- * @details This will set a bitmask using the input parameters to allow different \n
- * combinations. If all inputs are false then all 3 channels will be used.
- */
-void NimBLEExtAdvertisement::setPrimaryChannels(bool ch37, bool ch38, bool ch39) {
- m_params.channel_map = (ch37 | (ch38 << 1) | (ch39 << 2));
-} // setPrimaryChannels
-
-
-/**
- * @brief Set the filtering for the scan filter.
- * @param [in] scanRequestWhitelistOnly If true, only allow scan requests from those on the white list.
- * @param [in] connectWhitelistOnly If true, only allow connections from those on the white list.
- */
-void NimBLEExtAdvertisement::setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly) {
- if (!scanRequestWhitelistOnly && !connectWhitelistOnly) {
- m_params.filter_policy = BLE_HCI_ADV_FILT_NONE;
- return;
- }
- if (scanRequestWhitelistOnly && !connectWhitelistOnly) {
- m_params.filter_policy = BLE_HCI_ADV_FILT_SCAN;
- return;
- }
- if (!scanRequestWhitelistOnly && connectWhitelistOnly) {
- m_params.filter_policy = BLE_HCI_ADV_FILT_CONN;
- return;
- }
- if (scanRequestWhitelistOnly && connectWhitelistOnly) {
- m_params.filter_policy = BLE_HCI_ADV_FILT_BOTH;
- return;
- }
-} // setScanFilter
-
-
-/**
- * @brief Sets the peer to directly advertise to.
- * @param [in] addr The address of the peer to direct the advertisements.
- */
-void NimBLEExtAdvertisement::setDirectedPeer(const NimBLEAddress & addr) {
- ble_addr_t peerAddr;
- memcpy(&peerAddr.val, addr.getNative(), 6);
- peerAddr.type = addr.getType();
- m_params.peer = peerAddr;
-} // setDirectedPeer
-
-
-/**
- * @brief Enable or disable direct advertisements to the peer set with `NimBLEExtAdvertisement::setDirectedPeer`
- * @param [in] val true = send directed advertisements to peer.
- * @param [in] high_duty true = use fast advertising rate, default - true.
- */
-void NimBLEExtAdvertisement::setDirected(bool val, bool high_duty) {
- m_params.directed = val;
- m_params.high_duty_directed = high_duty;
-} // setDirected
-
-
-/**
- * @brief Set the minimum advertising interval.
- * @param [in] mininterval Minimum value for advertising interval in 0.625ms units, 0 = use default.
- */
-void NimBLEExtAdvertisement::setMinInterval(uint32_t mininterval) {
- m_params.itvl_min = mininterval;
-} // setMinInterval
-
-
-/**
- * @brief Set the maximum advertising interval.
- * @param [in] maxinterval Maximum value for advertising interval in 0.625ms units, 0 = use default.
- */
-void NimBLEExtAdvertisement::setMaxInterval(uint32_t maxinterval) {
- m_params.itvl_max = maxinterval;
-} // setMaxInterval
-
-
-/**
- * @brief Set the primary advertising PHY to use
- * @param [in] phy Can be one of following constants:
- * * BLE_HCI_LE_PHY_1M
- * * BLE_HCI_LE_PHY_CODED
- */
-void NimBLEExtAdvertisement::setPrimaryPhy(uint8_t phy) {
- m_params.primary_phy = phy;
-} // setPrimaryPhy
-
-
-/**
- * @brief Set the secondary advertising PHY to use
- * @param [in] phy Can be one of following constants:
- * * BLE_HCI_LE_PHY_1M
- * * BLE_HCI_LE_PHY_2M
- * * BLE_HCI_LE_PHY_CODED
- */
-void NimBLEExtAdvertisement::setSecondaryPhy(uint8_t phy) {
- m_params.secondary_phy = phy;
-} // setSecondaryPhy
-
-
-/**
- * @brief Sets whether the advertisement should be anonymous.
- * @param [in] val Set to true to enable anonymous advertising.
- *
- * @details Anonymous advertising omits the device's address from the advertisement.
- */
-void NimBLEExtAdvertisement::setAnonymous(bool val) {
- m_params.anonymous = val;
-} // setAnonymous
-
-
-/**
- * @brief Sets whether the scan response request callback should be called.
- * @param [in] enable If true the scan response request callback will be called for this advertisement.
- */
-void NimBLEExtAdvertisement::enableScanRequestCallback(bool enable) {
- m_params.scan_req_notif = enable;
-} // enableScanRequestCallback
-
-
-/**
- * @brief Clears the data stored in this instance, does not change settings.
- * @details This will clear all data but preserves advertising parameter settings.
- */
-void NimBLEExtAdvertisement::clearData() {
- std::vector swap;
- std::swap(m_payload, swap);
-}
-
-
-/**
- * @brief Get the size of the current data.
- */
-size_t NimBLEExtAdvertisement::getDataSize() {
- return m_payload.size();
-} // getDataSize
-
-
-/**
- * @brief Set the advertisement data.
- * @param [in] data The data to be set as the payload.
- * @param [in] length The size of data.
- * @details This will completely replace any data that was previously set.
- */
-void NimBLEExtAdvertisement::setData(const uint8_t * data, size_t length) {
- m_payload.assign(data, data + length);
-} // setData
-
-
-/**
- * @brief Add data to the payload to be advertised.
- * @param [in] data The data to be added to the payload.
- */
-void NimBLEExtAdvertisement::addData(const std::string &data) {
- addData((uint8_t*)data.data(), data.length());
-} // addData
-
-
-/**
- * @brief Add data to the payload to be advertised.
- * @param [in] data The data to be added to the payload.
- * @param [in] length The size of data to be added to the payload.
- */
-void NimBLEExtAdvertisement::addData(const uint8_t * data, size_t length) {
- m_payload.insert(m_payload.end(), data, data + length);
-} // addData
-
-
-/**
- * @brief Set the appearance.
- * @param [in] appearance The appearance code value.
- *
- * See also:
- * https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml
- */
-void NimBLEExtAdvertisement::setAppearance(uint16_t appearance) {
- char cdata[2];
- cdata[0] = 3;
- cdata[1] = BLE_HS_ADV_TYPE_APPEARANCE; // 0x19
- addData(std::string(cdata, 2) + std::string((char*) &appearance, 2));
-} // setAppearance
-
-
-/**
- * @brief Set the advertisement flags.
- * @param [in] flag The flags to be set in the advertisement.
- * * BLE_HS_ADV_F_DISC_LTD
- * * BLE_HS_ADV_F_DISC_GEN
- * * BLE_HS_ADV_F_BREDR_UNSUP - must always use with NimBLE
- */
-void NimBLEExtAdvertisement::setFlags(uint8_t flag) {
- char cdata[3];
- cdata[0] = 2;
- cdata[1] = BLE_HS_ADV_TYPE_FLAGS; // 0x01
- cdata[2] = flag | BLE_HS_ADV_F_BREDR_UNSUP;
- addData(std::string(cdata, 3));
-} // setFlags
-
-
-/**
- * @brief Set manufacturer specific data.
- * @param [in] data The manufacturer data to advertise.
- */
-void NimBLEExtAdvertisement::setManufacturerData(const std::string &data) {
- char cdata[2];
- cdata[0] = data.length() + 1;
- cdata[1] = BLE_HS_ADV_TYPE_MFG_DATA ; // 0xff
- addData(std::string(cdata, 2) + data);
-} // setManufacturerData
-
-
-/**
- * @brief Set the URI to advertise.
- * @param [in] uri The uri to advertise.
- */
-void NimBLEExtAdvertisement::setURI(const std::string &uri) {
- char cdata[2];
- cdata[0] = uri.length() + 1;
- cdata[1] = BLE_HS_ADV_TYPE_URI;
- addData(std::string(cdata, 2) + uri);
-} // setURI
-
-
-/**
- * @brief Set the complete name of this device.
- * @param [in] name The name to advertise.
- */
-void NimBLEExtAdvertisement::setName(const std::string &name) {
- char cdata[2];
- cdata[0] = name.length() + 1;
- cdata[1] = BLE_HS_ADV_TYPE_COMP_NAME; // 0x09
- addData(std::string(cdata, 2) + name);
-} // setName
-
-
-/**
- * @brief Set a single service to advertise as a complete list of services.
- * @param [in] uuid The service to advertise.
- */
-void NimBLEExtAdvertisement::setCompleteServices(const NimBLEUUID &uuid) {
- setServices(true, uuid.bitSize(), {uuid});
-} // setCompleteServices
-
-
-/**
- * @brief Set the complete list of 16 bit services to advertise.
- * @param [in] v_uuid A vector of 16 bit UUID's to advertise.
- */
-void NimBLEExtAdvertisement::setCompleteServices16(const std::vector& v_uuid) {
- setServices(true, 16, v_uuid);
-} // setCompleteServices16
-
-
-/**
- * @brief Set the complete list of 32 bit services to advertise.
- * @param [in] v_uuid A vector of 32 bit UUID's to advertise.
- */
-void NimBLEExtAdvertisement::setCompleteServices32(const std::vector& v_uuid) {
- setServices(true, 32, v_uuid);
-} // setCompleteServices32
-
-
-/**
- * @brief Set a single service to advertise as a partial list of services.
- * @param [in] uuid The service to advertise.
- */
-void NimBLEExtAdvertisement::setPartialServices(const NimBLEUUID &uuid) {
- setServices(false, uuid.bitSize(), {uuid});
-} // setPartialServices
-
-
-/**
- * @brief Set the partial list of services to advertise.
- * @param [in] v_uuid A vector of 16 bit UUID's to advertise.
- */
-void NimBLEExtAdvertisement::setPartialServices16(const std::vector& v_uuid) {
- setServices(false, 16, v_uuid);
-} // setPartialServices16
-
-
-/**
- * @brief Set the partial list of services to advertise.
- * @param [in] v_uuid A vector of 32 bit UUID's to advertise.
- */
-void NimBLEExtAdvertisement::setPartialServices32(const std::vector& v_uuid) {
- setServices(false, 32, v_uuid);
-} // setPartialServices32
-
-
-/**
- * @brief Utility function to create the list of service UUID's from a vector.
- * @param [in] complete If true the vector is the complete set of services.
- * @param [in] size The bit size of the UUID's in the vector. (16, 32, or 128).
- * @param [in] v_uuid The vector of service UUID's to advertise.
- */
-void NimBLEExtAdvertisement::setServices(const bool complete, const uint8_t size,
- const std::vector &v_uuid)
-{
- char cdata[2];
- cdata[0] = (size / 8) * v_uuid.size() + 1;
- switch(size) {
- case 16:
- cdata[1] = complete ? BLE_HS_ADV_TYPE_COMP_UUIDS16 : BLE_HS_ADV_TYPE_INCOMP_UUIDS16;
- break;
- case 32:
- cdata[1] = complete ? BLE_HS_ADV_TYPE_COMP_UUIDS32 : BLE_HS_ADV_TYPE_INCOMP_UUIDS32;
- break;
- case 128:
- cdata[1] = complete ? BLE_HS_ADV_TYPE_COMP_UUIDS128 : BLE_HS_ADV_TYPE_INCOMP_UUIDS128;
- break;
- default:
- return;
- }
-
- std::string uuids;
-
- for(auto &it : v_uuid){
- if(it.bitSize() != size) {
- NIMBLE_LOGE(LOG_TAG, "Service UUID(%d) invalid", size);
- return;
- } else {
- switch(size) {
- case 16:
- uuids += std::string((char*)&it.getNative()->u16.value, 2);
- break;
- case 32:
- uuids += std::string((char*)&it.getNative()->u32.value, 4);
- break;
- case 128:
- uuids += std::string((char*)&it.getNative()->u128.value, 16);
- break;
- default:
- return;
- }
- }
- }
-
- addData(std::string(cdata, 2) + uuids);
-} // setServices
-
-
-/**
- * @brief Set the service data (UUID + data)
- * @param [in] uuid The UUID to set with the service data.
- * @param [in] data The data to be associated with the service data advertised.
- */
-void NimBLEExtAdvertisement::setServiceData(const NimBLEUUID &uuid, const std::string &data) {
- char cdata[2];
- switch (uuid.bitSize()) {
- case 16: {
- // [Len] [0x16] [UUID16] data
- cdata[0] = data.length() + 3;
- cdata[1] = BLE_HS_ADV_TYPE_SVC_DATA_UUID16; // 0x16
- addData(std::string(cdata, 2) + std::string((char*) &uuid.getNative()->u16.value, 2) + data);
- break;
- }
-
- case 32: {
- // [Len] [0x20] [UUID32] data
- cdata[0] = data.length() + 5;
- cdata[1] = BLE_HS_ADV_TYPE_SVC_DATA_UUID32; // 0x20
- addData(std::string(cdata, 2) + std::string((char*) &uuid.getNative()->u32.value, 4) + data);
- break;
- }
-
- case 128: {
- // [Len] [0x21] [UUID128] data
- cdata[0] = data.length() + 17;
- cdata[1] = BLE_HS_ADV_TYPE_SVC_DATA_UUID128; // 0x21
- addData(std::string(cdata, 2) + std::string((char*) &uuid.getNative()->u128.value, 16) + data);
- break;
- }
-
- default:
- return;
- }
-} // setServiceData
-
-
-/**
- * @brief Set the short name.
- * @param [in] name The short name of the device.
- */
-void NimBLEExtAdvertisement::setShortName(const std::string &name) {
- char cdata[2];
- cdata[0] = name.length() + 1;
- cdata[1] = BLE_HS_ADV_TYPE_INCOMP_NAME; // 0x08
- addData(std::string(cdata, 2) + name);
-} // setShortName
-
-
-/**
- * @brief Adds Tx power level to the advertisement data.
- */
-void NimBLEExtAdvertisement::addTxPower() {
- m_params.include_tx_power = 1;
-} // addTxPower
-
-
-/**
- * @brief Set the preferred connection interval parameters.
- * @param [in] min The minimum interval desired.
- * @param [in] max The maximum interval desired.
- */
-void NimBLEExtAdvertisement::setPreferredParams(uint16_t min, uint16_t max) {
- uint8_t data[6];
- data[0] = BLE_HS_ADV_SLAVE_ITVL_RANGE_LEN + 1;
- data[1] = BLE_HS_ADV_TYPE_SLAVE_ITVL_RANGE;
- data[2] = min;
- data[3] = min >> 8;
- data[4] = max;
- data[5] = max >> 8;
- addData(data, 6);
-} // setPreferredParams
-
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_EXT_ADV */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEExtAdvertising.h b/libraries/NimBLE-Arduino/src/NimBLEExtAdvertising.h
deleted file mode 100644
index b1f21fc7..00000000
--- a/libraries/NimBLE-Arduino/src/NimBLEExtAdvertising.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * NimBLEExtAdvertising.h
- *
- * Created: on February 6, 2022
- * Author H2zero
- */
-
-#ifndef MAIN_BLEEXTADVERTISING_H_
-#define MAIN_BLEEXTADVERTISING_H_
-#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && \
- defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER) && \
- CONFIG_BT_NIMBLE_EXT_ADV
-
-# if defined(CONFIG_NIMBLE_CPP_IDF)
-# include "host/ble_gap.h"
-# else
-# include "nimble/nimble/host/include/host/ble_gap.h"
-# endif
-
-/**** FIX COMPILATION ****/
-#undef min
-#undef max
-/**************************/
-
-#include "NimBLEAddress.h"
-#include "NimBLEUUID.h"
-
-#include
-
-class NimBLEExtAdvertisingCallbacks;
-
-
-/**
- * @brief Extended advertisement data
- */
-class NimBLEExtAdvertisement {
-public:
- NimBLEExtAdvertisement(uint8_t priPhy = BLE_HCI_LE_PHY_1M,
- uint8_t secPhy = BLE_HCI_LE_PHY_1M);
- void setAppearance(uint16_t appearance);
- void setCompleteServices(const NimBLEUUID &uuid);
- void setCompleteServices16(const std::vector &v_uuid);
- void setCompleteServices32(const std::vector &v_uuid);
- void setFlags(uint8_t flag);
- void setManufacturerData(const std::string &data);
- void setURI(const std::string &uri);
- void setName(const std::string &name);
- void setPartialServices(const NimBLEUUID &uuid);
- void setPartialServices16(const std::vector &v_uuid);
- void setPartialServices32(const std::vector &v_uuid);
- void setServiceData(const NimBLEUUID &uuid, const std::string &data);
- void setShortName(const std::string &name);
- void setData(const uint8_t * data, size_t length);
- void addData(const std::string &data);
- void addData(const uint8_t * data, size_t length);
- void addTxPower();
- void setPreferredParams(uint16_t min, uint16_t max);
- void setLegacyAdvertising(bool val);
- void setConnectable(bool val);
- void setScannable(bool val);
- void setMinInterval(uint32_t mininterval);
- void setMaxInterval(uint32_t maxinterval);
- void setPrimaryPhy(uint8_t phy);
- void setSecondaryPhy(uint8_t phy);
- void setScanFilter(bool scanRequestWhitelistOnly, bool connectWhitelistOnly);
- void setDirectedPeer(const NimBLEAddress & addr);
- void setDirected(bool val, bool high_duty = true);
- void setAnonymous(bool val);
- void setPrimaryChannels(bool ch37, bool ch38, bool ch39);
- void setTxPower(int8_t dbm);
- void setAddress(const NimBLEAddress & addr);
- void enableScanRequestCallback(bool enable);
- void clearData();
- size_t getDataSize();
-
-private:
- friend class NimBLEExtAdvertising;
-
- void setServices(const bool complete, const uint8_t size,
- const std::vector &v_uuid);
-
- std::vector m_payload;
- ble_gap_ext_adv_params m_params;
- NimBLEAddress m_advAddress;
-}; // NimBLEExtAdvertisement
-
-
-/**
- * @brief Extended advertising class.
- */
-class NimBLEExtAdvertising {
-public:
- /**
- * @brief Construct an extended advertising object.
- */
- NimBLEExtAdvertising() :m_advStatus(CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES + 1, false) {}
- ~NimBLEExtAdvertising();
- bool start(uint8_t inst_id, int duration = 0, int max_events = 0);
- bool setInstanceData(uint8_t inst_id, NimBLEExtAdvertisement& adv);
- bool setScanResponseData(uint8_t inst_id, NimBLEExtAdvertisement & data);
- bool removeInstance(uint8_t inst_id);
- bool removeAll();
- bool stop(uint8_t inst_id);
- bool stop();
- bool isActive(uint8_t inst_id);
- bool isAdvertising();
- void setCallbacks(NimBLEExtAdvertisingCallbacks* callbacks,
- bool deleteCallbacks = true);
-
-private:
- friend class NimBLEDevice;
- friend class NimBLEServer;
-
- void onHostSync();
- static int handleGapEvent(struct ble_gap_event *event, void *arg);
-
- bool m_scanResp;
- bool m_deleteCallbacks;
- NimBLEExtAdvertisingCallbacks* m_pCallbacks;
- ble_gap_ext_adv_params m_advParams;
- std::vector m_advStatus;
-};
-
-
-/**
- * @brief Callbacks associated with NimBLEExtAdvertising class.
- */
-class NimBLEExtAdvertisingCallbacks {
-public:
- virtual ~NimBLEExtAdvertisingCallbacks() {};
-
- /**
- * @brief Handle an advertising stop event.
- * @param [in] pAdv A convenience pointer to the extended advertising interface.
- * @param [in] reason The reason code for stopping the advertising.
- * @param [in] inst_id The instance ID of the advertisement that was stopped.
- */
- virtual void onStopped(NimBLEExtAdvertising *pAdv, int reason, uint8_t inst_id);
-
- /**
- * @brief Handle a scan response request.
- * This is called when a scanning device requests a scan response.
- * @param [in] pAdv A convenience pointer to the extended advertising interface.
- * @param [in] inst_id The instance ID of the advertisement that the scan response request was made.
- * @param [in] addr The address of the device making the request.
- */
- virtual void onScanRequest(NimBLEExtAdvertising *pAdv, uint8_t inst_id, NimBLEAddress addr);
-}; // NimBLEExtAdvertisingCallbacks
-
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER && CONFIG_BT_NIMBLE_EXT_ADV */
-#endif /* MAIN_BLEADVERTISING_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEHIDDevice.cpp b/libraries/NimBLE-Arduino/src/NimBLEHIDDevice.cpp
index a2310eb9..37d0f52f 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEHIDDevice.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEHIDDevice.cpp
@@ -11,9 +11,11 @@
* Created on: Jan 03, 2018
* Author: chegewara
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
#include "NimBLEHIDDevice.h"
#include "NimBLE2904.h"
@@ -27,7 +29,7 @@ NimBLEHIDDevice::NimBLEHIDDevice(NimBLEServer* server) {
* Here we create mandatory services described in bluetooth specification
*/
m_deviceInfoService = server->createService(NimBLEUUID((uint16_t) 0x180a));
- m_hidService = server->createService(NimBLEUUID((uint16_t) 0x1812));
+ m_hidService = server->createService(NimBLEUUID((uint16_t) 0x1812), 40);
m_batteryService = server->createService(NimBLEUUID((uint16_t) 0x180f));
/*
@@ -99,7 +101,7 @@ void NimBLEHIDDevice::manufacturer(std::string name) {
}
/**
- * @brief Sets the Plug n Play characteristic value.
+ * @brief Sets the Plug n Play characterisc value.
* @param [in] sig The vendor ID source number.
* @param [in] vid The vendor ID number.
* @param [in] pid The product ID number.
@@ -203,12 +205,12 @@ void NimBLEHIDDevice::setBatteryLevel(uint8_t level) {
/*
* @brief Returns battery level characteristic
* @ return battery level characteristic
- */
-NimBLECharacteristic* NimBLEHIDDevice::batteryLevel() {
+ *//*
+BLECharacteristic* BLEHIDDevice::batteryLevel() {
return m_batteryLevelCharacteristic;
}
-/*
+
BLECharacteristic* BLEHIDDevice::reportMap() {
return m_reportMapCharacteristic;
@@ -245,4 +247,5 @@ NimBLEService* NimBLEHIDDevice::batteryService() {
return m_batteryService;
}
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif // #if defined(CONFIG_BT_ENABLED)
diff --git a/libraries/NimBLE-Arduino/src/NimBLEHIDDevice.h b/libraries/NimBLE-Arduino/src/NimBLEHIDDevice.h
index 0e8b2828..6ed7c2bd 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEHIDDevice.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEHIDDevice.h
@@ -15,8 +15,11 @@
#ifndef _BLEHIDDEVICE_H_
#define _BLEHIDDEVICE_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
+#if defined(CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
#include "NimBLECharacteristic.h"
#include "NimBLEService.h"
@@ -55,7 +58,7 @@ class NimBLEHIDDevice {
void pnp(uint8_t sig, uint16_t vid, uint16_t pid, uint16_t version);
//NimBLECharacteristic* hidInfo();
void hidInfo(uint8_t country, uint8_t flags);
- NimBLECharacteristic* batteryLevel();
+ //NimBLECharacteristic* batteryLevel();
void setBatteryLevel(uint8_t level);
@@ -81,6 +84,6 @@ class NimBLEHIDDevice {
NimBLECharacteristic* m_protocolModeCharacteristic; //0x2a4e
NimBLECharacteristic* m_batteryLevelCharacteristic; //0x2a19
};
-
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_BROADCASTER */
+#endif // CONFIG_BT_NIMBLE_ROLE_BROADCASTER
+#endif // CONFIG_BT_ENABLED
#endif /* _BLEHIDDEVICE_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLELog.h b/libraries/NimBLE-Arduino/src/NimBLELog.h
index dda9073f..b76f1dc2 100644
--- a/libraries/NimBLE-Arduino/src/NimBLELog.h
+++ b/libraries/NimBLE-Arduino/src/NimBLELog.h
@@ -12,69 +12,59 @@
#if defined(CONFIG_BT_ENABLED)
-#if defined(CONFIG_NIMBLE_CPP_IDF) // using esp-idf
-# include "esp_log.h"
-# ifndef CONFIG_NIMBLE_CPP_LOG_LEVEL
-# define CONFIG_NIMBLE_CPP_LOG_LEVEL 0
-# endif
+#ifdef ARDUINO_ARCH_ESP32
+#include "syscfg/syscfg.h"
+#include "modlog/modlog.h"
-# define NIMBLE_CPP_LOG_PRINT(level, tag, format, ...) do { \
- if (CONFIG_NIMBLE_CPP_LOG_LEVEL >= level) \
- ESP_LOG_LEVEL_LOCAL(level, tag, format, ##__VA_ARGS__); \
- } while(0)
+// If Arduino is being used, strip out the colors and ignore log printing below ui setting.
+// Note: because CONFIG_LOG_DEFAULT_LEVEL is set at ERROR in Arduino we must use MODLOG_DFLT(ERROR
+// otherwise no messages will be printed above that level.
-# define NIMBLE_LOGD(tag, format, ...) \
- NIMBLE_CPP_LOG_PRINT(ESP_LOG_DEBUG, tag, format, ##__VA_ARGS__)
+#ifndef CONFIG_NIMBLE_CPP_DEBUG_LEVEL
+ #ifdef CORE_DEBUG_LEVEL
+ #define CONFIG_NIMBLE_CPP_DEBUG_LEVEL CORE_DEBUG_LEVEL
+ #else
+ #define CONFIG_NIMBLE_CPP_DEBUG_LEVEL 0
+ #endif
+#endif
-# define NIMBLE_LOGI(tag, format, ...) \
- NIMBLE_CPP_LOG_PRINT(ESP_LOG_INFO, tag, format, ##__VA_ARGS__)
+#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 4
+#define NIMBLE_LOGD( tag, format, ... ) MODLOG_DFLT(ERROR, "D %s: "#format"\n",tag,##__VA_ARGS__)
+#else
+#define NIMBLE_LOGD( tag, format, ... ) (void)tag
+#endif
-# define NIMBLE_LOGW(tag, format, ...) \
- NIMBLE_CPP_LOG_PRINT(ESP_LOG_WARN, tag, format, ##__VA_ARGS__)
+#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 3
+#define NIMBLE_LOGI( tag, format, ... ) MODLOG_DFLT(ERROR, "I %s: "#format"\n",tag,##__VA_ARGS__)
+#else
+#define NIMBLE_LOGI( tag, format, ... ) (void)tag
+#endif
-# define NIMBLE_LOGE(tag, format, ...) \
- NIMBLE_CPP_LOG_PRINT(ESP_LOG_ERROR, tag, format, ##__VA_ARGS__)
+#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 2
+#define NIMBLE_LOGW( tag, format, ... ) MODLOG_DFLT(ERROR, "W %s: "#format"\n",tag,##__VA_ARGS__)
+#else
+#define NIMBLE_LOGW( tag, format, ... ) (void)tag
+#endif
-# define NIMBLE_LOGC(tag, format, ...) \
- NIMBLE_CPP_LOG_PRINT(ESP_LOG_ERROR, tag, format, ##__VA_ARGS__)
+#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 1
+#define NIMBLE_LOGE( tag, format, ... ) MODLOG_DFLT(ERROR, "E %s: "#format"\n",tag,##__VA_ARGS__)
+#else
+#define NIMBLE_LOGE( tag, format, ... ) (void)tag
+#endif
-#else // using Arduino
-# include "nimble/porting/nimble/include/syscfg/syscfg.h"
-# include "nimble/console/console.h"
-# ifndef CONFIG_NIMBLE_CPP_LOG_LEVEL
-# if defined(ARDUINO_ARCH_ESP32) && defined(CORE_DEBUG_LEVEL)
-# define CONFIG_NIMBLE_CPP_LOG_LEVEL CORE_DEBUG_LEVEL
-# else
-# define CONFIG_NIMBLE_CPP_LOG_LEVEL 0
-# endif
-# endif
+#define NIMBLE_LOGC( tag, format, ... ) MODLOG_DFLT(CRITICAL, "CRIT %s: "#format"\n",tag,##__VA_ARGS__)
-# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4
-# define NIMBLE_LOGD( tag, format, ... ) console_printf("D %s: " format "\n", tag, ##__VA_ARGS__)
-# else
-# define NIMBLE_LOGD( tag, format, ... ) (void)tag
-# endif
+#else
-# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 3
-# define NIMBLE_LOGI( tag, format, ... ) console_printf("I %s: " format "\n", tag, ##__VA_ARGS__)
-# else
-# define NIMBLE_LOGI( tag, format, ... ) (void)tag
-# endif
+#include "esp_log.h"
-# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 2
-# define NIMBLE_LOGW( tag, format, ... ) console_printf("W %s: " format "\n", tag, ##__VA_ARGS__)
-# else
-# define NIMBLE_LOGW( tag, format, ... ) (void)tag
-# endif
+#define NIMBLE_LOGE(tag, format, ...) ESP_LOGE(tag, format, ##__VA_ARGS__)
+#define NIMBLE_LOGW(tag, format, ...) ESP_LOGW(tag, format, ##__VA_ARGS__)
+#define NIMBLE_LOGI(tag, format, ...) ESP_LOGI(tag, format, ##__VA_ARGS__)
+#define NIMBLE_LOGD(tag, format, ...) ESP_LOGD(tag, format, ##__VA_ARGS__)
+#define NIMBLE_LOGC(tag, format, ...) ESP_LOGE(tag, format, ##__VA_ARGS__)
-# if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 1
-# define NIMBLE_LOGE( tag, format, ... ) console_printf("E %s: " format "\n", tag, ##__VA_ARGS__)
-# define NIMBLE_LOGC( tag, format, ... ) console_printf("CRIT %s: " format "\n", tag, ##__VA_ARGS__)
-# else
-# define NIMBLE_LOGE( tag, format, ... ) (void)tag
-# define NIMBLE_LOGC( tag, format, ... ) (void)tag
-# endif
+#endif /*ARDUINO_ARCH_ESP32*/
-#endif /* CONFIG_NIMBLE_CPP_IDF */
-#endif /* CONFIG_BT_ENABLED */
-#endif /* MAIN_NIMBLELOG_H_ */
+#endif /*CONFIG_BT_ENABLED*/
+#endif /*MAIN_NIMBLELOG_H_*/
\ No newline at end of file
diff --git a/libraries/NimBLE-Arduino/src/NimBLERemoteCharacteristic.cpp b/libraries/NimBLE-Arduino/src/NimBLERemoteCharacteristic.cpp
index 6cca615d..3b7e1ccf 100644
--- a/libraries/NimBLE-Arduino/src/NimBLERemoteCharacteristic.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLERemoteCharacteristic.cpp
@@ -12,15 +12,16 @@
* Author: kolban
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
#include "NimBLERemoteCharacteristic.h"
#include "NimBLEUtils.h"
#include "NimBLELog.h"
-#include
-
static const char* LOG_TAG = "NimBLERemoteCharacteristic";
/**
@@ -58,6 +59,8 @@ static const char* LOG_TAG = "NimBLERemoteCharacteristic";
m_charProp = chr->properties;
m_pRemoteService = pRemoteService;
m_notifyCallback = nullptr;
+ m_timestamp = 0;
+ m_valMux = portMUX_INITIALIZER_UNLOCKED;
NIMBLE_LOGD(LOG_TAG, "<< NimBLERemoteCharacteristic(): %s", m_uuid.toString().c_str());
} // NimBLERemoteCharacteristic
@@ -266,10 +269,6 @@ bool NimBLERemoteCharacteristic::retrieveDescriptors(const NimBLEUUID *uuid_filt
}
}
- if (m_handle == m_endHandle) {
- return true;
- }
-
desc_filter_t filter = {uuid_filter, &taskData};
rc = ble_gattc_disc_all_dscs(getRemoteService()->getClient()->getConnId(),
@@ -320,31 +319,14 @@ NimBLERemoteDescriptor* NimBLERemoteCharacteristic::getDescriptor(const NimBLEUU
return m_descriptorVector.back();
}
- // If the request was successful but 16/32 bit uuid not found
+ // If the request was successful but 16/32 bit descriptor not found
// try again with the 128 bit uuid.
if(uuid.bitSize() == BLE_UUID_TYPE_16 ||
uuid.bitSize() == BLE_UUID_TYPE_32)
{
NimBLEUUID uuid128(uuid);
uuid128.to128();
- if(retrieveDescriptors(&uuid128)) {
- if(m_descriptorVector.size() > prev_size) {
- return m_descriptorVector.back();
- }
- }
- } else {
- // If the request was successful but the 128 bit uuid not found
- // try again with the 16 bit uuid.
- NimBLEUUID uuid16(uuid);
- uuid16.to16();
- // if the uuid was 128 bit but not of the BLE base type this check will fail
- if (uuid16.bitSize() == BLE_UUID_TYPE_16) {
- if(retrieveDescriptors(&uuid16)) {
- if(m_descriptorVector.size() > prev_size) {
- return m_descriptorVector.back();
- }
- }
- }
+ return getDescriptor(uuid128);
}
}
@@ -434,12 +416,15 @@ NimBLEUUID NimBLERemoteCharacteristic::getUUID() {
* @param [in] timestamp A pointer to a time_t struct to store the time the value was read.
* @return The value of the remote characteristic.
*/
-NimBLEAttValue NimBLERemoteCharacteristic::getValue(time_t *timestamp) {
+std::string NimBLERemoteCharacteristic::getValue(time_t *timestamp) {
+ portENTER_CRITICAL(&m_valMux);
+ std::string value = m_value;
if(timestamp != nullptr) {
- *timestamp = m_value.getTimeStamp();
+ *timestamp = m_timestamp;
}
+ portEXIT_CRITICAL(&m_valMux);
- return m_value;
+ return value;
}
@@ -487,12 +472,12 @@ float NimBLERemoteCharacteristic::readFloat() {
* @param [in] timestamp A pointer to a time_t struct to store the time the value was read.
* @return The value of the remote characteristic.
*/
-NimBLEAttValue NimBLERemoteCharacteristic::readValue(time_t *timestamp) {
+std::string NimBLERemoteCharacteristic::readValue(time_t *timestamp) {
NIMBLE_LOGD(LOG_TAG, ">> readValue(): uuid: %s, handle: %d 0x%.2x",
getUUID().toString().c_str(), getHandle(), getHandle());
NimBLEClient* pClient = getRemoteService()->getClient();
- NimBLEAttValue value;
+ std::string value;
if (!pClient->isConnected()) {
NIMBLE_LOGE(LOG_TAG, "Disconnected");
@@ -543,11 +528,14 @@ NimBLEAttValue NimBLERemoteCharacteristic::readValue(time_t *timestamp) {
}
} while(rc != 0 && retryCount--);
- value.setTimeStamp();
+ time_t t = time(nullptr);
+ portENTER_CRITICAL(&m_valMux);
m_value = value;
+ m_timestamp = t;
if(timestamp != nullptr) {
- *timestamp = value.getTimeStamp();
+ *timestamp = m_timestamp;
}
+ portEXIT_CRITICAL(&m_valMux);
NIMBLE_LOGD(LOG_TAG, "<< readValue length: %d rc=%d", value.length(), rc);
return value;
@@ -572,17 +560,17 @@ int NimBLERemoteCharacteristic::onReadCB(uint16_t conn_handle,
NIMBLE_LOGI(LOG_TAG, "Read complete; status=%d conn_handle=%d", error->status, conn_handle);
- NimBLEAttValue *valBuf = (NimBLEAttValue*)pTaskData->buf;
+ std::string *strBuf = (std::string*)pTaskData->buf;
int rc = error->status;
if(rc == 0) {
if(attr) {
- uint16_t data_len = OS_MBUF_PKTLEN(attr->om);
- if((valBuf->size() + data_len) > BLE_ATT_ATTR_MAX_LEN) {
+ uint32_t data_len = OS_MBUF_PKTLEN(attr->om);
+ if(((*strBuf).length() + data_len) > BLE_ATT_ATTR_MAX_LEN) {
rc = BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
} else {
- NIMBLE_LOGD(LOG_TAG, "Got %u bytes", data_len);
- valBuf->append(attr->om->om_data, data_len);
+ NIMBLE_LOGD(LOG_TAG, "Got %d bytes", data_len);
+ (*strBuf) += std::string((char*) attr->om->om_data, data_len);
return 0;
}
}
@@ -733,33 +721,22 @@ std::string NimBLERemoteCharacteristic::toString() {
/**
- * @brief Write a new value to the remote characteristic from a std::vector.
- * @param [in] vec A std::vector value to write to the remote characteristic.
- * @param [in] response Whether we require a response from the write.
- * @return false if not connected or otherwise cannot perform write.
+ * @brief Write the new value for the characteristic.
+ * @param [in] newValue The new value to write.
+ * @param [in] response Do we expect a response?
+ * @return false if not connected or cant perform write for some reason.
*/
-bool NimBLERemoteCharacteristic::writeValue(const std::vector& vec, bool response) {
- return writeValue((uint8_t*)&vec[0], vec.size(), response);
+bool NimBLERemoteCharacteristic::writeValue(const std::string &newValue, bool response) {
+ return writeValue((uint8_t*)newValue.c_str(), newValue.length(), response);
} // writeValue
/**
- * @brief Write a new value to the remote characteristic from a const char*.
- * @param [in] char_s A character string to write to the remote characteristic.
- * @param [in] response Whether we require a response from the write.
- * @return false if not connected or otherwise cannot perform write.
- */
-bool NimBLERemoteCharacteristic::writeValue(const char* char_s, bool response) {
- return writeValue((uint8_t*)char_s, strlen(char_s), response);
-} // writeValue
-
-
-/**
- * @brief Write a new value to the remote characteristic from a data buffer.
+ * @brief Write the new value for the characteristic from a data buffer.
* @param [in] data A pointer to a data buffer.
* @param [in] length The length of the data in the data buffer.
* @param [in] response Whether we require a response from the write.
- * @return false if not connected or otherwise cannot perform write.
+ * @return false if not connected or cant perform write for some reason.
*/
bool NimBLERemoteCharacteristic::writeValue(const uint8_t* data, size_t length, bool response) {
@@ -862,4 +839,6 @@ int NimBLERemoteCharacteristic::onWriteCB(uint16_t conn_handle,
return 0;
}
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+
+#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif /* CONFIG_BT_ENABLED */
diff --git a/libraries/NimBLE-Arduino/src/NimBLERemoteCharacteristic.h b/libraries/NimBLE-Arduino/src/NimBLERemoteCharacteristic.h
index 353d8322..39e6d40f 100644
--- a/libraries/NimBLE-Arduino/src/NimBLERemoteCharacteristic.h
+++ b/libraries/NimBLE-Arduino/src/NimBLERemoteCharacteristic.h
@@ -14,16 +14,17 @@
#ifndef COMPONENTS_NIMBLEREMOTECHARACTERISTIC_H_
#define COMPONENTS_NIMBLEREMOTECHARACTERISTIC_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
#include "NimBLERemoteService.h"
#include "NimBLERemoteDescriptor.h"
#include
#include
-#include "NimBLELog.h"
class NimBLERemoteService;
class NimBLERemoteDescriptor;
@@ -61,15 +62,47 @@ class NimBLERemoteCharacteristic {
uint16_t getHandle();
uint16_t getDefHandle();
NimBLEUUID getUUID();
- NimBLEAttValue readValue(time_t *timestamp = nullptr);
- std::string toString();
- NimBLERemoteService* getRemoteService();
+ std::string readValue(time_t *timestamp = nullptr);
+
+ /**
+ * @brief A template to convert the remote characteristic data to .
+ * @tparam T The type to convert the data to.
+ * @param [in] timestamp A pointer to a time_t struct to store the time the value was read.
+ * @param [in] skipSizeCheck If true it will skip checking if the data size is less than sizeof() .
+ * @return The data converted to or NULL if skipSizeCheck is false and the data is
+ * less than sizeof() .
+ * @details Use: readValue(×tamp, skipSizeCheck);
+ */
+ template
+ T readValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
+ std::string value = readValue(timestamp);
+ if(!skipSizeCheck && value.size() < sizeof(T)) return T();
+ const char *pData = value.data();
+ return *((T *)pData);
+ }
uint8_t readUInt8() __attribute__ ((deprecated("Use template readValue()")));
uint16_t readUInt16() __attribute__ ((deprecated("Use template readValue()")));
uint32_t readUInt32() __attribute__ ((deprecated("Use template readValue()")));
float readFloat() __attribute__ ((deprecated("Use template readValue()")));
- NimBLEAttValue getValue(time_t *timestamp = nullptr);
+ std::string getValue(time_t *timestamp = nullptr);
+
+ /**
+ * @brief A template to convert the remote characteristic data to .
+ * @tparam T The type to convert the data to.
+ * @param [in] timestamp A pointer to a time_t struct to store the time the value was read.
+ * @param [in] skipSizeCheck If true it will skip checking if the data size is less than sizeof() .
+ * @return The data converted to or NULL if skipSizeCheck is false and the data is
+ * less than sizeof() .
+ * @details Use: getValue(×tamp, skipSizeCheck);
+ */
+ template
+ T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
+ std::string value = getValue(timestamp);
+ if(!skipSizeCheck && value.size() < sizeof(T)) return T();
+ const char *pData = value.data();
+ return *((T *)pData);
+ }
bool subscribe(bool notifications = true,
notify_callback notifyCallback = nullptr,
@@ -82,74 +115,20 @@ class NimBLERemoteCharacteristic {
bool writeValue(const uint8_t* data,
size_t length,
bool response = false);
- bool writeValue(const std::vector& v, bool response = false);
- bool writeValue(const char* s, bool response = false);
-
-
- /*********************** Template Functions ************************/
-
+ bool writeValue(const std::string &newValue,
+ bool response = false);
/**
- * @brief Template to set the remote characteristic value to val.
+ * @brief Convenience template to set the remote characteristic value to val.
* @param [in] s The value to write.
* @param [in] response True == request write response.
- * @details Only used for non-arrays and types without a `c_str()` method.
*/
template
-#ifdef _DOXYGEN_
- bool
-#else
- typename std::enable_if::value && !Has_c_str_len::value, bool>::type
-#endif
- writeValue(const T& s, bool response = false) {
+ bool writeValue(const T &s, bool response = false) {
return writeValue((uint8_t*)&s, sizeof(T), response);
}
- /**
- * @brief Template to set the remote characteristic value to val.
- * @param [in] s The value to write.
- * @param [in] response True == request write response.
- * @details Only used if the has a `c_str()` method.
- */
- template
-#ifdef _DOXYGEN_
- bool
-#else
- typename std::enable_if::value, bool>::type
-#endif
- writeValue(const T& s, bool response = false) {
- return writeValue((uint8_t*)s.c_str(), s.length(), response);
- }
-
- /**
- * @brief Template to convert the remote characteristic data to .
- * @tparam T The type to convert the data to.
- * @param [in] timestamp A pointer to a time_t struct to store the time the value was read.
- * @param [in] skipSizeCheck If true it will skip checking if the data size is less than sizeof() .
- * @return The data converted to or NULL if skipSizeCheck is false and the data is
- * less than sizeof() .
- * @details Use: getValue(×tamp, skipSizeCheck);
- */
- template
- T getValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
- if(!skipSizeCheck && m_value.size() < sizeof(T)) return T();
- return *((T *)m_value.getValue(timestamp));
- }
-
- /**
- * @brief Template to convert the remote characteristic data to .
- * @tparam T The type to convert the data to.
- * @param [in] timestamp A pointer to a time_t struct to store the time the value was read.
- * @param [in] skipSizeCheck If true it will skip checking if the data size is less than sizeof() .
- * @return The data converted to or NULL if skipSizeCheck is false and the data is
- * less than sizeof() .
- * @details Use: readValue(×tamp, skipSizeCheck);
- */
- template
- T readValue(time_t *timestamp = nullptr, bool skipSizeCheck = false) {
- NimBLEAttValue value = readValue();
- if(!skipSizeCheck && value.size() < sizeof(T)) return T();
- return *((T *)value.getValue(timestamp));
- }
+ std::string toString();
+ NimBLERemoteService* getRemoteService();
private:
@@ -179,12 +158,15 @@ class NimBLERemoteCharacteristic {
uint16_t m_defHandle;
uint16_t m_endHandle;
NimBLERemoteService* m_pRemoteService;
- NimBLEAttValue m_value;
+ std::string m_value;
notify_callback m_notifyCallback;
+ time_t m_timestamp;
+ portMUX_TYPE m_valMux;
// We maintain a vector of descriptors owned by this characteristic.
std::vector m_descriptorVector;
}; // NimBLERemoteCharacteristic
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif /* CONFIG_BT_ENABLED */
#endif /* COMPONENTS_NIMBLEREMOTECHARACTERISTIC_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLERemoteDescriptor.cpp b/libraries/NimBLE-Arduino/src/NimBLERemoteDescriptor.cpp
index cae91030..887dab66 100644
--- a/libraries/NimBLE-Arduino/src/NimBLERemoteDescriptor.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLERemoteDescriptor.cpp
@@ -11,16 +11,16 @@
* Created on: Jul 8, 2017
* Author: kolban
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
#include "NimBLERemoteDescriptor.h"
#include "NimBLEUtils.h"
#include "NimBLELog.h"
-#include
-
static const char* LOG_TAG = "NimBLERemoteDescriptor";
/**
@@ -86,7 +86,11 @@ NimBLEUUID NimBLERemoteDescriptor::getUUID() {
* @deprecated Use readValue().
*/
uint8_t NimBLERemoteDescriptor::readUInt8() {
- return readValue();
+ std::string value = readValue();
+ if (value.length() >= 1) {
+ return (uint8_t) value[0];
+ }
+ return 0;
} // readUInt8
@@ -96,7 +100,11 @@ uint8_t NimBLERemoteDescriptor::readUInt8() {
* @deprecated Use readValue().
*/
uint16_t NimBLERemoteDescriptor::readUInt16() {
- return readValue();
+ std::string value = readValue();
+ if (value.length() >= 2) {
+ return *(uint16_t*) value.data();
+ }
+ return 0;
} // readUInt16
@@ -106,7 +114,11 @@ uint16_t NimBLERemoteDescriptor::readUInt16() {
* @deprecated Use readValue().
*/
uint32_t NimBLERemoteDescriptor::readUInt32() {
- return readValue();
+ std::string value = readValue();
+ if (value.length() >= 4) {
+ return *(uint32_t*) value.data();
+ }
+ return 0;
} // readUInt32
@@ -114,11 +126,11 @@ uint32_t NimBLERemoteDescriptor::readUInt32() {
* @brief Read the value of the remote descriptor.
* @return The value of the remote descriptor.
*/
-NimBLEAttValue NimBLERemoteDescriptor::readValue() {
+std::string NimBLERemoteDescriptor::readValue() {
NIMBLE_LOGD(LOG_TAG, ">> Descriptor readValue: %s", toString().c_str());
NimBLEClient* pClient = getRemoteCharacteristic()->getRemoteService()->getClient();
- NimBLEAttValue value;
+ std::string value;
if (!pClient->isConnected()) {
NIMBLE_LOGE(LOG_TAG, "Disconnected");
@@ -168,7 +180,7 @@ NimBLEAttValue NimBLERemoteDescriptor::readValue() {
}
} while(rc != 0 && retryCount--);
- NIMBLE_LOGD(LOG_TAG, "<< Descriptor readValue(): length: %u rc=%d", value.length(), rc);
+ NIMBLE_LOGD(LOG_TAG, "<< Descriptor readValue(): length: %d rc=%d", value.length(), rc);
return value;
} // readValue
@@ -181,7 +193,6 @@ int NimBLERemoteDescriptor::onReadCB(uint16_t conn_handle,
const struct ble_gatt_error *error,
struct ble_gatt_attr *attr, void *arg)
{
- (void)attr;
ble_task_data_t *pTaskData = (ble_task_data_t*)arg;
NimBLERemoteDescriptor* desc = (NimBLERemoteDescriptor*)pTaskData->pATT;
uint16_t conn_id = desc->getRemoteCharacteristic()->getRemoteService()->getClient()->getConnId();
@@ -192,17 +203,17 @@ int NimBLERemoteDescriptor::onReadCB(uint16_t conn_handle,
NIMBLE_LOGD(LOG_TAG, "Read complete; status=%d conn_handle=%d", error->status, conn_handle);
- NimBLEAttValue *valBuf = (NimBLEAttValue*)pTaskData->buf;
+ std::string *strBuf = (std::string*)pTaskData->buf;
int rc = error->status;
if(rc == 0) {
if(attr) {
- uint16_t data_len = OS_MBUF_PKTLEN(attr->om);
- if((valBuf->size() + data_len) > BLE_ATT_ATTR_MAX_LEN) {
+ uint32_t data_len = OS_MBUF_PKTLEN(attr->om);
+ if(((*strBuf).length() + data_len) > BLE_ATT_ATTR_MAX_LEN) {
rc = BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
} else {
- NIMBLE_LOGD(LOG_TAG, "Got %u bytes", data_len);
- valBuf->append(attr->om->om_data, data_len);
+ NIMBLE_LOGD(LOG_TAG, "Got %d bytes", data_len);
+ (*strBuf) += std::string((char*) attr->om->om_data, data_len);
return 0;
}
}
@@ -255,33 +266,11 @@ int NimBLERemoteDescriptor::onWriteCB(uint16_t conn_handle,
/**
- * @brief Write a new value to a remote descriptor from a std::vector.
- * @param [in] vec A std::vector value to write to the remote descriptor.
- * @param [in] response Whether we require a response from the write.
- * @return false if not connected or otherwise cannot perform write.
- */
-bool NimBLERemoteDescriptor::writeValue(const std::vector& vec, bool response) {
- return writeValue((uint8_t*)&vec[0], vec.size(), response);
-} // writeValue
-
-
-/**
- * @brief Write a new value to the remote descriptor from a const char*.
- * @param [in] char_s A character string to write to the remote descriptor.
- * @param [in] response Whether we require a response from the write.
- * @return false if not connected or otherwise cannot perform write.
- */
-bool NimBLERemoteDescriptor::writeValue(const char* char_s, bool response) {
- return writeValue((uint8_t*)char_s, strlen(char_s), response);
-} // writeValue
-
-
-/**
- * @brief Write a new value to a remote descriptor.
+ * @brief Write data to the BLE Remote Descriptor.
* @param [in] data The data to send to the remote descriptor.
* @param [in] length The length of the data to send.
* @param [in] response True if we expect a write response.
- * @return false if not connected or otherwise cannot perform write.
+ * @return True if successful
*/
bool NimBLERemoteDescriptor::writeValue(const uint8_t* data, size_t length, bool response) {
@@ -362,4 +351,15 @@ bool NimBLERemoteDescriptor::writeValue(const uint8_t* data, size_t length, bool
} // writeValue
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+/**
+ * @brief Write data represented as a string to the BLE Remote Descriptor.
+ * @param [in] newValue The data to send to the remote descriptor.
+ * @param [in] response True if we expect a response.
+ * @return True if successful
+ */
+bool NimBLERemoteDescriptor::writeValue(const std::string &newValue, bool response) {
+ return writeValue((uint8_t*) newValue.data(), newValue.length(), response);
+} // writeValue
+
+#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif /* CONFIG_BT_ENABLED */
diff --git a/libraries/NimBLE-Arduino/src/NimBLERemoteDescriptor.h b/libraries/NimBLE-Arduino/src/NimBLERemoteDescriptor.h
index 28863df3..b52738ef 100644
--- a/libraries/NimBLE-Arduino/src/NimBLERemoteDescriptor.h
+++ b/libraries/NimBLE-Arduino/src/NimBLERemoteDescriptor.h
@@ -14,9 +14,11 @@
#ifndef COMPONENTS_NIMBLEREMOTEDESCRIPTOR_H_
#define COMPONENTS_NIMBLEREMOTEDESCRIPTOR_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
#include "NimBLERemoteCharacteristic.h"
@@ -29,66 +31,41 @@ class NimBLERemoteDescriptor {
uint16_t getHandle();
NimBLERemoteCharacteristic* getRemoteCharacteristic();
NimBLEUUID getUUID();
- NimBLEAttValue readValue();
+ std::string readValue();
+
+ /**
+ * @brief A template to convert the remote descriptor data to .
+ * @tparam T The type to convert the data to.
+ * @param [in] skipSizeCheck If true it will skip checking if the data size is less than sizeof() .
+ * @return The data converted to or NULL if skipSizeCheck is false and the data is
+ * less than sizeof() .
+ * @details Use: readValue(skipSizeCheck);
+ */
+ template
+ T readValue(bool skipSizeCheck = false) {
+ std::string value = readValue();
+ if(!skipSizeCheck && value.size() < sizeof(T)) return T();
+ const char *pData = value.data();
+ return *((T *)pData);
+ }
uint8_t readUInt8() __attribute__ ((deprecated("Use template readValue()")));
uint16_t readUInt16() __attribute__ ((deprecated("Use template readValue()")));
uint32_t readUInt32() __attribute__ ((deprecated("Use template readValue()")));
std::string toString(void);
bool writeValue(const uint8_t* data, size_t length, bool response = false);
- bool writeValue(const std::vector& v, bool response = false);
- bool writeValue(const char* s, bool response = false);
-
-
- /*********************** Template Functions ************************/
-
+ bool writeValue(const std::string &newValue, bool response = false);
+
/**
- * @brief Template to set the remote descriptor value to val.
+ * @brief Convenience template to set the remote descriptor value to val.
* @param [in] s The value to write.
* @param [in] response True == request write response.
- * @details Only used for non-arrays and types without a `c_str()` method.
*/
template
-#ifdef _DOXYGEN_
- bool
-#else
- typename std::enable_if::value && !Has_c_str_len::value, bool>::type
-#endif
- writeValue(const T& s, bool response = false) {
+ bool writeValue(const T &s, bool response = false) {
return writeValue((uint8_t*)&s, sizeof(T), response);
}
- /**
- * @brief Template to set the remote descriptor value to val.
- * @param [in] s The value to write.
- * @param [in] response True == request write response.
- * @details Only used if the has a `c_str()` method.
- */
- template
-#ifdef _DOXYGEN_
- bool
-#else
- typename std::enable_if::value, bool>::type
-#endif
- writeValue(const T& s, bool response = false) {
- return writeValue((uint8_t*)s.c_str(), s.length(), response);
- }
-
- /**
- * @brief Template to convert the remote descriptor data to .
- * @tparam T The type to convert the data to.
- * @param [in] skipSizeCheck If true it will skip checking if the data size is less than sizeof() .
- * @return The data converted to or NULL if skipSizeCheck is false and the data is
- * less than sizeof() .
- * @details Use: readValue(skipSizeCheck);
- */
- template
- T readValue(bool skipSizeCheck = false) {
- NimBLEAttValue value = readValue();
- if(!skipSizeCheck && value.size() < sizeof(T)) return T();
- return *((T *)value.data());
- }
-
private:
friend class NimBLERemoteCharacteristic;
@@ -104,5 +81,6 @@ class NimBLERemoteDescriptor {
NimBLERemoteCharacteristic* m_pRemoteCharacteristic;
};
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif /* CONFIG_BT_ENABLED */
#endif /* COMPONENTS_NIMBLEREMOTEDESCRIPTOR_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLERemoteService.cpp b/libraries/NimBLE-Arduino/src/NimBLERemoteService.cpp
index 5a72fe36..6557369d 100644
--- a/libraries/NimBLE-Arduino/src/NimBLERemoteService.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLERemoteService.cpp
@@ -11,17 +11,17 @@
* Created on: Jul 8, 2017
* Author: kolban
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
#include "NimBLERemoteService.h"
#include "NimBLEUtils.h"
#include "NimBLEDevice.h"
#include "NimBLELog.h"
-#include
-
static const char* LOG_TAG = "NimBLERemoteService";
/**
@@ -109,31 +109,14 @@ NimBLERemoteCharacteristic* NimBLERemoteService::getCharacteristic(const NimBLEU
return m_characteristicVector.back();
}
- // If the request was successful but 16/32 bit uuid not found
+ // If the request was successful but 16/32 bit characteristic not found
// try again with the 128 bit uuid.
if(uuid.bitSize() == BLE_UUID_TYPE_16 ||
uuid.bitSize() == BLE_UUID_TYPE_32)
{
NimBLEUUID uuid128(uuid);
uuid128.to128();
- if (retrieveCharacteristics(&uuid128)) {
- if(m_characteristicVector.size() > prev_size) {
- return m_characteristicVector.back();
- }
- }
- } else {
- // If the request was successful but the 128 bit uuid not found
- // try again with the 16 bit uuid.
- NimBLEUUID uuid16(uuid);
- uuid16.to16();
- // if the uuid was 128 bit but not of the BLE base type this check will fail
- if (uuid16.bitSize() == BLE_UUID_TYPE_16) {
- if(retrieveCharacteristics(&uuid16)) {
- if(m_characteristicVector.size() > prev_size) {
- return m_characteristicVector.back();
- }
- }
- }
+ return getCharacteristic(uuid128);
}
}
@@ -165,7 +148,7 @@ std::vector* NimBLERemoteService::getCharacteristic
/**
- * @brief Callback for Characteristic discovery.
+ * @brief Callback for Characterisic discovery.
* @return success == 0 or error code.
*/
int NimBLERemoteService::characteristicDiscCB(uint16_t conn_handle,
@@ -256,9 +239,7 @@ bool NimBLERemoteService::retrieveCharacteristics(const NimBLEUUID *uuid_filter)
}
}
- if (m_characteristicVector.size() > 0) {
- m_characteristicVector.back()->m_endHandle = getEndHandle();
- }
+ m_characteristicVector.back()->m_endHandle = getEndHandle();
}
NIMBLE_LOGD(LOG_TAG, "<< retrieveCharacteristics()");
@@ -410,4 +391,6 @@ std::string NimBLERemoteService::toString() {
return res;
} // toString
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+
+#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif /* CONFIG_BT_ENABLED */
diff --git a/libraries/NimBLE-Arduino/src/NimBLERemoteService.h b/libraries/NimBLE-Arduino/src/NimBLERemoteService.h
index 0443cfd9..751c9eff 100644
--- a/libraries/NimBLE-Arduino/src/NimBLERemoteService.h
+++ b/libraries/NimBLE-Arduino/src/NimBLERemoteService.h
@@ -14,9 +14,11 @@
#ifndef COMPONENTS_NIMBLEREMOTESERVICE_H_
#define COMPONENTS_NIMBLEREMOTESERVICE_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
#include "NimBLEClient.h"
#include "NimBLEUUID.h"
@@ -81,5 +83,6 @@ class NimBLERemoteService {
uint16_t m_endHandle;
}; // NimBLERemoteService
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_CENTRAL */
+#endif // #if defined( CONFIG_BT_NIMBLE_ROLE_CENTRAL)
+#endif /* CONFIG_BT_ENABLED */
#endif /* COMPONENTS_NIMBLEREMOTESERVICE_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEScan.cpp b/libraries/NimBLE-Arduino/src/NimBLEScan.cpp
index d1c4879b..10c946a7 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEScan.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEScan.cpp
@@ -11,16 +11,17 @@
* Created on: Jul 1, 2017
* Author: kolban
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
+#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
#include "NimBLEScan.h"
#include "NimBLEDevice.h"
#include "NimBLELog.h"
#include
-#include
static const char* LOG_TAG = "NimBLEScan";
@@ -34,7 +35,7 @@ NimBLEScan::NimBLEScan() {
m_scan_params.itvl = 0; // This is defined as the time interval from when the Controller started its last LE scan until it begins the subsequent LE scan. (units=0.625 msec)
m_scan_params.window = 0; // The duration of the LE scan. LE_Scan_Window shall be less than or equal to LE_Scan_Interval (units=0.625 msec)
m_scan_params.limited = 0; // If set, only discover devices in limited discoverable mode.
- m_scan_params.filter_duplicates = 1; // If set, the controller ignores all but the first advertisement from each device.
+ m_scan_params.filter_duplicates = 0; // If set, the controller ignores all but the first advertisement from each device.
m_pAdvertisedDeviceCallbacks = nullptr;
m_ignoreResults = false;
m_pTaskData = nullptr;
@@ -56,27 +57,18 @@ NimBLEScan::~NimBLEScan() {
* @param [in] param Parameter data for this event.
*/
/*STATIC*/int NimBLEScan::handleGapEvent(ble_gap_event* event, void* arg) {
- (void)arg;
- NimBLEScan* pScan = NimBLEDevice::getScan();
+
+ NimBLEScan* pScan = (NimBLEScan*)arg;
switch(event->type) {
- case BLE_GAP_EVENT_EXT_DISC:
case BLE_GAP_EVENT_DISC: {
if(pScan->m_ignoreResults) {
NIMBLE_LOGI(LOG_TAG, "Scan op in progress - ignoring results");
return 0;
}
-#if CONFIG_BT_NIMBLE_EXT_ADV
- const auto& disc = event->ext_disc;
- const bool isLegacyAdv = disc.props & BLE_HCI_ADV_LEGACY_MASK;
- const auto event_type = isLegacyAdv ? disc.legacy_event_type : disc.props;
-#else
- const auto& disc = event->disc;
- const bool isLegacyAdv = true;
- const auto event_type = disc.event_type;
-#endif
- NimBLEAddress advertisedAddress(disc.addr);
+
+ NimBLEAddress advertisedAddress(event->disc.addr);
// Examine our list of ignored addresses and stop processing if we don't want to see it or are already connected
if(NimBLEDevice::isIgnored(advertisedAddress)) {
@@ -88,12 +80,7 @@ NimBLEScan::~NimBLEScan() {
// If we've seen this device before get a pointer to it from the vector
for(auto &it: pScan->m_scanResults.m_advertisedDevicesVector) {
-#if CONFIG_BT_NIMBLE_EXT_ADV
- // Same address but different set ID should create a new advertised device.
- if (it->getAddress() == advertisedAddress && it->getSetId() == disc.sid) {
-#else
- if (it->getAddress() == advertisedAddress) {
-#endif
+ if(it->getAddress() == advertisedAddress) {
advertisedDevice = it;
break;
}
@@ -101,27 +88,20 @@ NimBLEScan::~NimBLEScan() {
// If we haven't seen this device before; create a new instance and insert it in the vector.
// Otherwise just update the relevant parameters of the already known device.
- if (advertisedDevice == nullptr &&
- (!isLegacyAdv || event_type != BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP)) {
+ if(advertisedDevice == nullptr && event->disc.event_type != BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP){
// Check if we have reach the scan results limit, ignore this one if so.
// We still need to store each device when maxResults is 0 to be able to append the scan results
- if (pScan->m_maxResults > 0 && pScan->m_maxResults < 0xFF &&
- (pScan->m_scanResults.m_advertisedDevicesVector.size() >= pScan->m_maxResults)) {
+ if(pScan->m_maxResults > 0 && pScan->m_maxResults < 0xFF &&
+ (pScan->m_scanResults.m_advertisedDevicesVector.size() >= pScan->m_maxResults))
+ {
return 0;
}
-
advertisedDevice = new NimBLEAdvertisedDevice();
advertisedDevice->setAddress(advertisedAddress);
- advertisedDevice->setAdvType(event_type, isLegacyAdv);
-#if CONFIG_BT_NIMBLE_EXT_ADV
- advertisedDevice->setSetId(disc.sid);
- advertisedDevice->setPrimaryPhy(disc.prim_phy);
- advertisedDevice->setSecondaryPhy(disc.sec_phy);
- advertisedDevice->setPeriodicInterval(disc.periodic_adv_itvl);
-#endif
+ advertisedDevice->setAdvType(event->disc.event_type);
pScan->m_scanResults.m_advertisedDevicesVector.push_back(advertisedDevice);
NIMBLE_LOGI(LOG_TAG, "New advertiser: %s", advertisedAddress.toString().c_str());
- } else if (advertisedDevice != nullptr) {
+ } else if(advertisedDevice != nullptr) {
NIMBLE_LOGI(LOG_TAG, "Updated advertiser: %s", advertisedAddress.toString().c_str());
} else {
// Scan response from unknown device
@@ -129,18 +109,14 @@ NimBLEScan::~NimBLEScan() {
}
advertisedDevice->m_timestamp = time(nullptr);
- advertisedDevice->setRSSI(disc.rssi);
- advertisedDevice->setPayload(disc.data, disc.length_data, (isLegacyAdv &&
- event_type == BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP));
+ advertisedDevice->setRSSI(event->disc.rssi);
+ advertisedDevice->setPayload(event->disc.data, event->disc.length_data,
+ event->disc.event_type == BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP);
if (pScan->m_pAdvertisedDeviceCallbacks) {
- if (pScan->m_scan_params.filter_duplicates && advertisedDevice->m_callbackSent) {
- return 0;
- }
-
// If not active scanning or scan response is not available
- // or extended advertisement scanning, report the result to the callback now.
- if(pScan->m_scan_params.passive || !isLegacyAdv ||
+ // report the result to the callback now.
+ if(pScan->m_scan_params.passive ||
(advertisedDevice->getAdvType() != BLE_HCI_ADV_TYPE_ADV_IND &&
advertisedDevice->getAdvType() != BLE_HCI_ADV_TYPE_ADV_SCAN_IND))
{
@@ -148,7 +124,7 @@ NimBLEScan::~NimBLEScan() {
pScan->m_pAdvertisedDeviceCallbacks->onResult(advertisedDevice);
// Otherwise, wait for the scan response so we can report the complete data.
- } else if (isLegacyAdv && event_type == BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP) {
+ } else if (event->disc.event_type == BLE_HCI_ADV_RPT_EVTYPE_SCAN_RSP) {
advertisedDevice->m_callbackSent = true;
pScan->m_pAdvertisedDeviceCallbacks->onResult(advertisedDevice);
}
@@ -164,7 +140,7 @@ NimBLEScan::~NimBLEScan() {
NIMBLE_LOGD(LOG_TAG, "discovery complete; reason=%d",
event->disc_complete.reason);
- // If a device advertised with scan response available and it was not received
+ // If a device advertised with scan reponse available and it was not received
// the callback would not have been invoked, so do it here.
if(pScan->m_pAdvertisedDeviceCallbacks) {
for(auto &it : pScan->m_scanResults.m_advertisedDevicesVector) {
@@ -211,7 +187,7 @@ void NimBLEScan::setActiveScan(bool active) {
* from devices it has not already seen.
* @param [in] enabled If true, scanned devices will only be reported once.
* @details The controller has a limited buffer and will start reporting
- * duplicate devices once the limit is reached.
+ * dupicate devices once the limit is reached.
*/
void NimBLEScan::setDuplicateFilter(bool enabled) {
m_scan_params.filter_duplicates = enabled;
@@ -236,7 +212,7 @@ void NimBLEScan::setLimitedOnly(bool enabled) {
* directed, connectable advertising packets not sent to the scanner.
* * BLE_HCI_SCAN_FILT_USE_WL (1)
* Scanner processes advertisements from white list only. A connectable,\n
- * directed advertisement is ignored unless it contains scanners address.
+ * directed advertisment is ignored unless it contains scanners address.
* * BLE_HCI_SCAN_FILT_NO_WL_INITA (2)
* Scanner process all advertising packets (white list not used). A\n
* connectable, directed advertisement shall not be ignored if the InitA
@@ -308,7 +284,7 @@ bool NimBLEScan::isScanning() {
* @return True if scan started or false if there was an error.
*/
bool NimBLEScan::start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResults), bool is_continue) {
- NIMBLE_LOGD(LOG_TAG, ">> start: duration=%" PRIu32, duration);
+ NIMBLE_LOGD(LOG_TAG, ">> start(duration=%d)", duration);
// Save the callback to be invoked when the scan completes.
m_scanCompleteCB = scanCompleteCB;
@@ -329,28 +305,9 @@ bool NimBLEScan::start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResul
m_ignoreResults = true;
}
-# if CONFIG_BT_NIMBLE_EXT_ADV
- ble_gap_ext_disc_params scan_params;
- scan_params.passive = m_scan_params.passive;
- scan_params.itvl = m_scan_params.itvl;
- scan_params.window = m_scan_params.window;
- int rc = ble_gap_ext_disc(NimBLEDevice::m_own_addr_type,
- duration/10,
- 0,
- m_scan_params.filter_duplicates,
- m_scan_params.filter_policy,
- m_scan_params.limited,
- &scan_params,
- &scan_params,
- NimBLEScan::handleGapEvent,
- NULL);
-#else
- int rc = ble_gap_disc(NimBLEDevice::m_own_addr_type,
- duration,
- &m_scan_params,
- NimBLEScan::handleGapEvent,
- NULL);
-#endif
+ int rc = ble_gap_disc(NimBLEDevice::m_own_addr_type, duration, &m_scan_params,
+ NimBLEScan::handleGapEvent, this);
+
switch(rc) {
case 0:
if(!is_continue) {
@@ -582,4 +539,5 @@ NimBLEAdvertisedDevice *NimBLEScanResults::getDevice(const NimBLEAddress &addres
return nullptr;
}
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_OBSERVER */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
+#endif /* CONFIG_BT_ENABLED */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEScan.h b/libraries/NimBLE-Arduino/src/NimBLEScan.h
index 76a11427..49d67c8e 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEScan.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEScan.h
@@ -13,18 +13,16 @@
*/
#ifndef COMPONENTS_NIMBLE_SCAN_H_
#define COMPONENTS_NIMBLE_SCAN_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
+#if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
#include "NimBLEAdvertisedDevice.h"
#include "NimBLEUtils.h"
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "host/ble_gap.h"
-#else
-#include "nimble/nimble/host/include/host/ble_gap.h"
-#endif
#include
@@ -99,5 +97,6 @@ class NimBLEScan {
uint8_t m_maxResults;
};
-#endif /* CONFIG_BT_ENABLED CONFIG_BT_NIMBLE_ROLE_OBSERVER */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_OBSERVER)
+#endif /* CONFIG_BT_ENABLED */
#endif /* COMPONENTS_NIMBLE_SCAN_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLESecurity.cpp b/libraries/NimBLE-Arduino/src/NimBLESecurity.cpp
index 0a0b72ba..aa062969 100644
--- a/libraries/NimBLE-Arduino/src/NimBLESecurity.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLESecurity.cpp
@@ -12,7 +12,7 @@
* Author: chegewara
*/
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include "NimBLESecurity.h"
@@ -61,8 +61,8 @@ void NimBLESecurity::setCapability(esp_ble_io_cap_t iocap) {
/**
- * @brief Sets the keys we will distribute during encryption.
- * @param [in] init_key A bitmask of the keys we will distribute.\n
+ * @brief Sets the keys we will distibute during encryption.
+ * @param [in] init_key A bitmask of the keys we will distibute.\n
* Can be one or more of:
* * ESP_BLE_ENC_KEY_MASK (1 << 0)
* * ESP_BLE_ID_KEY_MASK (1 << 1)
diff --git a/libraries/NimBLE-Arduino/src/NimBLESecurity.h b/libraries/NimBLE-Arduino/src/NimBLESecurity.h
index 157577d7..5a7619f4 100644
--- a/libraries/NimBLE-Arduino/src/NimBLESecurity.h
+++ b/libraries/NimBLE-Arduino/src/NimBLESecurity.h
@@ -14,16 +14,10 @@
#ifndef COMPONENTS_NIMBLESECURITY_H_
#define COMPONENTS_NIMBLESECURITY_H_
-
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "host/ble_gap.h"
-#else
-#include "nimble/nimble/host/include/host/ble_gap.h"
-#endif
-
/**** FIX COMPILATION ****/
#undef min
#undef max
diff --git a/libraries/NimBLE-Arduino/src/NimBLEServer.cpp b/libraries/NimBLE-Arduino/src/NimBLEServer.cpp
index 82fbc7a0..7206a150 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEServer.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEServer.cpp
@@ -12,20 +12,19 @@
* Author: kolban
*/
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
#include "NimBLEServer.h"
#include "NimBLEDevice.h"
#include "NimBLELog.h"
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "services/gap/ble_svc_gap.h"
#include "services/gatt/ble_svc_gatt.h"
-#else
-#include "nimble/nimble/host/services/gap/include/services/gap/ble_svc_gap.h"
-#include "nimble/nimble/host/services/gatt/include/services/gatt/ble_svc_gatt.h"
-#endif
+
static const char* LOG_TAG = "NimBLEServer";
static NimBLEServerCallbacks defaultCallbacks;
@@ -42,9 +41,7 @@ NimBLEServer::NimBLEServer() {
// m_svcChgChrHdl = 0xffff; // Future Use
m_pServerCallbacks = &defaultCallbacks;
m_gattsStarted = false;
-#if !CONFIG_BT_NIMBLE_EXT_ADV
m_advertiseOnDisconnect = true;
-#endif
m_svcChanged = false;
m_deleteCallbacks = true;
} // NimBLEServer
@@ -77,19 +74,23 @@ NimBLEService* NimBLEServer::createService(const char* uuid) {
/**
* @brief Create a %BLE Service.
* @param [in] uuid The UUID of the new service.
+ * @param [in] numHandles The maximum number of handles associated with this service.
+ * @param [in] inst_id if we have multiple services with the same UUID we need
+ * to provide inst_id value different for each service.
* @return A reference to the new service object.
*/
-NimBLEService* NimBLEServer::createService(const NimBLEUUID &uuid) {
+NimBLEService* NimBLEServer::createService(const NimBLEUUID &uuid, uint32_t numHandles, uint8_t inst_id) {
NIMBLE_LOGD(LOG_TAG, ">> createService - %s", uuid.toString().c_str());
-
+ // TODO: add functionality to use inst_id for multiple services with same uuid
+ (void)inst_id;
// Check that a service with the supplied UUID does not already exist.
if(getServiceByUUID(uuid) != nullptr) {
NIMBLE_LOGW(LOG_TAG, "Warning creating a duplicate service UUID: %s",
std::string(uuid).c_str());
}
- NimBLEService* pService = new NimBLEService(uuid);
- m_svcVec.push_back(pService);
+ NimBLEService* pService = new NimBLEService(uuid, numHandles, this);
+ m_svcVec.push_back(pService); // Save a reference to this service being on this server.
serviceChanged();
NIMBLE_LOGD(LOG_TAG, "<< createService");
@@ -141,26 +142,15 @@ NimBLEService *NimBLEServer::getServiceByHandle(uint16_t handle) {
return nullptr;
}
-
-#if CONFIG_BT_NIMBLE_EXT_ADV
-/**
- * @brief Retrieve the advertising object that can be used to advertise the existence of the server.
- * @return An advertising object.
- */
-NimBLEExtAdvertising* NimBLEServer::getAdvertising() {
- return NimBLEDevice::getAdvertising();
-} // getAdvertising
-#endif
-
-#if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
/**
* @brief Retrieve the advertising object that can be used to advertise the existence of the server.
+ *
* @return An advertising object.
*/
NimBLEAdvertising* NimBLEServer::getAdvertising() {
return NimBLEDevice::getAdvertising();
} // getAdvertising
-#endif
+
/**
* @brief Sends a service changed notification and resets the GATT server.
@@ -191,7 +181,7 @@ void NimBLEServer::start() {
abort();
}
-#if CONFIG_NIMBLE_CPP_LOG_LEVEL >= 4
+#if CONFIG_NIMBLE_CPP_DEBUG_LEVEL >= 4
ble_gatts_show_local();
#endif
/*** Future use ***
@@ -253,7 +243,6 @@ int NimBLEServer::disconnect(uint16_t connId, uint8_t reason) {
} // disconnect
-#if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
/**
* @brief Set the server to automatically start advertising when a client disconnects.
* @param [in] aod true == advertise, false == don't advertise.
@@ -261,7 +250,7 @@ int NimBLEServer::disconnect(uint16_t connId, uint8_t reason) {
void NimBLEServer::advertiseOnDisconnect(bool aod) {
m_advertiseOnDisconnect = aod;
} // advertiseOnDisconnect
-#endif
+
/**
* @brief Return the number of connected clients.
@@ -337,9 +326,8 @@ NimBLEConnInfo NimBLEServer::getPeerIDInfo(uint16_t id) {
* @param [in] param
*
*/
-/*STATIC*/
-int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
- NimBLEServer* server = NimBLEDevice::getServer();
+/*STATIC*/int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
+ NimBLEServer* server = (NimBLEServer*)arg;
NIMBLE_LOGD(LOG_TAG, ">> handleGapEvent: %s",
NimBLEUtils::gapEventToString(event->type));
int rc = 0;
@@ -351,9 +339,7 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
if (event->connect.status != 0) {
/* Connection failed; resume advertising */
NIMBLE_LOGE(LOG_TAG, "Connection failed");
-#if !CONFIG_BT_NIMBLE_EXT_ADV
NimBLEDevice::startAdvertising();
-#endif
}
else {
server->m_connectedPeersVec.push_back(event->connect.conn_handle);
@@ -373,7 +359,7 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
case BLE_GAP_EVENT_DISCONNECT: {
// If Host reset tell the device now before returning to prevent
- // any errors caused by calling host functions before resync.
+ // any errors caused by calling host functions before resyncing.
switch(event->disconnect.reason) {
case BLE_HS_ETIMEOUT_HCI:
case BLE_HS_EOS:
@@ -398,11 +384,9 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
server->m_pServerCallbacks->onDisconnect(server);
server->m_pServerCallbacks->onDisconnect(server, &event->disconnect.conn);
-#if !CONFIG_BT_NIMBLE_EXT_ADV
if(server->m_advertiseOnDisconnect) {
server->startAdvertising();
}
-#endif
return 0;
} // BLE_GAP_EVENT_DISCONNECT
@@ -490,15 +474,11 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
return 0;
} // BLE_GAP_EVENT_NOTIFY_TX
-
- case BLE_GAP_EVENT_ADV_COMPLETE:
-#if CONFIG_BT_NIMBLE_EXT_ADV
- case BLE_GAP_EVENT_SCAN_REQ_RCVD:
- return NimBLEExtAdvertising::handleGapEvent(event, arg);
-#else
- return NimBLEAdvertising::handleGapEvent(event, arg);
-#endif
- // BLE_GAP_EVENT_ADV_COMPLETE | BLE_GAP_EVENT_SCAN_REQ_RCVD
+ case BLE_GAP_EVENT_ADV_COMPLETE: {
+ NIMBLE_LOGD(LOG_TAG, "Advertising Complete");
+ NimBLEDevice::getAdvertising()->advCompleteCB();
+ return 0;
+ }
case BLE_GAP_EVENT_CONN_UPDATE: {
NIMBLE_LOGD(LOG_TAG, "Connection parameters updated.");
@@ -557,7 +537,7 @@ int NimBLEServer::handleGapEvent(struct ble_gap_event *event, void *arg) {
NIMBLE_LOGD(LOG_TAG, "BLE_SM_IOACT_DISP; ble_sm_inject_io result: %d", rc);
} else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) {
- NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %" PRIu32, event->passkey.params.numcmp);
+ NIMBLE_LOGD(LOG_TAG, "Passkey on device's display: %d", event->passkey.params.numcmp);
pkey.action = event->passkey.params.action;
// Compatibility only - Do not use, should be removed the in future
if(NimBLEDevice::m_securityCallbacks != nullptr) {
@@ -636,7 +616,7 @@ void NimBLEServer::setCallbacks(NimBLEServerCallbacks* pCallbacks, bool deleteCa
* @brief Remove a service from the server.
*
* @details Immediately removes access to the service by clients, sends a service changed indication,
- * and removes the service (if applicable) from the advertisements.
+ * and removes the service (if applicable) from the advertisments.
* 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
* be deleted later by calling this method with deleteSvc set to true.
@@ -675,9 +655,7 @@ void NimBLEServer::removeService(NimBLEService* service, bool deleteSvc) {
service->m_removed = deleteSvc ? NIMBLE_ATT_REMOVE_DELETE : NIMBLE_ATT_REMOVE_HIDE;
serviceChanged();
-#if !CONFIG_BT_NIMBLE_EXT_ADV
NimBLEDevice::getAdvertising()->removeServiceUUID(service->getUUID());
-#endif
}
@@ -740,53 +718,23 @@ void NimBLEServer::resetGATT() {
}
-#if CONFIG_BT_NIMBLE_EXT_ADV
/**
* @brief Start advertising.
- * @param [in] inst_id The extended advertisement instance ID to start.
- * @param [in] duration How long to advertise for in milliseconds, 0 = forever (default).
- * @param [in] max_events Maximum number of advertisement events to send, 0 = no limit (default).
- * @return True if advertising started successfully.
- * @details Start the server advertising its existence. This is a convenience function and is equivalent to
- * retrieving the advertising object and invoking start upon it.
- */
-bool NimBLEServer::startAdvertising(uint8_t inst_id,
- int duration,
- int max_events) {
- return getAdvertising()->start(inst_id, duration, max_events);
-} // startAdvertising
-
-
-/**
- * @brief Convenience function to stop advertising a data set.
- * @param [in] inst_id The extended advertisement instance ID to stop advertising.
- * @return True if advertising stopped successfully.
- */
-bool NimBLEServer::stopAdvertising(uint8_t inst_id) {
- return getAdvertising()->stop(inst_id);
-} // stopAdvertising
-#endif
-
-#if !CONFIG_BT_NIMBLE_EXT_ADV|| defined(_DOXYGEN_)
-/**
- * @brief Start advertising.
- * @return True if advertising started successfully.
- * @details Start the server advertising its existence. This is a convenience function and is equivalent to
+ *
+ * Start the server advertising its existence. This is a convenience function and is equivalent to
* retrieving the advertising object and invoking start upon it.
*/
-bool NimBLEServer::startAdvertising() {
- return getAdvertising()->start();
+void NimBLEServer::startAdvertising() {
+ NimBLEDevice::startAdvertising();
} // startAdvertising
-#endif
/**
* @brief Stop advertising.
- * @return True if advertising stopped successfully.
*/
-bool NimBLEServer::stopAdvertising() {
- return getAdvertising()->stop();
-} // stopAdvertising
+void NimBLEServer::stopAdvertising() {
+ NimBLEDevice::stopAdvertising();
+} // startAdvertising
/**
@@ -824,31 +772,7 @@ void NimBLEServer::updateConnParams(uint16_t conn_handle,
if(rc != 0) {
NIMBLE_LOGE(LOG_TAG, "Update params error: %d, %s", rc, NimBLEUtils::returnCodeToString(rc));
}
-} // updateConnParams
-
-
-/**
- * @brief Request an update of the data packet length.
- * * Can only be used after a connection has been established.
- * @details Sends a data length update request to the peer.
- * The Data Length Extension (DLE) allows to increase the Data Channel Payload from 27 bytes to up to 251 bytes.
- * The peer needs to support the Bluetooth 4.2 specifications, to be capable of DLE.
- * @param [in] conn_handle The connection handle of the peer to send the request to.
- * @param [in] tx_octets The preferred number of payload octets to use (Range 0x001B-0x00FB).
- */
-void NimBLEServer::setDataLen(uint16_t conn_handle, uint16_t tx_octets) {
-#if defined(CONFIG_NIMBLE_CPP_IDF) && !defined(ESP_IDF_VERSION) || \
- (ESP_IDF_VERSION_MAJOR * 100 + ESP_IDF_VERSION_MINOR * 10 + ESP_IDF_VERSION_PATCH) < 432
- return;
-#else
- uint16_t tx_time = (tx_octets + 14) * 8;
-
- int rc = ble_gap_set_data_len(conn_handle, tx_octets, tx_time);
- if(rc != 0) {
- NIMBLE_LOGE(LOG_TAG, "Set data length error: %d, %s", rc, NimBLEUtils::returnCodeToString(rc));
- }
-#endif
-} // setDataLen
+}// updateConnParams
bool NimBLEServer::setIndicateWait(uint16_t conn_handle) {
@@ -918,4 +842,6 @@ bool NimBLEServerCallbacks::onConfirmPIN(uint32_t pin){
return true;
}
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif // CONFIG_BT_ENABLED
diff --git a/libraries/NimBLE-Arduino/src/NimBLEServer.h b/libraries/NimBLE-Arduino/src/NimBLEServer.h
index 54bbb9ab..ebcf39f2 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEServer.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEServer.h
@@ -14,22 +14,18 @@
#ifndef MAIN_NIMBLESERVER_H_
#define MAIN_NIMBLESERVER_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
#define NIMBLE_ATT_REMOVE_HIDE 1
#define NIMBLE_ATT_REMOVE_DELETE 2
-#define onMtuChanged onMTUChange
-
#include "NimBLEUtils.h"
#include "NimBLEAddress.h"
-#if CONFIG_BT_NIMBLE_EXT_ADV
-#include "NimBLEExtAdvertising.h"
-#else
#include "NimBLEAdvertising.h"
-#endif
#include "NimBLEService.h"
#include "NimBLESecurity.h"
#include "NimBLEConnInfo.h"
@@ -47,23 +43,15 @@ class NimBLEServer {
public:
size_t getConnectedCount();
NimBLEService* createService(const char* uuid);
- NimBLEService* createService(const NimBLEUUID &uuid);
+ NimBLEService* createService(const NimBLEUUID &uuid, uint32_t numHandles=15,
+ uint8_t inst_id=0);
void removeService(NimBLEService* service, bool deleteSvc = false);
void addService(NimBLEService* service);
+ NimBLEAdvertising* getAdvertising();
void setCallbacks(NimBLEServerCallbacks* pCallbacks,
bool deleteCallbacks = true);
-#if CONFIG_BT_NIMBLE_EXT_ADV
- NimBLEExtAdvertising* getAdvertising();
- bool startAdvertising(uint8_t inst_id,
- int duration = 0,
- int max_events = 0);
- bool stopAdvertising(uint8_t inst_id);
-#endif
-#if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
- NimBLEAdvertising* getAdvertising();
- bool startAdvertising();
-#endif
- bool stopAdvertising();
+ void startAdvertising();
+ void stopAdvertising();
void start();
NimBLEService* getServiceByUUID(const char* uuid, uint16_t instanceId = 0);
NimBLEService* getServiceByUUID(const NimBLEUUID &uuid, uint16_t instanceId = 0);
@@ -73,15 +61,12 @@ class NimBLEServer {
void updateConnParams(uint16_t conn_handle,
uint16_t minInterval, uint16_t maxInterval,
uint16_t latency, uint16_t timeout);
- void setDataLen(uint16_t conn_handle, uint16_t tx_octets);
uint16_t getPeerMTU(uint16_t conn_id);
std::vector getPeerDevices();
NimBLEConnInfo getPeerInfo(size_t index);
NimBLEConnInfo getPeerInfo(const NimBLEAddress& address);
NimBLEConnInfo getPeerIDInfo(uint16_t id);
-#if !CONFIG_BT_NIMBLE_EXT_ADV || defined(_DOXYGEN_)
void advertiseOnDisconnect(bool);
-#endif
private:
NimBLEServer();
@@ -90,15 +75,9 @@ class NimBLEServer {
friend class NimBLEService;
friend class NimBLEDevice;
friend class NimBLEAdvertising;
-#if CONFIG_BT_NIMBLE_EXT_ADV
- friend class NimBLEExtAdvertising;
- friend class NimBLEExtAdvertisementData;
-#endif
bool m_gattsStarted;
-#if !CONFIG_BT_NIMBLE_EXT_ADV
bool m_advertiseOnDisconnect;
-#endif
bool m_svcChanged;
NimBLEServerCallbacks* m_pServerCallbacks;
bool m_deleteCallbacks;
@@ -152,7 +131,7 @@ class NimBLEServerCallbacks {
* @brief Handle a client disconnection.
* This is called when a client discconnects.
* @param [in] pServer A pointer to the %BLE server that received the client disconnection.
- * @param [in] desc A pointer to the connection description structure containing information
+ * @param [in] desc A pointer to the connection description structure containig information
* about the connection.
*/
virtual void onDisconnect(NimBLEServer* pServer, ble_gap_conn_desc* desc);
@@ -160,7 +139,7 @@ class NimBLEServerCallbacks {
/**
* @brief Called when the connection MTU changes.
* @param [in] MTU The new MTU value.
- * @param [in] desc A pointer to the connection description structure containing information
+ * @param [in] desc A pointer to the connection description structure containig information
* about the connection.
*/
virtual void onMTUChange(uint16_t MTU, ble_gap_conn_desc* desc);
@@ -189,5 +168,7 @@ class NimBLEServerCallbacks {
virtual bool onConfirmPIN(uint32_t pin);
}; // NimBLEServerCallbacks
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif /* CONFIG_BT_ENABLED */
#endif /* MAIN_NIMBLESERVER_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEService.cpp b/libraries/NimBLE-Arduino/src/NimBLEService.cpp
index b124fcb9..9c43e900 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEService.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEService.cpp
@@ -14,10 +14,12 @@
// A service is identified by a UUID. A service is also the container for one or more characteristics.
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
+
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
-#include "NimBLEDevice.h"
#include "NimBLEService.h"
#include "NimBLEUtils.h"
#include "NimBLELog.h"
@@ -32,19 +34,25 @@ static const char* LOG_TAG = "NimBLEService"; // Tag for logging.
/**
* @brief Construct an instance of the NimBLEService
* @param [in] uuid The UUID of the service.
+ * @param [in] numHandles The maximum number of handles associated with the service.
+ * @param [in] pServer A pointer to the server instance that this service belongs to.
*/
-NimBLEService::NimBLEService(const char* uuid)
-: NimBLEService(NimBLEUUID(uuid)) {
+NimBLEService::NimBLEService(const char* uuid, uint16_t numHandles, NimBLEServer* pServer)
+: NimBLEService(NimBLEUUID(uuid), numHandles, pServer) {
}
/**
* @brief Construct an instance of the BLEService
* @param [in] uuid The UUID of the service.
+ * @param [in] numHandles The maximum number of handles associated with the service.
+ * @param [in] pServer A pointer to the server instance that this service belongs to.
*/
-NimBLEService::NimBLEService(const NimBLEUUID &uuid) {
+NimBLEService::NimBLEService(const NimBLEUUID &uuid, uint16_t numHandles, NimBLEServer* pServer) {
m_uuid = uuid;
m_handle = NULL_HANDLE;
+ m_pServer = pServer;
+ m_numHandles = numHandles;
m_pSvcDef = nullptr;
m_removed = 0;
@@ -113,12 +121,6 @@ bool NimBLEService::start() {
// Rebuild the service definition if the server attributes have changed.
if(getServer()->m_svcChanged && m_pSvcDef != nullptr) {
- if(m_pSvcDef[0].characteristics) {
- if(m_pSvcDef[0].characteristics[0].descriptors) {
- delete(m_pSvcDef[0].characteristics[0].descriptors);
- }
- delete(m_pSvcDef[0].characteristics);
- }
delete(m_pSvcDef);
m_pSvcDef = nullptr;
}
@@ -256,11 +258,10 @@ uint16_t NimBLEService::getHandle() {
* @brief Create a new BLE Characteristic associated with this service.
* @param [in] uuid - The UUID of the characteristic.
* @param [in] properties - The properties of the characteristic.
- * @param [in] max_len - The maximum length in bytes that the characteristic value can hold.
* @return The new BLE characteristic.
*/
-NimBLECharacteristic* NimBLEService::createCharacteristic(const char* uuid, uint32_t properties, uint16_t max_len) {
- return createCharacteristic(NimBLEUUID(uuid), properties, max_len);
+NimBLECharacteristic* NimBLEService::createCharacteristic(const char* uuid, uint32_t properties) {
+ return createCharacteristic(NimBLEUUID(uuid), properties);
}
@@ -268,11 +269,10 @@ NimBLECharacteristic* NimBLEService::createCharacteristic(const char* uuid, uint
* @brief Create a new BLE Characteristic associated with this service.
* @param [in] uuid - The UUID of the characteristic.
* @param [in] properties - The properties of the characteristic.
- * @param [in] max_len - The maximum length in bytes that the characteristic value can hold.
* @return The new BLE characteristic.
*/
-NimBLECharacteristic* NimBLEService::createCharacteristic(const NimBLEUUID &uuid, uint32_t properties, uint16_t max_len) {
- NimBLECharacteristic* pCharacteristic = new NimBLECharacteristic(uuid, properties, max_len, this);
+NimBLECharacteristic* NimBLEService::createCharacteristic(const NimBLEUUID &uuid, uint32_t properties) {
+ NimBLECharacteristic* pCharacteristic = new NimBLECharacteristic(uuid, properties, this);
if (getCharacteristic(uuid) != nullptr) {
NIMBLE_LOGD(LOG_TAG, "<< Adding a duplicate characteristic with UUID: %s",
@@ -429,7 +429,8 @@ std::string NimBLEService::toString() {
* @return The BLEServer associated with this service.
*/
NimBLEServer* NimBLEService::getServer() {
- return NimBLEDevice::getServer();
+ return m_pServer;
}// getServer
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif // CONFIG_BT_ENABLED
diff --git a/libraries/NimBLE-Arduino/src/NimBLEService.h b/libraries/NimBLE-Arduino/src/NimBLEService.h
index 21ec1af7..ebf913d3 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEService.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEService.h
@@ -14,9 +14,11 @@
#ifndef MAIN_NIMBLESERVICE_H_
#define MAIN_NIMBLESERVICE_H_
+#include "sdkconfig.h"
+#if defined(CONFIG_BT_ENABLED)
#include "nimconfig.h"
-#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
#include "NimBLEServer.h"
#include "NimBLECharacteristic.h"
@@ -34,8 +36,8 @@ class NimBLECharacteristic;
class NimBLEService {
public:
- NimBLEService(const char* uuid);
- NimBLEService(const NimBLEUUID &uuid);
+ NimBLEService(const char* uuid, uint16_t numHandles, NimBLEServer* pServer);
+ NimBLEService(const NimBLEUUID &uuid, uint16_t numHandles, NimBLEServer* pServer);
~NimBLEService();
NimBLEServer* getServer();
@@ -50,14 +52,12 @@ class NimBLEService {
NimBLECharacteristic* createCharacteristic(const char* uuid,
uint32_t properties =
NIMBLE_PROPERTY::READ |
- NIMBLE_PROPERTY::WRITE,
- uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
+ NIMBLE_PROPERTY::WRITE);
NimBLECharacteristic* createCharacteristic(const NimBLEUUID &uuid,
uint32_t properties =
NIMBLE_PROPERTY::READ |
- NIMBLE_PROPERTY::WRITE,
- uint16_t max_len = BLE_ATT_ATTR_MAX_LEN);
+ NIMBLE_PROPERTY::WRITE);
void addCharacteristic(NimBLECharacteristic* pCharacteristic);
void removeCharacteristic(NimBLECharacteristic* pCharacteristic, bool deleteChr = false);
@@ -76,12 +76,16 @@ class NimBLEService {
friend class NimBLEDevice;
uint16_t m_handle;
+ NimBLEServer* m_pServer;
NimBLEUUID m_uuid;
+ uint16_t m_numHandles;
ble_gatt_svc_def* m_pSvcDef;
uint8_t m_removed;
std::vector m_chrVec;
}; // NimBLEService
-#endif /* CONFIG_BT_ENABLED && CONFIG_BT_NIMBLE_ROLE_PERIPHERAL */
+
+#endif // #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
+#endif // CONFIG_BT_ENABLED
#endif /* MAIN_NIMBLESERVICE_H_ */
diff --git a/libraries/NimBLE-Arduino/src/NimBLEUUID.cpp b/libraries/NimBLE-Arduino/src/NimBLEUUID.cpp
index b14eae16..9338d7d0 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEUUID.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEUUID.cpp
@@ -11,8 +11,7 @@
* Created on: Jun 21, 2017
* Author: kolban
*/
-
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include "NimBLEUtils.h"
@@ -235,8 +234,8 @@ const ble_uuid_any_t* NimBLEUUID::getNative() const {
/**
* @brief Convert a UUID to its 128 bit representation.
- * @details A UUID can be internally represented as 16bit, 32bit or the full 128bit.
- * This method will convert 16 or 32bit representations to the full 128bit.
+ * @details A UUID can be internally represented as 16bit, 32bit or the full 128bit. This method
+ * will convert 16 or 32 bit representations to the full 128bit.
* @return The NimBLEUUID converted to 128bit.
*/
const NimBLEUUID &NimBLEUUID::to128() {
@@ -257,29 +256,6 @@ const NimBLEUUID &NimBLEUUID::to128() {
} // to128
-/**
- * @brief Convert 128 bit UUID to its 16 bit representation.
- * @details A UUID can be internally represented as 16bit, 32bit or the full 128bit.
- * This method will convert a 128bit uuid to 16bit if it contains the ble base uuid.
- * @return The NimBLEUUID converted to 16bit if successful, otherwise the original uuid.
- */
-const NimBLEUUID& NimBLEUUID::to16() {
- if (!m_valueSet || m_uuid.u.type == BLE_UUID_TYPE_16) {
- return *this;
- }
-
- if (m_uuid.u.type == BLE_UUID_TYPE_128) {
- uint8_t base128[] = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00,
- 0x00, 0x80, 0x00, 0x10, 0x00, 0x00};
- if (memcmp(m_uuid.u128.value, base128, sizeof(base128)) == 0 ) {
- *this = NimBLEUUID(*(uint16_t*)(m_uuid.u128.value + 12));
- }
- }
-
- return *this;
-}
-
-
/**
* @brief Get a string representation of the UUID.
* @details
@@ -297,7 +273,7 @@ std::string NimBLEUUID::toString() const {
/**
- * @brief Convenience operator to check if this UUID is equal to another.
+ * @brief Convienience operator to check if this UUID is equal to another.
*/
bool NimBLEUUID::operator ==(const NimBLEUUID & rhs) const {
if(m_valueSet && rhs.m_valueSet) {
@@ -336,7 +312,7 @@ bool NimBLEUUID::operator ==(const NimBLEUUID & rhs) const {
/**
- * @brief Convenience operator to check if this UUID is not equal to another.
+ * @brief Convienience operator to check if this UUID is not equal to another.
*/
bool NimBLEUUID::operator !=(const NimBLEUUID & rhs) const {
return !this->operator==(rhs);
@@ -344,7 +320,7 @@ bool NimBLEUUID::operator !=(const NimBLEUUID & rhs) const {
/**
- * @brief Convenience operator to convert this UUID to string representation.
+ * @brief Convienience operator to convert this UUID to string representation.
* @details This allows passing NimBLEUUID to functions
* that accept std::string and/or or it's methods as a parameter.
*/
diff --git a/libraries/NimBLE-Arduino/src/NimBLEUUID.h b/libraries/NimBLE-Arduino/src/NimBLEUUID.h
index 2c24971f..982f9c36 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEUUID.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEUUID.h
@@ -14,16 +14,10 @@
#ifndef COMPONENTS_NIMBLEUUID_H_
#define COMPONENTS_NIMBLEUUID_H_
-
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "host/ble_uuid.h"
-#else
-#include "nimble/nimble/host/include/host/ble_uuid.h"
-#endif
-
/**** FIX COMPILATION ****/
#undef min
#undef max
@@ -48,7 +42,6 @@ class NimBLEUUID {
bool equals(const NimBLEUUID &uuid) const;
const ble_uuid_any_t* getNative() const;
const NimBLEUUID & to128();
- const NimBLEUUID& to16();
std::string toString() const;
static NimBLEUUID fromString(const std::string &uuid);
diff --git a/libraries/NimBLE-Arduino/src/NimBLEUtils.cpp b/libraries/NimBLE-Arduino/src/NimBLEUtils.cpp
index 60ea541f..7a1f55b4 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEUtils.cpp
+++ b/libraries/NimBLE-Arduino/src/NimBLEUtils.cpp
@@ -6,13 +6,12 @@
*
*/
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include "NimBLEUtils.h"
#include "NimBLELog.h"
-
-#include
+#include "nimconfig.h"
static const char* LOG_TAG = "NimBLEUtils";
@@ -343,7 +342,6 @@ const char* NimBLEUtils::returnCodeToString(int rc) {
return "Unknown";
}
#else // #if defined(CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT)
- (void)rc;
return "";
#endif // #if defined(CONFIG_NIMBLE_CPP_ENABLE_RETURN_CODE_TEXT)
}
@@ -355,7 +353,7 @@ const char* NimBLEUtils::returnCodeToString(int rc) {
* @return A string representation of the advertising flags.
*/
const char* NimBLEUtils::advTypeToString(uint8_t advType) {
-#if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT)
+#if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT)
switch(advType) {
case BLE_HCI_ADV_TYPE_ADV_IND : //0
return "Undirected - Connectable / Scannable";
@@ -370,10 +368,9 @@ const char* NimBLEUtils::advTypeToString(uint8_t advType) {
default:
return "Unknown flag";
}
-#else // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT)
- (void)advType;
+#else // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT)
return "";
-#endif // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISEMENT_TYPE_TEXT)
+#endif // #if defined(CONFIG_NIMBLE_CPP_ENABLE_ADVERTISMENT_TYPE_TEXT)
} // adFlagsToString
@@ -419,11 +416,8 @@ char* NimBLEUtils::buildHexData(uint8_t* target, const uint8_t* source, uint8_t
* @param [in] arg Unused.
*/
void NimBLEUtils::dumpGapEvent(ble_gap_event *event, void *arg){
- (void)arg;
#if defined(CONFIG_NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT)
NIMBLE_LOGD(LOG_TAG, "Received a GAP event: %s", gapEventToString(event->type));
-#else
- (void)event;
#endif
}
@@ -510,7 +504,6 @@ const char* NimBLEUtils::gapEventToString(uint8_t eventType) {
return "Unknown event type";
}
#else // #if defined(CONFIG_NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT)
- (void)eventType;
return "";
#endif // #if defined(CONFIG_NIMBLE_CPP_ENABLE_GAP_EVENT_CODE_TEXT)
} // gapEventToString
diff --git a/libraries/NimBLE-Arduino/src/NimBLEUtils.h b/libraries/NimBLE-Arduino/src/NimBLEUtils.h
index 006d9352..acbc93e7 100644
--- a/libraries/NimBLE-Arduino/src/NimBLEUtils.h
+++ b/libraries/NimBLE-Arduino/src/NimBLEUtils.h
@@ -8,15 +8,10 @@
#ifndef COMPONENTS_NIMBLEUTILS_H_
#define COMPONENTS_NIMBLEUTILS_H_
-
-#include "nimconfig.h"
+#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
-#if defined(CONFIG_NIMBLE_CPP_IDF)
#include "host/ble_gap.h"
-#else
-#include "nimble/nimble/host/include/host/ble_gap.h"
-#endif
/**** FIX COMPILATION ****/
#undef min
@@ -29,7 +24,7 @@ typedef struct {
void *pATT;
TaskHandle_t task;
int rc;
- void *buf;
+ std::string *buf;
} ble_task_data_t;
diff --git a/libraries/NimBLE-Arduino/src/nimble/README.md b/libraries/NimBLE-Arduino/src/README.md
similarity index 90%
rename from libraries/NimBLE-Arduino/src/nimble/README.md
rename to libraries/NimBLE-Arduino/src/README.md
index 96c63663..bbd17fc8 100644
--- a/libraries/NimBLE-Arduino/src/nimble/README.md
+++ b/libraries/NimBLE-Arduino/src/README.md
@@ -23,7 +23,7 @@
## Overview
-Apache NimBLE is an open-source Bluetooth 5.1 stack (both Host & Controller)
+Apache NimBLE is an open-source Bluetooth 5.0 stack (both Host & Controller)
that completely replaces the proprietary SoftDevice on Nordic chipsets. It is
part of [Apache Mynewt project](https://github.com/apache/mynewt-core).
@@ -84,24 +84,27 @@ There are also some sample applications that show how to Apache Mynewt NimBLE
stack. These sample applications are located in the `apps/` directory of
Apache Mynewt [repo](https://github.com/apache/mynewt-core). Some examples:
-* [blecent](https://github.com/apache/mynewt-nimble/tree/master/apps/blecent):
+* [blecent](https://github.com/apache/mynewt-core/tree/master/apps/blecent):
A basic central device with no user interface. This application scans for
a peripheral that supports the alert notification service (ANS). Upon
discovering such a peripheral, blecent connects and performs a characteristic
read, characteristic write, and notification subscription.
-* [blehci](https://github.com/apache/mynewt-nimble/tree/master/apps/blehci):
+* [blehci](https://github.com/apache/mynewt-core/tree/master/apps/blehci):
Implements a BLE controller-only application. A separate host-only
implementation, such as Linux's BlueZ, can interface with this application via
HCI over UART.
-* [bleprph](https://github.com/apache/mynewt-nimble/tree/master/apps/bleprph): An
+* [bleprph](https://github.com/apache/mynewt-core/tree/master/apps/bleprph): An
implementation of a minimal BLE peripheral.
-* [btshell](https://github.com/apache/mynewt-nimble/tree/master/apps/btshell): A
+* [btshell](https://github.com/apache/mynewt-core/tree/master/apps/btshell): A
shell-like application allowing to configure and use most of NimBLE
functionality from command line.
* [bleuart](https://github.com/apache/mynewt-core/tree/master/apps/bleuart):
Implements a simple BLE peripheral that supports the Nordic
UART / Serial Port Emulation service
(https://developer.nordicsemi.com/nRF5_SDK/nRF51_SDK_v8.x.x/doc/8.0.0/s110/html/a00072.html).
+* [test](https://github.com/apache/mynewt-core/tree/master/apps/test): Test
+ project which can be compiled either with the simulator, or on a per-architecture basis.
+ Test will run all the package's unit tests.
# Getting Help
@@ -110,7 +113,7 @@ want to talk to a human about what you're working on, you can contact us via the
[developers mailing list](mailto:dev@mynewt.apache.org).
Although not a formal channel, you can also find a number of core developers
-on the #mynewt channel on Freenode IRC or #general channel on [Mynewt Slack](https://mynewt.slack.com/join/shared_invite/enQtNjA1MTg0NzgyNzg3LTcyMmZiOGQzOGMxM2U4ODFmMTIwNjNmYTE5Y2UwYjQwZWIxNTE0MTUzY2JmMTEzOWFjYWZkNGM0YmM4MzAxNWQ)
+on the #mynewt channel on Freenode IRC or #general channel on [Mynewt Slack](https://join.slack.com/mynewt/shared_invite/MTkwMTg1ODM1NTg5LTE0OTYxNzQ4NzQtZTU1YmNhYjhkMg)
Also, be sure to checkout the [Frequently Asked Questions](https://mynewt.apache.org/faq/answers)
for some help troubleshooting first.
diff --git a/libraries/NimBLE-Arduino/src/RELEASE_NOTES.md b/libraries/NimBLE-Arduino/src/RELEASE_NOTES.md
new file mode 100644
index 00000000..cda8fe2e
--- /dev/null
+++ b/libraries/NimBLE-Arduino/src/RELEASE_NOTES.md
@@ -0,0 +1,27 @@
+# RELEASE NOTES
+
+16 July 2019 - Apache NimBLE v1.2.0
+
+For full release notes, please visit the
+[Apache Mynewt Wiki](https://cwiki.apache.org/confluence/display/MYNEWT/Release+Notes).
+
+Apache NimBLE is an open-source Bluetooth 5.0 stack (both Host & Controller) that completely
+replaces the proprietary SoftDevice on Nordic chipsets.
+
+New features in this version of NimBLE include:
+
+* Perdiodic Advertising support with up to 1650 bytes of data (scanner and advertiser)
+* Support for scan request notification in GAP API
+* Updated host qualification ID
+* Qualification related bugfixes
+* GAP API doxygen documentation update
+* BLE Mesh improvements - fixes and resync with latest Zephyr code
+* RIOT OS port fixes and improvements
+* btshell sample application improvements
+* improvements for bttester application
+* Controller duplicates filtering improvements
+* Memory and CPU usage optimizations in controller
+
+If working on next-generation RTOS and Bluetooth protocol stack
+sounds exciting to you, get in touch, by sending a mail to the Apache Mynewt
+Developer's list, dev@mynewt.apache.org.
diff --git a/libraries/NimBLE-Arduino/src/console/console.h b/libraries/NimBLE-Arduino/src/console/console.h
new file mode 100644
index 00000000..96f96515
--- /dev/null
+++ b/libraries/NimBLE-Arduino/src/console/console.h
@@ -0,0 +1,21 @@
+// Copyright 2019 Espressif Systems (Shanghai) PTE LTD
+//
+//Licensed under the Apache License, Version 2.0 (the "License");
+//you may not use this file except in compliance with the License.
+//You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+//Unless required by applicable law or agreed to in writing, software
+//distributed under the License is distributed on an "AS IS" BASIS,
+//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//See the License for the specific language governing permissions and
+//limitations under the License.
+#ifndef _CONSOLE_H
+#define _CONSOLE_H
+
+#include
+
+#define console_printf printf
+
+#endif
diff --git a/libraries/NimBLE-Arduino/src/nimble/esp_port/esp-hci/src/esp_nimble_hci.c b/libraries/NimBLE-Arduino/src/esp-hci/src/esp_nimble_hci.c
similarity index 92%
rename from libraries/NimBLE-Arduino/src/nimble/esp_port/esp-hci/src/esp_nimble_hci.c
rename to libraries/NimBLE-Arduino/src/esp-hci/src/esp_nimble_hci.c
index 8ae48a9c..2963e15b 100644
--- a/libraries/NimBLE-Arduino/src/nimble/esp_port/esp-hci/src/esp_nimble_hci.c
+++ b/libraries/NimBLE-Arduino/src/esp-hci/src/esp_nimble_hci.c
@@ -1,22 +1,35 @@
/*
- * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
+ * Copyright 2019 Espressif Systems (Shanghai) PTE LTD
*
- * SPDX-License-Identifier: Apache-2.0
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-#ifdef ESP_PLATFORM
-
#include
-#include "nimble/porting/nimble/include/sysinit/sysinit.h"
-#include "nimble/nimble/include/nimble/hci_common.h"
-#include "nimble/nimble/host/include/host/ble_hs.h"
-#include "nimble/porting/nimble/include/nimble/nimble_port.h"
-#include "nimble/porting/npl/freertos/include/nimble/nimble_port_freertos.h"
-#include "../include/esp_nimble_hci.h"
-#include "../../port/include/esp_nimble_mem.h"
-#include
-#include
-#include "../include/esp_compiler.h"
+#include "sysinit/sysinit.h"
+#include "nimble/hci_common.h"
+#include "host/ble_hs.h"
+#include "nimble/nimble_port.h"
+#include "nimble/nimble_port_freertos.h"
+#include "esp_nimble_hci.h"
+#include "esp_nimble_mem.h"
+#include "esp_bt.h"
+#include "freertos/semphr.h"
+#include "esp_compiler.h"
/* IPC is used to improve performance when calls come from a processor not running the NimBLE stack */
/* but does not exist for solo */
#ifndef CONFIG_FREERTOS_UNICORE
@@ -97,7 +110,7 @@ int ble_hci_trans_hs_cmd_tx(uint8_t *cmd)
if (xSemaphoreTake(vhci_send_sem, NIMBLE_VHCI_TIMEOUT_MS / portTICK_PERIOD_MS) == pdTRUE) {
/* esp_ipc_call_blocking does not exist for solo */
#ifndef CONFIG_FREERTOS_UNICORE
- if (xPortGetCoreID() != CONFIG_BT_NIMBLE_PINNED_TO_CORE && !xPortInIsrContext()) {
+ if (xPortGetCoreID() != CONFIG_BT_NIMBLE_PINNED_TO_CORE) {
esp_ipc_call_blocking(CONFIG_BT_NIMBLE_PINNED_TO_CORE,
ble_hci_trans_hs_cmd_tx_on_core, cmd);
} else {
@@ -138,9 +151,7 @@ int ble_hci_trans_hs_acl_tx(struct os_mbuf *om)
{
uint16_t len = 0;
uint8_t data[MYNEWT_VAL(BLE_ACL_BUF_SIZE) + 3], rc = 0;
-#ifndef CONFIG_FREERTOS_UNICORE
bool tx_using_nimble_core = 0;
-#endif
/* If this packet is zero length, just free it */
if (OS_MBUF_PKTLEN(om) == 0) {
os_mbuf_free_chain(om);
@@ -155,7 +166,7 @@ int ble_hci_trans_hs_acl_tx(struct os_mbuf *om)
/* Don't check core ID if unicore */
#ifndef CONFIG_FREERTOS_UNICORE
tx_using_nimble_core = xPortGetCoreID() != CONFIG_BT_NIMBLE_PINNED_TO_CORE;
- if (tx_using_nimble_core && !xPortInIsrContext()) {
+ if (tx_using_nimble_core) {
data[0] = len;
data[1] = (len >> 8);
data[2] = BLE_HCI_UART_H4_ACL;
@@ -172,7 +183,7 @@ int ble_hci_trans_hs_acl_tx(struct os_mbuf *om)
if (xSemaphoreTake(vhci_send_sem, NIMBLE_VHCI_TIMEOUT_MS / portTICK_PERIOD_MS) == pdTRUE) {
/* esp_ipc_call_blocking does not exist for solo */
#ifndef CONFIG_FREERTOS_UNICORE
- if (tx_using_nimble_core && !xPortInIsrContext()) {
+ if (tx_using_nimble_core) {
esp_ipc_call_blocking(CONFIG_BT_NIMBLE_PINNED_TO_CORE,
ble_hci_trans_hs_acl_tx_on_core, data);
} else {
@@ -520,6 +531,7 @@ esp_err_t esp_nimble_hci_and_controller_init(void)
if ((ret = esp_bt_controller_enable(ESP_BT_MODE_BLE)) != ESP_OK) {
return ret;
}
+
return esp_nimble_hci_init();
}
@@ -581,5 +593,3 @@ esp_err_t esp_nimble_hci_and_controller_deinit(void)
return ESP_OK;
}
-
-#endif
diff --git a/libraries/NimBLE-Arduino/src/esp_compiler.h b/libraries/NimBLE-Arduino/src/esp_compiler.h
new file mode 100644
index 00000000..94ec29c2
--- /dev/null
+++ b/libraries/NimBLE-Arduino/src/esp_compiler.h
@@ -0,0 +1,33 @@
+// Copyright 2016-2019 Espressif Systems (Shanghai) PTE LTD
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+#ifndef __ESP_COMPILER_H
+#define __ESP_COMPILER_H
+
+/*
+ * The likely and unlikely macro pairs:
+ * These macros are useful to place when application
+ * knows the majority ocurrence of a decision paths,
+ * placing one of these macros can hint the compiler
+ * to reorder instructions producing more optimized
+ * code.
+ */
+#if (CONFIG_COMPILER_OPTIMIZATION_PERF)
+#define likely(x) __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else
+#define likely(x) (x)
+#define unlikely(x) (x)
+#endif
+
+#endif
\ No newline at end of file
diff --git a/libraries/NimBLE-Arduino/src/nimble/esp_port/port/include/esp_nimble_cfg.h b/libraries/NimBLE-Arduino/src/esp_nimble_cfg.h
similarity index 93%
rename from libraries/NimBLE-Arduino/src/nimble/esp_port/port/include/esp_nimble_cfg.h
rename to libraries/NimBLE-Arduino/src/esp_nimble_cfg.h
index fb00ae11..2cebffc8 100644
--- a/libraries/NimBLE-Arduino/src/nimble/esp_port/port/include/esp_nimble_cfg.h
+++ b/libraries/NimBLE-Arduino/src/esp_nimble_cfg.h
@@ -922,10 +922,6 @@
#define MYNEWT_VAL_BLE_MESH_LPN_GROUPS (10)
#endif
-#ifndef MYNEWT_VAL_BLE_MESH_LPN_SUB_ALL_NODES_ADDR
-#define MYNEWT_VAL_BLE_MESH_LPN_SUB_ALL_NODES_ADDR (1)
-#endif
-
#ifndef MYNEWT_VAL_BLE_MESH_LPN_INIT_POLL_TIMEOUT
#define MYNEWT_VAL_BLE_MESH_LPN_INIT_POLL_TIMEOUT (MYNEWT_VAL_BLE_MESH_LPN_POLL_TIMEOUT)
#endif
@@ -1047,10 +1043,6 @@
#endif
#endif
-#ifndef MYNEWT_VAL_BLE_MESH_CDB
-#define MYNEWT_VAL_BLE_MESH_CDB (0)
-#endif
-
#ifndef MYNEWT_VAL_BLE_MESH_PROV_LOG_LVL
#define MYNEWT_VAL_BLE_MESH_PROV_LOG_LVL (1)
#endif
@@ -1096,14 +1088,6 @@
#define MYNEWT_VAL_BLE_MESH_RX_SDU_MAX (72)
#endif
-#ifndef MYNEWT_VAL_BLE_MESH_SEG_BUFS
-#define MYNEWT_VAL_BLE_MESH_SEG_BUFS (72)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_RX_SEG_MAX
-#define MYNEWT_VAL_BLE_MESH_RX_SEG_MAX (3)
-#endif
-
#ifndef MYNEWT_VAL_BLE_MESH_RX_SEG_MSG_COUNT
#define MYNEWT_VAL_BLE_MESH_RX_SEG_MSG_COUNT (2)
#endif
@@ -1116,63 +1100,6 @@
#define MYNEWT_VAL_BLE_MESH_SEQ_STORE_RATE (128)
#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_TX_SEG_RETRANS_COUNT
-#define MYNEWT_VAL_BLE_MESH_TX_SEG_RETRANS_COUNT (4)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST
-#define MYNEWT_VAL_BLE_MESH_TX_SEG_RETRANS_TIMEOUT_UNICAST (400)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP
-#define MYNEWT_VAL_BLE_MESH_TX_SEG_RETRANS_TIMEOUT_GROUP (50)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_LOOPBACK_BUFS
-#define MYNEWT_VAL_BLE_MESH_LOOPBACK_BUFS (3)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_DEFAULT_TTL
-#define MYNEWT_VAL_BLE_MESH_DEFAULT_TTL (7)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_NETWORK_TRANSMIT_COUNT
-#define MYNEWT_VAL_BLE_MESH_NETWORK_TRANSMIT_COUNT (2)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_NETWORK_TRANSMIT_INTERVAL
-#define MYNEWT_VAL_BLE_MESH_NETWORK_TRANSMIT_INTERVAL (20)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_RELAY_RETRANSMIT_COUNT
-#define MYNEWT_VAL_BLE_MESH_RELAY_RETRANSMIT_COUNT (2)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_PB_ADV_RETRANS_TIMEOUT
-#define MYNEWT_VAL_BLE_MESH_PB_ADV_RETRANS_TIMEOUT (500)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_RELAY_ENABLED
-#define MYNEWT_VAL_BLE_MESH_RELAY_ENABLED (1)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_GATT_PROXY_ENABLED
-#define MYNEWT_VAL_BLE_MESH_GATT_PROXY_ENABLED (1)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_FRIEND_ENABLED
-#define MYNEWT_VAL_BLE_MESH_FRIEND_ENABLED (1)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_BEACON_ENABLED
-#define MYNEWT_VAL_BLE_MESH_BEACON_ENABLED (1)
-#endif
-
-#ifndef MYNEWT_VAL_BLE_MESH_RELAY_RETRANSMIT_INTERVAL
-#define MYNEWT_VAL_BLE_MESH_RELAY_RETRANSMIT_INTERVAL (20)
-#endif
-
/* Overridden by apps/blemesh (defined by @apache-mynewt-nimble/nimble/host/mesh) */
#ifndef MYNEWT_VAL_BLE_MESH_SETTINGS
#define MYNEWT_VAL_BLE_MESH_SETTINGS (0)
@@ -1231,10 +1158,6 @@
#define MYNEWT_VAL_BLE_MESH_TX_SEG_MSG_COUNT (4)
#endif
-#ifndef MYNEWT_VAL_BLE_MESH_UNPROV_BEACON_INT
-#define MYNEWT_VAL_BLE_MESH_UNPROV_BEACON_INT (5)
-#endif
-
/*** @apache-mynewt-nimble/nimble/host/services/ans */
#ifndef MYNEWT_VAL_BLE_SVC_ANS_NEW_ALERT_CAT
#define MYNEWT_VAL_BLE_SVC_ANS_NEW_ALERT_CAT (0)
@@ -1447,28 +1370,8 @@
#define MYNEWT_VAL_BLE_HCI_UART_STOP_BITS (1)
#endif
-#ifndef CONFIG_BLE_TX_CCA_ENABLED
-#define MYNEWT_VAL_BLE_TX_CCA_ENABLED (0)
-#else
-#define MYNEWT_VAL_BLE_TX_CCA_ENABLED (CONFIG_BLE_TX_CCA_ENABLED)
-#endif
-
-#ifndef CONFIG_BLE_CCA_RSSI_THRESH
-#define MYNEWT_VAL_BLE_CCA_RSSI_THRESH (50)
-#else
-#define MYNEWT_VAL_BLE_CCA_RSSI_THRESH (CONFIG_BLE_CCA_RSSI_THRESH)
-#endif
-
#ifndef MYNEWT_VAL_NEWT_FEATURE_LOGCFG
#define MYNEWT_VAL_NEWT_FEATURE_LOGCFG (1)
#endif
-#ifndef MYNEWT_VAL_BLE_USE_ESP_TIMER
-#ifdef CONFIG_BT_NIMBLE_USE_ESP_TIMER
-#define MYNEWT_VAL_BLE_USE_ESP_TIMER (1)
-#else
-#define MYNEWT_VAL_BLE_USE_ESP_TIMER (0)
-#endif
-#endif
-
#endif
diff --git a/libraries/NimBLE-Arduino/src/nimble/esp_port/esp-hci/include/esp_nimble_hci.h b/libraries/NimBLE-Arduino/src/esp_nimble_hci.h
similarity index 80%
rename from libraries/NimBLE-Arduino/src/nimble/esp_port/esp-hci/include/esp_nimble_hci.h
rename to libraries/NimBLE-Arduino/src/esp_nimble_hci.h
index 5d98edf5..e10436f3 100644
--- a/libraries/NimBLE-Arduino/src/nimble/esp_port/esp-hci/include/esp_nimble_hci.h
+++ b/libraries/NimBLE-Arduino/src/esp_nimble_hci.h
@@ -1,14 +1,28 @@
/*
- * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
- *
- * SPDX-License-Identifier: Apache-2.0
+ * Copyright 2019 Espressif Systems (Shanghai) PTE LTD
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-#ifdef ESP_PLATFORM
#ifndef __ESP_NIMBLE_HCI_H__
#define __ESP_NIMBLE_HCI_H__
-#include "nimble/nimble/include/nimble/ble_hci_trans.h"
+#include "nimble/ble_hci_trans.h"
#ifdef __cplusplus
extern "C" {
@@ -122,4 +136,3 @@ esp_err_t esp_nimble_hci_and_controller_deinit(void);
#endif
#endif /* __ESP_NIMBLE_HCI_H__ */
-#endif
diff --git a/libraries/NimBLE-Arduino/src/esp_nimble_mem.h b/libraries/NimBLE-Arduino/src/esp_nimble_mem.h
new file mode 100644
index 00000000..90e52a20
--- /dev/null
+++ b/libraries/NimBLE-Arduino/src/esp_nimble_mem.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2020 Espressif Systems (Shanghai) PTE LTD
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef __ESP_NIMBLE_MEM_H__
+#define __ESP_NIMBLE_MEM_H__
+
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *nimble_platform_mem_malloc(size_t size);
+void *nimble_platform_mem_calloc(size_t n, size_t size);
+void nimble_platform_mem_free(void *ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ESP_NIMBLE_MEM_H__ */
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/AUTHORS b/libraries/NimBLE-Arduino/src/ext/tinycrypt/AUTHORS
similarity index 100%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/AUTHORS
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/AUTHORS
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/LICENSE b/libraries/NimBLE-Arduino/src/ext/tinycrypt/LICENSE
similarity index 100%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/LICENSE
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/LICENSE
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/README b/libraries/NimBLE-Arduino/src/ext/tinycrypt/README
similarity index 100%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/README
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/README
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/VERSION b/libraries/NimBLE-Arduino/src/ext/tinycrypt/VERSION
similarity index 100%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/VERSION
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/VERSION
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/documentation/tinycrypt.rst b/libraries/NimBLE-Arduino/src/ext/tinycrypt/documentation/tinycrypt.rst
similarity index 100%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/documentation/tinycrypt.rst
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/documentation/tinycrypt.rst
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/aes_decrypt.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/aes_decrypt.c
similarity index 98%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/aes_decrypt.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/aes_decrypt.c
index 0bab6e28..993a6180 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/aes_decrypt.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/aes_decrypt.c
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/aes.h"
-#include "../include/tinycrypt/constants.h"
-#include "../include/tinycrypt/utils.h"
+#include
+#include
+#include
static const uint8_t inv_sbox[256] = {
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/aes_encrypt.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/aes_encrypt.c
similarity index 98%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/aes_encrypt.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/aes_encrypt.c
index bdc434bc..8991aee5 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/aes_encrypt.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/aes_encrypt.c
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/aes.h"
-#include "../include/tinycrypt/utils.h"
-#include "../include/tinycrypt/constants.h"
+#include
+#include
+#include
static const uint8_t sbox[256] = {
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/cbc_mode.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/cbc_mode.c
similarity index 96%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/cbc_mode.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/cbc_mode.c
index b743878a..62d7879e 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/cbc_mode.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/cbc_mode.c
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/cbc_mode.h"
-#include "../include/tinycrypt/constants.h"
-#include "../include/tinycrypt/utils.h"
+#include
+#include
+#include
int tc_cbc_mode_encrypt(uint8_t *out, unsigned int outlen, const uint8_t *in,
unsigned int inlen, const uint8_t *iv,
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ccm_mode.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ccm_mode.c
similarity index 98%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ccm_mode.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ccm_mode.c
index 59853125..929adac6 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ccm_mode.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ccm_mode.c
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/ccm_mode.h"
-#include "../include/tinycrypt/constants.h"
-#include "../include/tinycrypt/utils.h"
+#include
+#include
+#include
#include
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/cmac_mode.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/cmac_mode.c
similarity index 97%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/cmac_mode.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/cmac_mode.c
index dff28cf0..96d147e8 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/cmac_mode.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/cmac_mode.c
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/aes.h"
-#include "../include/tinycrypt/cmac_mode.h"
-#include "../include/tinycrypt/constants.h"
-#include "../include/tinycrypt/utils.h"
+#include
+#include
+#include
+#include
/* max number of calls until change the key (2^48).*/
const static uint64_t MAX_CALLS = ((uint64_t)1 << 48);
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ctr_mode.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ctr_mode.c
similarity index 95%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ctr_mode.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ctr_mode.c
index 6653afc5..1dfb92df 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ctr_mode.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ctr_mode.c
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/constants.h"
-#include "../include/tinycrypt/ctr_mode.h"
-#include "../include/tinycrypt/utils.h"
+#include
+#include
+#include
int tc_ctr_mode(uint8_t *out, unsigned int outlen, const uint8_t *in,
unsigned int inlen, uint8_t *ctr, const TCAesKeySched_t sched)
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ctr_prng.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ctr_prng.c
similarity index 98%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ctr_prng.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ctr_prng.c
index f908932e..cac2cc41 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ctr_prng.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ctr_prng.c
@@ -27,9 +27,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/ctr_prng.h"
-#include "../include/tinycrypt/utils.h"
-#include "../include/tinycrypt/constants.h"
+#include
+#include
+#include
#include
/*
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc.c
similarity index 99%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc.c
index e7fce278..46080bf6 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc.c
@@ -52,8 +52,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/ecc.h"
-#include "../include/tinycrypt/ecc_platform_specific.h"
+#include
+#include
#include
/* IMPORTANT: Make sure a cryptographically-secure PRNG is set and the platform
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc_dh.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc_dh.c
similarity index 98%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc_dh.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc_dh.c
index 5cd6a2e2..e5257d2d 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc_dh.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc_dh.c
@@ -54,9 +54,9 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/constants.h"
-#include "../include/tinycrypt/ecc.h"
-#include "../include/tinycrypt/ecc_dh.h"
+#include
+#include
+#include
#include
#if default_RNG_defined
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc_dsa.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc_dsa.c
similarity index 98%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc_dsa.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc_dsa.c
index 31046c86..064dfe5a 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc_dsa.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc_dsa.c
@@ -53,9 +53,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/constants.h"
-#include "../include/tinycrypt/ecc.h"
-#include "../include/tinycrypt/ecc_dsa.h"
+#include
+#include
+#include
#if default_RNG_defined
static uECC_RNG_Function g_rng_function = &default_CSPRNG;
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc_platform_specific.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc_platform_specific.c
similarity index 100%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/ecc_platform_specific.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/ecc_platform_specific.c
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/hmac.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/hmac.c
similarity index 97%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/hmac.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/hmac.c
index c86fd35a..89878cec 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/hmac.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/hmac.c
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/hmac.h"
-#include "../include/tinycrypt/constants.h"
-#include "../include/tinycrypt/utils.h"
+#include
+#include
+#include
static void rekey(uint8_t *key, const uint8_t *new_key, unsigned int key_size)
{
diff --git a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/hmac_prng.c b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/hmac_prng.c
similarity index 97%
rename from libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/hmac_prng.c
rename to libraries/NimBLE-Arduino/src/ext/tinycrypt/src/hmac_prng.c
index a41ea43d..68b5b1fa 100644
--- a/libraries/NimBLE-Arduino/src/nimble/ext/tinycrypt/src/hmac_prng.c
+++ b/libraries/NimBLE-Arduino/src/ext/tinycrypt/src/hmac_prng.c
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "../include/tinycrypt/hmac_prng.h"
-#include "../include/tinycrypt/hmac.h"
-#include "../include/tinycrypt/constants.h"
-#include "../include/tinycrypt/utils.h"
+#include
+#include