Remove automatic discovery in NimBLEClient::connect().

Instead of discovering the peripheral database on connection and consuming
the associated resources this will give the user more control over the
discovery operation.

* Adds void NimBLEClient::discoverAtrributes() for the user to discover all
the peripheral attributes as a replacement for the former functionality.

* getServices(), getCharacteristics(), getDescriptors() now take an
optional bool parameter (default false).
If true it will clear the respective vector and retrieve all the respective
attributes from the peripheral. If false it will retrieve the attributes
only if the vector is empty, otherwise the vector is returned with the
currently stored attributes.

* getService(NimBLEUUID), getCharacteristic(NimBLEUUID), getDescriptor(NimBLEUUID)
will now check the respective vectors for the attribute object and, if not
found, will retrieve (only) the specified attribute from the peripheral.
This commit is contained in:
h2zero
2020-05-23 10:30:11 -06:00
parent 10e50a8791
commit c5c9423893
9 changed files with 368 additions and 254 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ static const char* LOG_TAG = "NimBLERemoteDescriptor";
* @param [in] Reference to the struct that contains the descriptor information.
*/
NimBLERemoteDescriptor::NimBLERemoteDescriptor(NimBLERemoteCharacteristic* pRemoteCharacteristic,
const struct ble_gatt_dsc *dsc)
const struct ble_gatt_dsc *dsc)
{
switch (dsc->uuid.u.type) {
case BLE_UUID_TYPE_16: