- This changes NimBLERemoteCharacteristic::subscribe and NimBLERemoteCharacteristic::registerForNotify functionality
such that the notification callback will always be set.
Additionally these methods will always return true unless the descriptor write fails.
This allows for notifications to trigger the callback when a peer device sends them and does not have a CCCD.
Also it should not be flagged as a failure if the CCCD does not exist.
It should only be flagged when an acutal write operation fails.
* Fix for random notify crash in ISR context
Tested for stability over 30 minutes with a daisy chain of 3 esp32
Co-authored-by: h2zero <powellperalta@gmail.com>
* Adds functionality to advertise for a set duration, similar to NimBLEScan::start.
The first parameter being the duration (in seconds).
The second parameter is a pointer to a callback function that is invoked when advertising stops.
* NimBLEAdvertising::isAdvertising method added, returns true if advertising is currently active.
* These methods were noop's and are now removed due to lack of usefulness and advertisment space consumed if used.
Applications can still manually set these values if desired using NimBLEAdvertisementData::addData.
* The type is available in the NimBLEAddress parameter, no longer needed separately.
Co-authored-by: wakwak-koba <wakwak-koba@users.noreply.github.com>
* Add clearAll parameter to deinit()
Adds the ability to clear all resources consumed during BLE operation when deinitializing and shutting down BLE.
Useful when BLE is used intermittently or in a task that initializes, performs operations then deinitializes.
By setting the clearAll parameter to true all created BLE objects will be deleted, freeing the memory for other tasks.
Warning: This will invalidate any pointers that may be referencing the deleted objects.
* Add bool deleteCallbacks parameter to NimBLEServer::setCallbacks, if true (default) will delete the callback class when server is destructed.
* Delete scan results when scan is destructed.
* Add support for getting multiple services data from advertisments.
* Adds new methods for getting advertised service data and UUIDS.
- getServiceData(index), gets the service data by index value.
- getServiceData(NimBLEUUID), gets the service data by UUID.
- getServiceDataCount(), gets the number of services with data advertised.
* Templates added for getServiceData(index) and getServiceData(NimBLEUUID)
to be able to specify the data type returned by these methods
Example:
getServiceData<uint32_t>(NimBLEUUID("ABCD");
* Also added:
- getServiceUUID(index), gets the advertised service UUID by index value.
- getServiceUUIDCount(), gets the number of advertised services.