Set random Bluetooth Mac address ?.

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
jackyjoy123
Offline
Last seen:2 weeks 3 days ago
加入:2020-11-28 13:17
Set random Bluetooth Mac address ?.

Hello,

I am using WiRa SDK 10.440.8.6 with a Dialog 14695 Dev Kit.

I would like to change the Bluetooth address randomly after each connection.

I am generating a new Mac Id randomly and setting it using ble_gap_address_set (). But, I dont see any change to the Bluetooth Mac address when I discover using a Bluetooth App like LightBlue.

Let me know the correct method to change the Bluetooth Mac address.

thanks

jackyjoy

Device:
PM_Dialog
Offline
Last seen:20 hours 57 min ago
工作人员
加入:2018-02-08 11:03
Hi jackyjoy123,

Hi jackyjoy123,

By default, the device starts advertising with a static public BD Address. The default value is declared in sdk/ble/config/ble_config.h file. If another BD address is required, then the defaultBLE_STATIC_ADDRESS macro definition should be defined in config/custom_config_xxx.h file.

For example :

#define defaultBLE_STATIC_ADDRESS {0x01, 0x02, 0x03, 0x04, 0x05, 0x06}

To set a the BD address :

/*Initialize the BLE structure related to the BD address */

static const own_address_t user_bd_address = {

.addr_type = PRIVATE_RANDOM_NONRESOLVABLE_ADDRESS,

.addr = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06}

};

/ *设置蓝牙地址* /

ble_gap_address_set(&user_bd_address, 0x00FF);

Please also see theDA1469x Tutorial Advertising Conceptstutorial.

You could also use a random resolvable or a random non-resolvable address by using the ble_gap_address_set(). The renew duration can be se in defaultBLE_ADDRESS_RENEW_DURATION macro.

Thanks, PM_Dialog