Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2f5f8bd

Browse files
committedApr 17, 2024·
add comment
1 parent 4addf73 commit 2f5f8bd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

‎src/platform/silabs/efr32/BLEManagerImpl.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,17 @@ CHIP_ERROR BLEManagerImpl::_Init()
137137
mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
138138
mFlags.Set(Flags::kFastAdvertisingEnabled, true);
139139

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
140142
if (std::all_of(randomizedAddr.addr, randomizedAddr.addr + (sizeof(randomizedAddr.addr) / sizeof(uint8_t)),
141143
[](uint8_t i) { return i == 0; }))
142144
{
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
145146
uint64_t random = Crypto::GetRandU64();
147+
// Copy random value to address. We don't care of the ordering since it's a random value.
146148
memcpy(&randomizedAddr, &random, sizeof(randomizedAddr));
147149

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
149151
randomizedAddr.addr[5] |= 0xC0;
150152
}
151153

0 commit comments

Comments
 (0)
Please sign in to comment.