Add ability to set commissioner node ID and update logging. (#24294)
* Add ability to set commissioner node ID and update logging.
* Set delay action time in query response if present.
* Update examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
---------
Co-authored-by: Justin Wood <woody@apple.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
diff --git a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h
index 2280f71..3a3a6d8 100644
--- a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h
+++ b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h
@@ -38,6 +38,10 @@
: Command(commandName)
{
AddArgument("commissioner-name", &mCommissionerName);
+ AddArgument("commissioner-nodeId", 0, UINT64_MAX, &mCommissionerNodeId,
+ "Sets the commisser node ID of the given "
+ "commissioner-name. Interactive mode will only set a single commissioner on the inital command. "
+ "The commissioner node ID will be persisted until a different one is specified.");
AddArgument("paa-trust-store-path", &mPaaTrustStorePath,
"Path to directory holding PAA certificate information. Can be absolute or relative to the current working "
"directory.");
@@ -134,6 +138,7 @@
std::condition_variable cvWaitingForResponse;
std::mutex cvWaitingForResponseMutex;
chip::Optional<char *> mCommissionerName;
+ chip::Optional<uint64_t> mCommissionerNodeId;
bool mWaitingForResponse { true };
static dispatch_queue_t mOTAProviderCallbackQueue;
chip::Optional<char *> mPaaTrustStorePath;
diff --git a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm
index 6c1cd92..55f429c 100644
--- a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm
+++ b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.mm
@@ -137,9 +137,13 @@
ipk = [gNocSigner getIPK];
constexpr const char * identities[] = { kIdentityAlpha, kIdentityBeta, kIdentityGamma };
+ std::string commissionerName = mCommissionerName.HasValue() ? mCommissionerName.Value() : kIdentityAlpha;
for (size_t i = 0; i < ArraySize(identities); ++i) {
auto controllerParams = [[MTRDeviceControllerStartupParams alloc] initWithIPK:ipk fabricID:@(i + 1) nocSigner:gNocSigner];
+ if (commissionerName.compare(identities[i]) == 0 && mCommissionerNodeId.HasValue()) {
+ controllerParams.nodeId = @(mCommissionerNodeId.Value());
+ }
// We're not sure whether we're creating a new fabric or using an
// existing one, so just try both.
auto controller = [factory createControllerOnExistingFabric:controllerParams error:&error];