From 0d6dd36af94ca13ab0e0ecc669ce730a4a6233c9 Mon Sep 17 00:00:00 2001 From: lly Date: Mon, 9 Mar 2020 20:51:40 +0800 Subject: [PATCH] ble_mesh: Use the right net_idx & app_idx for publish --- components/bt/esp_ble_mesh/mesh_core/access.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/access.c b/components/bt/esp_ble_mesh/mesh_core/access.c index 8438bc736..dab417534 100644 --- a/components/bt/esp_ble_mesh/mesh_core/access.c +++ b/components/bt/esp_ble_mesh/mesh_core/access.c @@ -396,13 +396,17 @@ static int publish_retransmit(struct bt_mesh_model *mod) }; int err = 0; - key = bt_mesh_app_key_find(pub->key); + key = bt_mesh_tx_appkey_get(pub->dev_role, pub->key); if (!key) { BT_ERR("%s, Failed to find AppKey", __func__); return -EADDRNOTAVAIL; } - tx.sub = bt_mesh_subnet_get(key->net_idx); + tx.sub = bt_mesh_tx_netkey_get(pub->dev_role, key->net_idx); + if (!tx.sub) { + BT_ERR("%s, Failed to get subnet", __func__); + return -EADDRNOTAVAIL; + } ctx.net_idx = key->net_idx; ctx.app_idx = key->app_idx;