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 <aleksandr.khromykh@nordicsemi.no>
This commit is contained in:
Aleksandr Khromykh 2024-06-20 09:03:08 +02:00 committed by Alberto Escolar
commit f9d7385879
2 changed files with 8 additions and 2 deletions

View file

@ -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.

View file

@ -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;
}