Use CyBle_GetDeviceAddress to get the device MAC address. Use CyBle_GapSetLocalName to set the device local name. Call this API before the advertisement start APIs so that the device advertises with the new address.
I am testing on a few devices, and for every single device I am getting same address when calling CyBle_GetDeviceAddress with the addr type set to 0 for public address.
I have 'Silicon generated "Company assigned" part of the address' checked in the BLE component, and the public address remains as:
on every call to CyBle_GetDeviceAddress I am getting: 0x80 0x95 0x19 0x29 0x49 0x80
Am I comparing two different addresses? Shouldn't the company prefix and 'die' assigned address be there?
I got a little further following this advice: http://www.cypress.com/forum/proc-ble/update-device-name-id-during-advertising
I am now waiting until the BLESS state is event_close before getting the device address.
while( CyBle_GetBleSsState() != CYBLE_BLESS_STATE_EVENT_CLOSE )
This gets me unique mac addresses.
The other issue I ran into was that CyBle_GapSetLocalName was truncating the custom name I was setting based on the length I put in the component:
charLen = (uint8)CYBLE_GATT_DB_ATTR_GET_ATTR_GEN_MAX_LEN(CYBLE_GAP_DEVICE_NAME_INDEX + 1u);
Once I padded out the name I put in the component settings, this stopped truncating.
Is there a better way to do that?