mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
ble_mesh: fix checking for active heartbeat publication
This commit is contained in:
@ -787,7 +787,6 @@ static void gatt_proxy_set(struct bt_mesh_model *model,
|
|||||||
struct net_buf_simple *buf)
|
struct net_buf_simple *buf)
|
||||||
{
|
{
|
||||||
struct bt_mesh_cfg_srv *cfg = model->user_data;
|
struct bt_mesh_cfg_srv *cfg = model->user_data;
|
||||||
struct bt_mesh_subnet *sub;
|
|
||||||
|
|
||||||
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
|
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
|
||||||
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
|
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
|
||||||
@ -846,8 +845,7 @@ static void gatt_proxy_set(struct bt_mesh_model *model,
|
|||||||
bt_mesh_adv_update();
|
bt_mesh_adv_update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sub = bt_mesh_subnet_get(cfg->hb_pub.net_idx);
|
if (cfg->hb_pub.feat & BLE_MESH_FEAT_PROXY) {
|
||||||
if ((cfg->hb_pub.feat & BLE_MESH_FEAT_PROXY) && sub) {
|
|
||||||
bt_mesh_heartbeat_send();
|
bt_mesh_heartbeat_send();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -943,7 +941,6 @@ static void relay_set(struct bt_mesh_model *model,
|
|||||||
if (!cfg) {
|
if (!cfg) {
|
||||||
BT_WARN("No Configuration Server context available");
|
BT_WARN("No Configuration Server context available");
|
||||||
} else if (buf->data[0] == 0x00 || buf->data[0] == 0x01) {
|
} else if (buf->data[0] == 0x00 || buf->data[0] == 0x01) {
|
||||||
struct bt_mesh_subnet *sub;
|
|
||||||
bool change;
|
bool change;
|
||||||
|
|
||||||
if (cfg->relay == BLE_MESH_RELAY_NOT_SUPPORTED) {
|
if (cfg->relay == BLE_MESH_RELAY_NOT_SUPPORTED) {
|
||||||
@ -964,8 +961,7 @@ static void relay_set(struct bt_mesh_model *model,
|
|||||||
BLE_MESH_TRANSMIT_COUNT(cfg->relay_retransmit),
|
BLE_MESH_TRANSMIT_COUNT(cfg->relay_retransmit),
|
||||||
BLE_MESH_TRANSMIT_INT(cfg->relay_retransmit));
|
BLE_MESH_TRANSMIT_INT(cfg->relay_retransmit));
|
||||||
|
|
||||||
sub = bt_mesh_subnet_get(cfg->hb_pub.net_idx);
|
if ((cfg->hb_pub.feat & BLE_MESH_FEAT_RELAY) && change) {
|
||||||
if ((cfg->hb_pub.feat & BLE_MESH_FEAT_RELAY) && sub && change) {
|
|
||||||
bt_mesh_heartbeat_send();
|
bt_mesh_heartbeat_send();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2682,7 +2678,6 @@ static void friend_set(struct bt_mesh_model *model,
|
|||||||
struct net_buf_simple *buf)
|
struct net_buf_simple *buf)
|
||||||
{
|
{
|
||||||
struct bt_mesh_cfg_srv *cfg = model->user_data;
|
struct bt_mesh_cfg_srv *cfg = model->user_data;
|
||||||
struct bt_mesh_subnet *sub;
|
|
||||||
|
|
||||||
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
|
BT_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s",
|
||||||
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
|
ctx->net_idx, ctx->app_idx, ctx->addr, buf->len,
|
||||||
@ -2716,8 +2711,7 @@ static void friend_set(struct bt_mesh_model *model,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub = bt_mesh_subnet_get(cfg->hb_pub.net_idx);
|
if (cfg->hb_pub.feat & BLE_MESH_FEAT_FRIEND) {
|
||||||
if ((cfg->hb_pub.feat & BLE_MESH_FEAT_FRIEND) && sub) {
|
|
||||||
bt_mesh_heartbeat_send();
|
bt_mesh_heartbeat_send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1614,6 +1614,11 @@ void bt_mesh_heartbeat_send(void)
|
|||||||
.xmit = bt_mesh_net_transmit_get(),
|
.xmit = bt_mesh_net_transmit_get(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Do nothing if heartbeat publication is not enabled */
|
||||||
|
if (cfg->hb_pub.dst == BLE_MESH_ADDR_UNASSIGNED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hb.init_ttl = cfg->hb_pub.ttl;
|
hb.init_ttl = cfg->hb_pub.ttl;
|
||||||
|
|
||||||
if (bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED) {
|
if (bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED) {
|
||||||
|
Reference in New Issue
Block a user