From 316c37e809e1bbe843343154d13868bf8ff94b8d Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Wed, 1 Dec 2021 15:40:03 +0100 Subject: [PATCH] [chip-tool] Maintains multiple commissioners alive at the same time in chip-tool --- examples/chip-tool/commands/common/CHIPCommand.cpp | 9 +++++++-- src/lib/core/CHIPConfig.h | 13 ++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index 8d64fd7b454154..aa52f1e84e4d8d 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -55,7 +55,9 @@ CHIP_ERROR CHIPCommand::Run() factoryInitParams.listenPort = static_cast(mDefaultStorage.GetListenPort() + CurrentCommissionerIndex()); ReturnLogErrorOnFailure(DeviceControllerFactory::GetInstance().Init(factoryInitParams)); - ReturnLogErrorOnFailure(InitializeCommissioner(GetIdentity(), CurrentCommissionerIndex())); + ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityAlpha, kIdentityAlphaFabricId)); + ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityBeta, kIdentityBetaFabricId)); + ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityGamma, kIdentityGammaFabricId)); chip::DeviceLayer::PlatformMgr().ScheduleWork(RunQueuedCommand, reinterpret_cast(this)); ReturnLogErrorOnFailure(StartWaiting(GetWaitDuration())); @@ -67,7 +69,9 @@ CHIP_ERROR CHIPCommand::Run() // since the CHIP thread and event queue have been stopped, preventing any thread // races. // - ReturnLogErrorOnFailure(ShutdownCommissioner(GetIdentity())); + ReturnLogErrorOnFailure(ShutdownCommissioner(kIdentityAlpha)); + ReturnLogErrorOnFailure(ShutdownCommissioner(kIdentityBeta)); + ReturnLogErrorOnFailure(ShutdownCommissioner(kIdentityGamma)); StopTracing(); return CHIP_NO_ERROR; @@ -190,6 +194,7 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(std::string key, chip::FabricId f std::unique_ptr commissioner = std::make_unique(); chip::Controller::SetupParams commissionerParams; commissionerParams.storageDelegate = &mCommissionerStorage; + commissionerParams.fabricIndex = static_cast(fabricId); commissionerParams.operationalCredentialsDelegate = &mOpCredsIssuer; commissionerParams.ephemeralKeypair = &ephemeralKey; commissionerParams.controllerRCAC = rcacSpan; diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 2b55c9b3a48641..ded6a4298d1e9d 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -2731,22 +2731,13 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; "Please enable at least one of CHIP_CONFIG_EXAMPLE_ACCESS_CONTROL_FAST_COPY_SUPPORT or CHIP_CONFIG_EXAMPLE_ACCESS_CONTROL_FLEXIBLE_COPY_SUPPORT" #endif -/** - * @def CHIP_CONFIG_MAX_SESSION_CREATION_DELEGATES - * - * @brief Defines the max number of SessionCreationDelegates - */ -#ifndef CHIP_CONFIG_MAX_SESSION_CREATION_DELEGATES -#define CHIP_CONFIG_MAX_SESSION_CREATION_DELEGATES 2 -#endif - /** * @def CHIP_CONFIG_MAX_SESSION_RELEASE_DELEGATES * * @brief Defines the max number of SessionReleaseDelegate */ #ifndef CHIP_CONFIG_MAX_SESSION_RELEASE_DELEGATES -#define CHIP_CONFIG_MAX_SESSION_RELEASE_DELEGATES 2 +#define CHIP_CONFIG_MAX_SESSION_RELEASE_DELEGATES 4 #endif /** @@ -2755,7 +2746,7 @@ extern const char CHIP_NON_PRODUCTION_MARKER[]; * @brief Defines the max number of SessionRecoveryDelegate */ #ifndef CHIP_CONFIG_MAX_SESSION_RECOVERY_DELEGATES -#define CHIP_CONFIG_MAX_SESSION_RECOVERY_DELEGATES 3 +#define CHIP_CONFIG_MAX_SESSION_RECOVERY_DELEGATES 4 #endif /**