Skip to content

Commit f754957

Browse files
committed
sketch out a first XPC method
1 parent 55e479f commit f754957

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm

+26
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,39 @@
1717
#import "MTRDeviceController_XPC.h"
1818
#import "MTRLogging_Internal.h"
1919

20+
@interface MTRDeviceController_XPC ()
21+
@property (nonatomic, strong) NSXPCConnection * xpcConnection;
22+
@end
23+
2024
@implementation MTRDeviceController_XPC
2125

2226
- (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters
2327
error:(NSError * __autoreleasing *)error
2428
{
2529
MTR_LOG_ERROR("unimplemented method %s called", __PRETTY_FUNCTION__);
30+
// initiate XPC connection? kmo 14 aug 2024 12h35
2631
return nil;
2732
}
2833

34+
- (BOOL)setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload
35+
newNodeID:(NSNumber *)newNodeID
36+
error:(NSError * __autoreleasing *)error
37+
{
38+
// xpc things obviously! kmo 14 aug 2024 12h35
39+
// transform async work to sync work
40+
41+
MTR_LOG_ERROR("unimplemented method %s called", __PRETTY_FUNCTION__);
42+
return false;
43+
}
44+
45+
typedef void (^BoolReplyBlock)(bool);
46+
- (void)_xpc_setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload
47+
newNodeID:(NSNumber *)newNodeID
48+
error:(NSError * __autoreleasing *)error
49+
reply:(BoolReplyBlock)reply
50+
{
51+
MTR_LOG_ERROR("unimplemented XPC method %s called", __PRETTY_FUNCTION__);
52+
reply(false);
53+
}
54+
2955
@end

src/darwin/Framework/CHIP/MTRXPCServiceProtocol.h

+11
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,24 @@
1616

1717
#import <Foundation/Foundation.h>
1818

19+
@class MTRSetupPayload;
20+
1921
NS_ASSUME_NONNULL_BEGIN
2022

2123
typedef void (^MTRXPCServiceIntReplyBlock)(int);
24+
typedef void (^MTRXPCServiceBoolReplyBlock)(BOOL);
2225

2326
@protocol MTRXPCServiceProtocol <NSObject>
2427
- (void)ping;
2528
- (void)getMeaningOfLifeWithReplyBlock:(MTRXPCServiceIntReplyBlock)reply;
29+
30+
// these real methods will be optional for now, but not when we are done building here.
31+
@optional
32+
- (void)setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload
33+
newNodeID:(NSNumber *)newNodeID
34+
error:(NSError * __autoreleasing *)error
35+
reply:(MTRXPCServiceBoolReplyBlock)reply;
36+
2637
@end
2738

2839
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)