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:
- Address storage - both for subscription and publishing.
- Network key management - Generate and store network security material for mesh rx and tx, as well as beacon and connectable advertisements.
- Application key management - Generate and store application security material for mesh rx and tx.
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_FOUND Device State Manager metadata was not found. NRF_ERROR_INVALID_DATA Data stored in the persistent memory was corrupted. NRF_SUCCESS Data 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_handle The subnet handle of the network key used in the transmission. [in] app_handle The application handle of the application key used in the transmission. [in,out] p_secmat Pointer to the structure for the application and master network security material for a mesh packet.
- Return values
-
NRF_SUCCESS The requested network and application security materials successfully populated the p_secmat.NRF_ERROR_NOT_FOUND The given application handle is not valid. NRF_ERROR_NULL An unexpected NULL pointer is given. NRF_ERROR_INVALID_STATE There 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_handle The handle of the subnetwork the beacon represents. [in,out] pp_beacon_info Pointer to the beacon info structure pointer.
- Return values
-
NRF_SUCCESS The pp_beacon_infohas been successfully populated.NRF_ERROR_NOT_FOUND The given subnetwork handle is not valid. NRF_ERROR_NULL An 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_handle The handle of the subnetwork the node identity key belongs to. [in,out] pp_identity Pointer to the identity key list pointer.
- Return values
-
NRF_SUCCESS The identity key for the given subnetwork is successfully returned via pp_identity.NRF_ERROR_NOT_FOUND The given subnetwork handle is not valid. NRF_ERROR_NULL An unexpected NULL pointer is given. NRF_ERROR_NOT_SUPPORTED This 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_index Netkey index for which security material will be retrived. [out] pp_net Pointer to a variable where the security material pointer is stored.
- Return values
-
NRF_SUCCESS Security material is retrived successfully. NRF_ERROR_NULL pp_netis a null pointer.NRF_ERROR_NOT_FOUND Security material is not found for the given netkey index.