diff --git a/docs/BREAKING_API_CHANGES.md b/docs/BREAKING_API_CHANGES.md index bec4bf1..cfbe929 100644 --- a/docs/BREAKING_API_CHANGES.md +++ b/docs/BREAKING_API_CHANGES.md @@ -99,15 +99,17 @@ This can be changed to use passkey authentication or numeric comparison. See [Se The `NimBLEAdvertisedDeviceCallbacks::onResult()` method now receives a pointer to the `NimBLEAdvertisedDevice` object instead of a copy. -`NimBLEClient::connect()` now takes an extra parameter to indicate if the client should download the services - database from the peripheral, default value is true. - +`NimBLEClient::connect()` Has had it's parameters altered. Defined as: +> NimBLEClient::connect(bool refreshServices = true); > NimBLEClient::connect(NimBLEAdvertisedDevice\* device, bool refreshServices = true); -> NimBLEClient::connect(NimBLEAddress address, uint8_t type = BLE_ADDR_PUBLIC, bool refreshServices = true); +> NimBLEClient::connect(NimBLEAddress address, bool refreshServices = true); +
-If set to false the client will use the services database it retrieved from the peripheral last time it connected. -This allows for faster connections and power saving if the devices just dropped connection and want to reconnect. +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.
> NimBLERemoteCharacteristic::writeValue(); @@ -117,6 +119,7 @@ Now return true or false to indicate success or failure so you can choose to dis
> NimBLERemoteCharacteristic::registerForNotify(); + Is now **deprecated**. > NimBLERemoteCharacteristic::subscribe() > NimBLERemoteCharacteristic::unsubscribe() @@ -129,7 +132,7 @@ Are the new methods added to replace it. > NimBLERemoteCharacteristic::readUInt32() > NimBLERemoteCharacteristic::readFloat() -Are **deprecated** and NimBLERemoteCharacteristic::readValue(time_t\*, bool) template added to replace them. +Are **deprecated** and NimBLERemoteCharacteristic::readValue(time_t\*, bool) template added to replace them.
> NimBLERemoteService::getCharacteristicsByHandle() @@ -152,8 +155,9 @@ uint8_t *val = (uint8_t*)pChr->readValue().data(); > NimBLERemoteService::getCharacteristics(bool refresh = false) These methods now take an optional (bool) parameter and return a pointer to `std::vector` instead of `std::map`. -If passed true it will clear the respective vector and retrieve all the respective attributes from the peripheral. -If false(default) it will return the respective vector with the currently stored attributes. +If passed true it will clear the respective vector and retrieve **all** the respective attributes from the peripheral. +If false(default) it will return the respective vector with the currently stored attributes. +
**Removed:** the automatic discovery of all peripheral attributes as they consumed time and resources for data the user may not be interested in. @@ -177,6 +181,17 @@ The client will automatically initiate security when the peripheral responds tha The default configuration will use "just-works" pairing with no bonding, if you wish to enable bonding see below.
+# General Differences +`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. + +Defined as: +> NimBLEAddress(ble_addr_t address); +> NimBLEAddress(uint8_t address[6], uint8_t type = BLE_ADDR_PUBLIC); +> NimBLEAddress(const std::string &stringAddress, uint8_t type = BLE_ADDR_PUBLIC); +> NimBLEAddress(const uint64_t &address, uint8_t type = BLE_ADDR_PUBLIC); +
+ # Security Differences Security callback functions are now incorporated in the NimBLEServerCallbacks / NimBLEClientCallbacks classes. However backward compatibility with the original `BLESecurity` class is retained to minimize app code changes. diff --git a/docs/Improvements_and_updates.md b/docs/Improvements_and_updates.md index e7f3e48..702a30f 100644 --- a/docs/Improvements_and_updates.md +++ b/docs/Improvements_and_updates.md @@ -45,16 +45,12 @@ A new method `NimBLEServer::advertiseOnDisconnect(bool)` has been implemented to `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`.
-New characteristic read/write callbacks added to NimBLECharacteristicCallbacks that receive a pointer to the connection -description of the client reading/writing. -This is useful when connected to multiple clients to discern which client is performing the operation. -
- # Client NimBLERemoteCharacteristic::readValue(time_t\*, bool) @@ -91,6 +87,9 @@ NimBLEClient::getService will now retrieve only the service specified and not th otherwise wasted retrieving and allocating attributes the user application is not interested in.
+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. diff --git a/src/NimBLEClient.cpp b/src/NimBLEClient.cpp index e65ced9..4bb486e 100644 --- a/src/NimBLEClient.cpp +++ b/src/NimBLEClient.cpp @@ -152,7 +152,6 @@ bool NimBLEClient::connect(NimBLEAdvertisedDevice* device, bool deleteAttibutes) /** * @brief Connect to the BLE Server. * @param [in] address The address of the server. - * @param [in] type The address type of the server (Random/public/other) * @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. diff --git a/src/NimBLEScan.cpp b/src/NimBLEScan.cpp index 9020dda..dc82de5 100644 --- a/src/NimBLEScan.cpp +++ b/src/NimBLEScan.cpp @@ -161,7 +161,7 @@ void NimBLEScan::setActiveScan(bool active) { /** * @brief Set whether or not the BLE controller should only report results * from devices it has not already seen. - * @param [in] active If true, scanned devices will only be reported once. + * @param [in] enabled If true, scanned devices will only be reported once. * @details The controller has a limited buffer and will start reporting * dupicate devices once the limit is reached. */ @@ -173,7 +173,7 @@ void NimBLEScan::setDuplicateFilter(bool enabled) { /** * @brief Set whether or not the BLE controller only report scan results * from devices advertising in limited discovery mode, i.e. directed advertising. - * @param [in] active If true, only limited discovery devices will be in scan results. + * @param [in] enabled If true, only limited discovery devices will be in scan results. */ void NimBLEScan::setLimitedOnly(bool enabled) { m_scan_params.limited = enabled; diff --git a/src/NimBLEServer.cpp b/src/NimBLEServer.cpp index a39fdd6..f4ce6ac 100644 --- a/src/NimBLEServer.cpp +++ b/src/NimBLEServer.cpp @@ -534,11 +534,9 @@ void NimBLEServer::removeService(NimBLEService* service, bool deleteSvc) { /** * @brief Adds a service which was already created, but removed from availability. - * + * @param [in] service The service object to add. * @note If it is desired to advertise the service it must be added by * calling NimBLEAdvertising::addServiceUUID. - * - * @param [in} service The service object to add. */ void NimBLEServer::addService(NimBLEService* service) { // If adding a service that was not removed just return. diff --git a/src/NimBLEUUID.cpp b/src/NimBLEUUID.cpp index f008e20..1b00a32 100644 --- a/src/NimBLEUUID.cpp +++ b/src/NimBLEUUID.cpp @@ -179,7 +179,7 @@ bool NimBLEUUID::equals(const NimBLEUUID &uuid) const { * Create a NimBLEUUID from a string of the form: * 0xNNNN * 0xNNNNNNNN - * 0x + * 0x * NNNN * NNNNNNNN *