Use of scenes in BLE mesh with nrf52840

Hi,

I have autoprovisioned and autoconfigured my nrf52840 board (provisioning and configuring are made inside the software and not through external app/provisioner).

In particular, I have configured three couples of switch/led as client/server.

Now I'd like to set some scenes, for example:

  • two leds on and one off.
  • one led on and two off
  • all led on

My goal is to be able to recall one of these scenes 

How can I implement these scenes in the software? Which is the way to memorize them?

And then how can I recall each of them?

Here is my elements definition:

/* ELEMENTS */
static struct bt_mesh_elem elements[] = {
	BT_MESH_ELEM(1,
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_CFG_SRV,
					 BT_MESH_MODEL_CFG_CLI(&cli_data),
					 BT_MESH_MODEL_HEALTH_SRV(&health_srv, &health_pub),
					 BT_MESH_MODEL_DFD_SRV(&dfd_srv),
					 BT_MESH_MODEL_ONOFF_CLI(&buttons[BUTTON_IDX].client),
					 BT_MESH_MODEL_ONOFF_SRV(&led_ctx[LED_IDX].srv)),
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_CHAT_CLI(&chat))),
	BT_MESH_ELEM(2,
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_DFU_SRV(&dfu_srv)),
				 BT_MESH_MODEL_NONE),
	BT_MESH_ELEM(3,
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_ONOFF_CLI(&buttons[BUTTON_IDX2].client),
					 BT_MESH_MODEL_ONOFF_SRV(&led_ctx[LED_IDX2].srv)),
				 BT_MESH_MODEL_NONE),
	BT_MESH_ELEM(4,
				 BT_MESH_MODEL_LIST(
					 BT_MESH_MODEL_ONOFF_CLI(&buttons[BUTTON_IDX3].client),
					 BT_MESH_MODEL_ONOFF_SRV(&led_ctx[LED_IDX3].srv)),
				 BT_MESH_MODEL_NONE),
};

I hope in your help as always

Best regards

Related