diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 5695ef23c7a9e7..8b8295d94450c2 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -714,7 +714,7 @@ - (NSUInteger)_iterateDelegateInfoWithBlock:(void (^_Nullable)(MTRDeviceControll } } -- (void)_callDelegatesWithBlock:(void (^_Nullable)(id delegate))block logString:(const char *)logString; +- (void)_callDelegatesWithBlock:(void (^_Nullable)(id delegate))block logString:(const char *)logString { NSUInteger delegatesCalled = [self _iterateDelegateInfoWithBlock:^(MTRDeviceControllerDelegateInfo * delegateInfo) { id strongDelegate = delegateInfo.delegate; diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm index 7e88870aa7b570..d737e4d95d9856 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm @@ -43,6 +43,9 @@ @interface MTRDeviceController_XPC () NSString * const MTRDeviceControllerRegistrationControllerContextKey = @"MTRDeviceControllerRegistrationControllerContext"; NSString * const MTRDeviceControllerRegistrationNodeIDsKey = @"MTRDeviceControllerRegistrationNodeIDs"; NSString * const MTRDeviceControllerRegistrationNodeIDKey = @"MTRDeviceControllerRegistrationNodeID"; +NSString * const MTRDeviceControllerRegistrationControllerNodeIDKey = @"MTRDeviceControllerRegistrationControllerNodeID"; +NSString * const MTRDeviceControllerRegistrationControllerIsRunningKey = @"MTRDeviceControllerRegistrationControllerIsRunning"; +NSString * const MTRDeviceControllerRegistrationDeviceInternalStateKey = @"MTRDeviceControllerRegistrationDeviceInternalState"; // #define MTR_HAVE_MACH_SERVICE_NAME_CONSTRUCTOR @@ -90,6 +93,8 @@ - (void)removeDevice:(MTRDevice *)device } #pragma mark - XPC +@synthesize controllerNodeID = _controllerNodeID; + + (NSMutableSet *)_allowedClasses { static NSArray * sBaseAllowedClasses = @[ @@ -167,6 +172,13 @@ - (NSXPCInterface *)_interfaceForClientProtocol argumentIndex:1 ofReply:NO]; + allowedClasses = [MTRDeviceController_XPC _allowedClasses]; + + [interface setClasses:allowedClasses + forSelector:@selector(controller:controllerConfigurationUpdated:) + argumentIndex:1 + ofReply:NO]; + return interface; } @@ -346,9 +358,6 @@ - (MTRDevice *)_setupDeviceForNodeID:(NSNumber *)nodeID prefetchedClusterData:(N #pragma mark - XPC Action Overrides -MTR_DEVICECONTROLLER_SIMPLE_REMOTE_XPC_GETTER(isRunning, BOOL, NO, getIsRunningWithReply) -MTR_DEVICECONTROLLER_SIMPLE_REMOTE_XPC_GETTER(controllerNodeID, NSNumber *, nil, controllerNodeIDWithReply) - // Not Supported via XPC // - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; // - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithDiscoveredDevice:(MTRCommissionableBrowserResult *)discoveredDevice payload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; @@ -424,6 +433,60 @@ - (oneway void)device:(NSNumber *)nodeID internalStateUpdated:(NSDictionary *)di #pragma mark - MTRDeviceController Protocol Client +- (oneway void)controller:(NSUUID *)controller controllerConfigurationUpdated:(NSDictionary *)configuration +{ + // Reuse the same format as config dictionary, and add values for internal states + // @{ + // MTRDeviceControllerRegistrationControllerContextKey: @{ + // MTRDeviceControllerRegistrationControllerNodeIDKey: controllerNodeID + // } + // MTRDeviceControllerRegistrationNodeIDsKey: @[ + // @{ + // MTRDeviceControllerRegistrationNodeIDKey: nodeID, + // MTRDeviceControllerRegistrationDeviceInternalStateKey: deviceInternalStateDictionary + // } + // ] + // } + + NSDictionary * controllerContext = MTR_SAFE_CAST(configuration[MTRDeviceControllerRegistrationControllerContextKey], NSDictionary); + NSNumber * controllerNodeID = MTR_SAFE_CAST(controllerContext[MTRDeviceControllerRegistrationControllerNodeIDKey], NSNumber); + if (controllerContext && controllerNodeID) { + _controllerNodeID = controllerContext[MTRDeviceControllerRegistrationControllerNodeIDKey]; + } + + NSArray * deviceInfoList = MTR_SAFE_CAST(configuration[MTRDeviceControllerRegistrationNodeIDsKey], NSArray); + + MTR_LOG("Received controllerConfigurationUpdated: controllerNode ID %@ deviceInfoList %@", self.controllerNodeID, deviceInfoList); + + for (NSDictionary * deviceInfo in deviceInfoList) { + if (!MTR_SAFE_CAST(deviceInfo, NSDictionary)) { + MTR_LOG_ERROR(" - Missing or malformed device Info"); + continue; + } + + NSNumber * nodeID = MTR_SAFE_CAST(deviceInfo[MTRDeviceControllerRegistrationNodeIDKey], NSNumber); + if (!nodeID) { + MTR_LOG_ERROR(" - Missing or malformed nodeID"); + continue; + } + + NSDictionary * deviceInternalState = MTR_SAFE_CAST(deviceInfo[MTRDeviceControllerRegistrationDeviceInternalStateKey], NSDictionary); + if (!deviceInternalState) { + MTR_LOG_ERROR(" - Missing or malformed deviceInternalState"); + continue; + } + + auto * device = static_cast([self deviceForNodeID:nodeID]); + [device device:nodeID internalStateUpdated:deviceInternalState]; + } +} + +- (BOOL)isRunning +{ + // For XPC controller, always return yes + return YES; +} + // Not Supported via XPC //- (oneway void)controller:(NSUUID *)controller statusUpdate:(MTRCommissioningStatus)status { // } diff --git a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm index 12b6250e0bcadb..a7b5d255f8772d 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_Concrete.mm @@ -475,15 +475,26 @@ - (NSString *)description - (NSDictionary *)_internalProperties { NSMutableDictionary * properties = [NSMutableDictionary dictionary]; - std::lock_guard lock(_descriptionLock); + { + std::lock_guard lock(_descriptionLock); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyKeyVendorID, _vid, properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyKeyProductID, _pid, properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyNetworkFeatures, _allNetworkFeatures, properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceState, [NSNumber numberWithUnsignedInteger:_internalDeviceStateForDescription], properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionAttemptWait, [NSNumber numberWithUnsignedInt:_lastSubscriptionAttemptWaitForDescription], properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyMostRecentReportTime, _mostRecentReportTimeForDescription, properties); - MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionFailureTime, _lastSubscriptionFailureTimeForDescription, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyKeyVendorID, _vid, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyKeyProductID, _pid, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyNetworkFeatures, _allNetworkFeatures, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyMostRecentReportTime, _mostRecentReportTimeForDescription, properties); + } + + { + std::lock_guard lock(_lock); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceInternalState, [NSNumber numberWithUnsignedInteger:_internalDeviceState], properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionAttemptWait, [NSNumber numberWithUnsignedInt:_lastSubscriptionAttemptWait], properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionFailureTime, _lastSubscriptionFailureTime, properties); + + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceState, @(_state), properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceCachePrimed, @(_deviceCachePrimed), properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyEstimatedStartTime, _estimatedStartTime, properties); + MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyEstimatedSubscriptionLatency, _estimatedSubscriptionLatency, properties); + } return properties; } @@ -968,6 +979,7 @@ - (void)_callDelegateDeviceCachePrimed [delegate deviceCachePrimed:self]; } }]; + [self _notifyDelegateOfPrivateInternalPropertiesChanges]; } // assume lock is held @@ -998,6 +1010,7 @@ - (void)_changeState:(MTRDeviceState)state [self _callDelegatesWithBlock:^(id delegate) { [delegate device:self stateChanged:state]; }]; + [self _notifyDelegateOfPrivateInternalPropertiesChanges]; } else { MTR_LOG( "%@ Not reporting reachability state change, since no change in state %lu => %lu", self, static_cast(lastState), static_cast(state)); @@ -1438,6 +1451,7 @@ - (void)_handleUnsolicitedMessageFromPublisher [delegate deviceBecameActive:self]; } }]; + [self _notifyDelegateOfPrivateInternalPropertiesChanges]; // in case this is called during exponential back off of subscription // reestablishment, this starts the attempt right away @@ -2423,7 +2437,9 @@ - (void)_setupSubscriptionWithReason:(NSString *)reason mtr_strongify(self); VerifyOrReturn(self); - [self _markDeviceAsUnreachableIfNeverSubscribed]; + if (!HaveSubscriptionEstablishedRightNow(self->_internalDeviceState)) { + [self _markDeviceAsUnreachableIfNeverSubscribed]; + } }); } diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRDevice_Internal.h index 35cc25e26949da..f162e43e4d683d 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDevice_Internal.h @@ -187,9 +187,13 @@ static NSString * const kTestStorageUserDefaultEnabledKey = @"enableTestStorage" static NSString * const kMTRDeviceInternalPropertyKeyVendorID = @"MTRDeviceInternalStateKeyVendorID"; static NSString * const kMTRDeviceInternalPropertyKeyProductID = @"MTRDeviceInternalStateKeyProductID"; static NSString * const kMTRDeviceInternalPropertyNetworkFeatures = @"MTRDeviceInternalPropertyNetworkFeatures"; -static NSString * const kMTRDeviceInternalPropertyDeviceState = @"MTRDeviceInternalPropertyDeviceState"; +static NSString * const kMTRDeviceInternalPropertyDeviceInternalState = @"MTRDeviceInternalPropertyDeviceInternalState"; static NSString * const kMTRDeviceInternalPropertyLastSubscriptionAttemptWait = @"kMTRDeviceInternalPropertyLastSubscriptionAttemptWait"; static NSString * const kMTRDeviceInternalPropertyMostRecentReportTime = @"MTRDeviceInternalPropertyMostRecentReportTime"; static NSString * const kMTRDeviceInternalPropertyLastSubscriptionFailureTime = @"MTRDeviceInternalPropertyLastSubscriptionFailureTime"; +static NSString * const kMTRDeviceInternalPropertyDeviceState = @"MTRDeviceInternalPropertyDeviceState"; +static NSString * const kMTRDeviceInternalPropertyDeviceCachePrimed = @"MTRDeviceInternalPropertyDeviceCachePrimed"; +static NSString * const kMTRDeviceInternalPropertyEstimatedStartTime = @"MTRDeviceInternalPropertyEstimatedStartTime"; +static NSString * const kMTRDeviceInternalPropertyEstimatedSubscriptionLatency = @"MTRDeviceInternalPropertyEstimatedSubscriptionLatency"; NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm index 8a5f745a1dfc70..ec156cdcc5c0b3 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm +++ b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm @@ -56,6 +56,7 @@ #import "MTRSetupPayload.h" #import "MTRTimeUtils.h" #import "MTRUnfairLock.h" +#import "MTRUtilities.h" #import "NSDataSpanConversion.h" #import "NSStringSpanConversion.h" @@ -113,22 +114,21 @@ - (NSString *)description } // TODO: Add these to the description - // MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyDeviceState, _internalDeviceStateForDescription, properties); // MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionAttemptWait, _lastSubscriptionAttemptWaitForDescription, properties); // MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyMostRecentReportTime, _mostRecentReportTimeForDescription, properties); // MTR_OPTIONAL_ATTRIBUTE(kMTRDeviceInternalPropertyLastSubscriptionFailureTime, _lastSubscriptionFailureTimeForDescription, properties); - return [NSString - stringWithFormat:@"<%@: %p, node: %016llX-%016llX (%llu), VID: %@, PID: %@, WiFi: %@, Thread: %@, controller: %@>", - NSStringFromClass(self.class), self, - _deviceController.compressedFabricID.unsignedLongLongValue, - _nodeID.unsignedLongLongValue, - _nodeID.unsignedLongLongValue, - [self._internalState objectForKey:kMTRDeviceInternalPropertyKeyVendorID], - [self._internalState objectForKey:kMTRDeviceInternalPropertyKeyProductID], - wifi, - thread, - _deviceController.uniqueIdentifier]; + return [NSString stringWithFormat:@"<%@: %p, node: %016llX-%016llX (%llu), VID: %@, PID: %@, WiFi: %@, Thread: %@, controller: %@ state: %lu>", + NSStringFromClass(self.class), self, + _deviceController.compressedFabricID.unsignedLongLongValue, + _nodeID.unsignedLongLongValue, + _nodeID.unsignedLongLongValue, + [self vendorID], + [self productID], + wifi, + thread, + _deviceController.uniqueIdentifier, + (unsigned long) self.state]; } - (nullable NSNumber *)vendorID @@ -146,19 +146,12 @@ - (nullable NSNumber *)productID // required methods for MTRDeviceDelegates - (oneway void)device:(NSNumber *)nodeID stateChanged:(MTRDeviceState)state { - if (!MTR_SAFE_CAST(nodeID, NSNumber)) { - MTR_LOG_ERROR("%@ invalid device:stateChanged: nodeID: %@", self, nodeID); - return; - } - - MTR_LOG("%s", __PRETTY_FUNCTION__); - [self _lockAndCallDelegatesWithBlock:^(id delegate) { - [delegate device:self stateChanged:state]; - }]; + // Not needed, since internal will get this } - (oneway void)device:(NSNumber *)nodeID receivedAttributeReport:(NSArray *)attributeReport { + MTR_LOG("%@ %s", self, __PRETTY_FUNCTION__); if (!MTR_SAFE_CAST(nodeID, NSNumber)) { MTR_LOG_ERROR("%@ invalid device:receivedAttributeReport: nodeID: %@", self, nodeID); return; @@ -169,7 +162,6 @@ - (oneway void)device:(NSNumber *)nodeID receivedAttributeReport:(NSArray delegate) { [delegate device:self receivedAttributeReport:attributeReport]; }]; @@ -177,6 +169,7 @@ - (oneway void)device:(NSNumber *)nodeID receivedAttributeReport:(NSArray *)eventReport { + MTR_LOG("%@ %s", self, __PRETTY_FUNCTION__); if (!MTR_SAFE_CAST(nodeID, NSNumber)) { MTR_LOG_ERROR("%@ invalid device:receivedEventReport: nodeID: %@", self, nodeID); return; @@ -187,7 +180,6 @@ - (oneway void)device:(NSNumber *)nodeID receivedEventReport:(NSArray delegate) { [delegate device:self receivedEventReport:eventReport]; }]; @@ -196,12 +188,12 @@ - (oneway void)device:(NSNumber *)nodeID receivedEventReport:(NSArray delegate) { if ([delegate respondsToSelector:@selector(deviceBecameActive:)]) { [delegate deviceBecameActive:self]; @@ -211,20 +203,12 @@ - (oneway void)deviceBecameActive:(NSNumber *)nodeID - (oneway void)deviceCachePrimed:(NSNumber *)nodeID { - if (!MTR_SAFE_CAST(nodeID, NSNumber)) { - MTR_LOG_ERROR("%@ invalid deviceCachePrimed: nodeID: %@", self, nodeID); - return; - } - - [self _lockAndCallDelegatesWithBlock:^(id delegate) { - if ([delegate respondsToSelector:@selector(deviceCachePrimed:)]) { - [delegate deviceCachePrimed:self]; - } - }]; + // Not needed since this is a state update now } - (oneway void)deviceConfigurationChanged:(NSNumber *)nodeID { + MTR_LOG("%@ %s", self, __PRETTY_FUNCTION__); if (!MTR_SAFE_CAST(nodeID, NSNumber)) { MTR_LOG_ERROR("%@ invalid deviceConfigurationChanged: nodeID: %@", self, nodeID); return; @@ -264,6 +248,7 @@ - (BOOL)_internalState:(NSDictionary *)dictionary hasValidValuesForKeys:(const N - (oneway void)device:(NSNumber *)nodeID internalStateUpdated:(NSDictionary *)dictionary { + MTR_LOG("%@ %s", self, __PRETTY_FUNCTION__); if (!MTR_SAFE_CAST(nodeID, NSNumber)) { MTR_LOG_ERROR("%@ invalid device:internalStateUpdated: nodeID: %@", self, nodeID); return; @@ -274,22 +259,56 @@ - (oneway void)device:(NSNumber *)nodeID internalStateUpdated:(NSDictionary *)di return; } + NSNumber * oldStateNumber = MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyDeviceState], NSNumber); + NSNumber * newStateNumber = MTR_SAFE_CAST(dictionary[kMTRDeviceInternalPropertyDeviceState], NSNumber); + VerifyOrReturn([self _internalState:dictionary hasValidValuesForKeys:requiredInternalStateKeys valueRequired:YES]); VerifyOrReturn([self _internalState:dictionary hasValidValuesForKeys:optionalInternalStateKeys valueRequired:NO]); [self _setInternalState:dictionary]; - MTR_LOG("%@ internal state updated", self); + + if (!MTREqualObjects(oldStateNumber, newStateNumber)) { + MTRDeviceState state = self.state; + [self _lockAndCallDelegatesWithBlock:^(id delegate) { + [delegate device:self stateChanged:state]; + }]; + } + + NSNumber * oldPrimedState = MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyDeviceCachePrimed], NSNumber); + NSNumber * newPrimedState = MTR_SAFE_CAST(dictionary[kMTRDeviceInternalPropertyDeviceCachePrimed], NSNumber); + + if (!MTREqualObjects(oldPrimedState, newPrimedState)) { + [self _lockAndCallDelegatesWithBlock:^(id delegate) { + if ([delegate respondsToSelector:@selector(deviceCachePrimed:)]) { + [delegate deviceCachePrimed:self]; + } + }]; + } } -#pragma mark - Remote Commands +- (MTRDeviceState)state +{ + NSNumber * stateNumber = MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyDeviceState], NSNumber); + return stateNumber ? static_cast(stateNumber.unsignedIntegerValue) : MTRDeviceStateUnknown; +} + +- (BOOL)deviceCachePrimed +{ + NSNumber * deviceCachePrimedNumber = MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyDeviceCachePrimed], NSNumber); + return deviceCachePrimedNumber.boolValue; +} + +- (nullable NSDate *)estimatedStartTime +{ + return MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyEstimatedStartTime], NSDate); +} -// TODO: Figure out how to validate the return values for the various -// MTR_DEVICE_*_XPC macros below. +- (nullable NSNumber *)estimatedSubscriptionLatency +{ + return MTR_SAFE_CAST(self._internalState[kMTRDeviceInternalPropertyEstimatedSubscriptionLatency], NSNumber); +} -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(state, MTRDeviceState, MTRDeviceStateUnknown, getStateWithReply) -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(deviceCachePrimed, BOOL, NO, getDeviceCachePrimedWithReply) -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedStartTime, NSDate * _Nullable, nil, getEstimatedStartTimeWithReply) -MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedSubscriptionLatency, NSNumber * _Nullable, nil, getEstimatedSubscriptionLatencyWithReply) +#pragma mark - Remote Commands typedef NSDictionary * _Nullable ReadAttributeResponseType; MTR_DEVICE_COMPLEX_REMOTE_XPC_GETTER(readAttributeWithEndpointID diff --git a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h index cfa59db8a73303..bd9048e4595f81 100644 --- a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h +++ b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h @@ -37,6 +37,8 @@ MTR_NEWLY_AVAILABLE //- (oneway void)controller:(NSUUID *)controller commissioningSessionEstablishmentDone:(NSError * _Nullable)error; //- (oneway void)controller:(NSUUID *)controller commissioningComplete:(NSError * _Nullable)error nodeID:(NSNumber * _Nullable)nodeID metrics:(MTRMetrics * _Nullable)metrics; //- (oneway void)controller:(NSUUID *)controller readCommissioningInfo:(MTRProductIdentity *)info; +@optional +- (oneway void)controller:(NSUUID *)controller controllerConfigurationUpdated:(NSDictionary *)configuration; @end MTR_NEWLY_AVAILABLE diff --git a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h index 9ecec60ae52a41..1a468a133264bb 100644 --- a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h +++ b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h @@ -21,6 +21,9 @@ NS_ASSUME_NONNULL_BEGIN MTR_EXTERN NSString * const MTRDeviceControllerRegistrationNodeIDsKey MTR_NEWLY_AVAILABLE; MTR_EXTERN NSString * const MTRDeviceControllerRegistrationNodeIDKey MTR_NEWLY_AVAILABLE; MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerContextKey MTR_NEWLY_AVAILABLE; +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerNodeIDKey MTR_NEWLY_AVAILABLE; +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationControllerIsRunningKey MTR_NEWLY_AVAILABLE; +MTR_EXTERN NSString * const MTRDeviceControllerRegistrationDeviceInternalStateKey MTR_NEWLY_AVAILABLE; MTR_NEWLY_AVAILABLE @protocol MTRXPCServerProtocol_MTRDevice @@ -54,10 +57,6 @@ MTR_NEWLY_AVAILABLE @protocol MTRXPCServerProtocol_MTRDeviceController @optional -- (oneway void)deviceController:(NSUUID *)controller getIsRunningWithReply:(void (^)(BOOL response))reply; -- (oneway void)deviceController:(NSUUID *)controller getUniqueIdentifierWithReply:(void (^)(NSUUID *))reply; -- (oneway void)deviceController:(NSUUID *)controller controllerNodeIDWithReply:(void (^)(NSNumber * nodeID))reply; - // - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void (^)(BOOL success, NSError * _Nullable error))reply; // - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithDiscoveredDevice:(MTRCommissionableBrowserResult *)discoveredDevice payload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void (^)(BOOL success, NSError * _Nullable error))reply; // - (oneway void)deviceController:(NSUUID *)controller commissionNodeWithID:(NSNumber *)nodeID commissioningParams:(MTRCommissioningParameters *)commissioningParams withReply:(void (^)(BOOL success, NSError * _Nullable error))reply; @@ -73,6 +72,7 @@ MTR_NEWLY_AVAILABLE - (oneway void)deviceController:(NSUUID *)controller registerNodeID:(NSNumber *)nodeID; - (oneway void)deviceController:(NSUUID *)controller unregisterNodeID:(NSNumber *)nodeID; +- (oneway void)deviceController:(NSUUID *)controller updateControllerConfiguration:(NSDictionary *)controllerState; @end @@ -80,7 +80,6 @@ MTR_NEWLY_AVAILABLE @protocol MTRXPCServerProtocol @optional - (oneway void)deviceController:(NSUUID *)controller checkInWithContext:(NSDictionary *)context; -- (oneway void)deviceController:(NSUUID *)controller updateControllerConfiguration:(NSDictionary *)controllerState; @end NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 673f1cacaabc10..a21e90d726ec0b 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -1322,8 +1322,6 @@ isa = PBXGroup; children = ( D444F9A12C6E8058007761E5 /* XPC Protocol */, - 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */, - 9B0484F42C701154006C2D5F /* MTRDeviceController_Concrete.h */, 88E07D602B9A89A4005FD53E /* MTRMetricKeys.h */, 88FA798B2B7B257100CD4B6F /* MTRMetricsCollector.h */, 88FA798C2B7B257100CD4B6F /* MTRMetricsCollector.mm */, @@ -1404,11 +1402,13 @@ 75B3269B2BCDB9D600E17C4E /* MTRDeviceConnectivityMonitor.h */, 75B3269D2BCDB9EA00E17C4E /* MTRDeviceConnectivityMonitor.mm */, 991DC0822475F45400C13860 /* MTRDeviceController.h */, + 5136660F28067D540025EDAE /* MTRDeviceController_Internal.h */, + 991DC0872475F47D00C13860 /* MTRDeviceController.mm */, + 9B0484F42C701154006C2D5F /* MTRDeviceController_Concrete.h */, + 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */, 9BFE5D4E2C6D3075007D4319 /* MTRDeviceController_XPC.h */, 9B5CCB582C6E6FD3009DD99B /* MTRDeviceController_XPC_Internal.h */, 9BFE5D4F2C6D3075007D4319 /* MTRDeviceController_XPC.mm */, - 5136660F28067D540025EDAE /* MTRDeviceController_Internal.h */, - 991DC0872475F47D00C13860 /* MTRDeviceController.mm */, 5A7947E227C0101200434CF2 /* MTRDeviceController+XPC.h */, 5A7947E327C0129500434CF2 /* MTRDeviceController+XPC.mm */, 2CB7163E252F731E0026E2BB /* MTRDeviceControllerDelegate.h */,