Skip to content

Commit 8bff4db

Browse files
committed
Update docs and workflows.
1 parent db8ac65 commit 8bff4db

9 files changed

Lines changed: 137 additions & 42 deletions

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
- "examples/NimBLE_Server"
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v5
2121
- name: Set up Python
2222
uses: actions/setup-python@v5
2323
with:
24-
python-version: "3.x"
24+
python-version: "3.13"
2525
- name: Install platformio
2626
run: |
2727
python -m pip install --upgrade pip
@@ -57,7 +57,7 @@ jobs:
5757
- "examples/Bluetooth_5/NimBLE_extended_server"
5858
runs-on: ubuntu-latest
5959
steps:
60-
- uses: actions/checkout@v4
60+
- uses: actions/checkout@v5
6161
- name: Set up Python
6262
uses: actions/setup-python@v5
6363
with:
@@ -96,7 +96,7 @@ jobs:
9696
- "examples/NimBLE_Server"
9797
runs-on: ubuntu-latest
9898
steps:
99-
- uses: actions/checkout@v4
99+
- uses: actions/checkout@v5
100100
- name: Set up Python
101101
uses: actions/setup-python@v5
102102
with:
@@ -142,7 +142,7 @@ jobs:
142142
- "examples/Bluetooth_5/NimBLE_extended_server"
143143
runs-on: ubuntu-latest
144144
steps:
145-
- uses: actions/checkout@v4
145+
- uses: actions/checkout@v5
146146
- name: Set up Python
147147
uses: actions/setup-python@v5
148148
with:
@@ -195,7 +195,7 @@ jobs:
195195
- esp32h2
196196
runs-on: ubuntu-latest
197197
steps:
198-
- uses: actions/checkout@v4
198+
- uses: actions/checkout@v5
199199
- name: Build arduino-esp32
200200
uses: arduino/compile-sketches@v1.1.0
201201
with:
@@ -221,7 +221,7 @@ jobs:
221221
- esp32h2
222222
runs-on: ubuntu-latest
223223
steps:
224-
- uses: actions/checkout@v4
224+
- uses: actions/checkout@v5
225225
- name: Set config for BT5
226226
run: |
227227
sed -i '0,/#include \"nimconfig_rename.h\"/a #define CONFIG_BT_NIMBLE_EXT_ADV 1' ./src/nimconfig.h
@@ -250,7 +250,7 @@ jobs:
250250
- Generic_nRF52840
251251
runs-on: ubuntu-latest
252252
steps:
253-
- uses: actions/checkout@v4
253+
- uses: actions/checkout@v5
254254
- name: Build n-able Arduino
255255
uses: arduino/compile-sketches@v1.1.0
256256
with:
@@ -273,7 +273,7 @@ jobs:
273273
- Generic_nRF52840
274274
runs-on: ubuntu-latest
275275
steps:
276-
- uses: actions/checkout@v4
276+
- uses: actions/checkout@v5
277277
- name: Set config for BT5
278278
run: |
279279
echo "-DCONFIG_BT_NIMBLE_EXT_ADV=1" > ${{ matrix.example }}/build_opt.h
@@ -297,7 +297,7 @@ jobs:
297297
- "examples/NimBLE_Server"
298298
runs-on: ubuntu-latest
299299
steps:
300-
- uses: actions/checkout@v4
300+
- uses: actions/checkout@v5
301301
- name: Set up Python
302302
uses: actions/setup-python@v5
303303
with:
@@ -340,7 +340,7 @@ jobs:
340340
- "examples/Bluetooth_5/NimBLE_extended_server"
341341
runs-on: ubuntu-latest
342342
steps:
343-
- uses: actions/checkout@v4
343+
- uses: actions/checkout@v5
344344
- name: Set up Python
345345
uses: actions/setup-python@v5
346346
with:
@@ -369,7 +369,7 @@ jobs:
369369
build_docs:
370370
runs-on: ubuntu-latest
371371
steps:
372-
- uses: actions/checkout@v4
372+
- uses: actions/checkout@v5
373373
- name: Doxygen Action
374374
uses: mattnotmitt/doxygen-action@v1.9.8
375375
with:

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build_docs:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313
- name: Doxygen Action
1414
uses: mattnotmitt/doxygen-action@v1.9.8
1515
with:
@@ -19,4 +19,13 @@ jobs:
1919
uses: peaceiris/actions-gh-pages@v4
2020
with:
2121
github_token: ${{ secrets.GITHUB_TOKEN }}
22-
publish_dir: ./docs/doxydocs/html
22+
publish_dir: ./docs/doxydocs/html
23+
24+
upload_to_platformio_registry:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v5
28+
- name: Upload component to PlatformIO Registry
29+
uses: bojit/platformio-publish@main
30+
with:
31+
token: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}

