Skip to content

Commit

Permalink
Add ability to set commissioner node ID and update logging. (#24294)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

---------

Co-authored-by: Justin Wood <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
3 people authored and pull[bot] committed Jul 13, 2023
1 parent 52c838e commit b8176cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class CHIPCommandBridge : public Command {
: 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.");
Expand Down Expand Up @@ -134,6 +138,7 @@ class CHIPCommandBridge : public Command {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit b8176cb

Please sign in to comment.