NimBLE-Arduino 2.4.0
Loading...
Searching...
No Matches
NimBLEBondMigration Namespace Reference

Helpers for converting NimBLE bond data stored in ESP NVS between the legacy 1.x layout and the current 2.x layout. More...

Functions

std::string dumpBondData (uint16_t maxEntries=MYNEWT_VAL(BLE_STORE_MAX_BONDS))
 Read and format the contents of the NimBLE bond store.
 
bool migrateBondStoreToCurrent (uint16_t maxEntries=MYNEWT_VAL(BLE_STORE_MAX_BONDS))
 Convert legacy 1.x bond data in NVS to the current 2.x format.
 
bool migrateBondStoreToV1 (uint16_t maxEntries=MYNEWT_VAL(BLE_STORE_MAX_BONDS))
 Convert current 2.x bond data in NVS back to the legacy 1.x format.
 

Detailed Description

Helpers for converting NimBLE bond data stored in ESP NVS between the legacy 1.x layout and the current 2.x layout.

These helpers are intended for one-time migration firmware and must be used before calling NimBLEDevice::init().

Function Documentation

◆ dumpBondData()

std::string NimBLEBondMigration::dumpBondData ( uint16_t  maxEntries = MYNEWT_VAL(BLE_STORE_MAX_BONDS))
inline

Read and format the contents of the NimBLE bond store.

This is intended for diagnostics before or after migration and returns a human-readable summary of each our_sec_*, peer_sec_*, and local_irk_* record found in the NVS bond namespace.

Parameters
[in]maxEntriesThe maximum number of bond slots to inspect.
Returns
A formatted string describing the stored bond data, or an error message if the NVS namespace could not be opened.

◆ migrateBondStoreToCurrent()

bool NimBLEBondMigration::migrateBondStoreToCurrent ( uint16_t  maxEntries = MYNEWT_VAL(BLE_STORE_MAX_BONDS))
inline

Convert legacy 1.x bond data in NVS to the current 2.x format.

This function should be called once, before NimBLEDevice::init(), by a temporary migration firmware when upgrading an existing installation that needs to preserve bonded peers.

Parameters
[in]maxEntriesThe maximum number of bond slots to inspect and convert.
Returns
true if migration completed successfully, otherwise false.

◆ migrateBondStoreToV1()

bool NimBLEBondMigration::migrateBondStoreToV1 ( uint16_t  maxEntries = MYNEWT_VAL(BLE_STORE_MAX_BONDS))
inline

Convert current 2.x bond data in NVS back to the legacy 1.x format.

This is intended for rollback scenarios where bond data must be preserved before flashing firmware built against the 1.x library.

Parameters
[in]maxEntriesThe maximum number of bond slots to inspect and convert.
Returns
true if migration completed successfully, otherwise false.