diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.h b/src/darwin/Framework/CHIP/MTRDeviceController.h index 670e12bbd0caaf..bac064cfbbde08 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController.h @@ -22,6 +22,7 @@ #import @class MTRBaseDevice; +@class MTRDeviceControllerParameters; NS_ASSUME_NONNULL_BEGIN @@ -37,11 +38,25 @@ typedef void (^MTRDeviceConnectionCallback)(MTRBaseDevice * _Nullable device, NS @interface MTRDeviceController : NSObject /** - * Controllers are created via the MTRDeviceControllerFactory object. + * Controllers are created via the MTRDeviceControllerFactory object or + * initialized via initWithParameters:error:. */ - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; +/** + * Initialize a device controller with the provided parameters. This will: + * + * 1) Auto-start the MTRDeviceControllerFactory in storage-per-controller mode + * if it has not already been started. + * 2) Return nil or a running controller. + * + * Once this returns non-nil, it's the caller's resposibility to call shutdown + * on the controller to avoid leaking it. + */ +- (nullable instancetype)initWithParameters:(MTRDeviceControllerParameters *)parameters + error:(NSError * __autoreleasing *)error MTR_NEWLY_AVAILABLE; + /** * If true, the controller has not been shut down yet. */ diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 98d757d6d291e7..82630b698790fb 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -15,6 +15,7 @@ * limitations under the License. */ #import +#import #import "MTRDeviceController_Internal.h" @@ -119,6 +120,20 @@ @interface MTRDeviceController () { @implementation MTRDeviceController +- (nullable instancetype)initWithParameters:(MTRDeviceControllerParameters *)parameters error:(NSError * __autoreleasing *)error +{ + __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; + if (!factory.isRunning) { + auto * params = [[MTRDeviceControllerFactoryParams alloc] initWithoutStorage]; + + if (![factory startControllerFactory:params error:error]) { + return nil; + } + } + + return [factory initializeController:self withParameters:parameters error:error]; +} + - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory queue:(dispatch_queue_t)queue storageDelegate:(id _Nullable)storageDelegate diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h index 6471db8b005ccb..c0a7dd72bb2991 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h @@ -22,7 +22,6 @@ #import #import -#import NS_ASSUME_NONNULL_BEGIN @@ -37,6 +36,9 @@ NS_ASSUME_NONNULL_BEGIN API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRDeviceControllerFactoryParams : NSObject + +- (instancetype)init NS_UNAVAILABLE; + /* * Storage used to store persistent information for the fabrics the * controllers ends up interacting with. This is only used if "initWithStorage" @@ -93,12 +95,6 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) */ - (instancetype)initWithStorage:(id)storage; -/* - * Initialize the device controller factory without storage. In this mode, - * device controllers will need to have per-controller storage provided to allow - * storing controller-specific information. - */ -- (instancetype)init MTR_NEWLY_AVAILABLE; @end API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @@ -180,18 +176,6 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) - (MTRDeviceController * _Nullable)createControllerOnNewFabric:(MTRDeviceControllerStartupParams *)startupParams error:(NSError * __autoreleasing *)error; -/** - * Create an MTRDeviceController. Returns nil on failure. - * - * This method will fail if there is already a controller running for the given - * node identity. - * - * This method will fail if the controller factory was not initialized in - * storage-per-controller mode. - */ -- (MTRDeviceController * _Nullable)createController:(MTRDeviceControllerStartupParameters *)startupParameters - error:(NSError * __autoreleasing *)error MTR_NEWLY_AVAILABLE; - @end MTR_DEPRECATED( diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm index 195fb61f5c7b6a..baffab496b548b 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm @@ -544,8 +544,13 @@ - (void)stopControllerFactory * The fabricChecker block will run on the Matter queue, and is expected to * return nil if pre-startup fabric table checks fail, and set fabricError to * the right error value in that situation. + * + * existingController can be provided if the controller object has already been + * allocated but not yet initialized. If not provided, a new controller object + * will be created. */ -- (MTRDeviceController * _Nullable)_startDeviceController:(id)startupParams +- (MTRDeviceController * _Nullable)_startDeviceController:(nullable MTRDeviceController *)existingController + startupParams:(id)startupParams fabricChecker:(MTRDeviceControllerStartupParamsInternal * (^)(FabricTable * fabricTable, MTRDeviceController * controller, CHIP_ERROR & fabricError))fabricChecker @@ -563,8 +568,8 @@ - (MTRDeviceController * _Nullable)_startDeviceController:(id)startupParams NSUUID * uniqueIdentifier; id _Nullable otaProviderDelegate; dispatch_queue_t _Nullable otaProviderDelegateQueue; - if ([startupParams isKindOfClass:[MTRDeviceControllerStartupParameters class]]) { - MTRDeviceControllerStartupParameters * params = startupParams; + if ([startupParams isKindOfClass:[MTRDeviceControllerParameters class]]) { + MTRDeviceControllerParameters * params = startupParams; storageDelegate = params.storageDelegate; storageDelegateQueue = params.storageDelegateQueue; uniqueIdentifier = params.uniqueIdentifier; @@ -607,7 +612,8 @@ - (MTRDeviceController * _Nullable)_startDeviceController:(id)startupParams // Create the controller, so we start the event loop, since we plan to do // our fabric table operations there. - auto * controller = [self _createController:storageDelegate + auto * controller = [self _createController:existingController + storageDelegate:storageDelegate storageDelegateQueue:storageDelegateQueue otaProviderDelegate:otaProviderDelegate otaProviderDelegateQueue:otaProviderDelegateQueue @@ -713,7 +719,8 @@ - (MTRDeviceController * _Nullable)createControllerOnExistingFabric:(MTRDeviceCo return nil; } - return [self _startDeviceController:startupParams + return [self _startDeviceController:nil + startupParams:startupParams fabricChecker:^MTRDeviceControllerStartupParamsInternal *( FabricTable * fabricTable, MTRDeviceController * controller, CHIP_ERROR & fabricError) { const FabricInfo * fabric = nullptr; @@ -789,7 +796,8 @@ - (MTRDeviceController * _Nullable)createControllerOnNewFabric:(MTRDeviceControl return nil; } - return [self _startDeviceController:startupParams + return [self _startDeviceController:nil + startupParams:startupParams fabricChecker:^MTRDeviceControllerStartupParamsInternal *( FabricTable * fabricTable, MTRDeviceController * controller, CHIP_ERROR & fabricError) { const FabricInfo * fabric = nullptr; @@ -822,36 +830,8 @@ - (MTRDeviceController * _Nullable)createControllerOnNewFabric:(MTRDeviceControl error:error]; } -- (MTRDeviceController * _Nullable)createController:(MTRDeviceControllerStartupParameters *)startupParameters - error:(NSError * __autoreleasing *)error -{ - [self _assertCurrentQueueIsNotMatterQueue]; - - return [self _startDeviceController:startupParameters - fabricChecker:^MTRDeviceControllerStartupParamsInternal *( - FabricTable * fabricTable, MTRDeviceController * controller, CHIP_ERROR & fabricError) { - auto advertiseOperational = self.advertiseOperational && startupParameters.shouldAdvertiseOperational; - auto * params = - [[MTRDeviceControllerStartupParamsInternal alloc] initForNewController:controller - fabricTable:fabricTable - keystore:self->_keystore - advertiseOperational:advertiseOperational - params:startupParameters - error:fabricError]; - if (params != nil) { - if (params.productAttestationAuthorityCertificates == nil) { - params.productAttestationAuthorityCertificates = self.productAttestationAuthorityCertificates; - } - if (params.certificationDeclarationCertificates == nil) { - params.certificationDeclarationCertificates = self.certificationDeclarationCertificates; - } - } - return params; - } - error:error]; -} - -- (MTRDeviceController * _Nullable)_createController:(id _Nullable)storageDelegate +- (MTRDeviceController * _Nullable)_createController:(nullable MTRDeviceController *)existingController + storageDelegate:(id _Nullable)storageDelegate storageDelegateQueue:(dispatch_queue_t _Nullable)storageDelegateQueue otaProviderDelegate:(id _Nullable)otaProviderDelegate otaProviderDelegateQueue:(dispatch_queue_t _Nullable)otaProviderDelegateQueue @@ -859,13 +839,17 @@ - (MTRDeviceController * _Nullable)_createController:(id_keystore + advertiseOperational:advertiseOperational + params:parameters + error:fabricError]; + if (params != nil) { + if (params.productAttestationAuthorityCertificates == nil) { + params.productAttestationAuthorityCertificates = self.productAttestationAuthorityCertificates; + } + if (params.certificationDeclarationCertificates == nil) { + params.certificationDeclarationCertificates = self.certificationDeclarationCertificates; + } + } + return params; + } + error:error]; +} + - (PersistentStorageDelegate *)storageDelegate { return _persistentStorageDelegate; @@ -1173,7 +1188,7 @@ - (instancetype)initWithStorage:(id)storage return self; } -- (instancetype)init +- (instancetype)initWithoutStorage { if (!(self = [super init])) { return nil; @@ -1188,7 +1203,7 @@ - (instancetype)init _productAttestationAuthorityCertificates = nil; _certificationDeclarationCertificates = nil; _port = nil; - _shouldStartServer = NO; + _shouldStartServer = YES; return self; } diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory_Internal.h index 9717f5062c93f5..9dd72dc0faa0b7 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory_Internal.h @@ -20,6 +20,8 @@ */ #import +#import +#import #import "MTRDeviceControllerFactory.h" @@ -67,9 +69,25 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)operationalInstanceAdded:(chip::PeerId &)operationalID; +/** + * Initialize an MTRDeviceController with the given parameters. + */ +- (nullable MTRDeviceController *)initializeController:(MTRDeviceController *)controller + withParameters:(MTRDeviceControllerParameters *)parameters + error:(NSError * __autoreleasing *)error; + @property (readonly) chip::PersistentStorageDelegate * storageDelegate; @property (readonly) chip::Credentials::GroupDataProvider * groupData; @end +@interface MTRDeviceControllerFactoryParams () +/* + * Initialize the device controller factory without storage. In this mode, + * device controllers will need to have per-controller storage provided to allow + * storing controller-specific information. + */ +- (instancetype)initWithoutStorage; +@end + NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParameters.h b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h similarity index 96% rename from src/darwin/Framework/CHIP/MTRDeviceControllerStartupParameters.h rename to src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h index 0fca31906c2e3b..8b21dcdd88e63a 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParameters.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h @@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN MTR_NEWLY_AVAILABLE -@interface MTRDeviceControllerStartupParameters : NSObject +@interface MTRDeviceControllerParameters : NSObject - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; @@ -69,7 +69,7 @@ MTR_NEWLY_AVAILABLE @end MTR_NEWLY_AVAILABLE -@interface MTRDeviceControllerExternalCertificateStartupParameters : MTRDeviceControllerStartupParameters +@interface MTRDeviceControllerExternalCertificateParameters : MTRDeviceControllerParameters - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm index 7bbcea96183035..ba697956129a79 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm @@ -140,15 +140,15 @@ - (instancetype)initWithParams:(MTRDeviceControllerStartupParams *)params return self; } -- (instancetype)initWithParameters:(MTRDeviceControllerStartupParameters *)params error:(CHIP_ERROR &)error +- (instancetype)initWithParameters:(MTRDeviceControllerParameters *)params error:(CHIP_ERROR &)error { if (!(self = [super init])) { error = CHIP_ERROR_INCORRECT_STATE; return nil; } - if (![params isKindOfClass:[MTRDeviceControllerExternalCertificateStartupParameters class]]) { - MTR_LOG_ERROR("Unexpected subclass of MTRDeviceControllerStartupParameters"); + if (![params isKindOfClass:[MTRDeviceControllerExternalCertificateParameters class]]) { + MTR_LOG_ERROR("Unexpected subclass of MTRDeviceControllerParameters"); error = CHIP_ERROR_INVALID_ARGUMENT; return nil; } @@ -247,7 +247,7 @@ - (instancetype)initWithOperationalKeypair:(id)operationalKeypair @end -@implementation MTRDeviceControllerStartupParameters +@implementation MTRDeviceControllerParameters - (instancetype)initWithStorageDelegate:(id)storageDelegate storageDelegateQueue:(dispatch_queue_t)storageDelegateQueue uniqueIdentifier:(NSUUID *)uniqueIdentifier @@ -297,7 +297,7 @@ - (void)setOTAProviderDelegate:(id)otaProviderDelegate q @end -@implementation MTRDeviceControllerExternalCertificateStartupParameters +@implementation MTRDeviceControllerExternalCertificateParameters - (instancetype)initWithStorageDelegate:(id)storageDelegate storageDelegateQueue:(dispatch_queue_t)storageDelegateQueue uniqueIdentifier:(NSUUID *)uniqueIdentifier @@ -538,7 +538,7 @@ - (instancetype)initForNewController:(MTRDeviceController *)controller fabricTable:(chip::FabricTable *)fabricTable keystore:(chip::Crypto::OperationalKeystore *)keystore advertiseOperational:(BOOL)advertiseOperational - params:(MTRDeviceControllerStartupParameters *)params + params:(MTRDeviceControllerParameters *)params error:(CHIP_ERROR &)error { if (!(self = [super initWithParameters:params error:error])) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h index 734197ef72d2d6..2d16f12985b98c 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams_Internal.h @@ -20,7 +20,7 @@ #import #import #import -#import +#import #include #include @@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithParams:(MTRDeviceControllerStartupParams *)params; @end -@interface MTRDeviceControllerStartupParameters () +@interface MTRDeviceControllerParameters () - (instancetype)initWithStorageDelegate:(id)storageDelegate storageDelegateQueue:(dispatch_queue_t)storageDelegateQueue @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN intermediateCertificate:(MTRCertificateDERBytes _Nullable)intermediateCertificate rootCertificate:(MTRCertificateDERBytes)rootCertificate; -// When we have other subclasses of MTRDeviceControllerStartupParameters, we may +// When we have other subclasses of MTRDeviceControllerParameters, we may // need to make more things nullable here and/or add more fields. But for now // we know exactly what information we have. @property (nonatomic, copy, readonly) NSData * ipk; @@ -153,7 +153,7 @@ MTR_HIDDEN fabricTable:(chip::FabricTable *)fabricTable keystore:(chip::Crypto::OperationalKeystore *)keystore advertiseOperational:(BOOL)advertiseOperational - params:(MTRDeviceControllerStartupParameters *)params + params:(MTRDeviceControllerParameters *)params error:(CHIP_ERROR &)error; /** diff --git a/src/darwin/Framework/CHIP/Matter.h b/src/darwin/Framework/CHIP/Matter.h index 26c74cd80487d2..8667260a5c5ef4 100644 --- a/src/darwin/Framework/CHIP/Matter.h +++ b/src/darwin/Framework/CHIP/Matter.h @@ -40,7 +40,7 @@ #import #import #import -#import +#import #import #import #import diff --git a/src/darwin/Framework/CHIPTests/MTRControllerAdvertisingTests.m b/src/darwin/Framework/CHIPTests/MTRControllerAdvertisingTests.m index 1276e0ce845bca..4092a38b56f84e 100644 --- a/src/darwin/Framework/CHIPTests/MTRControllerAdvertisingTests.m +++ b/src/darwin/Framework/CHIPTests/MTRControllerAdvertisingTests.m @@ -131,8 +131,6 @@ - (void)setUp [self setContinueAfterFailure:NO]; _storageQueue = dispatch_queue_create("test.storage.queue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - - [self startFactory]; } - (void)tearDown @@ -143,22 +141,6 @@ - (void)tearDown [super tearDown]; } -- (void)startFactory -{ - __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; - XCTAssertNotNil(factory); - - __auto_type * factoryParams = [[MTRDeviceControllerFactoryParams alloc] init]; - factoryParams.shouldStartServer = YES; - - NSError * error; - BOOL ok = [factory startControllerFactory:factoryParams error:&error]; - XCTAssertNil(error); - XCTAssertTrue(ok); - - XCTAssertTrue(factory.isRunning); -} - - (void)stopFactory { __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; @@ -178,9 +160,6 @@ - (nullable MTRDeviceController *)startControllerWithRootKeys:(MTRTestKeys *)roo { XCTAssertTrue(error != NULL); - __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; - XCTAssertNotNil(factory); - // Specify a fixed issuerID, so we get the same cert if we use the same keys. __auto_type * root = [MTRCertificates createRootCertificate:rootKeys issuerID:@(1) fabricID:nil error:error]; XCTAssertNil(*error); @@ -196,21 +175,20 @@ - (nullable MTRDeviceController *)startControllerWithRootKeys:(MTRTestKeys *)roo XCTAssertNil(*error); XCTAssertNotNil(operational); - __auto_type * params = - [[MTRDeviceControllerExternalCertificateStartupParameters alloc] initWithStorageDelegate:storage - storageDelegateQueue:_storageQueue - uniqueIdentifier:storage.controllerID - ipk:rootKeys.ipk - vendorID:@(kTestVendorId) - operationalKeypair:operationalKeys - operationalCertificate:operational - intermediateCertificate:nil - rootCertificate:root]; + __auto_type * params = [[MTRDeviceControllerExternalCertificateParameters alloc] initWithStorageDelegate:storage + storageDelegateQueue:_storageQueue + uniqueIdentifier:storage.controllerID + ipk:rootKeys.ipk + vendorID:@(kTestVendorId) + operationalKeypair:operationalKeys + operationalCertificate:operational + intermediateCertificate:nil + rootCertificate:root]; XCTAssertNotNil(params); params.shouldAdvertiseOperational = advertiseOperational; - return [factory createController:params error:error]; + return [[MTRDeviceController alloc] initWithParameters:params error:error]; } - (void)test001_CheckAdvertisingAsExpected diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index 894eb5f3893464..3f318b2ded17b0 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -28,7 +28,6 @@ static const uint16_t kPairingTimeoutInSeconds = 10; static const uint16_t kTimeoutInSeconds = 3; static NSString * kOnboardingPayload = @"MT:-24J0AFN00KA0648G00"; -static const uint16_t kLocalPort = 5541; static const uint16_t kTestVendorId = 0xFFF1u; @interface MTRPerControllerStorageTestsControllerDelegate : NSObject @@ -192,8 +191,6 @@ - (void)setUp [self setContinueAfterFailure:NO]; _storageQueue = dispatch_queue_create("test.storage.queue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); - - [self startFactory]; } - (void)tearDown @@ -204,20 +201,6 @@ - (void)tearDown [super tearDown]; } -- (void)startFactory -{ - __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; - XCTAssertNotNil(factory); - - __auto_type * factoryParams = [[MTRDeviceControllerFactoryParams alloc] init]; - factoryParams.port = @(kLocalPort); - - NSError * error; - BOOL ok = [factory startControllerFactory:factoryParams error:&error]; - XCTAssertNil(error); - XCTAssertTrue(ok); -} - - (void)stopFactory { __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; @@ -260,9 +243,6 @@ - (nullable MTRDeviceController *)startControllerWithRootKeys:(MTRTestKeys *)roo { XCTAssertTrue(error != NULL); - __auto_type * factory = [MTRDeviceControllerFactory sharedInstance]; - XCTAssertNotNil(factory); - // Specify a fixed issuerID, so we get the same cert if we use the same keys. __auto_type * root = [MTRCertificates createRootCertificate:rootKeys issuerID:@(1) fabricID:nil error:error]; XCTAssertNil(*error); @@ -278,16 +258,15 @@ - (nullable MTRDeviceController *)startControllerWithRootKeys:(MTRTestKeys *)roo XCTAssertNil(*error); XCTAssertNotNil(operational); - __auto_type * params = - [[MTRDeviceControllerExternalCertificateStartupParameters alloc] initWithStorageDelegate:storage - storageDelegateQueue:_storageQueue - uniqueIdentifier:storage.controllerID - ipk:rootKeys.ipk - vendorID:@(kTestVendorId) - operationalKeypair:operationalKeys - operationalCertificate:operational - intermediateCertificate:nil - rootCertificate:root]; + __auto_type * params = [[MTRDeviceControllerExternalCertificateParameters alloc] initWithStorageDelegate:storage + storageDelegateQueue:_storageQueue + uniqueIdentifier:storage.controllerID + ipk:rootKeys.ipk + vendorID:@(kTestVendorId) + operationalKeypair:operationalKeys + operationalCertificate:operational + intermediateCertificate:nil + rootCertificate:root]; XCTAssertNotNil(params); __auto_type * ourCertificateIssuer = [[MTRPerControllerStorageTestsCertificateIssuer alloc] initWithRootCertificate:root @@ -302,7 +281,7 @@ - (nullable MTRDeviceController *)startControllerWithRootKeys:(MTRTestKeys *)roo [params setOperationalCertificateIssuer:ourCertificateIssuer queue:dispatch_get_main_queue()]; - return [factory createController:params error:error]; + return [[MTRDeviceController alloc] initWithParameters:params error:error]; } - (nullable MTRDeviceController *)startControllerWithRootKeys:(MTRTestKeys *)rootKeys diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index a95c790993dfd5..fc6fcc5c7f2c13 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -159,7 +159,7 @@ 51565CB12A7AD77600469F18 /* MTRDeviceControllerDataStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 51565CAF2A7AD77600469F18 /* MTRDeviceControllerDataStore.h */; }; 51565CB22A7AD77600469F18 /* MTRDeviceControllerDataStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51565CB02A7AD77600469F18 /* MTRDeviceControllerDataStore.mm */; }; 51565CB42A7AD78D00469F18 /* MTRDeviceControllerStorageDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51565CB32A7AD78D00469F18 /* MTRDeviceControllerStorageDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 51565CB62A7B0D6600469F18 /* MTRDeviceControllerStartupParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 51565CB52A7B0D6600469F18 /* MTRDeviceControllerStartupParameters.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 51565CB62A7B0D6600469F18 /* MTRDeviceControllerParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 51565CB52A7B0D6600469F18 /* MTRDeviceControllerParameters.h */; settings = {ATTRIBUTES = (Public, ); }; }; 515C1C6F284F9FFB00A48F0C /* MTRFramework.mm in Sources */ = {isa = PBXBuildFile; fileRef = 515C1C6D284F9FFB00A48F0C /* MTRFramework.mm */; }; 515C1C70284F9FFB00A48F0C /* MTRFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = 515C1C6E284F9FFB00A48F0C /* MTRFramework.h */; }; 51669AF02913204400F4AA36 /* MTRBackwardsCompatTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 51669AEF2913204400F4AA36 /* MTRBackwardsCompatTests.m */; }; @@ -474,7 +474,7 @@ 51565CAF2A7AD77600469F18 /* MTRDeviceControllerDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerDataStore.h; sourceTree = ""; }; 51565CB02A7AD77600469F18 /* MTRDeviceControllerDataStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceControllerDataStore.mm; sourceTree = ""; }; 51565CB32A7AD78D00469F18 /* MTRDeviceControllerStorageDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerStorageDelegate.h; sourceTree = ""; }; - 51565CB52A7B0D6600469F18 /* MTRDeviceControllerStartupParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerStartupParameters.h; sourceTree = ""; }; + 51565CB52A7B0D6600469F18 /* MTRDeviceControllerParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerParameters.h; sourceTree = ""; }; 515C1C6D284F9FFB00A48F0C /* MTRFramework.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRFramework.mm; sourceTree = ""; }; 515C1C6E284F9FFB00A48F0C /* MTRFramework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRFramework.h; sourceTree = ""; }; 51669AEF2913204400F4AA36 /* MTRBackwardsCompatTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRBackwardsCompatTests.m; sourceTree = ""; }; @@ -1083,7 +1083,7 @@ 51E51FBC282AD37A00FC978D /* MTRDeviceControllerStartupParams.h */, 51E51FBD282AD37A00FC978D /* MTRDeviceControllerStartupParams_Internal.h */, 51E51FBE282AD37A00FC978D /* MTRDeviceControllerStartupParams.mm */, - 51565CB52A7B0D6600469F18 /* MTRDeviceControllerStartupParameters.h */, + 51565CB52A7B0D6600469F18 /* MTRDeviceControllerParameters.h */, 51565CB32A7AD78D00469F18 /* MTRDeviceControllerStorageDelegate.h */, 5A6FEC9427B5976200F25F42 /* MTRDeviceControllerXPCConnection.h */, 5A6FEC9527B5983000F25F42 /* MTRDeviceControllerXPCConnection.mm */, @@ -1233,7 +1233,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 51565CB62A7B0D6600469F18 /* MTRDeviceControllerStartupParameters.h in Headers */, + 51565CB62A7B0D6600469F18 /* MTRDeviceControllerParameters.h in Headers */, 51565CB42A7AD78D00469F18 /* MTRDeviceControllerStorageDelegate.h in Headers */, 510A07492A685D3900A9241C /* Matter.apinotes in Headers */, 51EF279F2A2A3EB100E33F75 /* MTRBackwardsCompatShims.h in Headers */,