.github/workflows/sponsors.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [Unreleased]
5+
6+
## Fixed
7+
- GATT attribute handles are now assigned from the registration callback so duplicate UUID attributes are identified correctly.
8+
- Dynamic service changes now properly remove characteristics/descriptors and reset the GATT database when advertising starts.
9+
- Missing notification/indication payload data when the value spans multiple mbufs, such as values larger than 255 bytes with small ACL buffers.
10+
- `NimBLEDevice::createServer` will longer crash when called before the stack is initialized.
11+
- Re-pairing after deleting all bonds now works by unpairing each stored bond instead of only deleting NVS data.
12+
- Whitelist bounds checks.
13+
- `NimBLEDevice::getBondedAddress` index bounds validation.
14+
- ESP32 linker error when both central and peripheral roles are disabled.
15+
- Compiler warnings when bonds are disabled.
16+
17+
## Added
18+
- `NimBLEStream`, `NimBLEStreamClient`, and `NimBLEStreamServer` classes and examples.
19+
- `NimBLECppVersion.h` with compile-time version macros.
20+
- `NimBLEDevice::getVersion` runtime version string helper.
21+
- Matching passkey callbacks for both roles: `NimBLEServerCallbacks::onPassKeyEntry` and `NimBLEClientCallbacks::onPassKeyDisplay`.
22+
- Bond migration helpers to convert bond storage between v1 and current formats while preserving existing bonds.
23+
- `NimBLEUUID` constructor overload for `ble_uuid_t*`.
24+
- Optional `index` parameter for `NimBLECharacteristic::getDescriptorByUUID` to access multiple descriptors with the same UUID.
25+
26+
## Changed
27+
- `NimBLEService::start` is deprecated; services are now added when the server starts.
28+
- `NimBLEHIDDevice::startServices()` is deprecated; services are now added when the server starts.
29+
430
## [2.3.9] 2026-03-08
531

632
## Fixed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ For Nordic devices, this library provides access to a completely open source and
3131
* Open platformio.ini, a project configuration file located in the root of PlatformIO project.
3232
* Add the following line to the lib_deps option of [env:] section:
3333
```
34-
h2zero/NimBLE-Arduino@^2.1.0
34+
h2zero/NimBLE-Arduino
3535
```
3636
* Build a project, PlatformIO will automatically install dependencies.
3737

@@ -56,15 +56,9 @@ Change the settings in the `src/nimconfig.h` file to customize NimBLE to your pr
5656
such as increasing max connections, default is 3 for the esp32.
5757
<br/>
5858

