apps/bttester: Use random addr from HW instead of generating new one

This commit is contained in:
Michał Narajowski
2020-01-07 12:17:57 +01:00
parent 6290d39c07
commit 0ceef89b72
2 changed files with 9 additions and 2 deletions
+1
View File
@@ -33,6 +33,7 @@ pkg.deps:
- "@apache-mynewt-core/sys/shell"
- "@apache-mynewt-nimble/nimble/controller"
- "@apache-mynewt-nimble/nimble/host"
- "@apache-mynewt-nimble/nimble/host/util"
- "@apache-mynewt-nimble/nimble/host/services/gap"
- "@apache-mynewt-nimble/nimble/host/services/gatt"
- "@apache-mynewt-nimble/nimble/host/store/ram"
+8 -2
View File
@@ -27,6 +27,7 @@
#include <host/ble_gap.h>
#include "host/ble_gap.h"
#include "host/util/util.h"
#include "console/console.h"
#include "../../../nimble/host/src/ble_hs_pvcy_priv.h"
@@ -161,14 +162,19 @@ static void controller_info(u8_t *data, u16_t len)
memset(&rp, 0, sizeof(rp));
rc = ble_hs_id_gen_rnd(MYNEWT_VAL(BTTESTER_USE_NRPA), &addr);
/* Make sure we have proper identity address set (public preferred) */
rc = ble_hs_util_ensure_addr(1);
assert(rc == 0);
rc = ble_hs_id_set_rnd(addr.val);
rc = ble_hs_id_copy_addr(BLE_ADDR_RANDOM, addr.val, NULL);
assert(rc == 0);
if (MYNEWT_VAL(BTTESTER_PRIVACY_MODE)) {
if (MYNEWT_VAL(BTTESTER_USE_NRPA)) {
own_addr_type = BLE_OWN_ADDR_RANDOM;
rc = ble_hs_id_gen_rnd(1, &addr);
assert(rc == 0);
rc = ble_hs_id_set_rnd(addr.val);
assert(rc == 0);
} else {
own_addr_type = BLE_OWN_ADDR_RPA_RANDOM_DEFAULT;
}