38 #ifndef DEVICE_STATE_MANAGER_H__ 39 #define DEVICE_STATE_MANAGER_H__ 45 #include "nrf_mesh_config_app.h" 59 #define DSM_ADDR_MAX (DSM_VIRTUAL_ADDR_MAX + DSM_NONVIRTUAL_ADDR_MAX) 61 #define DSM_HANDLE_INVALID (0xFFFF) 64 #define DSM_KEY_INDEX_MAX (NRF_MESH_GLOBAL_KEY_INDEX_MAX) 72 #error "GATT proxy is currently not supported." 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 app_handle, nrf_mesh_secmat_t *p_secmat)
Retrieves the necessary security material for sending a mesh packet.
uint32_t dsm_address_subscription_virtual_add(const uint8_t *p_label_uuid, dsm_handle_t *p_address_handle)
Adds the specified virtual address to the global subscription list.
uint32_t dsm_subnet_kr_phase_get(dsm_handle_t subnet_handle, nrf_mesh_key_refresh_phase_t *p_phase)
Retrieves the current key refresh phase for a subnetwork.
bool dsm_has_unflashed_data(void)
Check whether there's data waiting to be flashed.
uint32_t dsm_subnet_update(dsm_handle_t subnet_handle, const uint8_t *p_key)
Updates an existing subnetwork key.
uint32_t dsm_devkey_handle_get(uint16_t unicast_address, dsm_handle_t *p_devkey_handle)
Obtains the handle for a device key.
uint32_t dsm_address_publish_add(uint16_t raw_address, dsm_handle_t *p_address_handle)
Adds an address to the DSM to be used as a publish address.
Network security material structure.
uint32_t dsm_address_subscription_count_get(dsm_handle_t address_handle, uint16_t *p_count)
Returns the number of subscriptions registered for an address in the global subscription list...
uint32_t dsm_address_get(dsm_handle_t address_handle, nrf_mesh_address_t *p_address)
Retrieves the address for a given address handle and fills out the given nrf_mesh_address_t structure...
const void * dsm_flash_area_get(void)
Get a pointer to the flash area used by the device state manager.
uint32_t dsm_appkey_update(dsm_handle_t app_handle, const uint8_t *p_key)
Updates an existing application key.
uint32_t dsm_address_publish_remove(dsm_handle_t address_handle)
Removes an address that has been used as a publish address.
Structure representing the unicast addresses assigned to this device.
uint32_t dsm_address_handle_get(const nrf_mesh_address_t *p_address, dsm_handle_t *p_address_handle)
Retrieves the address handle for a given nrf_mesh_address_t structure.
uint32_t dsm_address_publish_virtual_add(const uint8_t *p_label_uuid, dsm_handle_t *p_address_handle)
Adds a virtual address to the DSM to be used as a publish address.
uint16_t dsm_handle_t
DSM handle type, used for the handles returned for the each set of data added.
bool dsm_address_subscription_get(dsm_handle_t address_handle)
Returns whether the given address_handle is in the global subscription list.
uint32_t dsm_address_get_all(dsm_handle_t *p_address_handle_list, uint32_t *p_count)
Get a list of all address handles in the address pool.
uint32_t dsm_appkey_get_all(dsm_handle_t subnet_handle, mesh_key_index_t *p_key_list, uint32_t *p_count)
Retrieves all the application key indices of the stored application keys of a specific subnetwork...
dsm_handle_t dsm_net_key_index_to_subnet_handle(mesh_key_index_t net_key_index)
Retrieves the subnetwork handle for a given network key index.
Application security material structure.
uint32_t dsm_subnet_update_swap_keys(dsm_handle_t subnet_handle)
Starts using the new subnetwork key.
uint32_t dsm_devkey_delete(dsm_handle_t dev_handle)
Removes an existing device key from the device state storage.
uint32_t dsm_local_unicast_addresses_set(const dsm_local_unicast_address_t *p_address)
Set the unicast addresses of the device.
uint16_t mesh_key_index_t
Key index type, used for network key index and application key index.
uint32_t dsm_appkey_handle_to_appkey_index(dsm_handle_t appkey_handle, mesh_key_index_t *p_index)
Retrieves the application key index for a specified application key handle.
dsm_handle_t dsm_appkey_index_to_appkey_handle(mesh_key_index_t appkey_index)
Retrieves the application key handle for a given application key index.
dsm_handle_t dsm_subnet_handle_get(const nrf_mesh_network_secmat_t *p_secmat)
Retrieves the subnetwork handle for a given network security material structure.
Bluetooth Mesh security material structure.
uint32_t dsm_beacon_secmat_get(dsm_handle_t subnet_handle, const nrf_mesh_beacon_secmat_t **pp_beacon)
Retrieves the necessary security material for sending a mesh network beacon packet.
uint32_t dsm_subnet_delete(dsm_handle_t subnet_handle)
Removes an existing subnetwork from the device state storage.
uint32_t dsm_subnet_handle_to_netkey_index(dsm_handle_t subnet_handle, mesh_key_index_t *p_netkey_index)
Retrieves the key index for a subnetwork.
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 network security material from the given netkey index.
nrf_mesh_key_refresh_phase_t
Key refresh phase.
uint32_t dsm_appkey_add(mesh_key_index_t app_key_id, dsm_handle_t subnet_handle, const uint8_t *p_key, dsm_handle_t *p_app_handle)
Adds an application key and its associated application key index to the device state storage...
uint32_t dsm_address_subscription_add_handle(dsm_handle_t address_handle)
Adds a subscription to an existing address handle.
uint32_t dsm_address_subscription_remove(dsm_handle_t address_handle)
Removes the given address_handle from the global subscription list.
uint32_t dsm_address_publish_add_handle(dsm_handle_t address_handle)
Adds a publication to an existing address handle.
uint32_t dsm_subnet_add(mesh_key_index_t net_key_id, const uint8_t *p_key, dsm_handle_t *p_subnet_handle)
Adds a subnetwork and its associated network key index to the device state storage.
bool dsm_flash_config_load(void)
Load DSM state from flash, to recover state.
uint16_t address_start
First address in the range of unicast addresses.
uint32_t dsm_devkey_add(uint16_t raw_unicast_addr, dsm_handle_t subnet_handle, const uint8_t *p_key, dsm_handle_t *p_devkey_handle)
Adds a device key.
Security material for the Bluetooth Mesh network beacons.
uint16_t count
Number of addresses in the range of unicast addresses.
void dsm_local_unicast_addresses_get(dsm_local_unicast_address_t *p_address)
Get the local unicast address range of the device.
uint32_t dsm_subnet_get_all(mesh_key_index_t *p_key_list, uint32_t *p_count)
Retrieves all the network key indices of the stored subnetworks.
uint32_t dsm_appkey_delete(dsm_handle_t app_handle)
Removes an existing application key from the device state storage.
uint32_t dsm_address_subscription_add(uint16_t raw_address, dsm_handle_t *p_address_handle)
Adds the specified address to the global subscription list.
uint32_t dsm_subnet_update_commit(dsm_handle_t subnet_handle)
Commits to using the new subnetwork key.
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.
void dsm_init(void)
Initialize the device state manager.
dsm_handle_t dsm_appkey_handle_get(const nrf_mesh_application_secmat_t *p_secmat)
Retrieves the application key handle for a given application security material.