59-
# Development Status
60-
This Library is tracking the esp-nimble repo, nimble-1.5.0-idf branch, currently [@e3cbdc0.](https://github.com/espressif/esp-nimble)
61-
<br/>
62-
6359
# Sponsors
6460
Thank you to all the sponsors who support this project!
6561

66-
<!-- sponsors --><!-- sponsors -->
67-
6862
If you use this library for a commercial product please consider [sponsoring the development](https://github.com/sponsors/h2zero) to ensure the continued updates and maintenance.
6963
<br/>
7064

docs/1.x_to2.x_migration_guide.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This guide will help you migrate your application code to use the new API.
77
The changes listed here are only the required changes that must be made, and a short overview of options for migrating existing applications.
88

99
* [General changes](#general-changes)
10+
* [Bond migration](#bond-migration)
1011
* [BLE Device](#ble-device)
1112
* [BLE Addresses](#ble-addresses)
1213
* [BLE UUID's](#ble-uuids)
@@ -34,6 +35,49 @@ The changes listed here are only the required changes that must be made, and a s
3435
`NimBLEServerCallbacks::onConnect(NimBLEServer* pServer)` signature is now `NimBLEServerCallbacks::onConnect(NimBLEServer* pServer, NimBLEConnInfo& connInfo)`.
3536
<br/>
3637

38+
## Bond migration
39+
If your 1.x application stores bonds and you want paired devices to continue working after upgrading to 2.x, the library provides helper functions to migrate the bond data stored in NVS.
40+
41+
The helpers are declared in `NimBLEBondMigration.h`:
42+
43+
- `NimBLEBondMigration::migrateBondStoreToCurrent()` converts 1.x bond data to the current 2.x format.
44+
- `NimBLEBondMigration::migrateBondStoreToV1()` converts current bond data back to the 1.x format.
45+
- `NimBLEBondMigration::dumpBondData()` returns a human-readable dump of the stored bond records for debugging.
46+
47+
These functions must be called **before** `NimBLEDevice::init()` so the bond store can be updated before the stack starts using it.
48+
49+
Typical migration flow:
50+
51+
1. Build and flash a temporary migration firmware that includes `NimBLEBondMigration.h`.
52+
2. Call `migrateBondStoreToCurrent()` once during startup before BLE initialization.
53+
3. If the function returns `true`, stop there and then flash the final 2.x application firmware.
54+
4. After the migration is complete, do not run the migration again in normal application startup.
55+
56+
Example:
57+
58+
#include <NimBLEDevice.h>
59+
#include <NimBLEBondMigration.h>
60+
61+
void setup() {
62+
bool success = NimBLEBondMigration::migrateBondStoreToCurrent();
63+
if (success) {
64+
// Flash the normal 2.x firmware after this one-time step.
65+
while (true) {
66+
delay(1000);
67+
}
68+
}
69+
70+
NimBLEDevice::init("NimBLE");
71+
}
72+
73+
Notes:
74+
75+
- These helpers currently require `ESP_PLATFORM` because they operate directly on the ESP NVS bond storage.
76+
- `dumpBondData()` is useful before and after migration to verify what records are present.
77+
- If you need to temporarily return to a 1.x firmware image while preserving bonds, run `migrateBondStoreToV1()` first, then flash the 1.x application.
78+
- See the `examples/NimBLE_Bond_Migration` example for a complete one-time migration sketch.
79+
<br/>
80+
3781
## BLE Device
3882
- Ignore list functions and vector have been removed, the application should implement this if desired. It was no longer used by the library.
3983
- `NimBLEDevice::startSecurity` now returns a `bool`, true on success, instead of an int to be consistent with the rest of the library.

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=NimBLE-Arduino
2-
version=2.3.9
2+
version=2.4.0-rc
33
author=h2zero
44
maintainer=Ryan Powell <ryan@nable-embedded.io>
55
sentence=Bluetooth low energy (BLE) library for Arduino based on NimBLE.

src/NimBLEBondMigration.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
#include "nvs.h"
1717
#include "syscfg/syscfg.h"
1818

19+
/**
20+
* @brief Helpers for converting NimBLE bond data stored in ESP NVS between
21+
* the legacy 1.x layout and the current 2.x layout.
22+
*
23+
* These helpers are intended for one-time migration firmware and must be used
24+
* before calling `NimBLEDevice::init()`.
25+
*/
1926
namespace NimBLEBondMigration {
2027

2128
namespace detail {
@@ -487,6 +494,17 @@ inline bool migrateBondStore(bool toCurrent, uint16_t maxEntries) {
487494

488495
} // namespace detail
489496

497+
/**
498+
* @brief Read and format the contents of the NimBLE bond store.
499+
*
500+
* This is intended for diagnostics before or after migration and returns a
501+
* human-readable summary of each `our_sec_*`, `peer_sec_*`, and `local_irk_*`
502+
* record found in the NVS bond namespace.
503+
*
504+
* @param[in] maxEntries The maximum number of bond slots to inspect.
505+
* @return A formatted string describing the stored bond data, or an error
506+
* message if the NVS namespace could not be opened.
507+
*/
490508
inline std::string dumpBondData(uint16_t maxEntries = MYNEWT_VAL(BLE_STORE_MAX_BONDS)) {
491509
std::string out;
492510
out.reserve(2048);
@@ -649,10 +667,31 @@ inline std::string dumpBondData(uint16_t maxEntries = MYNEWT_VAL(BLE_STORE_MAX_B
649667
return out;
650668
}
651669

670+
/**
671+
* @brief Convert legacy 1.x bond data in NVS to the current 2.x format.
672+
*
673+
* This function should be called once, before `NimBLEDevice::init()`, by a
674+
* temporary migration firmware when upgrading an existing installation that
675+
* needs to preserve bonded peers.
676+
*
677+
* @param[in] maxEntries The maximum number of bond slots to inspect and
678+
* convert.
679+
* @return `true` if migration completed successfully, otherwise `false`.
680+
*/
652681
inline bool migrateBondStoreToCurrent(uint16_t maxEntries = MYNEWT_VAL(BLE_STORE_MAX_BONDS)) {
653682
return detail::migrateBondStore(true, maxEntries);
654683
}
655684

685+
/**
686+
* @brief Convert current 2.x bond data in NVS back to the legacy 1.x format.
687+
*
688+
* This is intended for rollback scenarios where bond data must be preserved
689+
* before flashing firmware built against the 1.x library.
690+
*
691+
* @param[in] maxEntries The maximum number of bond slots to inspect and
692+
* convert.
693+
* @return `true` if migration completed successfully, otherwise `false`.
694+
*/
656695
inline bool migrateBondStoreToV1(uint16_t maxEntries = MYNEWT_VAL(BLE_STORE_MAX_BONDS)) {
657696
return detail::migrateBondStore(false, maxEntries);
658697
}

src/NimBLECppVersion.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#define NIMBLE_CPP_VERSION_MAJOR 2
2323

2424
/** @brief NimBLE-Arduino library minor version number. */
25-
#define NIMBLE_CPP_VERSION_MINOR 3
25+
#define NIMBLE_CPP_VERSION_MINOR 4
2626

2727
/** @brief NimBLE-Arduino library patch version number. */
28-
#define NIMBLE_CPP_VERSION_PATCH 9
28+
#define NIMBLE_CPP_VERSION_PATCH 0
2929

3030
/**
3131
* @brief Macro to create a version number for comparison.
@@ -58,7 +58,7 @@
5858
* @details Include the leading '-' when defined, for example: "-beta.1"
5959
*/
6060
#ifndef NIMBLE_CPP_VERSION_PRERELEASE
61-
# define NIMBLE_CPP_VERSION_PRERELEASE ""
61+
# define NIMBLE_CPP_VERSION_PRERELEASE "-rc.1"
6262
#endif
6363

6464
/**

0 commit comments

Comments
 (0)