From f25b1de0d385537a83cd347b56c7ea168d5f9ec2 Mon Sep 17 00:00:00 2001 From: Matias N Date: Wed, 27 Jan 2021 09:54:46 -0300 Subject: [PATCH] nuttx example: generate random address --- porting/examples/nuttx/ble.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/porting/examples/nuttx/ble.c b/porting/examples/nuttx/ble.c index da7bdecc1..60c0f6b88 100644 --- a/porting/examples/nuttx/ble.c +++ b/porting/examples/nuttx/ble.c @@ -97,6 +97,17 @@ static void app_ble_sync_cb(void) { int rc; + ble_addr_t addr; + + /* generate new non-resolvable private address */ + + rc = ble_hs_id_gen_rnd(1, &addr); + assert(rc == 0); + + /* set generated address */ + + rc = ble_hs_id_set_rnd(addr.val); + assert(rc == 0); rc = ble_hs_util_ensure_addr(0); assert(rc == 0);