From 07f712cd7db5acf053064d3da3f5507ffaec5506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Wed, 30 Jan 2019 14:34:48 +0100 Subject: [PATCH] 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. --- nimble/host/mesh/src/mesh.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nimble/host/mesh/src/mesh.c b/nimble/host/mesh/src/mesh.c index 347e756eb..c92ed497a 100644 --- a/nimble/host/mesh/src/mesh.c +++ b/nimble/host/mesh/src/mesh.c @@ -15,6 +15,7 @@ #include "syscfg/syscfg.h" #define BT_DBG_ENABLED (MYNEWT_VAL(BLE_MESH_DEBUG)) #include "host/ble_hs_log.h" +#include "host/ble_uuid.h" #include "adv.h" #include "prov.h" @@ -137,6 +138,15 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers) return -EALREADY; } + if (MYNEWT_VAL(BLE_MESH_DEBUG)) { + char uuid_buf[BLE_UUID_STR_LEN]; + const struct bt_mesh_prov *prov = bt_mesh_prov_get(); + ble_uuid_t *uuid = BLE_UUID128_DECLARE(); + + memcpy(BLE_UUID128(uuid)->value, prov->uuid, 16); + BT_INFO("Device UUID: %s", ble_uuid_to_str(uuid, uuid_buf)); + } + if (IS_ENABLED(CONFIG_BT_MESH_PB_ADV) && (bearers & BT_MESH_PROV_ADV)) { /* Make sure we're scanning for provisioning inviations */