nimble/ble_hs_conn: Add foreach helper function

This is going to be used in following patch
This commit is contained in:
Łukasz Rymanowski
2019-07-19 13:54:58 +02:00
parent 605d2225de
commit 450b12ad2a
2 changed files with 17 additions and 0 deletions
+14
View File
@@ -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)
{
+3
View File
@@ -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