Hi,
I'm using nRF52840 with mesh 2.0.0 and started from the light switch example to build my own application. I have now 2 type of boards master (client+provisionner) and slaves (server).
In case of a change of the master (client +provisioner) the slave boards have to delete their mesh information stored in flash and start again.
Currently, I do that by erasing the flash memory of the ship and reflash the code again which is a manual task! or by using the code provided in the switch light example and calling :
void mesh_stack_config_clear(void) { access_clear(); dsm_clear(); net_state_reset(); }
which will generate CONFIG_SERVER_EVT_NODE_RESET event to reset the chip something that I can't have in my application.
I tried to call nrf_mesh_prov_listen_stop() but it always indicate invalid state.
uint32_t nrf_mesh_prov_listen_stop(nrf_mesh_prov_ctx_t * p_ctx) { if (p_ctx == NULL) { return NRF_ERROR_NULL; } else if (p_ctx->state != NRF_MESH_PROV_STATE_WAIT_LINK) { return NRF_ERROR_INVALID_STATE; } prov_bearer_t * p_bearer; LIST_FOREACH(p_item, p_ctx->p_bearers) { p_bearer = PARENT_BY_FIELD_GET(prov_bearer_t, node, p_item); /* Try stopping listening on all available bearers. */ (void) p_bearer->p_interface->listen_stop(p_bearer); } p_ctx->state = NRF_MESH_PROV_STATE_IDLE; return NRF_SUCCESS; }
The only place where the state variable is set to NRF_MESH_PROV_STATE_WAIT_LINK is in the provisioner so I think stopping the prov listening mode with this function is not possible.
How can I achieve this with in a propre way ?
Thank you
/Chaabane