Bluetooth: Mesh: make models metadata const

Commit adds const qualifier to models metadata.
Specification claims: Composition Metadata Page 0
shall not change during a term of a node on the network.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
This commit is contained in:
Aleksandr Khromykh 2024-03-01 15:47:12 +01:00 committed by Alberto Escolar
commit aa87ed5d8a
7 changed files with 18 additions and 13 deletions

View file

@ -174,7 +174,7 @@ static void data_buf_add_le16_offset(struct net_buf_simple *buf,
}
}
static void data_buf_add_mem_offset(struct net_buf_simple *buf, uint8_t *data, size_t len,
static void data_buf_add_mem_offset(struct net_buf_simple *buf, const uint8_t *data, size_t len,
size_t *offset)
{
if (*offset >= len) {
@ -694,13 +694,13 @@ static int bt_mesh_comp_data_get_page_2(struct net_buf_simple *buf, size_t offse
data_buf_add_u8_offset(buf, dev_comp2->record[i].version.z, &offset);
data_buf_add_u8_offset(buf, dev_comp2->record[i].elem_offset_cnt, &offset);
if (dev_comp2->record[i].elem_offset_cnt) {
data_buf_add_mem_offset(buf, (uint8_t *)dev_comp2->record[i].elem_offset,
data_buf_add_mem_offset(buf, dev_comp2->record[i].elem_offset,
dev_comp2->record[i].elem_offset_cnt, &offset);
}
data_buf_add_le16_offset(buf, dev_comp2->record[i].data_len, &offset);
if (dev_comp2->record[i].data_len) {
data_buf_add_mem_offset(buf, (uint8_t *)dev_comp2->record[i].data,
data_buf_add_mem_offset(buf, dev_comp2->record[i].data,
dev_comp2->record[i].data_len, &offset);
}
}

View file

@ -145,12 +145,12 @@ static const struct bt_mesh_health_srv_cb health_srv_cb = {
#endif /* CONFIG_BT_MESH_SHELL_HEALTH_SRV_INSTANCE */
#ifdef CONFIG_BT_MESH_LARGE_COMP_DATA_SRV
static uint8_t health_tests[] = {
static const uint8_t health_tests[] = {
BT_MESH_HEALTH_TEST_INFO(COMPANY_ID_LF, 6, 0x01, 0x02, 0x03, 0x04, 0x34, 0x15),
BT_MESH_HEALTH_TEST_INFO(COMPANY_ID_NORDIC_SEMI, 3, 0x01, 0x02, 0x03),
};
static struct bt_mesh_models_metadata_entry health_srv_meta[] = {
static const struct bt_mesh_models_metadata_entry health_srv_meta[] = {
BT_MESH_HEALTH_TEST_INFO_METADATA(health_tests),
BT_MESH_MODELS_METADATA_END,
};