From e6278e23c9ed45afa2ea65354067ac56155eaec0 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 29 Aug 2023 15:50:53 -0400 Subject: [PATCH] Address more review comments. --- src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm | 5 ++++- .../Framework/CHIP/MTRDeviceControllerStartupParams.mm | 6 ++++++ .../Framework/CHIP/MTRDeviceControllerStorageDelegate.h | 4 ++-- .../Framework/CHIPTests/MTRPerControllerStorageTests.m | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm index 6e5f581ffe257b..95282450952ef2 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm @@ -650,11 +650,14 @@ - (MTRDeviceController * _Nullable)_startDeviceController:(id)startupParams storageDelegate = params.storageDelegate; storageDelegateQueue = params.storageDelegateQueue; uniqueIdentifier = params.uniqueIdentifier; - } else { + } else if ([startupParams isKindOfClass:[MTRDeviceControllerStartupParams class]]) { MTRDeviceControllerStartupParams * params = startupParams; storageDelegate = nil; storageDelegateQueue = nil; uniqueIdentifier = params.uniqueIdentifier; + } else { + MTR_LOG_ERROR("Unknown kind of startup params: %@", startupParams); + return nil; } if (_usingPerControllerStorage && storageDelegate == nil) { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm index 232750d6ab2317..4584bbf8e4af9b 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm @@ -164,6 +164,12 @@ - (instancetype)initWithParameters:(MTRDeviceControllerStartupParameters *)param _ipk = params.ipk; _vendorID = params.vendorID; + // Note: Since we have an operationalCertificate, we do not need a nodeID as + // part of our params; it will not be used. Don't even initialize it, to + // avoid confusion about that. + // + // We don't really use the fabricID for anything either, but we promise to + // have a non-nil one, which is why we set it above. _nodeID = nil; _caseAuthenticatedTags = nil; _rootCertificate = params.rootCertificate; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStorageDelegate.h b/src/darwin/Framework/CHIP/MTRDeviceControllerStorageDelegate.h index 570ff2ff58aa43..4f19ac81fd33d4 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStorageDelegate.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStorageDelegate.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022-2023 Project CHIP Authors + * Copyright (c) 2023 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,7 @@ typedef NS_ENUM(NSUInteger, MTRStorageSharingType) { * it is to get its controllerID. * * 2) The delegate method calls will happen on the queue that was provided along - * with the gelegate. All Matter work will be blocked until the method + * with the delegate. All Matter work will be blocked until the method * completes, and these calls may themselves block other Matter API calls * from completing. Attempting to call any Matter API on the queue used for * this delegate, apart from de-serializing and serializing the items being diff --git a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m index 68ee35b54aa4dc..d5cd419e477063 100644 --- a/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m +++ b/src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Project CHIP Authors + * Copyright (c) 2023 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.