Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set commissioner node ID and update logging. #24294

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ 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 "
"comssioner-name. Interactive mode will only set a single commissioner on the inital command.");
woody-apple marked this conversation as resolved.
Show resolved Hide resolved
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 +137,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()) {
krypton36 marked this conversation as resolved.
Show resolved Hide resolved
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