Bluetooth Mesh Subnet Configuration.
More...
Bluetooth Mesh Subnet Configuration.
◆ bt_mesh_subnet_add()
uint8_t bt_mesh_subnet_add |
( |
uint16_t |
net_idx, |
|
|
const uint8_t |
key[16] |
|
) |
| |
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_idx | Network index. |
key | Root network key of the Subnet. All other keys are derived from this. |
- Return values
-
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. |
◆ bt_mesh_subnet_del()
uint8_t bt_mesh_subnet_del |
( |
uint16_t |
net_idx | ) |
|
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
-
- Return values
-
STATUS_SUCCESS | The Subnet was deleted. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
◆ bt_mesh_subnet_exists()
bool bt_mesh_subnet_exists |
( |
uint16_t |
net_idx | ) |
|
Check whether a Subnet is known.
- Parameters
-
- 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 |
|
) |
| |
Get the Subnet's Key Refresh phase.
- Parameters
-
net_idx | Network index. |
phase | Pointer to the Key Refresh variable to fill. |
- Return values
-
STATUS_SUCCESS | Successfully populated the phase variable. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
◆ bt_mesh_subnet_kr_phase_set()
uint8_t bt_mesh_subnet_kr_phase_set |
( |
uint16_t |
net_idx, |
|
|
uint8_t * |
phase |
|
) |
| |
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_idx | Network index. |
phase | Pointer to the new Key Refresh phase. Will return the actual Key Refresh phase after updating. |
- Return values
-
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. |
◆ 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 |
|
) |
| |
Get the Node Identity state of the Subnet.
- Parameters
-
net_idx | Network index. |
node_id | Node Identity variable to fill. |
- Return values
-
STATUS_SUCCESS | Successfully populated the node_id variable. |
STATUS_INVALID_NETKEY | The NetIdx is unknown. |
◆ bt_mesh_subnet_node_id_set()
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 @option{CONFIG_BT_MESH_GATT_PROXY}.
- Parameters
-
- Return values
-
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. |
◆ bt_mesh_subnet_update()
uint8_t bt_mesh_subnet_update |
( |
uint16_t |
net_idx, |
|
|
const uint8_t |
key[16] |
|
) |
| |
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_idx | Network index. |
key | New root network key of the Subnet. |
- Return values
-
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. |
◆ bt_mesh_subnets_get()
ssize_t bt_mesh_subnets_get |
( |
uint16_t |
net_idxs[], |
|
|
size_t |
max, |
|
|
off_t |
skip |
|
) |
| |
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
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_idxs | Array to fill. |
max | Max number of indexes to return. |
skip | Number 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.