Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Darwin] MTRDeviceController_XPC client protocol xpc interface fix #35087

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading