Bluetooth: Mesh: Move Device UUID log to bt_mesh_prov_enable()

In some cases the application might only initialize its UUID after
calling bt_mesh_init(), e.g. in the case of deriving the UUID from the
identity address. To avoid confusing logs, only print the UUID when
actually enabling one of the provisioing bearers.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-08-16 13:51:24 +03:00 committed by Johan Hedberg
commit bb576f61b6
2 changed files with 9 additions and 6 deletions

View file

@ -13,6 +13,7 @@
#include <net/buf.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/conn.h>
#include <bluetooth/uuid.h>
#include <bluetooth/mesh.h>
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_MESH_DEBUG)
@ -133,6 +134,14 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)
return -EALREADY;
}
if (IS_ENABLED(CONFIG_BT_DEBUG)) {
const struct bt_mesh_prov *prov = bt_mesh_prov_get();
struct bt_uuid_128 uuid = { .uuid.type = BT_UUID_TYPE_128 };
memcpy(uuid.val, prov->uuid, 16);
BT_INFO("Device UUID: %s", bt_uuid_str(&uuid.uuid));
}
if (IS_ENABLED(CONFIG_BT_MESH_PB_ADV) &&
(bearers & BT_MESH_PROV_ADV)) {
/* Make sure we're scanning for provisioning inviations */

View file

@ -1593,12 +1593,6 @@ int bt_mesh_prov_init(const struct bt_mesh_prov *prov_info)
#endif /* CONFIG_BT_MESH_PB_ADV */
if (IS_ENABLED(CONFIG_BT_DEBUG)) {
struct bt_uuid_128 uuid = { .uuid.type = BT_UUID_TYPE_128 };
memcpy(uuid.val, prov->uuid, 16);
BT_INFO("Device UUID: %s", bt_uuid_str(&uuid.uuid));
}
return 0;
}