nRF5 SDK for Mesh v5.0.0
Modules | Functions
Device State Manager

The Device State Manager provides a means for storing and retrieving Bluetooth Mesh state during operation. More...

Modules

 Defines
 Device State Manager defines.
 
 Types
 Device State Manager types.
 
 Address management
 Functions for managing the set of addresses known to the device.
 
 Key management
 Functions for managing the set of encryption keys known to the device.
 

Functions

void dsm_init (void)
 Initialize the device state manager.
 
uint32_t dsm_load_config_apply (void)
 Apply data loaded from the mesh configuration system into Device State Manager structures. More...
 
void dsm_clear (void)
 Clear all stored state in the Device State Manager, including flash state.
 
uint32_t dsm_tx_secmat_get (dsm_handle_t subnet_handle, dsm_handle_t app_handle, nrf_mesh_secmat_t *p_secmat)
 Retrieves the necessary application and master network security material for sending a mesh packet. More...
 
uint32_t dsm_beacon_info_get (dsm_handle_t subnet_handle, const nrf_mesh_beacon_info_t **pp_beacon_info)
 Retrieves the necessary info for sending a mesh network beacon packet. More...
 
uint32_t dsm_proxy_identity_get (dsm_handle_t subnet_handle, const uint8_t **pp_identity)
 Retrieves the identity key for advertising with node identity, see Bluetooth Mesh Profile Specification (MshPRFv1.0.1) section 7.2.2.2.3. More...
 
uint32_t dsm_net_secmat_from_keyindex_get (mesh_key_index_t net_key_index, const nrf_mesh_network_secmat_t **pp_net)
 Retrives the master network security material from the given netkey index. More...
 

Detailed Description

The Device State Manager provides a means for storing and retrieving Bluetooth Mesh state during operation.

It handles:

Function Documentation

◆ dsm_load_config_apply()

uint32_t dsm_load_config_apply ( void  )

Apply data loaded from the mesh configuration system into Device State Manager structures.

Note
Actual metadata is restored automatically if it was not found or if read out data is not equal configuration parameters.
Return values
NRF_ERROR_NOT_FOUNDDevice State Manager metadata was not found.
NRF_ERROR_INVALID_DATAData stored in the persistent memory was corrupted.
NRF_SUCCESSData was restored and applied successfully.

◆ dsm_tx_secmat_get()

uint32_t dsm_tx_secmat_get ( dsm_handle_t  subnet_handle,
dsm_handle_t  app_handle,
nrf_mesh_secmat_t p_secmat 
)

Retrieves the necessary application and master network security material for sending a mesh packet.

It is possible to set the subnet_handle to DSM_HANDLE_INVALID value. In this case, the DSM will try to find the network key bound to the application key.

Parameters
[in]subnet_handleThe subnet handle of the network key used in the transmission.
[in]app_handleThe application handle of the application key used in the transmission.
[in,out]p_secmatPointer to the structure for the application and master network security material for a mesh packet.
Return values
NRF_SUCCESSThe requested network and application security materials successfully populated the p_secmat.
NRF_ERROR_NOT_FOUNDThe given application handle is not valid.
NRF_ERROR_NULLAn unexpected NULL pointer is given.
NRF_ERROR_INVALID_STATEThere are no allocated subnets.

◆ dsm_beacon_info_get()

uint32_t dsm_beacon_info_get ( dsm_handle_t  subnet_handle,
const nrf_mesh_beacon_info_t **  pp_beacon_info 
)

Retrieves the necessary info for sending a mesh network beacon packet.

Parameters
[in]subnet_handleThe handle of the subnetwork the beacon represents.
[in,out]pp_beacon_infoPointer to the beacon info structure pointer.
Return values
NRF_SUCCESSThe pp_beacon_info has been successfully populated.
NRF_ERROR_NOT_FOUNDThe given subnetwork handle is not valid.
NRF_ERROR_NULLAn unexpected NULL pointer is given.

◆ dsm_proxy_identity_get()

uint32_t dsm_proxy_identity_get ( dsm_handle_t  subnet_handle,
const uint8_t **  pp_identity 
)

Retrieves the identity key for advertising with node identity, see Bluetooth Mesh Profile Specification (MshPRFv1.0.1) section 7.2.2.2.3.

Parameters
[in]subnet_handleThe handle of the subnetwork the node identity key belongs to.
[in,out]pp_identityPointer to the identity key list pointer.
Return values
NRF_SUCCESSThe identity key for the given subnetwork is successfully returned via pp_identity.
NRF_ERROR_NOT_FOUNDThe given subnetwork handle is not valid.
NRF_ERROR_NULLAn unexpected NULL pointer is given.
NRF_ERROR_NOT_SUPPORTEDThis function needs the GATT proxy feautre enabled.

◆ dsm_net_secmat_from_keyindex_get()

uint32_t dsm_net_secmat_from_keyindex_get ( mesh_key_index_t  net_key_index,
const nrf_mesh_network_secmat_t **  pp_net 
)

Retrives the master network security material from the given netkey index.

Parameters
[in]net_key_indexNetkey index for which security material will be retrived.
[out]pp_netPointer to a variable where the security material pointer is stored.
Return values
NRF_SUCCESSSecurity material is retrived successfully.
NRF_ERROR_NULLpp_net is a null pointer.
NRF_ERROR_NOT_FOUNDSecurity material is not found for the given netkey index.

Documentation feedback | Developer Zone | Subscribe | Updated