Skip to content

[Backport v4.0.99-ncs1-branch] Mesh pts test bug fix for pnid #2735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion subsys/bluetooth/mesh/proxy_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,10 +897,13 @@ static void subnet_evt(struct bt_mesh_subnet *sub, enum bt_mesh_key_evt evt)
if (sub == beacon_sub) {
beacon_sub = NULL;
}

bt_mesh_proxy_identity_stop(sub);
} else {
bt_mesh_proxy_beacon_send(sub);
bt_mesh_adv_gatt_update();
}

bt_mesh_adv_gatt_update();
}

BT_MESH_SUBNET_CB_DEFINE(gatt_services) = {
Expand Down
3 changes: 3 additions & 0 deletions tests/bluetooth/tester/src/btp/btp_mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,9 @@ struct btp_priv_node_id_set_cmd {
} __packed;

#define BTP_MESH_PROXY_PRIVATE_IDENTITY 0x72
struct btp_proxy_priv_identity_cmd {
uint8_t enabled;
} __packed;

#define BTP_MESH_OD_PRIV_PROXY_GET 0x73
struct btp_od_priv_proxy_get_cmd {
Expand Down
30 changes: 26 additions & 4 deletions tests/bluetooth/tester/src/btp_mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,20 +899,40 @@ static uint8_t priv_node_id_set(const void *cmd, uint16_t cmd_len,

return BTP_STATUS_SUCCESS;
}
#endif

#ifdef CONFIG_BT_MESH_PRIV_BEACON_SRV
static uint8_t proxy_private_identity_enable(const void *cmd, uint16_t cmd_len,
void *rsp, uint16_t *rsp_len)
{
const struct btp_proxy_priv_identity_cmd *cp = cmd;
uint16_t net_idx[CONFIG_BT_MESH_SUBNET_COUNT];
enum bt_mesh_feat_state priv_node_id = BT_MESH_FEATURE_DISABLED;
ssize_t count;
int err;

LOG_DBG("");

err = bt_mesh_proxy_private_identity_enable();
if (err) {
LOG_ERR("Failed to enable proxy private identity (err %d)", err);
count = bt_mesh_subnets_get(net_idx, ARRAY_SIZE(net_idx), 0);

if (count <= 0) {
LOG_ERR("No subnet (err:%i)", count);
return BTP_STATUS_FAILED;
}

if (cp->enabled) {
priv_node_id = BT_MESH_FEATURE_ENABLED;
}

for (int i = 0; i < count; i++) {
err = bt_mesh_subnet_priv_node_id_set(net_idx[i], priv_node_id);
if (err) {
LOG_ERR("Failed to %s proxy private identity for net idx:%x (err %d)",
cp->enabled ? "enable" : "disable", net_idx[i], err);
return BTP_STATUS_FAILED;
}
}

return BTP_STATUS_SUCCESS;
}
#endif
Expand Down Expand Up @@ -5251,8 +5271,10 @@ static const struct btp_handler handlers[] = {
{.opcode = BTP_MESH_PRIV_NODE_ID_SET,
.expect_len = sizeof(struct btp_priv_node_id_set_cmd),
.func = priv_node_id_set},
#endif
#ifdef CONFIG_BT_MESH_PRIV_BEACON_SRV
{.opcode = BTP_MESH_PROXY_PRIVATE_IDENTITY,
.expect_len = 0,
.expect_len = sizeof(struct btp_proxy_priv_identity_cmd),
.func = proxy_private_identity_enable},
#endif
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI)
Expand Down
Loading