Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS

Subnet Configuration. More...

Functions

uint8_t bt_mesh_subnet_add (uint16_t net_idx, const uint8_t key[16])
 Add a Subnet. More...
 
uint8_t bt_mesh_subnet_update (uint16_t net_idx, const uint8_t key[16])
 Update the given Subnet. More...
 
uint8_t bt_mesh_subnet_del (uint16_t net_idx)
 Delete a Subnet. More...
 
bool bt_mesh_subnet_exists (uint16_t net_idx)
 Check whether a Subnet is known. More...
 
uint8_t bt_mesh_subnet_kr_phase_set (uint16_t net_idx, uint8_t *phase)
 Set the Subnet's Key Refresh phase. More...
 
uint8_t bt_mesh_subnet_kr_phase_get (uint16_t net_idx, uint8_t *phase)
 Get the Subnet's Key Refresh phase. More...
 
uint8_t bt_mesh_subnet_node_id_set (uint16_t net_idx, enum bt_mesh_feat_state node_id)
 Set the Node Identity state of the Subnet. More...
 
uint8_t bt_mesh_subnet_node_id_get (uint16_t net_idx, enum bt_mesh_feat_state *node_id)
 Get the Node Identity state of the Subnet. More...
 
ssize_t bt_mesh_subnets_get (uint16_t net_idxs[], size_t max, off_t skip)
 Get a list of all known Subnet indexes. More...
 

Detailed Description

Subnet Configuration.

Function Documentation

◆ bt_mesh_subnet_add()

uint8_t bt_mesh_subnet_add ( uint16_t  net_idx,
const uint8_t  key[16] 
)

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

Add a Subnet.

Adds a subnet with the given network index and network key to the list of known Subnets. All messages sent on the given Subnet will be processed by this node, and the node may send and receive Network Beacons on the given Subnet.

Parameters
net_idxNetwork index.
keyRoot network key of the Subnet. All other keys are derived from this.
Return values
STATUS_SUCCESSThe Subnet was successfully added.
STATUS_INSUFF_RESOURCESNo room for this Subnet.
STATUS_UNSPECIFIEDThe Subnet couldn't be created for some reason.

◆ bt_mesh_subnet_del()

uint8_t bt_mesh_subnet_del ( uint16_t  net_idx)

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

Delete a Subnet.

Removes the Subnet with the given network index from the node. The node will stop sending Network Beacons with the given Subnet, and can no longer process messages on this Subnet.

All Applications bound to this Subnet are also deleted.

Parameters
net_idxNetwork index.
Return values
STATUS_SUCCESSThe Subnet was deleted.
STATUS_INVALID_NETKEYThe NetIdx is unknown.

◆ bt_mesh_subnet_exists()

bool bt_mesh_subnet_exists ( uint16_t  net_idx)

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

Check whether a Subnet is known.

Parameters
net_idxNetwork index
Returns
true if a Subnet with the given index exists, false otherwise.

◆ bt_mesh_subnet_kr_phase_get()

uint8_t bt_mesh_subnet_kr_phase_get ( uint16_t  net_idx,
uint8_t phase 
)

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

Get the Subnet's Key Refresh phase.

Parameters
net_idxNetwork index.
phasePointer to the Key Refresh variable to fill.
Return values
STATUS_SUCCESSSuccessfully populated the phase variable.
STATUS_INVALID_NETKEYThe NetIdx is unknown.

◆ bt_mesh_subnet_kr_phase_set()

uint8_t bt_mesh_subnet_kr_phase_set ( uint16_t  net_idx,
uint8_t phase 
)

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

Set the Subnet's Key Refresh phase.

The Key Refresh procedure is started by updating the Subnet keys through bt_mesh_subnet_update. This puts the Subnet in Key Refresh Phase 1. Once all nodes have received the new Subnet key, Key Refresh Phase 2 can be activated through this function to start transmitting with the new network key. Finally, to revoke the old key, set the Key Refresh Phase to 3. This removes the old keys from the node, and returns the Subnet back to normal single-key operation with the new key set.

Parameters
net_idxNetwork index.
phasePointer to the new Key Refresh phase. Will return the actual Key Refresh phase after updating.
Return values
STATUS_SUCCESSThe Key Refresh phase of the Subnet was successfully changed.
STATUS_INVALID_NETKEYThe NetIdx is unknown.
STATUS_CANNOT_UPDATEThe given phase change is invalid.

◆ bt_mesh_subnet_node_id_get()

uint8_t bt_mesh_subnet_node_id_get ( uint16_t  net_idx,
enum bt_mesh_feat_state node_id 
)

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

Get the Node Identity state of the Subnet.

Parameters
net_idxNetwork index.
node_idNode Identity variable to fill.
Return values
STATUS_SUCCESSSuccessfully populated the node_id variable.
STATUS_INVALID_NETKEYThe NetIdx is unknown.

◆ bt_mesh_subnet_node_id_set()

uint8_t bt_mesh_subnet_node_id_set ( uint16_t  net_idx,
enum bt_mesh_feat_state  node_id 
)

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

Set the Node Identity state of the Subnet.

The Node Identity state of a Subnet determines whether the Subnet advertises connectable Node Identity beacons for Proxy Clients to connect to. Once started, the Node Identity beacon runs for 60 seconds, or until it is stopped.

This function serves the same purpose as bt_mesh_proxy_identity_enable, but only acts on a single Subnet.

GATT Proxy support must be enabled through

embed:rst:inline :kconfig:`CONFIG_BT_MESH_GATT_PROXY` 

.

Parameters
net_idxNetwork index.
node_idNew Node Identity state, must be either BT_MESH_FEATURE_ENABLED or BT_MESH_FEATURE_DISABLED.
Return values
STATUS_SUCCESSSuccessfully set the Node Identity state of the Subnet.
STATUS_INVALID_NETKEYThe NetIdx is unknown.
STATUS_FEAT_NOT_SUPPThe Node Identity feature is not supported.
STATUS_CANNOT_SETCouldn't set the Node Identity state.

◆ bt_mesh_subnet_update()

uint8_t bt_mesh_subnet_update ( uint16_t  net_idx,
const uint8_t  key[16] 
)

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

Update the given Subnet.

Starts the Key Refresh procedure for this Subnet by adding a second set of encryption keys. The Subnet will continue sending with the old key (but receiving messages using both) until the Subnet enters Key Refresh phase 2.

This allows a network configurator to replace old network and application keys for the entire network, effectively removing access for all nodes that aren't given the new keys.

Parameters
net_idxNetwork index.
keyNew root network key of the Subnet.
Return values
STATUS_SUCCESSThe Subnet was updated with a second key.
STATUS_INVALID_NETKEYThe NetIdx is unknown.
STATUS_IDX_ALREADY_STOREDThe key value is the same as the current key.
STATUS_CANNOT_UPDATEThe Subnet cannot be updated for some reason.

◆ bt_mesh_subnets_get()

ssize_t bt_mesh_subnets_get ( uint16_t  net_idxs[],
size_t  max,
off_t  skip 
)

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

Get a list of all known Subnet indexes.

Builds a list of all known Subnet indexes in the net_idxs array. If the net_idxs array is smaller than the list of known Subnets, 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_subnets_get(list, max, max);
ssize_t bt_mesh_subnets_get(uint16_t net_idxs[], size_t max, off_t skip)
Get a list of all known Subnet indexes.

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

Parameters
net_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 net_idxs array, or -ENOMEM if the number of known Subnets exceeds the max parameter.