mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-17 15:30:11 +00:00
nimble/ble_hs_conn: Add foreach helper function
This is going to be used in following patch
This commit is contained in:
@@ -199,6 +199,20 @@ ble_hs_conn_delete_chan(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan)
|
||||
ble_l2cap_chan_free(chan);
|
||||
}
|
||||
|
||||
void
|
||||
ble_hs_conn_foreach(ble_hs_conn_foreach_fn *cb, void *arg)
|
||||
{
|
||||
struct ble_hs_conn *conn;
|
||||
|
||||
BLE_HS_DBG_ASSERT(ble_hs_locked_by_cur_task());
|
||||
|
||||
SLIST_FOREACH(conn, &ble_hs_conns, bhc_next) {
|
||||
if (cb(conn, arg) != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ble_hs_conn_free(struct ble_hs_conn *conn)
|
||||
{
|
||||
|
||||
@@ -119,6 +119,9 @@ void ble_hs_conn_addrs(const struct ble_hs_conn *conn,
|
||||
struct ble_hs_conn_addrs *addrs);
|
||||
int32_t ble_hs_conn_timer(void);
|
||||
|
||||
typedef int ble_hs_conn_foreach_fn(struct ble_hs_conn *conn, void *arg);
|
||||
void ble_hs_conn_foreach(ble_hs_conn_foreach_fn *cb, void *arg);
|
||||
|
||||
int ble_hs_conn_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user