Bluetooth: Mesh: Add missing Configuration Client API

Add missing API:
- Delete all group addresses in a SIG model's subscription list
- Update a network key
- Update an application key
- Get/Set Node Identity parameters
- Set virtual addtess for a SIG model
- Get/Set Key Refresh Procedures

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
This commit is contained in:
Agata Ponitka 2021-03-02 10:49:14 +01:00 committed by Johan Hedberg
commit 22aafd422c
2 changed files with 626 additions and 6 deletions

View file

@ -80,6 +80,32 @@ int bt_mesh_cfg_comp_data_get(uint16_t net_idx, uint16_t addr, uint8_t page,
*/
int bt_mesh_cfg_beacon_get(uint16_t net_idx, uint16_t addr, uint8_t *status);
/** @brief Get the target node's network key refresh phase state.
* @param net_idx Network index to encrypt with.
* @param addr Target node address.
* @param key_net_idx Network key index.
* @param status Status response parameter.
* @param phase Pointer to the Key Refresh variable to fill.
*
* @return 0 on success, or (negative) error code on failure.
*/
int bt_mesh_cfg_krp_get(uint16_t net_idx, uint16_t addr, uint16_t key_net_idx,
uint8_t *status, uint8_t *phase);
/** @brief Set the target node's network key refresh phase parameters.
* @param net_idx Network index to encrypt with.
* @param addr Target node address.
* @param key_net_idx Network key index.
* @param transition Transition parameter.
* @param status Status response parameter.
* @param phase Pointer to the new Key Refresh phase. Will return the actual
* Key Refresh phase after updating.
*
* @return 0 on success, or (negative) error code on failure.
*/
int bt_mesh_cfg_krp_set(uint16_t net_idx, uint16_t addr, uint16_t key_net_idx,
uint8_t transition, uint8_t *status, uint8_t *phase);
/** @brief Set the target node's network beacon state.
*
* @param net_idx Network index to encrypt with.
@ -474,7 +500,9 @@ int bt_mesh_cfg_mod_app_get_vnd(uint16_t net_idx, uint16_t addr, uint16_t elem_a
/** Model publication configuration parameters. */
struct bt_mesh_cfg_mod_pub {
/** Publication destination address. */
uint16_t addr;
uint16_t addr;
/** Virtual address UUID, or NULL if this is not a virtual address. */
const uint8_t *uuid;
/** Application index to publish with. */
uint16_t app_idx;
/** Friendship credential flag. */
@ -926,6 +954,94 @@ int bt_mesh_cfg_hb_pub_set(uint16_t net_idx, uint16_t addr,
int bt_mesh_cfg_hb_pub_get(uint16_t net_idx, uint16_t addr,
struct bt_mesh_cfg_hb_pub *pub, uint8_t *status);
/** @brief Delete all group addresses in a SIG model's subscription list.
*
* @param net_idx Network index to encrypt with.
* @param addr Target node address.
* @param elem_addr Element address the model is in.
* @param mod_id Model ID.
* @param status Status response parameter.
*
* @return 0 on success, or (negative) error code on failure.
*/
int bt_mesh_cfg_mod_sub_del_all(uint16_t net_idx, uint16_t addr,
uint16_t elem_addr, uint16_t mod_id,
uint8_t *status);
/** @brief Update a network key to the target node.
*
* @param net_idx Network index to encrypt with.
* @param addr Target node address.
* @param key_net_idx Network key index.
* @param net_key Network key.
* @param status Status response parameter.
*
* @return 0 on success, or (negative) error code on failure.
*/
int bt_mesh_cfg_net_key_update(uint16_t net_idx, uint16_t addr,
uint16_t key_net_idx, const uint8_t net_key[16],
uint8_t *status);
/** @brief Update an application key to the target node.
*
* @param net_idx Network index to encrypt with.
* @param addr Target node address.
* @param key_net_idx Network key index the application key belongs to.
* @param key_app_idx Application key index.
* @param app_key Application key.
* @param status Status response parameter.
*
* @return 0 on success, or (negative) error code on failure.
*/
int bt_mesh_cfg_app_key_update(uint16_t net_idx, uint16_t addr,
uint16_t key_net_idx, uint16_t key_app_idx,
const uint8_t app_key[16], uint8_t *status);
/** @brief Set the Node Identity parameters.
*
* @param net_idx Network index to encrypt with.
* @param addr Target node address.
* @param new_identity New identity state. Must be one of
* @ref BT_MESH_NODE_IDENTITY_STOPPED or
* @ref BT_MESH_NODE_IDENTITY_RUNNING
* @param key_net_idx Network key index the application key belongs to.
* @param status Status response parameter.
* @param identity Identity response parameter.
*
* @return 0 on success, or (negative) error code on failure.
*/
int bt_mesh_cfg_node_identity_set(uint16_t net_idx, uint16_t addr,
uint16_t key_net_idx, uint8_t new_identity,
uint8_t *status, uint8_t *identity);
/** @brief Get the Node Identity parameters.
*
* @param net_idx Network index to encrypt with.
* @param addr Target node address.
* @param key_net_idx Network key index the application key belongs to.
* @param status Status response parameter.
* @param identity Identity response parameter. Must be one of
* @ref BT_MESH_NODE_IDENTITY_STOPPED or
* @ref BT_MESH_NODE_IDENTITY_RUNNING
*
* @return 0 on success, or (negative) error code on failure.
*/
int bt_mesh_cfg_node_identity_get(uint16_t net_idx, uint16_t addr,
uint16_t key_net_idx, uint8_t *status,
uint8_t *identity);
/** @brief Get the Low Power Node Polltimeout parameters.
*
* @param net_idx Network index to encrypt with.
* @param addr Target node address.
* @param unicast_addr LPN unicast address.
* @param polltimeout Poltimeout response parameter.
*
* @return 0 on success, or (negative) error code on failure.
*/
int bt_mesh_cfg_lpn_timeout_get(uint16_t net_idx, uint16_t addr,
uint16_t unicast_addr, int32_t *polltimeout);
/** @brief Get the current transmission timeout value.
*
* @return The configured transmission timeout in milliseconds.