|
18 | 18 |
|
19 | 19 | #import "MTRDefines_Internal.h"
|
20 | 20 | #import "MTRDeviceController_Internal.h"
|
| 21 | +#import "MTRDevice_Internal.h" |
21 | 22 | #import "MTRDevice_XPC.h"
|
22 | 23 | #import "MTRDevice_XPC_Internal.h"
|
23 | 24 | #import "MTRError_Internal.h"
|
@@ -77,10 +78,13 @@ - (void)_updateRegistrationInfo
|
77 | 78 | NSMutableArray * nodeIDs = [NSMutableArray array];
|
78 | 79 |
|
79 | 80 | for (NSNumber * nodeID in [self.nodeIDToDeviceMap keyEnumerator]) {
|
80 |
| - NSMutableDictionary * nodeDictionary = [NSMutableDictionary dictionary]; |
81 |
| - MTR_REQUIRED_ATTRIBUTE(MTRDeviceControllerRegistrationNodeIDKey, nodeID, nodeDictionary) |
82 |
| - |
83 |
| - [nodeIDs addObject:nodeDictionary]; |
| 81 | + MTRDevice * device = [self _deviceForNodeID: nodeID createIfNeeded: NO]; |
| 82 | + if ( [device _delegateExists] ) { |
| 83 | + NSMutableDictionary * nodeDictionary = [NSMutableDictionary dictionary]; |
| 84 | + MTR_REQUIRED_ATTRIBUTE(MTRDeviceControllerRegistrationNodeIDKey, nodeID, nodeDictionary) |
| 85 | + |
| 86 | + [nodeIDs addObject:nodeDictionary]; |
| 87 | + } |
84 | 88 | }
|
85 | 89 | MTR_REQUIRED_ATTRIBUTE(MTRDeviceControllerRegistrationNodeIDsKey, nodeIDs, registrationInfo)
|
86 | 90 | MTR_REQUIRED_ATTRIBUTE(MTRDeviceControllerRegistrationControllerContextKey, controllerContext, registrationInfo)
|
@@ -386,8 +390,6 @@ - (MTRDevice *)_setupDeviceForNodeID:(NSNumber *)nodeID prefetchedClusterData:(N
|
386 | 390 | [self.nodeIDToDeviceMap setObject:deviceToReturn forKey:nodeID];
|
387 | 391 | MTR_LOG("%s: returning XPC device for node id %@", __PRETTY_FUNCTION__, nodeID);
|
388 | 392 |
|
389 |
| - [self _updateRegistrationInfo]; |
390 |
| - |
391 | 393 | return deviceToReturn;
|
392 | 394 | }
|
393 | 395 |
|
|
0 commit comments