Skip to content

Commit

Permalink
Allow chip-tool/darwin-framework-tool vendor id to be customised (#26575
Browse files Browse the repository at this point in the history
)

* [chip-tool] Allow chip-tool vendor id to be customized

* [darwin-framework-tool] Allow darwin-framework-tool vendor id to be customized
  • Loading branch information
vivien-apple authored and pull[bot] committed Oct 20, 2023
1 parent 4622445 commit 1235810
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(CommissionerIdentity & identity,

// TODO: Initialize IPK epoch key in ExampleOperationalCredentials issuer rather than relying on DefaultIpkValue
commissionerParams.operationalCredentialsDelegate = mCredIssuerCmds->GetCredentialIssuer();
commissionerParams.controllerVendorId = chip::VendorId::TestVendor1;
commissionerParams.controllerVendorId = mCommissionerVendorId.ValueOr(chip::VendorId::TestVendor1);

ReturnLogErrorOnFailure(DeviceControllerFactory::GetInstance().SetupCommissioner(commissionerParams, *(commissioner.get())));

Expand Down
4 changes: 4 additions & 0 deletions examples/chip-tool/commands/common/CHIPCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ class CHIPCommand : public Command
AddArgument("ble-adapter", 0, UINT16_MAX, &mBleAdapterId);
AddArgument("storage-directory", &mStorageDirectory,
"Directory to place chip-tool's storage files in. Defaults to $TMPDIR, with fallback to /tmp");
AddArgument(
"commissioner-vendor-id", 0, UINT16_MAX, &mCommissionerVendorId,
"The vendor id to use for chip-tool. If not provided, chip::VendorId::TestVendor1 (65521, 0xFFF1) will be used.");
}

/////////// Command Interface /////////
Expand Down Expand Up @@ -203,6 +206,7 @@ class CHIPCommand : public Command

chip::Optional<char *> mCommissionerName;
chip::Optional<chip::NodeId> mCommissionerNodeId;
chip::Optional<chip::VendorId> mCommissionerVendorId;
chip::Optional<uint16_t> mBleAdapterId;
chip::Optional<char *> mPaaTrustStorePath;
chip::Optional<char *> mCDTrustStorePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class CHIPCommandBridge : public Command {
AddArgument("paa-trust-store-path", &mPaaTrustStorePath,
"Path to directory holding PAA certificate information. Can be absolute or relative to the current working "
"directory.");
AddArgument("commissioner-vendor-id", 0, UINT16_MAX, &mCommissionerVendorId,
"The vendor id to use for darwin-framework-tool. If not provided, chip::VendorId::TestVendor1 (65521, 0xFFF1) will be "
"used.");
}

/////////// Command Interface /////////
Expand Down Expand Up @@ -134,4 +137,5 @@ class CHIPCommandBridge : public Command {
bool mWaitingForResponse { true };
static dispatch_queue_t mOTAProviderCallbackQueue;
chip::Optional<char *> mPaaTrustStorePath;
chip::Optional<chip::VendorId> mCommissionerVendorId;
};
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
auto controller = [factory createControllerOnExistingFabric:controllerParams error:&error];
if (controller == nil) {
// Maybe we didn't have this fabric yet.
controllerParams.vendorID = @(chip::VendorId::TestVendor1);
controllerParams.vendorID = @(mCommissionerVendorId.ValueOr(chip::VendorId::TestVendor1));
controller = [factory createControllerOnNewFabric:controllerParams error:&error];
}
if (controller == nil) {
Expand Down

0 comments on commit 1235810

Please sign in to comment.