Zephyr Project API 3.7.0
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. | |
uint8_t | bt_mesh_subnet_update (uint16_t net_idx, const uint8_t key[16]) |
Update the given Subnet. | |
uint8_t | bt_mesh_subnet_del (uint16_t net_idx) |
Delete a Subnet. | |
bool | bt_mesh_subnet_exists (uint16_t net_idx) |
Check whether a Subnet is known. | |
uint8_t | bt_mesh_subnet_kr_phase_set (uint16_t net_idx, uint8_t *phase) |
Set the Subnet's Key Refresh phase. | |
uint8_t | bt_mesh_subnet_kr_phase_get (uint16_t net_idx, uint8_t *phase) |
Get the Subnet's Key Refresh phase. | |
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. | |
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. | |
uint8_t | bt_mesh_subnet_priv_node_id_set (uint16_t net_idx, enum bt_mesh_feat_state priv_node_id) |
Set the Private Node Identity state of the Subnet. | |
uint8_t | bt_mesh_subnet_priv_node_id_get (uint16_t net_idx, enum bt_mesh_feat_state *priv_node_id) |
Get the Private Node Identity state of the Subnet. | |
ssize_t | bt_mesh_subnets_get (uint16_t net_idxs[], size_t max, off_t skip) |
Get a list of all known Subnet indexes. | |
Subnet Configuration.
#include <include/zephyr/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.
net_idx | Network index. |
key | Root network key of the Subnet. All other keys are derived from this. |
STATUS_SUCCESS | The Subnet was successfully added. |
STATUS_INSUFF_RESOURCES | No room for this Subnet. |
STATUS_UNSPECIFIED | The Subnet couldn't be created for some reason. |
#include <include/zephyr/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.
net_idx | Network index. |
STATUS_SUCCESS | The Subnet was deleted. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
#include <include/zephyr/bluetooth/mesh/cfg.h>
Check whether a Subnet is known.
net_idx | Network index |
#include <include/zephyr/bluetooth/mesh/cfg.h>
Get the Subnet's Key Refresh phase.
net_idx | Network index. |
phase | Pointer to the Key Refresh variable to fill. |
STATUS_SUCCESS | Successfully populated the phase variable. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
#include <include/zephyr/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.
net_idx | Network index. |
phase | Pointer to the new Key Refresh phase. Will return the actual Key Refresh phase after updating. |
STATUS_SUCCESS | The Key Refresh phase of the Subnet was successfully changed. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
STATUS_CANNOT_UPDATE | The given phase change is invalid. |
uint8_t bt_mesh_subnet_node_id_get | ( | uint16_t | net_idx, |
enum bt_mesh_feat_state * | node_id | ||
) |
#include <include/zephyr/bluetooth/mesh/cfg.h>
Get the Node Identity state of the Subnet.
net_idx | Network index. |
node_id | Node Identity variable to fill. |
STATUS_SUCCESS | Successfully populated the node_id variable. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
uint8_t bt_mesh_subnet_node_id_set | ( | uint16_t | net_idx, |
enum bt_mesh_feat_state | node_id | ||
) |
#include <include/zephyr/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 CONFIG_BT_MESH_GATT_PROXY
.
net_idx | Network index. |
node_id | New Node Identity state, must be either BT_MESH_FEATURE_ENABLED or BT_MESH_FEATURE_DISABLED. |
STATUS_SUCCESS | Successfully set the Node Identity state of the Subnet. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
STATUS_FEAT_NOT_SUPP | The Node Identity feature is not supported. |
STATUS_CANNOT_SET | Couldn't set the Node Identity state. |
uint8_t bt_mesh_subnet_priv_node_id_get | ( | uint16_t | net_idx, |
enum bt_mesh_feat_state * | priv_node_id | ||
) |
#include <include/zephyr/bluetooth/mesh/cfg.h>
Get the Private Node Identity state of the Subnet.
net_idx | Network index. |
priv_node_id | Private Node Identity variable to fill. |
STATUS_SUCCESS | Successfully populated the priv_node_id variable. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
uint8_t bt_mesh_subnet_priv_node_id_set | ( | uint16_t | net_idx, |
enum bt_mesh_feat_state | priv_node_id | ||
) |
#include <include/zephyr/bluetooth/mesh/cfg.h>
Set the Private Node Identity state of the Subnet.
The Private Node Identity state of a Subnet determines whether the Subnet advertises connectable Private Node Identity beacons for Proxy Clients to connect to. Once started, the Node Identity beacon runs for 60 seconds, or until it is stopped.
Private Node Identity can only be enabled if regular Node Identity is not enabled for any subnet.
GATT Proxy and Private Beacon support must be enabled through CONFIG_BT_MESH_GATT_PROXY
and CONFIG_BT_MESH_PRIV_BEACONS
.
net_idx | Network index. |
priv_node_id | New Private Node Identity state, must be either BT_MESH_FEATURE_ENABLED or BT_MESH_FEATURE_DISABLED. |
STATUS_SUCCESS | Successfully set the Private Node Identity state of the Subnet. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
STATUS_FEAT_NOT_SUPP | The Private Node Identity feature is not supported. |
STATUS_TEMP_STATE_CHG_FAIL | The Private Node Identity state cannot be enabled, because Node Identity state is already enabled. |
STATUS_CANNOT_SET | Couldn't set the Private Node Identity state. |
#include <include/zephyr/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.
net_idx | Network index. |
key | New root network key of the Subnet. |
STATUS_SUCCESS | The Subnet was updated with a second key. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
STATUS_IDX_ALREADY_STORED | The key value is the same as the current key. |
STATUS_CANNOT_UPDATE | The Subnet cannot be updated for some reason. |
#include <include/zephyr/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
Note that any changes to the Subnet list between calls to this function could change the order and number of entries in the list.
net_idxs | Array to fill. |
max | Max number of indexes to return. |
skip | Number of indexes to skip. Enables batched processing of the list. |
net_idxs
array, or -ENOMEM
if the number of known Subnets exceeds the max
parameter.