Commit graph

249 commits

Author SHA1 Message Date
gluhovsky
e868f37135
Add conn_handle to NimBLECharacteristic::notify to send notification/indication to a specific client (#97)
Adds the ability to send notifications/indications to specific clients individually.
2022-09-11 20:18:55 -06:00
Casey Smith
6fb26e3809
Change type of index to int (instead of uint8_t) to fix issue with adding more than 255 Characteristics (or Descriptors) (#101) 2022-09-11 19:54:15 -06:00
h2zero
6a2f558ea5 [BREAKING] Replace advertised device callbacks with scan callbacks. (#389)
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.
2022-08-27 14:04:50 -06:00
h2zero
562a32eda6 Add docs build. 2022-08-27 13:02:29 -06:00
h2zero
ba79a1bf72 [Breaking] Update callbacks to use NimBLEConnInfo.
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.
2022-08-27 13:02:29 -06:00
h2zero
ca8a7c56ac
[Breaking] Remove extra notification status from onStatus callback. (#80)
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.
2022-08-26 20:40:21 -06:00
h2zero
03b22e53a0
[Breaking] Remove deprecated functions/response parameter from un/sub (#76)
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.
2022-08-26 20:15:25 -06:00
h2zero
bfe68f4a91
[Breaking] Add disconnect reason to client callback. (#398) (#81)
Adds the reason code as a parameter to the client onDisconnect callback.

* Update examples/docs.
2022-08-26 19:51:19 -06:00
h2zero
bb3dd5f114
[Breaking] Change all time input parameters to milliseconds. (#78)
Changes all functions that accept a time parameter to use milliseconds instead of seconds.

* Adds duration input to NimBLEDevice::startAdvertising and NimBLEServer::startAdvertising.
2022-08-26 19:32:01 -06:00
h2zero
0b6337538c
Remove NimBLESecurity class. (#75) 2022-08-21 21:33:39 -06:00
Giovanni Cascione
32e7059732 add NimBLEHIDDevice::batteryLevel() 2022-08-21 21:19:54 -06:00
Cody
cd3185fe43 Added the setDeviceName functionality while BLE is running 2022-08-21 21:19:30 -06:00
h2zero
efa48c0d57 Release 1.4.0
* Fix typos

* Update docs
2022-07-31 11:34:56 -06:00
h2zero
70ed6e293f Don't set advertisement flags if not connectable. 2022-07-10 07:15:46 -06:00
h2zero
93de7ab8ed Bugfix/onRead callback not called for non-long read commands. 2022-06-26 17:03:21 -06:00
h2zero
9285a9b31f Don't call scan result callback if it was already called. 2022-06-04 14:24:30 -06:00
h2zero
a36655c105 Add success/fail return value to disoverAttributes. 2022-04-16 20:32:01 -06:00
h2zero
c285052f6d Use write with response when writing 0x2902 descriptors.
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.
2022-04-16 12:47:23 -06:00
h2zero
9e5db157f8
Add extended advertising support. (#72)
Adds support for advertising and connections with coded/2M PHY's.

Adds new classes `NimBLEExtAdvertising` and `NimBLEExtAdvertisement`.
When extended advertising is enabled the original advertising classes become unavailable and the new classes must be used.

Changed some return values for advertising methods for consistency with the new classes methods.
2022-04-10 10:21:45 -06:00
h2zero
58787b516b Prevent crash when characteristic vector is empty. 2022-04-02 14:22:23 -06:00
h2zero
a1428e63a6 Fixup client logs. 2022-02-20 10:04:13 -07:00
h2zero
0f4326d3fd Check characteristic handles before fetching descriptors. 2022-02-20 10:02:09 -07:00
h2zero
99a23d3c19 Remove recursive calling when fetching remote attributes. 2022-02-15 20:32:18 -07:00
h2zero
6cda761f13 Fix memory leak when deleting client instance. 2022-02-15 20:31:26 -07:00
jvrobert
288ee92d39
Added extended advertising scan support (#69) 2022-02-06 16:52:42 -07:00
h2zero
2e498cef2b Fix IDF version check. 2022-02-06 12:58:26 -07:00
h2zero
2386a8a68a Retrieve attributes with 16bit uuid if 128bit fails.
When retrieving attribute handles using the 128bit base version of a 16 bit UUID some devices will
report "not found". This will attempt to convert the UUID to the 16bit version and try again.

* Adds `to16()` method to NimBLEUUID.
2022-01-18 14:48:07 -07:00
h2zero
6b858a0efd Fix memory leak when services changed. 2022-01-18 14:44:47 -07:00
h2zero
e3ee082dd7
Add NimBLEAttValue class. (#67)
This is a specialized container class to hold BLE attribute values.

- Removes the use of std::string previously used to store the values.
- Allows for setting/getting/notifying values from std::string, std::vector<uint8_t>, Arduino String, const char*, and uint8_t buffers.
- Has operators retrieve the value as std::string, Arduino String, std::vector<uint8_t>, uint8_t* or char pointers.
- Includes iterators and subscript/random access operator.
- Introduces a max length parameter to the creation of server characteristics/descriptors to limit the size of the memory footprint.
- Nearly Seamless integration with existing code.
- Adds a config option to enable/disable timestamp storage when the value is updated.
- Adds a config option to specify the initial size of the value container if not specified in the constructor.
2022-01-16 20:11:18 -07:00
h2zero
be9cdc1ab6 Update docs 2022-01-15 15:21:41 -07:00
h2zero
cf482f9112 Cleanup ARM-gcc compiler warnings. 2022-01-15 12:43:17 -07:00
h2zero
830c4cc39e Re-enable data length extension newer IDF versions. 2022-01-15 08:51:49 -07:00
Jackson Ming Hu
ea6e2101e3 Fix compilation on ESP32-S3 2022-01-14 21:46:30 -07:00
h2zero
d47cf59ba9 Cleanup compile errors in arm-gcc. 2022-01-14 20:45:24 -07:00
h2zero
ea02eb9452 Add config option for log verbosity. 2022-01-14 19:47:44 -07:00
h2zero
9824bdfe73 Update log level macro name 2022-01-14 10:02:47 -07:00
h2zero
fac16f2428 Fix long data notifications.
The notification data when received was using an incorrect length value and would cut off long values, this has now been corrected.
2022-01-13 08:57:50 -07:00
h2zero
0957d7f6ad The latest versions of IDF include a new esp_timer library that seems to be incrementing the task notification values in unexpected places depending on other tasks in operation.
This causes task blocking to fail in client operations leading to exceptions and crashing.

This is a workaround for this situation and will need to be reworked properly in the future.
2022-01-09 19:04:41 -07:00
David Lehrian
5facd89a00
Update NimBLEServer.h (#65) 2022-01-01 18:00:45 -07:00
h2zero
f2ade345f4 Fix missing data when reading large values.
The wrong length value was being used to set the values read from peer attributes.
This has been corrected to use the proper value size.
2021-12-29 14:01:37 -07:00
h2zero
7a82067177 Add last error function to client. 2021-12-29 08:12:38 -07:00
h2zero
d041a089e6 [NimBLEService] Remove unused variables/parameters. 2021-12-29 08:12:07 -07:00
h2zero
9debfcd226 Use NimBLE calls for critical sections 2021-12-29 08:10:57 -07:00
h2zero
8620092c90 Cleanup and add support for non-esp devices. 2021-12-29 08:08:25 -07:00
h2zero
96459073a4 Initialize advertising complete callback in NimBLEAdvertising constructor.
* cleanup advertising start return.
2021-12-29 07:51:57 -07:00
h2zero
a4403fe6b8 Clear client disconnect timer in constructor before initializing. 2021-12-29 07:50:42 -07:00
David Robertson
f841f030ae
Add method to send notifications/indications with custom values (#63) 2021-12-28 20:11:37 -07:00
h2zero
d793b1251e Remove data length extension in IDF (not released yet) 2021-09-13 20:45:36 -06:00
Author: Mr-Mime
5925782a65 [Server][Client] Add function to set data length.
Enables the use of BLE data length extension to improve data transfer rates.
2021-09-12 19:11:38 -06:00
h2zero
ccea428b9e Refactor include directives to use different paths for arduino/idf.
* Sets macros to allow compiling when Central role is enabled and Observer disabled, or Peripheral enabled and Broadcaster disabled.

* Adds a macro definition for CONFIG_NIMBLE_CPP_IDF to enable different include paths/functionality for IDF / Arduino.
2021-09-12 18:43:31 -06:00
h2zero
b24597ac56 Remove definition of btInUse().
This reverts a previous change @2e1d78ff that caused compiling/linking errors due to the redefinition of btInUse() when another linked library uses the Arduino bluetooth code.
2021-08-03 12:43:34 -06:00
h2zero
e5edc9d59e Add missing return documentation in NimBLEAdvertising. 2021-08-02 19:51:04 -06:00
h2zero
2e1d78ff78 Code cleanup 2021-08-02 13:29:19 -06:00
h2zero
6be6a111d0
[Server] Implement remove Characteristics/Descriptors. (#54)
This allows for adding and removing of characteristics and descriptors after initial setup of the server.
When used it will send a service changed notification to all clients.
The changes will not take effect until all clients have disconnected and advertising restarted.
2021-07-30 20:56:52 -06:00
h2zero
0a2714c169
[Server] Add callback for MTU change. (#55)
onMTUChange callback added that is called when a connection MTU is updated.
2021-07-19 21:47:59 -06:00
h2zero
7d01fa595d
Fix compilation for ESP32C3. (#53) 2021-07-19 21:46:30 -06:00
h2zero
09adf86036 Remove FreeRTOS files. 2021-07-12 10:25:32 -06:00
h2zero
d3a0f95aaf Add whitelist API.
This adds the functions:
- bool NimBLEDevice::whiteListAdd(const NimBLEAddress & address);
- bool NimBLEDevice::whiteListRemove(const NimBLEAddress & address);
- bool NimBLEDevice::onWhiteList(const NimBLEAddress & address);
- size_t NimBLEDevice::getWhiteListCount();
- NimBLEAddress NimBLEDevice::getWhiteListAddress(size_t index);
2021-05-23 13:12:44 -06:00
h2zero
d9d794ae40 [Server] Add ability to create static attributes.
This allows creating instances of services/characteristics and decriptors without
needing to call the parent createX() methods. This allows creation of the attibutes
within a class or other structure and the attributes can be linked to the parent by
calling the parent addX() method.

Additonally this increases the backward compatibility with the original bluedroid library
to further support user migration.
2021-05-23 13:07:00 -06:00
boozer2
30d6c399b8 [Client] Fix for truncation of strings with null in writeValue std::string overload 2021-05-21 19:54:08 -06:00
Bascy
7815d89dbf Call onSubscribe() after adding connection to subscribedVector
This allows for sending BLE messages in the onSubscribe() handler
2021-05-19 22:28:30 -06:00
Ketan Padegaonkar
9fa9531e50 Add method to get the callbacks from a characteristic.
This is useul to be able to unit/integration test the behavior of a
characteristic.
2021-05-19 22:23:40 -06:00
h2zero
946b971750 Properly find the remote characteristic end handle for descriptor discovery.
Previously we used the service end handle or, if available, the handle of the next characteristic in the service
as the end handle when retrieving the descriptors of a characteristic. This process would fail when connecting to some
devices if the characteristics were retrieved individually instead of all together. The cause of failure was requesting
a handle range that is out of characteristic scope which is also out of line with BLE
specifications.

The fix included in this is to set the end handles of the characteristics either after retrieving all the characteristics
in a service by using the next charactertistic definition handle or, if the characteristic was retrieved separately,
we retrieve the next characteristic just before retrieving the descriptors.
2021-05-17 14:37:03 -06:00
h2zero
b62358a520 Remove task notification for server indications.
This resolves an issue when sending an indication from a callback that can cause the server to hang.
2021-05-17 14:08:02 -06:00
h2zero
e45fb8616a Cleanup logs. 2021-05-15 09:52:00 -06:00
h2zero
d38865e022 Remove some asserts. 2021-05-07 11:06:45 -06:00
h2zero
62d1f67d8b Add connection info class and access methods to server and client.
This adds the ability to access information about the current connection.
A new class was created to wrap the struct ble_gap_conn_desc with methods to retrieve the connection information.

Example server use:
```
for(auto i=0; i<pServer->getConnectedCount();i++) {
    NimBLEConnInfo connInfo = pServer->getPeerInfo(i);
    printf("Connected client %d info:\n", i);
    printf("Peer address: %s\n", connInfo.getAddress().toString().c_str());
    printf("Peer ID address: %s\n", connInfo.getIdAddress().toString().c_str());
    printf("Handle: %u\n", connInfo.getConnHandle());
    printf("Interval: %u\n", connInfo.getConnInterval());
    printf("Timeout: %u\n", connInfo.getConnTimeout());
    printf("Latency: %u\n", connInfo.getConnLatency());
    printf("MTU: %u\n", connInfo.getMTU());
    printf("Master: %s\n", connInfo.isMaster()? "true":"false");
    printf("Slave: %s\n", connInfo.isSlave()? "true":"false");
    printf("Bonded: %s\n", connInfo.isBonded()? "true":"false");
    printf("Authenticated: %s\n", connInfo.isAuthenticated()? "true":"false");
    printf("Encrypted: %s\n", connInfo.isEncrypted()? "true":"false");
    printf("Encryption Key Size: %u\n", connInfo.getSecKeySize());
}
```

Example client use:
```
if (pClient->isConnected()) {
    NimBLEConnInfo connInfo = pClient->getConnInfo();
    printf("Connection info:\n");
    printf("Peer address: %s\n", connInfo.getAddress().toString().c_str());
    printf("Peer ID address: %s\n", connInfo.getIdAddress().toString().c_str());
    printf("Handle: %u\n", connInfo.getConnHandle());
    printf("Interval: %u\n", connInfo.getConnInterval());
    printf("Timeout: %u\n", connInfo.getConnTimeout());
    printf("Latency: %u\n", connInfo.getConnLatency());
    printf("MTU: %u\n", connInfo.getMTU());
    printf("Master: %s\n", connInfo.isMaster()? "true":"false");
    printf("Slave: %s\n", connInfo.isSlave()? "true":"false");
    printf("Bonded: %s\n", connInfo.isBonded()? "true":"false");
    printf("Authenticated: %s\n", connInfo.isAuthenticated()? "true":"false");
    printf("Encrypted: %s\n", connInfo.isEncrypted()? "true":"false");
    printf("Encryption Key Size: %u\n", connInfo.getSecKeySize());
}
```
2021-05-07 09:02:43 -06:00
h2zero
4f8342e275 Add bond management API.
* Adds these new methods to NimBLEDevice to manage bonded peers:

- NimBLEDevice::deleteBond(const NimBLEAddress &address);
- NimBLEDevice::getNumBonds();
- NimBLEDevice::isBonded(const NimBLEAddress &address);
- NimBLEDevice::deleteAllBonds();
- NimBLEDevice::getBondedAddress(int index);
2021-04-25 08:06:38 -06:00
h2zero
05080abad4 Add clear scan duplicate filter cache method + clear on start.
This allows for clearing the duplicate filter cache when required and will also clear it
automatically when starting a scan.

This is useful when unexpectedly disconnected from a device and attempting to reconnect.
Previously the scan filter would not report advertisements from a device if it was multi-connectable
and advertising while connected. The result was long delays until the device would be scanned again.
This resolves it by clearing the filter cache on each scan start/clearResults call
and adding a method to NimBLEScan for manually clearing the cache on demand.
2021-03-31 20:24:57 -06:00
h2zero
f5eab87a87 Fix missing data in long write to descriptor. 2021-03-31 17:43:19 -06:00
David Robertson
3227681476
Use ESP_LOGx macros for logging (#42)
This allows filtering of this components logging when using higher log levels in IDF.
2021-03-28 14:47:30 -06:00
Aron Rubin
cf3227503b
Use more stable arduino detection methods (#38)
* Use a more stable arduino detection macro.

* Detection method for both IDF config phases. Newer IDF API and targets.
2021-03-04 21:00:21 -07:00
h2zero
ef049ddf19 Fix compile errors in latest IDF (NimBLE 1.3.0) see (#37).
Const qualifiers were added to multiple struct members in NimBLE 1.3.0.
This solves compilation errors related to those.
2021-02-10 10:54:53 -07:00
h2zero
7bec9c240a Release 1.2.0 2021-02-08 11:46:11 -07:00
David Robertson
7dd4d68806
[NimBLEServer] Support duplicate characteristics (#36)
* Add method to get all characteristics of a service

* Added method on NimBLEDescriptor to get the value out as a std::string

* Added methods to get things by handle where UUID could be used already.

* Added helper methods for getting a list of characteristics with a given UUID and service

* Demote the warning log for adding duplicate characteristics to a debug level log.

* Add methods to get services and characteristics using UUID + index
2021-02-08 08:28:32 -07:00
h2zero
28d6492ea4 NimBLEAdvertising::reset check if the stack is initialized before stop.
This prevents an exception when initializing a NimBLEAdvertising instance before calling NimBLEDevice::init().
The constructor calls reset() which calls stop(), if the stack was not yet initialized it will cause an exception.
2021-02-07 22:26:02 -07:00
h2zero
dff5122ce2 Add complementary methods to NimBLEAdvertising and NimBLEAdvertisementData
Previous to this NimBLEAdvertising did not have some functionality that was in NimBLEAdvertisementData.
Also NimBLEAdvertisementData was missing functionality that exists in NimBLEAdvertising.

This resolves that by adding the missing functions to both classes.

Changed:
NimBLEAdvertising: Transmission power is no longer advertised by default and can be added to the advertisement by calling ::addTxPower()

Added:
- NimBLEAdvertising::setName
- NimBLEAdvertising::setManufacturerData
- NimBLEAdvertising::setURI
- NimBLEAdvertising::setServiceData
- NimBLEAdvertising::addTxPower
- NimBLEAdvertising::reset

- NimBLEAdvertisementData::addTxPower
- NimBLEAdvertisementData::setPreferredParams
- NimBLEAdvertisementData::setURI
2021-02-07 20:33:57 -07:00
h2zero
6e104dfb45 Allow custom scan response data without custom advertising.
This lets applications use custom scan response data while using the advertisment data added by the NimBLEAdvertising add/set methods.
2021-02-06 14:29:03 -07:00
h2zero
b290ca9077 [NimBLEAdvertisementData] Add setServices methods for multiple UUID's
Adds:
- setPartialServices16
- setPartialServices32
- setCompleteServices16
- setCompleteServices32

Each takes an input parameter of std::vector<NimBLEUUID> to allow for advertising multiple services with a simple interface.
2021-02-06 13:27:12 -07:00
h2zero
ae2ff3a638 Fix Documentation. 2021-02-06 11:12:40 -07:00
h2zero
af24cd7720 Add controller scan filter options and refactor nimconfig.h
* Add the option to change the scan filter mode through NimBLEDevice::setScanFilterMode

* Add the option to change the scan filter cache size through NimBLEDevice::setScanDuplicateCacheSize

* Refactor nimconfig to make it for doxygen use only.
2021-01-31 21:15:31 -07:00
h2zero
82524c80e3 [NimBLEScan] Use controller duplicate filter and add max result limit.
* Adds setMaxResults to NimBLEScan to limit the number of advertised devices stored.
  If set to 0 no devices will be stored in memory and only the callback will be invoked.
  If set to 0xFF (default) stored devices will be unlimited. Any other value will be the limit.

* Uses the controller to filter duplicate devices from the scan results when wantDuplicates == false.
2021-01-30 18:27:06 -07:00
h2zero
9527c41486 Refactor advertisedDevice (#181)
* Stores complete advertisement payload and only performs parsing on demand. The advertised data is no longer parsed automatically as it is discovered, instead it will be parsed to find only the data requested by the user application when it makes a call to do so. This saves processing time and approximately 2.4k in flash size, with the new methods listed below included.

Add more advertised device field methods:
* Adds haveAdvInterval/getAdvInterval - checks if the interval is advertised / gets the advertisement interval value.

* Adds haveConnParams/getMinInterval/getMaxInterval - checks if the parameters are advertised / get min value / get max value.

* Adds haveURI/getURI - checks if a URI is advertised / gets the URI data.

* Adds haveTargetAddress/getTargetAddressCount/getTargetAddress(index) - checks if a target address is present / gets a count of the addresses targeted / gets the address of the target at index.
2021-01-30 18:06:29 -07:00
wakwak_koba
51c49ba9fc [NimBLEHIDDevice] Modern Apple devices require READ_ENC and WRITE_ENC (#182)
- Added `READ_ENC` to the attribute of characteristics in 1812/2a4d
- Added `READ_ENC` and `WRITE_ENC` to the default values ​​of properties of `createDescriptor()`
2021-01-30 09:04:51 -07:00
h2zero
4e24a06645 Release 1.1.0 2021-01-20 20:18:23 -07:00
h2zero
310c5f7c84 Remove log print in disconnect timer callback.
Timer callback runs in ISR context, so log printing is inappropriate.
2021-01-20 12:29:22 -07:00
h2zero
026864e031 Set Client connect/disconnect data before stack calls.
Connect should set m_pTaskData before calling ble_gap_connect in case of an early event.

Disconnect should check if the timer has already started before starting the timer so it does not reset it.
The timer should also be started before calling ble_gap_terminate in case of an early event that would cause the timer to start
after disconnection, resetting the host unnecessarily.
2021-01-20 12:28:07 -07:00
h2zero
cf64169bc0 Update documentation.
* Docuemnt HID device class.

* Add usage tips.
2021-01-17 17:29:28 -07:00
h2zero
559a6e6970 Update documentation. 2021-01-15 21:51:49 -07:00
h2zero
c089eab595 Check connection status when returning in NimBLEClient::Connect.
There is a chance to become disconnected before returning from the onConnect callback so the connection
status should be checked when returning from client connect.
2021-01-14 10:21:25 -07:00
h2zero
c157680575 Limit delay in NimBLEClient::connect to connection timeout.
In the case the controller become unresponsive, or does not comply with the timeout period,
this will ensure the application continues instead of potentially blocking forever.
2021-01-13 22:00:39 -07:00
h2zero
6ee1cc236a Advertising start: add return status, use more verbose logging.
Advertising start did not return a value to indicate success/failure,
this patch adds that functionality. In addition, more verbose logging of errors from
this function are provided with the removal of the related asserts.

* Minor code cleanup
2021-01-13 19:48:38 -07:00
h2zero
6487225563 Call advertising stopped callback when the host re-synced.
If the stack was reset and duration was not indefinite the callback for
advertising stopped should be called when re-synced.
2021-01-13 18:34:49 -07:00
h2zero
5629f4d3e9 Initialize duration member variable in NimBLEAdvertising constructor.
m_duration member variable was not set previously which could trigger advertising to start if the
host was reset prior to the application calling start.
2021-01-13 18:21:23 -07:00
wakwak_koba
b064cc65d4 Find characteristic end handle using the next characterisic handle.
On some devices, searching for descriptors using the service end handle would return an invalid error.
This patch instead uses the handle of the next characteristic as the end handle (if available).
2021-01-13 18:05:19 -07:00
Asuki Kono
f61bd5c2df Add option to use resolvable and non-resolvable private address.
Adds the possibility to configure a resolvable or non-resolvable address (BLE privacy).
2021-01-13 18:01:41 -07:00
h2zero
57ba0e583d Fix commit 8fe2766 in scan start.
Scan start would return false when the return code was BLE_HS_EALREADY.
2021-01-12 21:25:30 -07:00
h2zero
372c79a6b8 Only start scan/advertise when host re-synced if duration was indefinite.
Previously when the host reset while scanning (if active prior) it would be restarted automatically.
This caused errors for some applications and has been removed since the event invokes the scan
ended callback for the app to take action. Instead scanning will now only be restarted if the duration
was indefinite and a callback was set for the advertisment events, this use case is less likely to have
a scan ended callback.

Advertising (if active prior) would be started without regard to it's previous state.
This has been corrected to only start advertising again if it was advertising for an idefinite time.
2021-01-12 20:42:19 -07:00
h2zero
28573f5abe Fix crash in NimBLEDevice::deleteClient when notification arrives.
While deleting the client attribute database, if a notification occurs there is a possibility of
concurrency causing an exception. This fixes that by setting a flag before calling disconnect in
the deleteClient function to prevent processing further notifications.
2021-01-12 14:01:44 -07:00
h2zero
b807321d1b NimBLEDevice::onSync should call taskYIELD() before returning.
This change is needed to allow any tasks that were stopped during a host reset to finish
before resuming from the re-sync. This would occasionally result in a LoadStoreError exception
if not done.
2021-01-12 13:59:49 -07:00