Skip to content

Commit f0e3672

Browse files
authoredOct 31, 2024
[Darwin] MTRDeviceController_XPC should fetch compressedFabricID (project-chip#36323)
1 parent c4c9ccf commit f0e3672

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
 

‎src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm

+12-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ @interface MTRDeviceController_XPC ()
4747
NSString * const MTRDeviceControllerRegistrationControllerNodeIDKey = @"MTRDeviceControllerRegistrationControllerNodeID";
4848
NSString * const MTRDeviceControllerRegistrationControllerIsRunningKey = @"MTRDeviceControllerRegistrationControllerIsRunning";
4949
NSString * const MTRDeviceControllerRegistrationDeviceInternalStateKey = @"MTRDeviceControllerRegistrationDeviceInternalState";
50+
NSString * const MTRDeviceControllerRegistrationControllerCompressedFabricIDKey = @"MTRDeviceControllerRegistrationControllerCompressedFabricID";
5051

5152
// #define MTR_HAVE_MACH_SERVICE_NAME_CONSTRUCTOR
5253

@@ -95,6 +96,7 @@ - (void)removeDevice:(MTRDevice *)device
9596

9697
#pragma mark - XPC
9798
@synthesize controllerNodeID = _controllerNodeID;
99+
@synthesize compressedFabricID = _compressedFabricID;
98100

99101
+ (NSMutableSet *)_allowedClasses
100102
{
@@ -450,9 +452,16 @@ - (oneway void)controller:(NSUUID *)controller controllerConfigurationUpdated:(N
450452
// }
451453

452454
NSDictionary * controllerContext = MTR_SAFE_CAST(configuration[MTRDeviceControllerRegistrationControllerContextKey], NSDictionary);
453-
NSNumber * controllerNodeID = MTR_SAFE_CAST(controllerContext[MTRDeviceControllerRegistrationControllerNodeIDKey], NSNumber);
454-
if (controllerContext && controllerNodeID) {
455-
_controllerNodeID = controllerContext[MTRDeviceControllerRegistrationControllerNodeIDKey];
455+
if (controllerContext) {
456+
NSNumber * controllerNodeID = MTR_SAFE_CAST(controllerContext[MTRDeviceControllerRegistrationControllerNodeIDKey], NSNumber);
457+
if (controllerNodeID) {
458+
_controllerNodeID = controllerNodeID;
459+
}
460+
461+
NSNumber * compressedFabricID = MTR_SAFE_CAST(controllerContext[MTRDeviceControllerRegistrationControllerCompressedFabricIDKey], NSNumber);
462+
if (compressedFabricID) {
463+
_compressedFabricID = compressedFabricID;
464+
}
456465
}
457466

458467
NSArray * deviceInfoList = MTR_SAFE_CAST(configuration[MTRDeviceControllerRegistrationNodeIDsKey], NSArray);

‎src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerContextKey
2424
MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerNodeIDKey MTR_NEWLY_AVAILABLE;
2525
MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerIsRunningKey MTR_NEWLY_AVAILABLE;
2626
MTR_EXTERN NSString * const MTRDeviceControllerRegistrationDeviceInternalStateKey MTR_NEWLY_AVAILABLE;
27+
MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerCompressedFabricIDKey MTR_NEWLY_AVAILABLE;
2728

2829
MTR_AVAILABLE(ios(18.2), macos(15.2), watchos(11.2), tvos(18.2))
2930
@protocol MTRXPCServerProtocol_MTRDevice <NSObject>

0 commit comments

Comments
 (0)