Bluetooth: Mesh: Update models metadata API
This commit updates models metadata API to simplify the usage and removes the metadata pointer in health server model context. Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
This commit is contained in:
parent
435f32d191
commit
11eed84775
10 changed files with 112 additions and 39 deletions
|
@ -220,7 +220,7 @@ static size_t metadata_model_size(const struct bt_mesh_model *mod,
|
|||
|
||||
size += sizeof(uint8_t);
|
||||
|
||||
for (entry = *mod->metadata; entry && entry->len; ++entry) {
|
||||
for (entry = mod->metadata; entry && entry->len; ++entry) {
|
||||
size += sizeof(entry->len) + sizeof(entry->id) + entry->len;
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ static int metadata_add_model(const struct bt_mesh_model *mod,
|
|||
count_ptr = data_buf_add_u8_offset(buf, 0, offset);
|
||||
|
||||
if (mod->metadata) {
|
||||
for (entry = *mod->metadata; entry && entry->data != NULL; ++entry) {
|
||||
for (entry = mod->metadata; entry && entry->data != NULL; ++entry) {
|
||||
data_buf_add_le16_offset(buf, entry->len, offset);
|
||||
data_buf_add_le16_offset(buf, entry->id, offset);
|
||||
data_buf_add_mem_offset(buf, entry->data, entry->len, offset);
|
||||
|
|
|
@ -144,13 +144,13 @@ 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
|
||||
#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_SRV)
|
||||
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 const struct bt_mesh_models_metadata_entry health_srv_meta[] = {
|
||||
const struct bt_mesh_models_metadata_entry health_srv_meta[] = {
|
||||
BT_MESH_HEALTH_TEST_INFO_METADATA(health_tests),
|
||||
BT_MESH_MODELS_METADATA_END,
|
||||
};
|
||||
|
@ -160,9 +160,6 @@ struct bt_mesh_health_srv bt_mesh_shell_health_srv = {
|
|||
#if defined(CONFIG_BT_MESH_SHELL_HEALTH_SRV_INSTANCE)
|
||||
.cb = &health_srv_cb,
|
||||
#endif
|
||||
#ifdef CONFIG_BT_MESH_LARGE_COMP_DATA_SRV
|
||||
.metadata = health_srv_meta,
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(CONFIG_BT_MESH_SHELL_HEALTH_CLI)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue