Bluetooth: Mesh: Added support for application access to mesh messages
Added bt_mesh_msg_send() which can be used by the application to directly send model layer messages without local instantiation of related models. Also added bt_mesh_msg_cb_set() which allows the application to recieve mesh model layer messages without local instantiation of related models. Added bt_mesh_has_addr() which returns a bool. For unicast addresses, this returns whether or not bt_mesh_elem_find() was successfull. If the above mentioned bt_mesh_msg_cb_set() has been used by the application to set a message callback, this returns true so that the stack attempts to push every model message up to the application via the callback. If no callback has been set, group addresses are searched to see if the stack should pass the message up the stack to an instantiated model. These changes allow applications that do not or can not instantiate models to interface with models in a mesh network. This is applicable to applications which act as a Bluetooth mesh gateway, sniffer, debugger, network monitoring, non-mesh relay/extender, etc. In app_keys.c friend.c net.c bt_mesh_elem_find() is used only to determine the existance of an address. The full return value of bt_mesh_elem_find() is unecessary and so was replaced by the above mentioned bt_mesh_has_addr() function in these instances. Simplified bt_mesh_elem_find() by removing the search through group address. Since the above mentioned bt_mesh_has_addr() function handles instances where group addresses must be searched, it was no longer necessary to preform this search in this function. Signed-off-by: Bud Wandinger <bud@budkoembedded.ca>
This commit is contained in:
parent
6e7939bc77
commit
7a2b248b98
6 changed files with 99 additions and 33 deletions
|
@ -460,7 +460,7 @@ int bt_mesh_keys_resolve(struct bt_mesh_msg_ctx *ctx,
|
|||
}
|
||||
|
||||
if (ctx->app_idx == BT_MESH_KEY_DEV_REMOTE &&
|
||||
!bt_mesh_elem_find(ctx->addr)) {
|
||||
!bt_mesh_has_addr(ctx->addr)) {
|
||||
struct bt_mesh_cdb_node *node;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_BT_MESH_CDB)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue