File tree 1 file changed +5
-3
lines changed
src/platform/silabs/efr32
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -137,15 +137,17 @@ CHIP_ERROR BLEManagerImpl::_Init()
137
137
mFlags .ClearAll ().Set (Flags::kAdvertisingEnabled , CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
138
138
mFlags .Set (Flags::kFastAdvertisingEnabled , true );
139
139
140
+ // Check that an address was not already configured at boot.
141
+ // This covers the init-shutdown-init case to comply with the BLE address change at boot only requirement
140
142
if (std::all_of (randomizedAddr.addr , randomizedAddr.addr + (sizeof (randomizedAddr.addr ) / sizeof (uint8_t )),
141
143
[](uint8_t i) { return i == 0 ; }))
142
144
{
143
- // Since random address configured, generate one
144
- // Copy random value to address. We don't care of the ordering since it's a random value.
145
+ // Since a random address is not configured, configure one
145
146
uint64_t random = Crypto::GetRandU64 ();
147
+ // Copy random value to address. We don't care of the ordering since it's a random value.
146
148
memcpy (&randomizedAddr, &random , sizeof (randomizedAddr));
147
149
148
- // Set MSB to 11 to properly - BLE Static Device Address requirement
150
+ // Set two MSBs to 11 to properly the address - BLE Static Device Address requirement
149
151
randomizedAddr.addr [5 ] |= 0xC0 ;
150
152
}
151
153
You can’t perform that action at this time.
0 commit comments