Bluetooth: Mesh: Add proxy test API

Adds internal proxy API to enhance testabillity of
the proxy implementation.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
This commit is contained in:
Anders Storrø 2023-10-11 16:19:57 +02:00 committed by Carles Cufí
parent 5551b4cfad
commit 6f2ebb963a
4 changed files with 25 additions and 0 deletions

View file

@ -36,3 +36,4 @@ void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub);
bool bt_mesh_proxy_relay(struct net_buf *buf, uint16_t dst);
void bt_mesh_proxy_addr_add(struct net_buf_simple *buf, uint16_t addr);
uint8_t bt_mesh_proxy_srv_connected_cnt(void);

View file

@ -391,3 +391,12 @@ static void subnet_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt)
BT_MESH_SUBNET_CB_DEFINE(proxy_cli) = {
.evt_handler = subnet_evt,
};
bool bt_mesh_proxy_cli_is_connected(uint16_t net_idx)
{
if (find_proxy_srv(net_idx, true, false)) {
return true;
}
return false;
}

View file

@ -9,3 +9,5 @@ void bt_mesh_proxy_cli_adv_recv(const struct bt_le_scan_recv_info *info,
struct net_buf_simple *buf);
bool bt_mesh_proxy_cli_relay(struct net_buf *buf);
bool bt_mesh_proxy_cli_is_connected(uint16_t net_idx);

View file

@ -1157,3 +1157,16 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
.connected = gatt_connected,
.disconnected = gatt_disconnected,
};
uint8_t bt_mesh_proxy_srv_connected_cnt(void)
{
uint8_t cnt = 0;
for (int i = 0; i < ARRAY_SIZE(clients); i++) {
if (clients[i].cli) {
cnt++;
}
}
return cnt;
}