I'm working on a project that implements multiple virtual keyboard devices.
When switching devices I call NimBLEDevice::deinit(true) and then reinitialize again with init(). It works fine, but I'm limited in the number of devices by the nimble bond store. What's worse is that pairing/unpairing multiple devices on one virtual device can break bonding on others.
What would be ideal is a way to change NimBLE's NVS namespace name - that would keep bound devices for each virtual device separate.
I've hacked this by redefining NIMBLE_NVS_NAMESPACE in ble_store_nvs.c
//#define NIMBLE_NVS_NAMESPACE "nimble_bond"
const char* NIMBLE_NVS_NAMESPACE = "nimble_bond";
and updating it in my code:
extern const char* NIMBLE_NVS_NAMESPACE;
// deinit before
sprintf(nvsName, "nimble_bond_%i", virtualDeviceIndex);
NIMBLE_NVS_NAMESPACE = nvsName;
// reinit after
The above works, but an official way to do this would be nice.
(Also open to suggestions for an existing correct way to do this).
I'm working on a project that implements multiple virtual keyboard devices.
When switching devices I call
NimBLEDevice::deinit(true)and then reinitialize again withinit(). It works fine, but I'm limited in the number of devices by the nimble bond store. What's worse is that pairing/unpairing multiple devices on one virtual device can break bonding on others.What would be ideal is a way to change NimBLE's NVS namespace name - that would keep bound devices for each virtual device separate.
I've hacked this by redefining
NIMBLE_NVS_NAMESPACEinble_store_nvs.cand updating it in my code:
The above works, but an official way to do this would be nice.
(Also open to suggestions for an existing correct way to do this).