Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Application Configuration . More...

Functions

uint8_t bt_mesh_app_key_add (uint16_t app_idx, uint16_t net_idx, const uint8_t key[16])
 Add an Application key.
 
uint8_t bt_mesh_app_key_update (uint16_t app_idx, uint16_t net_idx, const uint8_t key[16])
 Update an Application key.
 
uint8_t bt_mesh_app_key_del (uint16_t app_idx, uint16_t net_idx)
 Delete an Application key.
 
bool bt_mesh_app_key_exists (uint16_t app_idx)
 Check if an Application key is known.
 
ssize_t bt_mesh_app_keys_get (uint16_t net_idx, uint16_t app_idxs[], size_t max, off_t skip)
 Get a list of all known Application key indexes.
 

Detailed Description

Application Configuration .

Function Documentation

◆ bt_mesh_app_key_add()

uint8_t bt_mesh_app_key_add ( uint16_t app_idx,
uint16_t net_idx,
const uint8_t key[16] )

#include <zephyr/bluetooth/mesh/cfg.h>

Add an Application key.

Adds the Application with the given index to the list of known applications. Allows the node to send and receive model messages encrypted with this Application key.

Every Application is bound to a specific Subnet. The node must know the Subnet the Application is bound to before it can add the Application.

Parameters
app_idxApplication index.
net_idxNetwork index the Application is bound to.
keyApplication key value.
Return values
STATUS_SUCCESSThe Application was successfully added.
STATUS_INVALID_NETKEYThe NetIdx is unknown.
STATUS_INSUFF_RESOURCESThere's no room for storing this Application.
STATUS_INVALID_BINDINGThis AppIdx is already bound to another Subnet.
STATUS_IDX_ALREADY_STOREDThis AppIdx is already stored with a different key value.
STATUS_CANNOT_SETCannot set the Application key for some reason.

◆ bt_mesh_app_key_del()

uint8_t bt_mesh_app_key_del ( uint16_t app_idx,
uint16_t net_idx )

#include <zephyr/bluetooth/mesh/cfg.h>

Delete an Application key.

All models bound to this application will remove this binding. All models publishing with this application will stop publishing.

Parameters
app_idxApplication index.
net_idxNetwork index.
Return values
STATUS_SUCCESSThe Application key was successfully deleted.
STATUS_INVALID_NETKEYThe NetIdx is unknown.
STATUS_INVALID_BINDINGThis AppIdx is not bound to the given NetIdx.

◆ bt_mesh_app_key_exists()

bool bt_mesh_app_key_exists ( uint16_t app_idx)

#include <zephyr/bluetooth/mesh/cfg.h>

Check if an Application key is known.

Parameters
app_idxApplication index.
Returns
true if the Application is known, false otherwise.

◆ bt_mesh_app_key_update()

uint8_t bt_mesh_app_key_update ( uint16_t app_idx,
uint16_t net_idx,
const uint8_t key[16] )

#include <zephyr/bluetooth/mesh/cfg.h>

Update an Application key.

Update an Application with a second Application key, as part of the Key Refresh procedure of the bound Subnet. The node will continue transmitting with the old application key (but receiving on both) until the Subnet enters Key Refresh phase 2. Once the Subnet enters Key Refresh phase 3, the old application key will be deleted.

Note
The Application key can only be updated if the bound Subnet is in Key Refresh phase 1.
Parameters
app_idxApplication index.
net_idxNetwork index the Application is bound to, or BT_MESH_KEY_ANY to skip the binding check.
keyNew key value.
Return values
STATUS_SUCCESSThe Application key was successfully updated.
STATUS_INVALID_NETKEYThe NetIdx is unknown.
STATUS_INVALID_BINDINGThis AppIdx is not bound to the given NetIdx.
STATUS_CANNOT_UPDATEThe Application key cannot be updated for some reason.
STATUS_IDX_ALREADY_STOREDThis AppIdx is already updated with a different key value.

◆ bt_mesh_app_keys_get()

ssize_t bt_mesh_app_keys_get ( uint16_t net_idx,
uint16_t app_idxs[],
size_t max,
off_t skip )

#include <zephyr/bluetooth/mesh/cfg.h>

Get a list of all known Application key indexes.

Builds a list of all Application indexes for the given network index in the app_idxs array. If the app_idxs array cannot fit all bound Applications, this function fills all available entries and returns -ENOMEM. In this case, the next max entries of the list can be read out by calling

bt_mesh_app_keys_get(net_idx, list, max, max);
ssize_t bt_mesh_app_keys_get(uint16_t net_idx, uint16_t app_idxs[], size_t max, off_t skip)
Get a list of all known Application key indexes.

Note that any changes to the Application key list between calls to this function could change the order and number of entries in the list.

Parameters
net_idxNetwork Index to get the Applications of, or BT_MESH_KEY_ANY to get all Applications.
app_idxsArray to fill.
maxMax number of indexes to return.
skipNumber of indexes to skip. Enables batched processing of the list.
Returns
The number of indexes added to the app_idxs array, or -ENOMEM if the number of known Applications exceeds the max parameter.