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.
This commit is contained in:
Michał Narajowski
2019-01-31 17:50:26 +01:00
parent 8799108df8
commit 07f712cd7d
+10
View File
@@ -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 */