From 11371965c8ca0cdb0854760d865dbff1c6389a24 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Fri, 17 Feb 2023 01:30:46 +0100 Subject: [PATCH] [yaml] Add discoverOnce as an optional argument to CommissionerCommands::PairWithCode (#25048) * [yaml] Add discoverOnce as an optional argument to CommissionerCommands::PairWithCode * Update zap version * Add ClustersWithShutdownFunctions to config-data.yaml in order to get ZAP to run * Update generated simulated clusters code --- integrations/docker/images/chip-cert-bins/Dockerfile | 2 +- scripts/setup/zap.json | 2 +- scripts/tools/zap/zap_execution.py | 2 +- src/app/common/templates/config-data.yaml | 2 ++ .../suites/commands/commissioner/CommissionerCommands.cpp | 7 +++++++ .../suites/commands/commissioner/CommissionerCommands.h | 3 +++ .../zap-generated/tests/simulated-cluster-objects.h | 5 +++++ 7 files changed, 20 insertions(+), 3 deletions(-) diff --git a/integrations/docker/images/chip-cert-bins/Dockerfile b/integrations/docker/images/chip-cert-bins/Dockerfile index 5a74d4f7d42daf..872c3e696fed1f 100644 --- a/integrations/docker/images/chip-cert-bins/Dockerfile +++ b/integrations/docker/images/chip-cert-bins/Dockerfile @@ -7,7 +7,7 @@ ARG COMMITHASH=7b99e6399c6069037c613782d78132c69b9dcabb # ZAP Development install, so that it runs on both x64 and arm64 # Generally this should match with the ZAP version that is used for codegen within the # specified SHA -ARG ZAP_VERSION=v2023.02.09-nightly +ARG ZAP_VERSION=v2023.02.16-nightly # Ensure TARGETPLATFORM is set RUN case ${TARGETPLATFORM} in \ diff --git a/scripts/setup/zap.json b/scripts/setup/zap.json index fa066ed9eb35cb..9dff5d9940e660 100644 --- a/scripts/setup/zap.json +++ b/scripts/setup/zap.json @@ -8,7 +8,7 @@ "mac-arm64", "windows-amd64" ], - "tags": ["version:2@v2023.02.09-nightly.1"] + "tags": ["version:2@v2023.02.16-nightly.1"] } ] } diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index cc36b802380dc8..88f94dbc86028b 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -23,7 +23,7 @@ # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions # -MIN_ZAP_VERSION = '2023.2.9' +MIN_ZAP_VERSION = '2023.2.16' class ZapTool: diff --git a/src/app/common/templates/config-data.yaml b/src/app/common/templates/config-data.yaml index 91201121c9b5b2..0cdde61a50a466 100644 --- a/src/app/common/templates/config-data.yaml +++ b/src/app/common/templates/config-data.yaml @@ -65,3 +65,5 @@ ClustersWithPreAttributeChangeFunctions: - Mode Select - Fan Control - Thermostat + +ClustersWithShutdownFunctions: [] diff --git a/src/app/tests/suites/commands/commissioner/CommissionerCommands.cpp b/src/app/tests/suites/commands/commissioner/CommissionerCommands.cpp index 74545a47e95d5b..d9c45b1b5d5341 100644 --- a/src/app/tests/suites/commands/commissioner/CommissionerCommands.cpp +++ b/src/app/tests/suites/commands/commissioner/CommissionerCommands.cpp @@ -33,6 +33,8 @@ CommissionerCommands::PairWithCode(const char * identity, memcpy(code, value.payload.data(), value.payload.size()); ChipLogError(chipTool, "Pairing Code is %s", code); + mDiscoverOnce = value.discoverOnce; + // To reduce the scanning latency in some setups, and since the primary use for PairWithCode is to commission a device to // another commissioner, assume that the commissionable device is available on the network. chip::Controller::DiscoveryType discoveryType = chip::Controller::DiscoveryType::kDiscoveryNetworkOnly; @@ -128,6 +130,11 @@ void CommissionerCommands::OnStatusUpdate(DevicePairingDelegate::Status status) OnResponse(ConvertToStatusIB(CHIP_ERROR_INCORRECT_STATE), nullptr); break; case DevicePairingDelegate::Status::SecurePairingDiscoveringMoreDevices: + if (mDiscoverOnce.ValueOr(false)) + { + ChipLogError(chipTool, "Secure Pairing Failed"); + OnResponse(ConvertToStatusIB(CHIP_ERROR_INCORRECT_STATE), nullptr); + } break; } } diff --git a/src/app/tests/suites/commands/commissioner/CommissionerCommands.h b/src/app/tests/suites/commands/commissioner/CommissionerCommands.h index 9056f3a53947e3..31cbcef4396c3a 100644 --- a/src/app/tests/suites/commands/commissioner/CommissionerCommands.h +++ b/src/app/tests/suites/commands/commissioner/CommissionerCommands.h @@ -45,4 +45,7 @@ class CommissionerCommands : public chip::Controller::DevicePairingDelegate void OnPairingComplete(CHIP_ERROR error) override; void OnPairingDeleted(CHIP_ERROR error) override; void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR error) override; + +private: + chip::Optional mDiscoverOnce; }; diff --git a/zzz_generated/app-common/app-common/zap-generated/tests/simulated-cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/tests/simulated-cluster-objects.h index 8b02038206c5ec..c4db867b7323be 100644 --- a/zzz_generated/app-common/app-common/zap-generated/tests/simulated-cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/tests/simulated-cluster-objects.h @@ -28,6 +28,7 @@ struct PairWithCodeCommand { chip::NodeId nodeId; chip::CharSpan payload; + Optional discoverOnce; CHIP_ERROR Encode(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const { @@ -35,6 +36,7 @@ struct PairWithCodeCommand ReturnErrorOnFailure(writer.StartContainer(tag, chip::TLV::kTLVType_Structure, outer)); ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(0), nodeId)); ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(1), payload)); + ReturnErrorOnFailure(chip::app::DataModel::Encode(writer, chip::TLV::ContextTag(2), discoverOnce)); ReturnErrorOnFailure(writer.EndContainer(outer)); return CHIP_NO_ERROR; } @@ -57,6 +59,9 @@ struct PairWithCodeCommand case 1: ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, payload)); break; + case 2: + ReturnErrorOnFailure(chip::app::DataModel::Decode(reader, discoverOnce)); + break; default: break; }