Bluetooth: Mesh: Make element as rodata

the reason is that the Mesh Profile clearly stipulates that Mesh nodes
cannot change their own element definitions.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
This commit is contained in:
Lingao Meng 2023-11-17 09:36:34 +08:00 committed by Carles Cufí
commit 5f1c2f199b
29 changed files with 130 additions and 126 deletions

View file

@ -257,7 +257,7 @@ static const struct bt_mesh_model models[] = {
NULL),
};
static struct bt_mesh_elem elements[] = {
static const struct bt_mesh_elem elements[] = {
BT_MESH_ELEM(0, models, BT_MESH_MODEL_NONE),
};

View file

@ -86,7 +86,7 @@ static int vnd_button_pressed(const struct bt_mesh_model *model,
{
printk("src 0x%04x\n", ctx->addr);
if (ctx->addr == bt_mesh_model_elem(model)->addr) {
if (ctx->addr == bt_mesh_model_elem(model)->rt->addr) {
return 0;
}
@ -105,7 +105,7 @@ static const struct bt_mesh_model vnd_models[] = {
BT_MESH_MODEL_VND(BT_COMP_ID_LF, MOD_LF, vnd_ops, NULL, NULL),
};
static struct bt_mesh_elem elements[] = {
static const struct bt_mesh_elem elements[] = {
BT_MESH_ELEM(0, root_models, vnd_models),
};

View file

@ -59,7 +59,7 @@ static const struct bt_mesh_model root_models[] = {
BT_MESH_MODEL_HEALTH_CLI(&health_cli),
};
static struct bt_mesh_elem elements[] = {
static const struct bt_mesh_elem elements[] = {
BT_MESH_ELEM(0, root_models, BT_MESH_MODEL_NONE),
};