Hi,
I am trying to create 2 elements with the same vendor model implemented.
My vendor model enables to switch on a pwm_led at a particular power during a given time. I have defined 2 pwm led on my dev kit (nrf52840 devkit) and I defined a vendor model for each of them.
struct led_ctx led_ctx[2] = {
{
.led_id = 0,
.operating_mode = &operating_mode[0],
.model_srv = BT_MESH_FORCED_WORKING_SRV_INIT(0, &forced_working_state[0])
},
{
.led_id = 1,
.operating_mode = &operating_mode[1],
.model_srv = BT_MESH_FORCED_WORKING_SRV_INIT(1, &forced_working_state[1])
}
};
BT_MESH_MODEL_PUB_DEFINE(forced_working_srv_pub1, NULL, 0);
BT_MESH_MODEL_PUB_DEFINE(forced_working_srv_pub2, NULL, 0);
static struct bt_mesh_elem elements[] = {
BT_MESH_ELEM(
1,
BT_MESH_MODEL_LIST(
BT_MESH_MODEL_CFG_SRV,
BT_MESH_MODEL_HEALTH_SRV(&health_srv, &health_pub)),
BT_MESH_MODEL_LIST(
BT_MESH_FORCED_WORKING_SRV(&led_ctx[0], &forced_working_srv_pub1))),
BT_MESH_ELEM(
2,
BT_MESH_MODEL_NONE,
BT_MESH_MODEL_LIST(
BT_MESH_FORCED_WORKING_SRV(&led_ctx[1], &forced_working_srv_pub2))),
};
static const struct bt_mesh_comp comp = {
.cid = VENDOR_ID,
.elem = elements,
.elem_count = ARRAY_SIZE(elements),
};
It works fine : when I provision my node I see the 2 elements and each element have an instance of my model. When I send a BT mesh "SET" message to an element I succeed to power on the corresponding LED. But when I try to send a message to "all Nodes" only one of the 2 LED is powered on ... What can I do to address my two elements in the same time ?
I'm sorry if this question has already been asked.
Maureen