Bluetooth: Mesh: Redesign element and storage info for models

Keeping the model struct same sized, change the element pointer to two
indexes, and add a flags member that will be used to track pending
storage actions.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-05-08 21:18:55 +03:00 committed by Johan Hedberg
commit 8703ffad23
8 changed files with 66 additions and 14 deletions

View file

@ -332,8 +332,10 @@ struct bt_mesh_model {
} vnd;
};
/* The Element this Model belongs to */
struct bt_mesh_elem *elem;
/* Internal information, mainly for persistent storage */
u8_t elem_idx; /* Belongs to Nth element */
u8_t mod_idx; /* Is the Nth model in the element */
u16_t flags; /* Information about what has changed */
/* Model Publication */
struct bt_mesh_model_pub * const pub;
@ -396,6 +398,15 @@ int bt_mesh_model_send(struct bt_mesh_model *model,
*/
int bt_mesh_model_publish(struct bt_mesh_model *model);
/**
* @brief Get the element that a model belongs to.
*
* @param mod Mesh model.
*
* @return Pointer to the element that the given model belongs to.
*/
struct bt_mesh_elem *bt_mesh_model_elem(struct bt_mesh_model *mod);
/** Node Composition */
struct bt_mesh_comp {
u16_t cid;