#include "beacon.h"
#include "foundation.h"
#include "lpn.h"
+#include "cfg_srv.h"
#ifdef CONFIG_BLE_MESH_LOW_POWER
static void clear_friendship(bool force, bool disable)
{
+ struct bt_mesh_cfg_srv *cfg = bt_mesh_cfg_get();
struct bt_mesh_lpn *lpn = &bt_mesh.lpn;
BT_DBG("force %u disable %u", force, disable);
*/
lpn->groups_changed = 1U;
+ if (cfg->hb_pub.feat & BLE_MESH_FEAT_LOW_POWER) {
+ bt_mesh_heartbeat_send();
+ }
+
if (disable) {
lpn_set_state(BLE_MESH_LPN_DISABLED);
return;
}
if (!lpn->established) {
+ struct bt_mesh_cfg_srv *cfg = bt_mesh_cfg_get();
+
/* This is normally checked on the transport layer, however
* in this state we're also still accepting master
* credentials so we need to ensure the right ones (Friend
BT_INFO("Friendship established with 0x%04x", lpn->frnd);
+ if (cfg->hb_pub.feat & BLE_MESH_FEAT_LOW_POWER) {
+ bt_mesh_heartbeat_send();
+ }
+
if (lpn_cb) {
lpn_cb(lpn->frnd, true);
}
feat |= BLE_MESH_FEAT_FRIEND;
}
-#if defined(CONFIG_BLE_MESH_LOW_POWER)
- if (bt_mesh.lpn.state != BLE_MESH_LPN_DISABLED) {
+ if (bt_mesh_lpn_established()) {
feat |= BLE_MESH_FEAT_LOW_POWER;
}
-#endif
hb.feat = sys_cpu_to_be16(feat);