From f9d7385879c6de49078e2a83b3b100a596024ec1 Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Thu, 20 Jun 2024 09:03:08 +0200 Subject: [PATCH] Bluetooth: Mesh: add extension config server by lcd server Commit add extension of configuration server by large composition data server. Mesh Protocol v1.1 specification 4.4.21.1 The Large Composition Data Server is a main model that extends the Configuration Server model. Signed-off-by: Aleksandr Khromykh --- subsys/bluetooth/mesh/Kconfig | 1 + subsys/bluetooth/mesh/large_comp_data_srv.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 030a417d58a..f1714a805bb 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -1152,6 +1152,7 @@ endif # BT_MESH_OP_AGG_CLI config BT_MESH_LARGE_COMP_DATA_SRV bool "Support for Large Composition Data Server Model" + depends on BT_MESH_MODEL_EXTENSIONS help Enable support for the Large Composition Data Server model. diff --git a/subsys/bluetooth/mesh/large_comp_data_srv.c b/subsys/bluetooth/mesh/large_comp_data_srv.c index f47947b9b92..d4e5af40147 100644 --- a/subsys/bluetooth/mesh/large_comp_data_srv.c +++ b/subsys/bluetooth/mesh/large_comp_data_srv.c @@ -170,8 +170,11 @@ const struct bt_mesh_model_op _bt_mesh_large_comp_data_srv_op[] = { static int large_comp_data_srv_init(const struct bt_mesh_model *model) { - if (!bt_mesh_model_in_primary(model)) { - LOG_ERR("Large Composition Data Server only allowed in primary element"); + const struct bt_mesh_model *config_srv = + bt_mesh_model_find(bt_mesh_model_elem(model), BT_MESH_MODEL_ID_CFG_SRV); + + if (config_srv == NULL) { + LOG_ERR("Large Composition Data Server cannot extend Configuration server"); return -EINVAL; } @@ -181,6 +184,8 @@ static int large_comp_data_srv_init(const struct bt_mesh_model *model) srv.model = model; + bt_mesh_model_extend(model, config_srv); + return 0; }