Lines Matching refs:elem

123 					const struct bt_mesh_elem *elem,  in bt_mesh_model_foreach()  argument
131 const struct bt_mesh_elem *elem = &dev_comp->elem[i]; in bt_mesh_model_foreach() local
133 for (j = 0; j < elem->model_count; j++) { in bt_mesh_model_foreach()
134 const struct bt_mesh_model *model = &elem->models[j]; in bt_mesh_model_foreach()
136 func(model, elem, false, i == 0, user_data); in bt_mesh_model_foreach()
139 for (j = 0; j < elem->vnd_model_count; j++) { in bt_mesh_model_foreach()
140 const struct bt_mesh_model *model = &elem->vnd_models[j]; in bt_mesh_model_foreach()
142 func(model, elem, true, i == 0, user_data); in bt_mesh_model_foreach()
147 static size_t bt_mesh_comp_elem_size(const struct bt_mesh_elem *elem) in bt_mesh_comp_elem_size() argument
149 return (4 + (elem->model_count * 2U) + (elem->vnd_model_count * 4U)); in bt_mesh_comp_elem_size()
189 static void comp_add_model(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem, in comp_add_model() argument
205 const struct bt_mesh_elem *elem, bool vnd) in metadata_model_size() argument
239 const struct bt_mesh_elem *elem = &dev_comp->elem[i]; in bt_mesh_metadata_page_0_size() local
241 size += sizeof(elem->model_count) + in bt_mesh_metadata_page_0_size()
242 sizeof(elem->vnd_model_count); in bt_mesh_metadata_page_0_size()
244 for (j = 0; j < elem->model_count; j++) { in bt_mesh_metadata_page_0_size()
245 const struct bt_mesh_model *model = &elem->models[j]; in bt_mesh_metadata_page_0_size()
247 size += metadata_model_size(model, elem, false); in bt_mesh_metadata_page_0_size()
250 for (j = 0; j < elem->vnd_model_count; j++) { in bt_mesh_metadata_page_0_size()
251 const struct bt_mesh_model *model = &elem->vnd_models[j]; in bt_mesh_metadata_page_0_size()
253 size += metadata_model_size(model, elem, true); in bt_mesh_metadata_page_0_size()
261 const struct bt_mesh_elem *elem, bool vnd, in metadata_add_model() argument
272 model_size = metadata_model_size(mod, elem, vnd); in metadata_add_model()
284 comp_add_model(mod, elem, vnd, user_data); in metadata_add_model()
318 const struct bt_mesh_elem *elem = &dev_comp->elem[i]; in bt_mesh_metadata_get_page_0() local
329 for (j = 0; j < elem->model_count; j++) { in bt_mesh_metadata_get_page_0()
330 const struct bt_mesh_model *model = &elem->models[j]; in bt_mesh_metadata_get_page_0()
336 err = metadata_add_model(model, elem, false, &arg); in bt_mesh_metadata_get_page_0()
346 for (j = 0; j < elem->vnd_model_count; j++) { in bt_mesh_metadata_get_page_0()
347 const struct bt_mesh_model *model = &elem->vnd_models[j]; in bt_mesh_metadata_get_page_0()
353 err = metadata_add_model(model, elem, true, &arg); in bt_mesh_metadata_get_page_0()
368 static int comp_add_elem(struct net_buf_simple *buf, const struct bt_mesh_elem *elem, in comp_add_elem() argument
375 const size_t elem_size = bt_mesh_comp_elem_size(elem); in comp_add_elem()
390 elem->rt->addr); in comp_add_elem()
398 data_buf_add_le16_offset(buf, elem->loc, offset); in comp_add_elem()
400 data_buf_add_u8_offset(buf, elem->model_count, offset); in comp_add_elem()
401 data_buf_add_u8_offset(buf, elem->vnd_model_count, offset); in comp_add_elem()
403 for (i = 0; i < elem->model_count; i++) { in comp_add_elem()
404 const struct bt_mesh_model *model = &elem->models[i]; in comp_add_elem()
406 comp_add_model(model, elem, false, &arg); in comp_add_elem()
409 for (i = 0; i < elem->vnd_model_count; i++) { in comp_add_elem()
410 const struct bt_mesh_model *model = &elem->vnd_models[i]; in comp_add_elem()
412 comp_add_model(model, elem, true, &arg); in comp_add_elem()
451 err = comp_add_elem(buf, &comp->elem[i], &offset); in bt_mesh_comp_data_get_page_0()
585 static size_t page1_elem_size(const struct bt_mesh_elem *elem) in page1_elem_size() argument
589 for (int i = 0; i < elem->model_count; i++) { in page1_elem_size()
590 temp_size += is_cor_present(&elem->models[i], NULL, 0) ? 2 : 1; in page1_elem_size()
591 temp_size += mod_items_size(&elem->models[i], 0); in page1_elem_size()
594 for (int i = 0; i < elem->vnd_model_count; i++) { in page1_elem_size()
595 temp_size += is_cor_present(&elem->vnd_models[i], NULL, elem->model_count) ? 2 : 1; in page1_elem_size()
596 temp_size += mod_items_size(&elem->vnd_models[i], elem->model_count); in page1_elem_size()
612 size_t elem_size = page1_elem_size(&comp->elem[i]); in bt_mesh_comp_data_get_page_1()
626 comp->elem[i].rt->addr); in bt_mesh_comp_data_get_page_1()
634 data_buf_add_u8_offset(buf, comp->elem[i].model_count, &offset); in bt_mesh_comp_data_get_page_1()
635 data_buf_add_u8_offset(buf, comp->elem[i].vnd_model_count, &offset); in bt_mesh_comp_data_get_page_1()
636 for (j = 0; j < comp->elem[i].model_count; j++) { in bt_mesh_comp_data_get_page_1()
637 prep_model_item_header(&comp->elem[i].models[j], &cor_id, &ext_mod_cnt, buf, in bt_mesh_comp_data_get_page_1()
640 add_items_to_page(buf, &comp->elem[i].models[j], ext_mod_cnt, in bt_mesh_comp_data_get_page_1()
646 for (j = 0; j < comp->elem[i].vnd_model_count; j++) { in bt_mesh_comp_data_get_page_1()
647 prep_model_item_header(&comp->elem[i].vnd_models[j], &cor_id, &ext_mod_cnt, in bt_mesh_comp_data_get_page_1()
649 comp->elem[i].model_count); in bt_mesh_comp_data_get_page_1()
651 add_items_to_page(buf, &comp->elem[i].vnd_models[j], ext_mod_cnt, in bt_mesh_comp_data_get_page_1()
653 comp->elem[i].model_count); in bt_mesh_comp_data_get_page_1()
962 return &dev_comp->elem[mod->rt->elem_idx]; in bt_mesh_model_elem()
967 const struct bt_mesh_elem *elem; in bt_mesh_model_get() local
974 elem = &dev_comp->elem[elem_idx]; in bt_mesh_model_get()
977 if (mod_idx >= elem->vnd_model_count) { in bt_mesh_model_get()
982 return &elem->vnd_models[mod_idx]; in bt_mesh_model_get()
984 if (mod_idx >= elem->model_count) { in bt_mesh_model_get()
989 return &elem->models[mod_idx]; in bt_mesh_model_get()
1017 static void mod_init(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem, in mod_init() argument
1036 mod->rt->elem_idx = elem - dev_comp->elem; in mod_init()
1038 mod->rt->mod_idx = mod - elem->vnd_models; in mod_init()
1048 mod->rt->mod_idx = mod - elem->models; in mod_init()
1118 const struct bt_mesh_elem *elem = &dev_comp->elem[i]; in bt_mesh_comp_provision() local
1120 elem->rt->addr = addr++; in bt_mesh_comp_provision()
1122 LOG_DBG("addr 0x%04x mod_count %u vnd_mod_count %u", elem->rt->addr, in bt_mesh_comp_provision()
1123 elem->model_count, elem->vnd_model_count); in bt_mesh_comp_provision()
1134 const struct bt_mesh_elem *elem = &dev_comp->elem[i]; in bt_mesh_comp_unprovision() local
1136 elem->rt->addr = BT_MESH_ADDR_UNASSIGNED; in bt_mesh_comp_unprovision()
1258 static const struct bt_mesh_model *bt_mesh_elem_find_group(const struct bt_mesh_elem *elem, in bt_mesh_elem_find_group() argument
1265 for (i = 0; i < elem->model_count; i++) { in bt_mesh_elem_find_group()
1266 model = &elem->models[i]; in bt_mesh_elem_find_group()
1274 for (i = 0; i < elem->vnd_model_count; i++) { in bt_mesh_elem_find_group()
1275 model = &elem->vnd_models[i]; in bt_mesh_elem_find_group()
1294 index = addr - dev_comp->elem[0].rt->addr; in bt_mesh_elem_find()
1299 return &dev_comp->elem[index]; in bt_mesh_elem_find()
1315 const struct bt_mesh_elem *elem = &dev_comp->elem[index]; in bt_mesh_has_addr() local
1317 if (bt_mesh_elem_find_group(elem, addr)) { in bt_mesh_has_addr()
1376 return (dev_comp->elem[mod->rt->elem_idx].rt->addr == dst); in model_has_dst()
1391 static const struct bt_mesh_model_op *find_op(const struct bt_mesh_elem *elem, in find_op() argument
1405 models = elem->models; in find_op()
1406 count = elem->model_count; in find_op()
1408 models = elem->vnd_models; in find_op()
1409 count = elem->vnd_model_count; in find_op()
1476 const struct bt_mesh_elem *elem, uint32_t opcode) in element_model_recv() argument
1483 op = find_op(elem, opcode, &model); in element_model_recv()
1485 LOG_DBG("No OpCode 0x%08x for elem 0x%02x", opcode, elem->rt->addr); in element_model_recv()
1490 LOG_DBG("Model at 0x%04x is not bound to app idx %d", elem->rt->addr, ctx->app_idx); in element_model_recv()
1496 elem->rt->addr); in element_model_recv()
1544 index = ctx->recv_dst - dev_comp->elem[0].rt->addr; in bt_mesh_model_recv()
1550 const struct bt_mesh_elem *elem = &dev_comp->elem[index]; in bt_mesh_model_recv() local
1552 err = element_model_recv(ctx, buf, elem, opcode); in bt_mesh_model_recv()
1557 const struct bt_mesh_elem *elem = &dev_comp->elem[index]; in bt_mesh_model_recv() local
1560 err_elem = element_model_recv(ctx, buf, elem, opcode); in bt_mesh_model_recv()
1668 const struct bt_mesh_model *bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem, in bt_mesh_model_find_vnd() argument
1673 for (i = 0U; i < elem->vnd_model_count; i++) { in bt_mesh_model_find_vnd()
1674 if (elem->vnd_models[i].vnd.company == company && in bt_mesh_model_find_vnd()
1675 elem->vnd_models[i].vnd.id == id) { in bt_mesh_model_find_vnd()
1676 return &elem->vnd_models[i]; in bt_mesh_model_find_vnd()
1683 const struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem, in bt_mesh_model_find() argument
1688 for (i = 0U; i < elem->model_count; i++) { in bt_mesh_model_find()
1689 if (elem->models[i].id == id) { in bt_mesh_model_find()
1690 return &elem->models[i]; in bt_mesh_model_find()
1732 const struct bt_mesh_elem *elem = bt_mesh_model_elem(mod); in get_sig_offset() local
1735 for (i = 0U; i < elem->vnd_model_count; i++) { in get_sig_offset()
1736 if (&elem->vnd_models[i] == mod) { in get_sig_offset()
1737 return elem->model_count; in get_sig_offset()
2245 const struct bt_mesh_elem *elem, bool vnd, in store_pending_mod() argument
2313 const struct bt_mesh_elem *elem; in comp_page_0_size() local
2319 elem = &comp->elem[i]; in comp_page_0_size()
2320 size += bt_mesh_comp_elem_size(elem); in comp_page_0_size()
2335 size += page1_elem_size(&comp->elem[i]); in comp_page_1_size()
2626 static void commit_mod(const struct bt_mesh_model *mod, const struct bt_mesh_elem *elem, in commit_mod() argument