From 4cc1e14b7462c23c5e8b93a20be0be7a5fc91198 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 14 Jul 2023 16:16:26 -0400 Subject: [PATCH] Add a "country-code" argument to darwin-framework-tool pairing commands. (#27951) --- .../commands/pairing/PairingCommandBridge.h | 7 +++++++ .../commands/pairing/PairingCommandBridge.mm | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.h b/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.h index 34ad517075fb36..4ca6c4c2b73582 100644 --- a/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.h +++ b/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.h @@ -74,6 +74,12 @@ class PairingCommandBridge : public CHIPCommandBridge break; } + if (mode != PairingMode::None) + { + AddArgument("country-code", &mCountryCode, + "Country code to use to set the Basic Information cluster's Location attribute"); + } + AddArgument("use-device-attestation-delegate", 0, 1, &mUseDeviceAttestationDelegate, "If true, use a device attestation delegate that always wants to be notified about attestation results. " "Defaults to false."); @@ -104,4 +110,5 @@ class PairingCommandBridge : public CHIPCommandBridge char * mOnboardingPayload; chip::Optional mUseDeviceAttestationDelegate; chip::Optional mDeviceAttestationFailsafeTime; + chip::Optional mCountryCode; }; diff --git a/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.mm b/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.mm index 316f1705e91363..2ab95a9f5b5e68 100644 --- a/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.mm +++ b/examples/darwin-framework-tool/commands/pairing/PairingCommandBridge.mm @@ -74,6 +74,10 @@ - (void)deviceAttestationCompletedForController:(MTRDeviceController *)controlle } } + if (mCountryCode.HasValue()) { + params.countryCode = [NSString stringWithUTF8String:mCountryCode.Value()]; + } + [deviceControllerDelegate setCommandBridge:this]; [deviceControllerDelegate setParams:params]; [deviceControllerDelegate setCommissioner:commissioner];