@@ -39,9 +39,9 @@ extern "C" {
39
39
#include " sl_bt_stack_config.h"
40
40
#include " sl_bt_stack_init.h"
41
41
#include " timers.h"
42
- #include < algorithm>
43
42
#include < ble/CHIPBleServiceData.h>
44
43
#include < crypto/RandUtils.h>
44
+ #include < cstring>
45
45
#include < lib/support/CodeUtils.h>
46
46
#include < lib/support/logging/CHIPLogging.h>
47
47
#include < platform/CommissionableDataProvider.h>
@@ -116,11 +116,8 @@ BLEManagerImpl BLEManagerImpl::sInstance;
116
116
117
117
CHIP_ERROR BLEManagerImpl::_Init ()
118
118
{
119
- CHIP_ERROR err;
120
-
121
119
// Initialize the CHIP BleLayer.
122
- err = BleLayer::Init (this , this , &DeviceLayer::SystemLayer ());
123
- SuccessOrExit (err);
120
+ ReturnErrorOnFailure (BleLayer::Init (this , this , &DeviceLayer::SystemLayer ()));
124
121
125
122
memset (mBleConnections , 0 , sizeof (mBleConnections ));
126
123
memset (mIndConfId , kUnusedIndex , sizeof (mIndConfId ));
@@ -139,8 +136,8 @@ CHIP_ERROR BLEManagerImpl::_Init()
139
136
140
137
// Check that an address was not already configured at boot.
141
138
// This covers the init-shutdown-init case to comply with the BLE address change at boot only requirement
142
- if ( std::all_of (randomizedAddr. addr , randomizedAddr. addr + ( sizeof (randomizedAddr. addr ) / sizeof ( uint8_t )),
143
- []( uint8_t i) { return i == 0 ; }) )
139
+ bd_addr temp = { 0 };
140
+ if ( memcmp (&randomizedAddr, &temp, sizeof (bd_addr)) == 0 )
144
141
{
145
142
// Since a random address is not configured, configure one
146
143
uint64_t random = Crypto::GetRandU64 ();
@@ -152,9 +149,7 @@ CHIP_ERROR BLEManagerImpl::_Init()
152
149
}
153
150
154
151
PlatformMgr ().ScheduleWork (DriveBLEState, 0 );
155
-
156
- exit :
157
- return err;
152
+ return CHIP_NO_ERROR;
158
153
}
159
154
160
155
uint16_t BLEManagerImpl::_NumConnections (void )
0 commit comments