@@ -245,12 +245,13 @@ std::optional<uint16_t> BridgedDeviceManager::AddDeviceEndpoint(std::unique_ptr<
245
245
246
246
int BridgedDeviceManager::RemoveDeviceEndpoint (BridgedDevice * dev)
247
247
{
248
+ assertChipStackLockedByCurrentThread ();
249
+
248
250
uint8_t index = 0 ;
249
251
while (index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT)
250
252
{
251
253
if (mDevices [index ].get () == dev)
252
254
{
253
- DeviceLayer::StackLock lock;
254
255
// Silence complaints about unused ep when progress logging
255
256
// disabled.
256
257
[[maybe_unused]] EndpointId ep = emberAfClearDynamicEndpoint (index );
@@ -266,6 +267,8 @@ int BridgedDeviceManager::RemoveDeviceEndpoint(BridgedDevice * dev)
266
267
267
268
BridgedDevice * BridgedDeviceManager::GetDevice (chip::EndpointId endpointId) const
268
269
{
270
+ assertChipStackLockedByCurrentThread ();
271
+
269
272
for (uint8_t index = 0 ; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index )
270
273
{
271
274
if (mDevices [index ] && mDevices [index ]->GetEndpointId () == endpointId)
@@ -304,6 +307,8 @@ std::string BridgedDeviceManager::GenerateUniqueId()
304
307
305
308
BridgedDevice * BridgedDeviceManager::GetDeviceByUniqueId (const std::string & id)
306
309
{
310
+ assertChipStackLockedByCurrentThread ();
311
+
307
312
for (uint8_t index = 0 ; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index )
308
313
{
309
314
if (mDevices [index ] && mDevices [index ]->GetBridgedAttributes ().uniqueId == id)
@@ -316,6 +321,8 @@ BridgedDevice * BridgedDeviceManager::GetDeviceByUniqueId(const std::string & id
316
321
317
322
BridgedDevice * BridgedDeviceManager::GetDeviceByScopedNodeId (chip::ScopedNodeId scopedNodeId) const
318
323
{
324
+ assertChipStackLockedByCurrentThread ();
325
+
319
326
for (uint8_t index = 0 ; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index )
320
327
{
321
328
if (mDevices [index ] && mDevices [index ]->GetScopedNodeId () == scopedNodeId)
@@ -328,11 +335,12 @@ BridgedDevice * BridgedDeviceManager::GetDeviceByScopedNodeId(chip::ScopedNodeId
328
335
329
336
std::optional<uint16_t > BridgedDeviceManager::RemoveDeviceByScopedNodeId (chip::ScopedNodeId scopedNodeId)
330
337
{
338
+ assertChipStackLockedByCurrentThread ();
339
+
331
340
for (uint16_t index = 0 ; index < CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; ++index )
332
341
{
333
342
if (mDevices [index ] && mDevices [index ]->GetScopedNodeId () == scopedNodeId)
334
343
{
335
- DeviceLayer::StackLock lock;
336
344
EndpointId ep = emberAfClearDynamicEndpoint (index );
337
345
mDevices [index ] = nullptr ;
338
346
ChipLogProgress (NotSpecified, " Removed device with Id=[%d:0x" ChipLogFormatX64 " ] from dynamic endpoint %d (index=%d)" ,
0 commit comments