nRF5 SDK for Mesh v5.0.0
Functions
Device key management

Device key management. More...

Functions

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. More...
 
uint32_t dsm_devkey_delete (dsm_handle_t dev_handle)
 Removes an existing device key from the device state storage. More...
 
uint32_t dsm_devkey_handle_get (uint16_t unicast_address, dsm_handle_t *p_devkey_handle)
 Obtains the handle for a device key. More...
 

Detailed Description

Device key management.

Function Documentation

◆ dsm_devkey_add()

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.

Note
"A device key is implicitly bound to all network keys." see Bluetooth Mesh Profile Specification (MshPRFv1.0.1), section 3.8.6. An exception to this is the provisioner who stores all the device keys of the other nodes, see section 5.
Parameters
[in]raw_unicast_addrUnicast address associated with this device key.
[in]subnet_handleDSM handle for the subnet this device key is being added, must be a valid network handle.
[in]p_keyThe device key, it must be NRF_MESH_KEY_SIZE bytes.
[in,out]p_devkey_handleThe handle for the device key.
Return values
NRF_SUCCESSThe device key has been added successfully.
NRF_ERROR_NULLUnexpected NULL pointer is given.
NRF_ERROR_FORBIDDENThe given device key has already been added before.
NRF_ERROR_INVALID_PARAMSThe given address isn't a unicast address.
NRF_ERROR_NO_MEMThe device key storage is out of space,
See also
DSM_DEVICE_MAX.

◆ dsm_devkey_delete()

uint32_t dsm_devkey_delete ( dsm_handle_t  dev_handle)

Removes an existing device key from the device state storage.

Parameters
[in]dev_handleThe handle for the existing device key.
Return values
NRF_SUCCESSThe given device handle has been freed successfully.
NRF_ERROR_FORBIDDENThe given device key handle is the local device key, which cannot be deleted.
NRF_ERROR_NOT_FOUNDThe given device handle is not valid.

◆ dsm_devkey_handle_get()

uint32_t dsm_devkey_handle_get ( uint16_t  unicast_address,
dsm_handle_t p_devkey_handle 
)

Obtains the handle for a device key.

Parameters
[in]unicast_addressUnicast address of the node to look up the device key for.
[out]p_devkey_handlePointer to a variable where the handle of the retrieved device key is stored.
Return values
NRF_SUCCESSThe device key handle was successfully found.
NRF_ERROR_NULLAn unexpected NULL pointer was passed for the p_devkey_handle parameter.
NRF_ERROR_INVALID_ADDRThe specified address was invalid.
NRF_ERROR_NOT_FOUNDThe device key for the specified address was not found.

Documentation feedback | Developer Zone | Subscribe | Updated