nRF5 SDK for Mesh v3.2.0  08c60f6
Mesh stack

High level management API for the mesh stack. More...

Data Structures

struct  mesh_stack_init_params_t
 Mesh stack configuration parameters. More...
 

Typedefs

typedef void(* mesh_stack_models_init_cb_t) (void)
 Models initialization callback. More...
 

Functions

uint32_t mesh_stack_init (const mesh_stack_init_params_t *p_init_params, bool *p_device_provisioned)
 Initialize the mesh stack. More...
 
uint32_t mesh_stack_start (void)
 Start dynamic behavior on the mesh stack. More...
 
uint32_t mesh_stack_provisioning_data_store (const nrf_mesh_prov_provisioning_data_t *p_prov_data, const uint8_t *p_devkey)
 Store received provisioning data in flash. More...
 
void mesh_stack_config_clear (void)
 Clear the saved configuration and network state of the mesh node. More...
 
bool mesh_stack_is_device_provisioned (void)
 Check if the device has been provisioned. More...
 
void mesh_stack_device_reset (void)
 Resets the device. More...
 
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. More...
 
health_server_t * mesh_stack_health_server_get (void)
 Gets a pointer to the Health Server instance in the primary element. More...
 

Detailed Description

High level management API for the mesh stack.

Functions for initializing and managing all mesh stack modules, including foundation models.

Typedef Documentation

◆ 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.

Function Documentation

◆ mesh_stack_init()

uint32_t mesh_stack_init ( const mesh_stack_init_params_t p_init_params,
bool *  p_device_provisioned 
)

Initialize the mesh stack.

This function initializes all mesh stack modules, including the foundation models.

Parameters
[in]p_init_paramsPointer to initialization parameter structure.
[out]p_device_provisionedReturns the device's provisioning state. Set to NULL if not required.
Return values
NRF_ERROR_NULLThe p_params parameter was NULL.
NRF_ERROR_INVALID_STATEThe device has already been configured.
NRF_ERROR_INVALID_PARAMOne or more of the parameters in the p_params structure were invalid.
NRF_SUCCESSInitialization 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_STATEThe mesh stack has not been initialized, or it has already been started.
NRF_SUCCESSThe mesh stack was successfully started.

◆ mesh_stack_provisioning_data_store()

uint32_t mesh_stack_provisioning_data_store ( const nrf_mesh_prov_provisioning_data_t p_prov_data,
const uint8_t *  p_devkey 
)

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_dataProvisioning data to be stored.
[in]p_devkeyDevice key to be stored.
Return values
NRF_SUCCESSStoring was successful.
NRF_ERROR_NULLUnexpected NULL pointer is given.
NRF_ERROR_FORBIDDENSome of the data has been set before, and the device state must be reset before they can be changed again.
NRF_ERROR_INVALID_DATAThe given address range is invalid or it overlaps with non-unicast type addresses.
NRF_ERROR_INVALID_PARAMOne or more of the parameters in the p_evt structure were invalid.
NRF_ERROR_NO_MEMThe subnetwork or device key storage is out of space,
See also
DSM_SUBNET_MAX or DSM_DEVICE_MAX.

◆ 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
trueThe device has been provisioned.
falseThe 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_startReturns 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_lengthReturns the length of the mesh stack persistent data.
Return values
NRF_SUCCESSThe parameters have successfully been populated.
NRF_ERROR_NULLOne 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.