From 0c22666e519f7e551de027a2f71bab6da3b941c8 Mon Sep 17 00:00:00 2001 From: h2zero Date: Sat, 7 Dec 2024 10:45:06 -0700 Subject: [PATCH] Remove improvements and updates. Removed as the changelog contians the notes and the class info has the details. --- docs/Improvements_and_updates.md | 149 ------------------------------- docs/Migration_guide.md | 2 +- docs/index.md | 4 +- 3 files changed, 2 insertions(+), 153 deletions(-) delete mode 100644 docs/Improvements_and_updates.md diff --git a/docs/Improvements_and_updates.md b/docs/Improvements_and_updates.md deleted file mode 100644 index a7504d5f..00000000 --- a/docs/Improvements_and_updates.md +++ /dev/null @@ -1,149 +0,0 @@ -# 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. - -* [Server](#server) -* [Advertising](#advertising) -* [Client](#client) -* [General](#general) -
- - -# 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)` - -Now use the `NimbleAttValue` class and templates to accommodate standard and custom types/values. - -**Example** -``` -struct my_struct { - uint8_t one; - uint16_t two; - uint32_t four; - uint64_t eight; - float flt; -} myStruct; - - myStruct.one = 1; - myStruct.two = 2; - myStruct.four = 4; - myStruct.eight = 8; - 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. - -`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. - -**Example** -``` - time_t timestamp; - myStruct = pCharacteristic->getValue(×tamp); // timestamp optional -``` -
- -**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. - -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 milliseconds), 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. - -Also now returns a bool value to indicate if advertising successfully started or not. -
- - -# Client - -`NimBLERemoteCharacteristic::readValue(time_t\*, bool)` -`NimBLERemoteDescriptor::readValue(bool)` - -Have been added as templates to allow reading the values as any specified type. - -**Example** -``` -struct my_struct{ - uint8_t one; - uint16_t two; - uint32_t four; - uint64_t eight; - float flt; -}myStruct; - - time_t timestamp; - myStruct = pRemoteCharacteristic->readValue(×tamp); // timestamp optional -``` -
- -`NimBLERemoteCharacteristic::registerForNotify` -Has been removed. - -`NimBLERemoteCharacteristic::subscribe` and `NimBLERemoteCharacteristic::unsubscribe` have been implemented to replace it. - -The internally stored characteristic value is now updated when notification/indication is recieved. Making a callback no longer required to get the most recent value unless timing is important. Instead, the application can call `NimBLERemoteCharacteristic::getValue` to get the most recent 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. - -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. - -> NimBLEClient::getService -> NimBLERemoteService::getCharacteristic -> 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 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()`. - - -# 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. - -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). - -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. -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) - diff --git a/docs/Migration_guide.md b/docs/Migration_guide.md index e943b2f7..8f76a7de 100644 --- a/docs/Migration_guide.md +++ b/docs/Migration_guide.md @@ -4,7 +4,7 @@ This guide describes the required changes to existing projects migrating from th **The changes listed here are only the required changes that must be made**, and a short overview of options for migrating existing applications. -For more information on the improvements and additions please refer to the [class documentation](https://h2zero.github.io/esp-nimble-cpp/annotated.html) and [Improvements and updates](Improvements_and_updates.md) +For more information on the improvements and additions please refer to the [class documentation](https://h2zero.github.io/esp-nimble-cpp/annotated.html) * [General Changes](#general-information) * [Server](#server-api) diff --git a/docs/index.md b/docs/index.md index 55764b85..094d5946 100644 --- a/docs/index.md +++ b/docs/index.md @@ -38,9 +38,7 @@ This library is intended to be compatible with the original ESP32 BLE functions If you have not used the original Bluedroid 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. +If you are familiar with the original library, see: [The migration guide](Migration_guide.md) for details. For more advanced usage see [Usage tips](Usage_tips.md) for more performance and optimization.