Skip to content

Commit

Permalink
[chip-tool] Maintains multiple commissioners alive at the same time i…
Browse files Browse the repository at this point in the history
…n chip-tool (#13033)
  • Loading branch information
vivien-apple authored and pull[bot] committed Aug 21, 2023
1 parent 04ff048 commit c72fa5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
9 changes: 7 additions & 2 deletions examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ CHIP_ERROR CHIPCommand::Run()
factoryInitParams.listenPort = static_cast<uint16_t>(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<intptr_t>(this));
ReturnLogErrorOnFailure(StartWaiting(GetWaitDuration()));
Expand All @@ -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;
Expand Down Expand Up @@ -190,6 +194,7 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(std::string key, chip::FabricId f
std::unique_ptr<ChipDeviceCommissioner> commissioner = std::make_unique<ChipDeviceCommissioner>();
chip::Controller::SetupParams commissionerParams;
commissionerParams.storageDelegate = &mCommissionerStorage;
commissionerParams.fabricIndex = static_cast<chip::FabricIndex>(fabricId);
commissionerParams.operationalCredentialsDelegate = &mOpCredsIssuer;
commissionerParams.ephemeralKeypair = &ephemeralKey;
commissionerParams.controllerRCAC = rcacSpan;
Expand Down
13 changes: 2 additions & 11 deletions src/lib/core/CHIPConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -2722,22 +2722,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

/**
Expand All @@ -2746,7 +2737,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

/**
Expand Down

0 comments on commit c72fa5f

Please sign in to comment.