* Make NimBLEConnInfo functions const.
* Update callback functions and update client to use new functions.
* Update examples.
* Update migration guide.
---------
Co-authored-by: Casey Smith <csmith@morningstarcorp.com>
* Adds NimBLEClient::setConnection to allow servers to read the name of connected clients by passing their connection info to the Client class.
* Adds NimBLEClient::clearConnection to be able to reuse the client without deleting and recreating.
Updates the interface to use a typedef'd std::function for the advertise callback, which is backwards compatible but also allows std::bind and lambda functions.
IDF 5.2 introduced a new member, cpfd, to the
ble_gatt_chr_def struct. It needs to be initialized
to nullptr in order to avoid accessing uninitialized
memory. By initializing the whole struct, we get
everything initialized in a backward-compatible way.
* fix warning: variable 'pkey' set but not used [-Wunused-but-set-variable]
---------
Co-authored-by: Franz Höpfinger <f.hoepfinger@hr-agrartechnik.de>
Somehow, the conn_handle can have the value of `0xffff`. Not sure why or how, but anyway it should be managed before moving forward on NimBLECharacteristic::handleGapEvent. Otherwise, an unhandled exception will occur on `assert(rc == 0);`
If a service has been created and started but not yet added to the gatt server then the call to getHandle will result in an invalid handle. This adds a call to set the handle value in the getHandle function.
This adds a callback that is called when a device is initially discovered.
It is always called wether scanning in passive or active mode. This allows
for active scanning to receive device detection information in the case where
the scan response is not sent/received.
This callback is optional, the application may decide to implement it or not.
Adds an index parameter to NimBLEAdvertisedDevice::getManufacturerData to allow for selecting from multiple instances in the advertisements.
Adds NimBLEAdvertisedDevice::getManufacturerDataCount to get the number of manufacturer data sets present in the advertised data.
If pairing is requested before performing an action on a protected attribute pairing could fail due to already being in progress.
This fix will wait for the result of the pairing process before proceeding with the action.
This replaces NimBLEAdvertisedDeviceCallbacks with NimBLEScanCallbacks and adds a onScanEnd callback.
The callback parameter for NimBLEScan::start has been removed and the blocking overload for NimBLEScan::start
has been replaced by an overload of NimBLEScan::getResults with the same parameters.
Change the callback functions that receive a ble_gap_conn_desc pointer to instead receive a NimBLEConnInfo reference.
* Add a reason parameter to the server disconnect callback.
* Remove connect and disconnect callback that do not receive info parameters.
* Remove onRead and onWrite Characteristic callbacks that do not receive info parameters.
* Add info parameter to Descriptor onWrite and onRead callbacks.
* Add details to migration guide.
Removes the unnecessary NimBLECharacteristicCallbacks::Status enum and callback parameter from NimBLECharacteristic::onStatus.
This was maintained for compatibility with the Arduino BLE library and is not necessary as the return code from the stack is also provided.
* Update examples/docs.
Removes the response parameter from remote characterisitc subscrible/unsubscribe functions
as a response is always required for this operation as per BLE specs.
Removes the deprecated functions from remote characteristic/desriptor.
* Update examples/docs.
Changes all functions that accept a time parameter to use milliseconds instead of seconds.
* Adds duration input to NimBLEDevice::startAdvertising and NimBLEServer::startAdvertising.
As per Bluetooth core specification we must write to 0x2902 descriptors with response request.
This change ensures the correct procedure is used.
Todo: Remove the "response" parameter from related functions.