Bluetooth: Mesh: Common comp page parse func
Create common composition page parser function. Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
This commit is contained in:
parent
2e3ae017e3
commit
65f029e185
4 changed files with 30 additions and 42 deletions
|
@ -59,27 +59,7 @@ static int dev_comp_data_get(struct bt_mesh_model *model,
|
|||
LOG_DBG("net_idx 0x%04x app_idx 0x%04x src 0x%04x len %u: %s", ctx->net_idx, ctx->app_idx,
|
||||
ctx->addr, buf->len, bt_hex(buf->data, buf->len));
|
||||
|
||||
page = net_buf_simple_pull_u8(buf);
|
||||
|
||||
if (page >= 130U && IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_2) &&
|
||||
(atomic_test_bit(bt_mesh.flags, BT_MESH_COMP_DIRTY) ||
|
||||
IS_ENABLED(CONFIG_BT_MESH_RPR_SRV))) {
|
||||
page = 130U;
|
||||
} else if (page >= 129U && IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1) &&
|
||||
(atomic_test_bit(bt_mesh.flags, BT_MESH_COMP_DIRTY) ||
|
||||
IS_ENABLED(CONFIG_BT_MESH_RPR_SRV))) {
|
||||
page = 129U;
|
||||
} else if (page >= 128U && (atomic_test_bit(bt_mesh.flags, BT_MESH_COMP_DIRTY) ||
|
||||
IS_ENABLED(CONFIG_BT_MESH_RPR_SRV))) {
|
||||
page = 128U;
|
||||
} else if (page >= 2U && IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_2)) {
|
||||
page = 2U;
|
||||
} else if (page >= 1U && IS_ENABLED(CONFIG_BT_MESH_COMP_PAGE_1)) {
|
||||
page = 1U;
|
||||
} else if (page != 0U) {
|
||||
LOG_DBG("Composition page %u not available", page);
|
||||
page = 0U;
|
||||
}
|
||||
page = bt_mesh_comp_parse_page(buf);
|
||||
LOG_DBG("Preparing Composition data page %d", page);
|
||||
|
||||
bt_mesh_model_msg_init(&sdu, OP_DEV_COMP_DATA_STATUS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue