Autoconfiguring of heartbeat destination and source nodes for nRF52840dongle

Hello,

I'm here again because this time I need to autoconfigure (configuring from inside program, no use of any nrf app) heartbeat destination node and source node.

For destination node, my idea could be this:

struct bt_mesh_cfg_cli_hb_sub hb_sub = {
			.src = 0x42,
			.dst = 0xFE,
			.period = 10,
			.count = 1,
			.min = 1,
			.max = 1,
		};
		res = bt_mesh_cfg_cli_hb_sub_set(net_idx, 0xFE, &hb_sub, NULL);

where:

  • 0x42 is the unicast address of heartbeat source
  • 0xFE is the unicast address of heartbeat dst
  • net_idx is the network index

For source node, my idea could be this:

struct bt_mesh_cfg_cli_hb_pub hb_pub = {
			.dst = 0xFE,
			.count = 100,
			.period = 1,
			.ttl = 5,
			.feat = 0,
			.net_idx = net_idx,
		};
		res = bt_mesh_cfg_cli_hb_pub_set(net_idx, 0x42, &hb_pub, NULL);

where:

  • 0x42 is the unicast address of heartbeat source
  • 0xFE is the unicast address of heartbeat dst
  • net_idx is the network index

These snippets are placed where the program executes autoconfiguring for chat and light/light switch models.

Questions:

  1. Is this the right way to autoconfigure heartbeat models?
  2. For source node, in my example feat = 0: does this mean that heartbeat begins after reset, with no need of any trigger events?
  3. Is there a callback function for every received heartbeat message of destination node, in which I can insert some log_info instructions to verify that something is working?

Thanks in advance for your help and best regards

Related