Skip to content

Commit

Permalink
[Darwin] MTRDeviceController_XPC client protocol xpc interface fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jtung-apple committed Aug 20, 2024
1 parent a902838 commit 209e4ce
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@ @implementation MTRDeviceController_XPC

@synthesize uniqueIdentifier = _uniqueIdentifier;

- (NSXPCInterface *)_interfaceForClientProtocol
{
NSXPCInterface * interface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)];
NSSet * allowedClasses = [NSSet setWithArray:@[
[NSString class], [NSNumber class], [NSData class], [NSArray class], [NSDictionary class], [NSError class], [MTRAttributePath class]
]];
[interface setClasses:allowedClasses
forSelector:@selector(device:receivedAttributeReport:)
argumentIndex:1
ofReply:NO];
allowedClasses = [NSSet setWithArray:@[
[NSString class], [NSNumber class], [NSData class], [NSArray class], [NSDictionary class], [NSError class], [MTREventPath class]
]];
[interface setClasses:allowedClasses
forSelector:@selector(device:receivedEventReport:)
argumentIndex:1
ofReply:NO];
return interface;
}

- (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection * (^)(void) )connectionBlock
{
if (self = [super initForSubclasses]) {
Expand All @@ -64,7 +84,7 @@ - (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection
if (self.xpcConnection) {
self.xpcConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCServerProtocol)];

self.xpcConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)];
self.xpcConnection.exportedInterface = [self _interfaceForClientProtocol];
self.xpcConnection.exportedObject = self;

self.xpcConnection.interruptionHandler = ^{
Expand Down

0 comments on commit 209e4ce

Please sign in to comment.