nRF5 SDK for Mesh v3.2.0  08c60f6
Device State Manager

The Device State Manager provides a means for storing and retrieving Bluetooth Mesh state during operation. It handles: 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.
 
bool dsm_flash_config_load (void)
 Load DSM state from flash, to recover state. More...
 
bool dsm_has_unflashed_data (void)
 Check whether there's data waiting to be flashed. More...
 
const void * dsm_flash_area_get (void)
 Get a pointer to the flash area used by the device state manager. 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 section 7.2.2.2.3 in Bluetooth Mesh Profile Specification v1.0. 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_flash_config_load()

bool dsm_flash_config_load ( void  )

Load DSM state from flash, to recover state.

If this fails, the device will be unable to join any network it has previously been part of.

Returns
Whether there was any valid data available for loading from flash.

◆ dsm_has_unflashed_data()

bool dsm_has_unflashed_data ( void  )

Check whether there's data waiting to be flashed.

Returns
Whether there's data waiting to be flashed.

◆ dsm_flash_area_get()

const void* dsm_flash_area_get ( void  )

Get a pointer to the flash area used by the device state manager.

Returns
A pointer to the device state manager flash area.

◆ 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 section 7.2.2.2.3 in Bluetooth Mesh Profile Specification v1.0.

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.