blemesh: Use privacy for mesh node
With this patch we use NRPA address for mesh node
@@ -194,10 +194,17 @@ static void
blemesh_on_sync(void)
{
int err;
+ ble_addr_t addr;
console_printf("Bluetooth initialized\n");
- err = bt_mesh_init(BLE_ADDR_PUBLIC, &prov, &comp);
+ /* Use NRPA */
+ err = ble_hs_id_gen_rnd(1, &addr);
+ assert(err == 0);
+ err = ble_hs_id_set_rnd(addr.val);
+ assert(err == 0);
+
+ err = bt_mesh_init(addr.type, &prov, &comp);
if (err) {
console_printf("Initializing mesh failed (err %d)\n", err);
return;
@@ -209,9 +216,6 @@ blemesh_on_sync(void)
int
main(void)
{
- /* Set initial BLE device address. */
- memcpy(g_dev_addr, (uint8_t[6]){0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a}, 6);
-
/* Initialize OS */
sysinit();
