High level management API for the mesh stack.
More...
High level management API for the mesh stack.
Functions for initializing and managing all mesh stack modules, including foundation models.
◆ mesh_stack_models_init_cb_t
typedef void(* mesh_stack_models_init_cb_t) (void) |
Models initialization callback.
This function is called to allow an application to initialize any models it needs before configuration starts.
Definition at line 61 of file mesh_stack.h.
◆ mesh_stack_init()
Initialize the mesh stack.
This function initializes all mesh stack modules, including the foundation models.
- Parameters
-
[in] | p_init_params | Pointer to initialization parameter structure. |
[out] | p_device_provisioned | Returns the device's provisioning state. Set to NULL if not required. |
- Return values
-
NRF_ERROR_NULL | The p_params parameter was NULL . |
NRF_ERROR_INVALID_STATE | The device has already been configured. |
NRF_ERROR_INVALID_DATA | Data in the persistent memory was corrupted. Stack is reset to default settings, all persistent data is lost. Device requires reset to start as unprovisioned one. |
- Warning
- After this status, no mesh API functions can be called since it might cause unpredictable behavior.
- Return values
-
NRF_ERROR_INVALID_PARAM | One or more of the parameters in the p_params structure were invalid. |
NRF_SUCCESS | Initialization was successful. |
◆ mesh_stack_start()
uint32_t mesh_stack_start |
( |
void |
| ) |
|
Start dynamic behavior on the mesh stack.
- Warning
- After calling this function, no mesh API functions can be called from an IRQ priority other than the one specified in nrf_mesh_init_params_t::irq_priority.
- Return values
-
NRF_ERROR_INVALID_STATE | The mesh stack has not been initialized, or it has already been started. |
NRF_SUCCESS | The mesh stack was successfully started. |
◆ mesh_stack_power_down()
void mesh_stack_power_down |
( |
void |
| ) |
|
Start the power down procedure.
The function stops timer scheduler (timeslot system still works to store MESH_CONFIG_STRATEGY_ON_POWER_DOWN files, app_timer works as well). The function stops and disables scanner, advertiser, bearer handler and GATT functionality. When the power down procedure has been completed, the event NRF_MESH_EVT_READY_TO_POWER_OFF is generated and the stack is ready for power off.
- Warning
- After calling this function, no mesh API functions can be called since it might cause unpredictable behavior.
◆ mesh_stack_provisioning_data_store()
Store received provisioning data in flash.
This function also binds the config server to the device key, and propagates the IV index to the network state module.
- Parameters
-
[in] | p_prov_data | Provisioning data to be stored. |
[in] | p_devkey | Device key to be stored. |
- Return values
-
NRF_SUCCESS | Storing was successful. |
NRF_ERROR_NULL | Unexpected NULL pointer is given. |
NRF_ERROR_FORBIDDEN | Some of the data has been set before, and the device state must be reset before they can be changed again. |
NRF_ERROR_INVALID_DATA | The given address range is invalid or it overlaps with non-unicast type addresses. |
NRF_ERROR_INVALID_PARAM | One or more of the parameters in the p_evt structure were invalid. |
NRF_ERROR_NO_MEM | The subnetwork or device key storage is out of space, |
- See also
- DSM_SUBNET_MAX or DSM_DEVICE_MAX.
- Return values
-
NRF_ERROR_NOT_FOUND | Config server is not initialized. |
◆ mesh_stack_config_clear()
void mesh_stack_config_clear |
( |
void |
| ) |
|
Clear the saved configuration and network state of the mesh node.
This is a factory reset of the mesh stack.
◆ mesh_stack_is_device_provisioned()
bool mesh_stack_is_device_provisioned |
( |
void |
| ) |
|
Check if the device has been provisioned.
- Return values
-
true | The device has been provisioned. |
false | The device has not been provisioned. |
◆ mesh_stack_device_reset()
void mesh_stack_device_reset |
( |
void |
| ) |
|
Resets the device.
- Warning
- This function will return if there are any pending flash operations. In that case, the application should return from any function blocking the mesh from processing. When the flash operations are complete. The device will be reset.
◆ mesh_stack_persistence_flash_usage()
uint32_t mesh_stack_persistence_flash_usage |
( |
const uint32_t ** |
pp_start, |
|
|
uint32_t * |
p_length |
|
) |
| |
Gets which flash areas used by the mesh stack for storing persistent data.
- Parameters
-
[in,out] | pp_start | Returns a pointer to the first word used by the mesh stack for storing persistent data, or NULL if no flash space is used for persistent data. |
[in,out] | p_length | Returns the length of the mesh stack persistent data. |
- Return values
-
NRF_SUCCESS | The parameters have successfully been populated. |
NRF_ERROR_NULL | One or more of the parameters were NULL. |
◆ mesh_stack_health_server_get()
health_server_t* mesh_stack_health_server_get |
( |
void |
| ) |
|
Gets a pointer to the Health Server instance in the primary element.
- Note
- The Health Server is initialized and added by the mesh stack module, and the pointer should only be used for interacting with the Health Server API.
- Returns
- A pointer to the Health Server instance in the mesh stack.