diff --git a/include/bluetooth/mesh/access.h b/include/bluetooth/mesh/access.h index 43e218b8cb3..8ae18a7aa49 100644 --- a/include/bluetooth/mesh/access.h +++ b/include/bluetooth/mesh/access.h @@ -415,6 +415,29 @@ int bt_mesh_model_publish(struct bt_mesh_model *model); */ struct bt_mesh_elem *bt_mesh_model_elem(struct bt_mesh_model *mod); +/** @brief Find a SIG model. + * + * @param elem Element to search for the model in. + * @param id Model ID of the model. + * + * @return A pointer to the Mesh model matching the given parameters, or NULL + * if no SIG model with the given ID exists in the given element. + */ +struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem, + u16_t id); + +/** @brief Find a vendor model. + * + * @param elem Element to search for the model in. + * @param company Company ID of the model. + * @param id Model ID of the model. + * + * @return A pointer to the Mesh model matching the given parameters, or NULL + * if no vendor model with the given ID exists in the given element. + */ +struct bt_mesh_model *bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem, + u16_t company, u16_t id); + /** Node Composition */ struct bt_mesh_comp { u16_t cid; diff --git a/subsys/bluetooth/mesh/access.c b/subsys/bluetooth/mesh/access.c index 48c46219277..b075479eaae 100644 --- a/subsys/bluetooth/mesh/access.c +++ b/subsys/bluetooth/mesh/access.c @@ -730,7 +730,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model) return 0; } -struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem, +struct bt_mesh_model *bt_mesh_model_find_vnd(const struct bt_mesh_elem *elem, u16_t company, u16_t id) { u8_t i; @@ -745,7 +745,7 @@ struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem, return NULL; } -struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem, +struct bt_mesh_model *bt_mesh_model_find(const struct bt_mesh_elem *elem, u16_t id) { u8_t i; diff --git a/subsys/bluetooth/mesh/access.h b/subsys/bluetooth/mesh/access.h index a6b9d0eaa3d..394b82abb29 100644 --- a/subsys/bluetooth/mesh/access.h +++ b/subsys/bluetooth/mesh/access.h @@ -20,11 +20,6 @@ u8_t bt_mesh_elem_count(void); /* Find local element based on unicast or group address */ struct bt_mesh_elem *bt_mesh_elem_find(u16_t addr); -struct bt_mesh_model *bt_mesh_model_find_vnd(struct bt_mesh_elem *elem, - u16_t company, u16_t id); -struct bt_mesh_model *bt_mesh_model_find(struct bt_mesh_elem *elem, - u16_t id); - u16_t *bt_mesh_model_find_group(struct bt_mesh_model *mod, u16_t addr); bool bt_mesh_fixed_group_match(u16_t addr);