mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-13 17:37:21 +00:00
mesh: add bt_mesh_friend_terminate() function
This function allows to terminate friendship manually.
This commit is contained in:
committed by
Łukasz Rymanowski
parent
9897e56cfb
commit
0b3db9a0df
@@ -432,6 +432,16 @@ int bt_mesh_lpn_poll(void);
|
||||
*/
|
||||
void bt_mesh_lpn_set_cb(void (*cb)(uint16_t friend_addr, bool established));
|
||||
|
||||
/** @brief Terminate Friendship.
|
||||
*
|
||||
* Terminated Friendship for given LPN.
|
||||
*
|
||||
* @param lpn_addr Low Power Node address.
|
||||
*
|
||||
* @return Zero on success or (negative) error code otherwise.
|
||||
*/
|
||||
int bt_mesh_friend_terminate(uint16_t lpn_addr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1693,6 +1693,20 @@ bool bt_mesh_friend_enqueue_tx(struct bt_mesh_net_tx *tx,
|
||||
return matched;
|
||||
}
|
||||
|
||||
int bt_mesh_friend_terminate(uint16_t lpn_addr)
|
||||
{
|
||||
struct bt_mesh_friend *frnd;
|
||||
|
||||
frnd = bt_mesh_friend_find(BT_MESH_KEY_ANY, lpn_addr, false, false);
|
||||
if (!frnd) {
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
friend_clear(frnd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bt_mesh_friend_clear_incomplete(struct bt_mesh_subnet *sub, uint16_t src,
|
||||
uint16_t dst, uint64_t *seq_auth)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user