This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NumS and NumV fields in Device Composition Data are doubled

Using Mesh SDK 3.2.0.

The returned Device Composition Data is malformed when requesting it after the node has been reset. This is because the sig_model_count and vendor_model_count for each element is incremented twice for each model.

The counter is incremented when the model is added to the access layer with access_model_add() but also when the models are restored from flash in restore_acquired_model(). Since the models are written to flash after a Config Node Reset message they will be recovered on the next boot causing all models to be counted twice.

The following patch fixes the issue.

diff --git a/mesh/access/src/access.c b/mesh/access/src/access.c
index e4f3ac0..401191e 100644
--- a/mesh/access/src/access.c
+++ b/mesh/access/src/access.c
@@ -804,7 +804,6 @@ static fm_iterate_action_t restore_acquired_model(const fm_entry_t * p_entry, vo
     }
 
     memcpy(&m_model_pool[index].model_info, p_model_data_entry, sizeof(access_model_state_data_t));
-    increment_model_count(p_model_data_entry->element_index, p_model_data_entry->model_id.company_id);
     ACCESS_INTERNAL_STATE_OUTDATED_CLR(m_model_pool[index].internal_state);
     return FM_ITERATE_ACTION_CONTINUE;
 }

Thanks.

Related