Skip to content

Commit 0eb76cf

Browse files
authored
Merge branch 'h2zero:master' into master
2 parents b28f840 + d02a89a commit 0eb76cf

File tree

192 files changed

+21602
-8486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+21602
-8486
lines changed

CHANGELOG.md

Lines changed: 79 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,39 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [Unreleased]
6+
7+
### Fixed
8+
- Fixed missing data from long notification values.
9+
10+
### Changed
11+
- Updated NimBLE core to use the v1.4.0 branch of esp-nimble
12+
13+
### Added
14+
- Preliminary support for non-esp devices, NRF51 and NRF52 devices supported with [n-able arduino core](https://github.com/h2zero/n-able)
15+
- Alias added for `NimBLEServerCallbacks::onMTUChange` to `onMtuChanged` in order to support porting code from original library.
16+
- `NimBLEAttValue` Class added to reduce and control RAM footprint of characteristic/descriptor values and support conversions from Arduio Strings and many other data types.
17+
- Bluetooth 5 extended advertising support for capable devices. CODED Phy, 2M Phy, extended advertising data, and multi-advertising are supported, periodic advertising will be implemented in the future.
18+
19+
## [1.3.8] - 2022-04-27
20+
21+
### Fixed
22+
- Fix compile error with ESP32S3.
23+
- Prevent a potential crash when retrieving characteristics from a service if the result was successful but no characteristics found.
24+
25+
### Changed
26+
- Save resources when retrieving descriptors if the characteristic handle is the same as the end handle (no descriptors).
27+
- Subscribing to characteristic notifications/indications will now always use write with response, as per BLE specifications.
28+
- `NimBLEClient::discoverAttributes` now returns a bool value to indicate success/failure
29+
30+
## [1.3.7] - 2022-02-15
31+
32+
### Fixed
33+
34+
- Crash when retrieving an attribute that does not exist on the peer.
35+
- Memory leak when deleting client instances.
36+
- Compilation errors for esp32s3
37+
538
## [1.3.6] - 2022-01-18
639

740
### Changed
@@ -97,7 +130,7 @@ All notable changes to this project will be documented in this file.
97130

98131
- `NimBLEService::getCharacteristicByHandle`: Get a pointer to the characteristic object with the specified handle.
99132

100-
- `NimBLEService::getCharacteristics`: Get the vector containing pointers to each characteristic associated with this service.
133+
- `NimBLEService::getCharacteristics`: Get the vector containing pointers to each characteristic associated with this service.
101134
Overloads to get a vector containing pointers to all the characteristics in a service with the UUID. (supports multiple same UUID's in a service)
102135
- `NimBLEService::getCharacteristics(const char *uuid)`
103136
- `NimBLEService::getCharacteristics(const NimBLEUUID &uuid)`
@@ -141,10 +174,10 @@ Overloads to get a vector containing pointers to all the characteristics in a se
141174

142175
- `NimBLEAdvertising` Custom scan response data can now be used without custom advertisment.
143176

144-
- `NimBLEScan` Now uses the controller duplicate filter.
177+
- `NimBLEScan` Now uses the controller duplicate filter.
145178

146-
- `NimBLEAdvertisedDevice` Has been refactored to store the complete advertisement payload and no longer parses the data from each advertisement.
147-
Instead the data will be parsed on-demand when the user application asks for specific data.
179+
- `NimBLEAdvertisedDevice` Has been refactored to store the complete advertisement payload and no longer parses the data from each advertisement.
180+
Instead the data will be parsed on-demand when the user application asks for specific data.
148181

149182
### Fixed
150183
- `NimBLEHIDDevice` Characteristics now use encryption, this resolves an issue with communicating with devices requiring encryption for HID devices.
@@ -153,84 +186,84 @@ Instead the data will be parsed on-demand when the user application asks for spe
153186
## [1.1.0] - 2021-01-20
154187

155188
### Added
156-
- `NimBLEDevice::setOwnAddrType` added to enable the use of random and random-resolvable addresses, by asukiaaa
189+
- `NimBLEDevice::setOwnAddrType` added to enable the use of random and random-resolvable addresses, by asukiaaa
157190

158-
- New examples for securing and authenticating client/server connections, by mblasee.
191+
- New examples for securing and authenticating client/server connections, by mblasee.
159192

160-
- `NimBLEAdvertising::SetMinPreferred` and `NimBLEAdvertising::SetMinPreferred` re-added.
193+
- `NimBLEAdvertising::SetMinPreferred` and `NimBLEAdvertising::SetMinPreferred` re-added.
161194

162-
- Conditional checks added for command line config options in `nimconfig.h` to support custom configuration in platformio.
195+
- Conditional checks added for command line config options in `nimconfig.h` to support custom configuration in platformio.
163196

164-
- `NimBLEClient::setValue` Now takes an extra bool parameter `response` to enable the use of write with response (default = false).
197+
- `NimBLEClient::setValue` Now takes an extra bool parameter `response` to enable the use of write with response (default = false).
165198

166-
- `NimBLEClient::getCharacteristic(uint16_t handle)` Enabling the use of the characteristic handle to be used to find
167-
the NimBLERemoteCharacteristic object.
199+
- `NimBLEClient::getCharacteristic(uint16_t handle)` Enabling the use of the characteristic handle to be used to find
200+
the NimBLERemoteCharacteristic object.
168201

169-
- `NimBLEHIDDevice` class added by wakwak-koba.
202+
- `NimBLEHIDDevice` class added by wakwak-koba.
170203

171-
- `NimBLEServerCallbacks::onDisconnect` overloaded callback added to provide a ble_gap_conn_desc parameter for the application
172-
to obtain information about the disconnected client.
204+
- `NimBLEServerCallbacks::onDisconnect` overloaded callback added to provide a ble_gap_conn_desc parameter for the application
205+
to obtain information about the disconnected client.
173206

174-
- Conditional checks in `nimconfig.h` for command line defined macros to support platformio config settings.
207+
- Conditional checks in `nimconfig.h` for command line defined macros to support platformio config settings.
175208

176209
### Changed
177-
- `NimBLEAdvertising::start` now returns a bool value to indicate success/failure.
210+
- `NimBLEAdvertising::start` now returns a bool value to indicate success/failure.
178211

179-
- Some asserts were removed in `NimBLEAdvertising::start` and replaced with better return code handling and logging.
212+
- Some asserts were removed in `NimBLEAdvertising::start` and replaced with better return code handling and logging.
180213

181-
- If a host reset event occurs, scanning and advertising will now only be restarted if their previous duration was indefinite.
214+
- If a host reset event occurs, scanning and advertising will now only be restarted if their previous duration was indefinite.
182215

183216
- `NimBLERemoteCharacteristic::subscribe` and `NimBLERemoteCharacteristic::registerForNotify` will now set the callback
184-
regardless of the existance of the CCCD and return true unless the descriptor write operation failed.
217+
regardless of the existance of the CCCD and return true unless the descriptor write operation failed.
185218

186-
- Advertising tx power level is now sent in the advertisement packet instead of scan response.
219+
- Advertising tx power level is now sent in the advertisement packet instead of scan response.
187220

188-
- `NimBLEScan` When the scan ends the scan stopped flag is now set before calling the scan complete callback (if used)
189-
this allows the starting of a new scan from the callback function.
221+
- `NimBLEScan` When the scan ends the scan stopped flag is now set before calling the scan complete callback (if used)
222+
this allows the starting of a new scan from the callback function.
190223

191224
### Fixed
192-
- Sometimes `NimBLEClient::connect` would hang on the task block if no event arrived to unblock.
193-
A time limit has been added to timeout appropriately.
225+
- Sometimes `NimBLEClient::connect` would hang on the task block if no event arrived to unblock.
226+
A time limit has been added to timeout appropriately.
227+
228+
- When getting descriptors for a characterisic the end handle of the service was used as a proxy for the characteristic end
229+
handle. This would be rejected by some devices and has been changed to use the next characteristic handle as the end when possible.
230+
231+
- An exception could occur when deleting a client instance if a notification arrived while the attribute vectors were being
232+
deleted. A flag has been added to prevent this.
233+
234+
- An exception could occur after a host reset event when the host re-synced if the tasks that were stopped during the event did
235+
not finish processing. A yield has been added after re-syncing to allow tasks to finish before proceeding.
236+
237+
- Occasionally the controller would fail to send a disconnected event causing the client to indicate it is connected
238+
and would be unable to reconnect. A timer has been added to reset the host/controller if it expires.
194239

195-
- When getting descriptors for a characterisic the end handle of the service was used as a proxy for the characteristic end
196-
handle. This would be rejected by some devices and has been changed to use the next characteristic handle as the end when possible.
240+
- Occasionally the call to start scanning would get stuck in a loop on BLE_HS_EBUSY, this loop has been removed.
197241

198-
- An exception could occur when deleting a client instance if a notification arrived while the attribute vectors were being
199-
deleted. A flag has been added to prevent this.
200-
201-
- An exception could occur after a host reset event when the host re-synced if the tasks that were stopped during the event did
202-
not finish processing. A yield has been added after re-syncing to allow tasks to finish before proceeding.
203-
204-
- Occasionally the controller would fail to send a disconnected event causing the client to indicate it is connected
205-
and would be unable to reconnect. A timer has been added to reset the host/controller if it expires.
206-
207-
- Occasionally the call to start scanning would get stuck in a loop on BLE_HS_EBUSY, this loop has been removed.
242+
- 16bit and 32bit UUID's in some cases were not discovered or compared correctly if the device
243+
advertised them as 16/32bit but resolved them to 128bits. Both are now checked.
208244

209-
- 16bit and 32bit UUID's in some cases were not discovered or compared correctly if the device
210-
advertised them as 16/32bit but resolved them to 128bits. Both are now checked.
211-
212-
- `FreeRTOS` compile errors resolved in latest Ardruino core and IDF v3.3.
245+
- `FreeRTOS` compile errors resolved in latest Ardruino core and IDF v3.3.
213246

214-
- Multiple instances of `time()` called inside critical sections caused sporadic crashes, these have been moved out of critical regions.
247+
- Multiple instances of `time()` called inside critical sections caused sporadic crashes, these have been moved out of critical regions.
215248

216-
- Advertisement type now correctly set when using non-connectable (advertiser only) mode.
249+
- Advertisement type now correctly set when using non-connectable (advertiser only) mode.
217250

218-
- Advertising payload length correction, now accounts for appearance.
251+
- Advertising payload length correction, now accounts for appearance.
219252

220-
- (Arduino) Ensure controller mode is set to BLE Only.
253+
- (Arduino) Ensure controller mode is set to BLE Only.
221254

222255

223256
## [1.0.2] - 2020-09-13
224257

225258
### Changed
226259

227-
- `NimBLEAdvertising::start` Now takes 2 optional parameters, the first is the duration to advertise for (in seconds), the second is a
260+
- `NimBLEAdvertising::start` Now takes 2 optional parameters, the first is the duration to advertise for (in seconds), the second is a
228261
callback that is invoked when advertsing ends and takes a pointer to a `NimBLEAdvertising` object (similar to the `NimBLEScan::start` API).
229262

230263
- (Arduino) Maximum BLE connections can now be altered by only changing the value of `CONFIG_BT_NIMBLE_MAX_CONNECTIONS` in `nimconfig.h`.
231264
Any changes to the controller max connection settings in `sdkconfig.h` will now have no effect when using this library.
232265

233-
- (Arduino) Revert the previous change to fix the advertising start delay. Instead a replacement fix that routes all BLE controller commands from
266+
- (Arduino) Revert the previous change to fix the advertising start delay. Instead a replacement fix that routes all BLE controller commands from
234267
a task running on core 0 (same as the controller) has been implemented. This improves response times and reliability for all BLE functions.
235268

236269

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ If you are familiar with the original library, see: [The migration guide](docs/M
5757

5858
Also see [Improvements_and_updates](docs/Improvements_and_updates.md) for information about non-breaking changes.
5959

60-
[Full API documentation and class list can be found here.](https://h2zero.github.io/esp-nimble-cpp/)
60+
[Full API documentation and class list can be found here.](https://h2zero.github.io/NimBLE-Arduino/)
6161

6262
For added performance and optimizations see [Usage tips](docs/Usage_tips.md).
6363

@@ -72,9 +72,9 @@ such as increasing max connections, default is 3, absolute maximum connections i
7272
<br/>
7373

7474
# Development Status
75-
This Library is tracking the esp-nimble repo, nimble-1.3.0-idf master branch, currently [@5bb7b40.](https://github.com/espressif/esp-nimble)
75+
This Library is tracking the esp-nimble repo, nimble-1.4.0-idf branch, currently [@3c2e1d4.](https://github.com/espressif/esp-nimble)
7676

77-
Also tracking the NimBLE related changes in ESP-IDF, master branch, currently [@639e7ad.](https://github.com/espressif/esp-idf/tree/master/components/bt/host/nimble)
77+
Also tracking the NimBLE related changes in ESP-IDF, master branch, currently [@95db4bb.](https://github.com/espressif/esp-idf/tree/master/components/bt/host/nimble)
7878
<br/>
7979

8080
# Acknowledgments

docs/Bluetooth 5 features.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Bluetooth 5.x features
2+
3+
## About extended advertising
4+
Extended advertising allows for much more capability and flexibility.
5+
6+
* Allows for 251 bytes of advertisement data and up to 1650 bytes when chained (configuration dependant) vs 31.
7+
8+
* New PHY's (physical layers) that allow for faster data rate (2M PHY) or long range/slower data rates (CODED PHY) as well as the original 1M PHY.
9+
10+
* New periodic advertising, allowing the scanning device to sync with the advertisements of a beacon. This allows for the scanning device to sleep or perform other tasks before the next expected advertisement is sent, preserving cpu cycles and power (To be implemented).
11+
<br/>
12+
13+
## Enabling extended advertising
14+
Extended advertising is supported when enabled with the config option `CONFIG_BT_NIMBLE_EXT_ADV` set to a value of 1. This is done in menuconfig under `Component config > Bluetooth > NimBLE options > Enable extended advertising`, or set in `nimconfig.h` for Arduino, or in `build_flags` in PlatformIO.
15+
16+
When enabled the following will occur:
17+
* `NimBLEScan::start` method will scan on both the 1M PHY and the coded PHY standards automatically.
18+
19+
* `NimBLEClient::connect` will use the primary PHY the device is listening on, unless specified (see below).
20+
21+
* `NimBLEClient::setConnectPhy` becomes available to specify the PHY's to connect with (default is all).
22+
23+
* `NimBLEAdvertising` is no longer available for use and is replaced by `NimBLEExtAdvertising`. `NimBLEDevice::getAdvertising` will now return an instance of `NimBLEExtAdvertising`.
24+
25+
* `NimBLEAdvertisementData` is no longer available for use and is replaced by `NimBLEExtAdvertisement`. This new class is where everything about the advertisement is configured, including the advertisement intervals and advertisement ended callback.
26+
27+
28+

docs/Command_line_config.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ characteristic or descriptor is constructed before a value is read/notifed.
2323
Increasing this will reduce reallocations but increase memory footprint.
2424
Default value is 20. Range: 1 : 512 (BLE_ATT_ATTR_MAX_LEN)
2525
<br/>
26-
26+
2727
`CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU`
2828

2929
Sets the default MTU size.
@@ -140,3 +140,41 @@ Set the task stack size for the NimBLE core.
140140
- Default is 4096
141141
<br/>
142142

143+
`CONFIG_NIMBLE_STACK_USE_MEM_POOLS`
144+
145+
Enable the use of memory pools for stack operations. This will use slightly more RAM but may provide more stability.
146+
147+
- Options: 0 or 1, default is disabled (0)
148+
<br/>
149+
150+
### Extended advertising settings, For use with ESP32C3, ESP32S3, ESP32H2 ONLY!
151+
152+
`CONFIG_BT_NIMBLE_EXT_ADV`
153+
154+
Set to 1 to enable extended advertising features.
155+
<br/>
156+
157+
`CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES`
158+
159+
Sets the max number of extended advertising instances
160+
- Range: 0 - 4
161+
- Default is 1
162+
<br/>
163+
164+
`CONFIG_BT_NIMBLE_MAX_EXT_ADV_DATA_LEN`
165+
166+
Set the max extended advertising data size,
167+
- Range: 31 - 1650
168+
- Default is 255
169+
<br/>
170+
171+
`CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV`
172+
173+
Set to 1 to enable periodic advertising.
174+
<br/>
175+
176+
`CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS`
177+
178+
Set the maximum number of periodically synced devices.
179+
- Range: 1 - 8
180+
- Default is 1

0 commit comments

Comments
 (0)