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:
parent
5551b4cfad
commit
6f2ebb963a
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue