esp-nimble icon indicating copy to clipboard operation
esp-nimble copied to clipboard

Make NVS namespace adjustable

Open vodka-bears opened this issue 9 months ago • 0 comments

  • Introduce static string nimble_nvs_namespace that is used instead of the old NIMBLE_NVS_NAMESPACE macro.
  • Add function int ble_store_set_namespace(const char * namespace_str) that allows for changing namespace string.
  • Rename NIMBLE_NVS_NAMESPACE to NIMBLE_NVS_NAMESPACE_DEFAULT.
  • Replace occurrences of macro NIMBLE_NVS_NAMESPACE with variable nimble_nvs_namespace.

Description

Developing a custom project I realized that I need to run several devices with different addresses on the same hardware. The purpose of the change is to make it possible.

I abstained from mentioning the new function in any headers. Users can make a forward declaration if they need to change the namespace string.

Related

Fixes #95

Testing

Works well in my project. Bonds separately to the same host or to multiple hosts and bonding remains consistent and isolated.


Checklist

Before submitting a Pull Request, please ensure the following:

  • [x] 🚨 This PR does not introduce breaking changes.
  • [x] All CI checks (GH Actions) pass.
  • [x] Documentation is updated as needed.
  • [x] Tests are updated or added as necessary.
  • [x] Code is well-commented, especially in complex areas.
  • [x] Git history is clean — commits are squashed to the minimum necessary.

vodka-bears avatar May 24 '25 14:05 vodka-bears