Skip to content

Commit 6e89138

Browse files
Johan Hedbergjhedberg
authored andcommitted
Bluetooth: Mesh: Suppport multiple subnets for app-triggered Node ID
Mesh Profile Specification 1.0 section 7.2.2.2.3: "When the server starts advertising as a result of user interaction, the server shall interleave the advertising of each subnet it is a member of" Signed-off-by: Johan Hedberg <[email protected]>
1 parent 174facc commit 6e89138

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

subsys/bluetooth/host/mesh/proxy.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -357,29 +357,32 @@ void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub)
357357

358358
int bt_mesh_proxy_identity_enable(void)
359359
{
360-
/* FIXME: Add support for multiple subnets */
361-
struct bt_mesh_subnet *sub = &bt_mesh.sub[0];
360+
int i, count = 0;
362361

363362
BT_DBG("");
364363

365364
if (!bt_mesh_is_provisioned()) {
366365
return -EAGAIN;
367366
}
368367

369-
if (sub->net_idx == BT_MESH_KEY_UNUSED) {
370-
return -ENOENT;
371-
}
368+
for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) {
369+
struct bt_mesh_subnet *sub = &bt_mesh.sub[i];
372370

373-
if (sub->node_id == BT_MESH_NODE_IDENTITY_NOT_SUPPORTED) {
374-
return -ENOTSUP;
375-
}
371+
if (sub->net_idx == BT_MESH_KEY_UNUSED) {
372+
continue;
373+
}
376374

377-
if (sub->node_id == BT_MESH_NODE_IDENTITY_RUNNING) {
378-
return 0;
375+
if (sub->node_id == BT_MESH_NODE_IDENTITY_NOT_SUPPORTED) {
376+
continue;
377+
}
378+
379+
bt_mesh_proxy_identity_start(sub);
380+
count++;
379381
}
380382

381-
bt_mesh_proxy_identity_start(sub);
382-
bt_mesh_adv_update();
383+
if (count) {
384+
bt_mesh_adv_update();
385+
}
383386

384387
return 0;
385388
}

0 commit comments

Comments
 (0)