From 27e8a8c51dfb8153b9c87eabe61113f74ce68aca Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 26 Apr 2022 12:15:57 -0400 Subject: [PATCH] Stop storing breadcrumb in persistent storage. Breadcrumb is not supposed to be stored persistently. Also adds a bunch of tests and fixes various bugs where we were setting breadcrumbs when we should not (e.g. in error conditions) and not setting them when we should (e.g. when the fail-safe expires). Fixes https://github.com/project-chip/connectedhomeip/issues/17515 --- .../general-commissioning-server.cpp | 51 ++- .../suites/TestGeneralCommissioning.yaml | 214 ++++++++++++ .../Framework/CHIP/templates/tests/tests.js | 4 +- src/include/platform/ConfigurationManager.h | 2 - src/include/platform/DeviceControlServer.h | 4 +- .../GenericConfigurationManagerImpl.h | 2 - .../GenericConfigurationManagerImpl.ipp | 12 - src/platform/Ameba/AmebaConfig.cpp | 1 - src/platform/Ameba/AmebaConfig.h | 1 - src/platform/CYW30739/CYW30739Config.h | 1 - src/platform/Darwin/PosixConfig.cpp | 1 - src/platform/Darwin/PosixConfig.h | 1 - src/platform/DeviceControlServer.cpp | 16 +- src/platform/EFR32/EFR32Config.h | 1 - src/platform/ESP32/ESP32Config.cpp | 1 - src/platform/ESP32/ESP32Config.h | 1 - src/platform/Linux/PosixConfig.cpp | 1 - src/platform/Linux/PosixConfig.h | 1 - src/platform/P6/P6Config.cpp | 1 - src/platform/P6/P6Config.h | 1 - src/platform/Tizen/PosixConfig.cpp | 1 - src/platform/Tizen/PosixConfig.h | 1 - src/platform/Zephyr/ZephyrConfig.cpp | 2 - src/platform/Zephyr/ZephyrConfig.h | 1 - src/platform/android/AndroidConfig.cpp | 1 - src/platform/android/AndroidConfig.h | 1 - .../chip/platform/ConfigurationManager.java | 1 - .../bouffalolab/BL602/BL602Config.cpp | 1 - src/platform/bouffalolab/BL602/BL602Config.h | 1 - .../cc13x2_26x2/CC13X2_26X2Config.cpp | 5 +- src/platform/cc13x2_26x2/CC13X2_26X2Config.h | 1 - src/platform/fake/ConfigurationManagerImpl.h | 2 - src/platform/mbed/MbedConfig.cpp | 1 - src/platform/mbed/MbedConfig.h | 1 - src/platform/nxp/k32w/k32w0/K32W0Config.h | 1 - src/platform/qpg/qpgConfig.h | 1 - src/platform/tests/TestConfigurationMgr.cpp | 15 - .../chip-tool/zap-generated/test/Commands.h | 328 +++++++++++++++++- 38 files changed, 567 insertions(+), 115 deletions(-) diff --git a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp index 692373e63394ea..1e9552a4c99611 100644 --- a/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp +++ b/src/app/clusters/general-commissioning-server/general-commissioning-server.cpp @@ -68,7 +68,6 @@ class GeneralCommissioningAttrAccess : public AttributeAccessInterface GeneralCommissioningAttrAccess() : AttributeAccessInterface(Optional::Missing(), GeneralCommissioning::Id) {} CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; - CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) override; private: CHIP_ERROR ReadIfSupported(CHIP_ERROR (ConfigurationManager::*getter)(uint8_t &), AttributeValueEncoder & aEncoder); @@ -100,9 +99,6 @@ CHIP_ERROR GeneralCommissioningAttrAccess::Read(const ConcreteReadAttributePath case SupportsConcurrentConnection::Id: { return ReadSupportsConcurrentConnection(aEncoder); } - case Breadcrumb::Id: { - return aEncoder.Encode(DeviceLayer::DeviceControlServer::DeviceControlSvr().GetBreadcrumb()); - } default: { break; } @@ -110,27 +106,6 @@ CHIP_ERROR GeneralCommissioningAttrAccess::Read(const ConcreteReadAttributePath return CHIP_NO_ERROR; } -CHIP_ERROR GeneralCommissioningAttrAccess::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder) -{ - // TODO: There was discussion about moving the breadcrumb to the attribute store, which would make this function obsolete - - if (aPath.mClusterId != GeneralCommissioning::Id) - { - // We shouldn't have been called at all. - return CHIP_ERROR_INVALID_ARGUMENT; - } - - switch (aPath.mAttributeId) - { - case Attributes::Breadcrumb::Id: - Attributes::Breadcrumb::TypeInfo::DecodableType value; - ReturnErrorOnFailure(aDecoder.Decode(value)); - return DeviceLayer::DeviceControlServer::DeviceControlSvr().SetBreadcrumb(value); - default: - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } -} - CHIP_ERROR GeneralCommissioningAttrAccess::ReadIfSupported(CHIP_ERROR (ConfigurationManager::*getter)(uint8_t &), AttributeValueEncoder & aEncoder) { @@ -208,6 +183,8 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * { // Force the timer to expire immediately. failSafeContext.ForceFailSafeTimerExpiry(); + // Don't set the breadcrumb, since expiring the failsafe should + // reset it anyway. response.errorCode = CommissioningError::kOk; commandObj->AddResponse(commandPath, response); } @@ -216,10 +193,10 @@ bool emberAfGeneralCommissioningClusterArmFailSafeCallback(app::CommandHandler * CheckSuccess( failSafeContext.ArmFailSafe(accessingFabricIndex, System::Clock::Seconds16(commandData.expiryLengthSeconds)), Failure); + Breadcrumb::Set(commandPath.mEndpointId, commandData.breadcrumb); response.errorCode = CommissioningError::kOk; commandObj->AddResponse(commandPath, response); } - DeviceLayer::DeviceControlServer::DeviceControlSvr().SetBreadcrumb(commandData.breadcrumb); } else { @@ -265,11 +242,11 @@ bool emberAfGeneralCommissioningClusterCommissioningCompleteCallback( CheckSuccess(server->CommissioningComplete(handle->AsSecureSession()->GetPeerNodeId(), handle->GetFabricIndex()), Failure); + Breadcrumb::Set(commandPath.mEndpointId, 0); response.errorCode = CommissioningError::kOk; } } - DeviceLayer::DeviceControlServer::DeviceControlSvr().SetBreadcrumb(0); commandObj->AddResponse(commandPath, response); return true; @@ -282,9 +259,8 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH MATTER_TRACE_EVENT_SCOPE("SetRegulatoryConfig", "GeneralCommissioning"); DeviceControlServer * server = &DeviceLayer::DeviceControlServer::DeviceControlSvr(); - CheckSuccess(server->SetRegulatoryConfig(to_underlying(commandData.newRegulatoryConfig), commandData.countryCode, - commandData.breadcrumb), - Failure); + CheckSuccess(server->SetRegulatoryConfig(to_underlying(commandData.newRegulatoryConfig), commandData.countryCode), Failure); + Breadcrumb::Set(commandPath.mEndpointId, commandData.breadcrumb); Commands::SetRegulatoryConfigResponse::Type response; response.errorCode = CommissioningError::kOk; @@ -293,8 +269,21 @@ bool emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(app::CommandH return true; } +namespace { +void OnPlatformEventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) +{ + if (event->Type == DeviceLayer::DeviceEventType::kFailSafeTimerExpired) + { + // Spec says to reset Breadcrumb attribute to 0. + Breadcrumb::Set(0, 0); + } +} + +} // anonymous namespace + void MatterGeneralCommissioningPluginServerInitCallback() { - DeviceLayer::DeviceControlServer::DeviceControlSvr().SetBreadcrumb(0); + Breadcrumb::Set(0, 0); registerAttributeAccessOverride(&gAttrAccess); + DeviceLayer::PlatformMgrImpl().AddEventHandler(OnPlatformEventHandler); } diff --git a/src/app/tests/suites/TestGeneralCommissioning.yaml b/src/app/tests/suites/TestGeneralCommissioning.yaml index 320f60e635bbd7..80386a86fd9e96 100644 --- a/src/app/tests/suites/TestGeneralCommissioning.yaml +++ b/src/app/tests/suites/TestGeneralCommissioning.yaml @@ -18,6 +18,12 @@ config: nodeId: 0x12344321 cluster: "General Commissioning" endpoint: 0 + discriminator: + type: INT16U + defaultValue: 3840 + payload: + type: CHAR_STRING + defaultValue: "MT:-24J0AFN00KA0648G00" # This value needs to be generated automatically tests: - label: "Wait for the commissioned device to be retrieved" @@ -52,6 +58,214 @@ tests: response: value: 81 + - label: "Reboot to reset Breadcrumb" + cluster: "SystemCommands" + command: "Reboot" + + - label: "Connect to the device again" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read back Breadcrumb after reboot and ensure it was not persisted" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 0 + + - label: "Set Breadcrumb to nonzero value" + command: "writeAttribute" + attribute: "Breadcrumb" + arguments: + value: 1 + + - label: "Check Breadcrumb set worked" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 1 + + - label: "Send CommissioningComplete without armed fail-safe" + command: "CommissioningComplete" + response: + values: + - name: errorCode + value: 3 # NoFailSafe + + - label: "Check Breadcrumb was not touched by invalid CommissioningComplete" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 1 + + - label: "Open Commissioning Window from alpha" + cluster: "AdministratorCommissioning" + command: "OpenBasicCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 180 + + # Arming a fail-safe over CASE while a commissioning window is open should not work. + - label: "Try to arm fail-safe" + command: "ArmFailSafe" + arguments: + values: + - name: expiryLengthSeconds + value: 10 + - name: breadcrumb + value: 5000 + response: + values: + - name: errorCode + value: 4 # BusyWithOtherAdmin + + - label: + "Check Breadcrumb was not touched by ArmFailSafe with commissioning + window open" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 1 + + - label: "Reset Breadcrumb to 0 so we can commission" + command: "writeAttribute" + attribute: "Breadcrumb" + arguments: + value: 0 + + - label: "Commission from beta" + identity: "beta" + cluster: "CommissionerCommands" + command: "PairWithQRCode" + arguments: + values: + - name: "nodeId" + value: 0x12345 + - name: "payload" + value: payload + + - label: "Wait for the commissioned device to be retrieved for beta" + identity: "beta" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: 0x12345 + + - label: "Arm fail-safe" + command: "ArmFailSafe" + arguments: + values: + - name: expiryLengthSeconds + value: 500 + - name: breadcrumb + value: 2 + response: + values: + - name: errorCode + value: 0 # OK + + - label: "Check Breadcrumb was properly set by ArmFailSafe" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 2 + + - label: "Try to arm fail-safe from wrong fabric" + command: "ArmFailSafe" + identity: "beta" + arguments: + values: + - name: expiryLengthSeconds + value: 10 + - name: breadcrumb + value: 5000 + response: + values: + - name: errorCode + value: 4 # BusyWithOtherAdmin + + - label: + "Check Breadcrumb was not touched by ArmFailSafe with existing + fail-safe armed" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 2 + + - label: "Send CommissioningComplete from wrong fabric" + command: "CommissioningComplete" + identity: "beta" + response: + values: + - name: errorCode + value: 2 # InvalidAuthentication + + - label: + "Check Breadcrumb was not touched by CommissioningComplete from wrong + fabric" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 2 + + - label: "Close out the fail-safe gracefully" + command: "CommissioningComplete" + response: + values: + - name: errorCode + value: 0 # Ok + + - label: "Check Breadcrumb was reset to 0 by CommissioningComplete" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 0 + + - label: "Arm fail-safe again" + command: "ArmFailSafe" + arguments: + values: + - name: expiryLengthSeconds + value: 500 + - name: breadcrumb + value: 3 + response: + values: + - name: errorCode + value: 0 # OK + + - label: "Check Breadcrumb was set by arming fail-safe again" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 3 + + - label: "Force-expire the fail-safe" + command: "ArmFailSafe" + arguments: + values: + - name: expiryLengthSeconds + value: 0 + - name: breadcrumb + value: 4 + response: + values: + - name: errorCode + value: 0 # OK + + - label: "Check Breadcrumb was reset by expiring the fail-safe" + command: "readAttribute" + attribute: "Breadcrumb" + response: + value: 0 + - label: "Validate presence of SupportsConcurrentConnection" command: "readAttribute" attribute: "SupportsConcurrentConnection" diff --git a/src/darwin/Framework/CHIP/templates/tests/tests.js b/src/darwin/Framework/CHIP/templates/tests/tests.js index 278ed1896d3039..f60e0fe8fab909 100644 --- a/src/darwin/Framework/CHIP/templates/tests/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests/tests.js @@ -272,7 +272,9 @@ function getTests() 'TestDelayCommands', 'TestDescriptorCluster', 'TestBasicInformation', - 'TestGeneralCommissioning', + // TestGeneralCommissioning does reboots that need to have side-effects, so + // can't be tested in this test framework. + //'TestGeneralCommissioning', 'TestGroupsCluster', 'TestGroupKeyManagementCluster', 'TestIdentifyCluster', diff --git a/src/include/platform/ConfigurationManager.h b/src/include/platform/ConfigurationManager.h index 86449cc768c69d..cc4954e703f46e 100644 --- a/src/include/platform/ConfigurationManager.h +++ b/src/include/platform/ConfigurationManager.h @@ -109,7 +109,6 @@ class ConfigurationManager #endif virtual CHIP_ERROR GetRegulatoryLocation(uint8_t & location) = 0; virtual CHIP_ERROR GetCountryCode(char * buf, size_t bufSize, size_t & codeLen) = 0; - virtual CHIP_ERROR GetBreadcrumb(uint64_t & breadcrumb) = 0; virtual CHIP_ERROR StoreSerialNumber(const char * serialNum, size_t serialNumLen) = 0; virtual CHIP_ERROR StorePrimaryWiFiMACAddress(const uint8_t * buf) = 0; virtual CHIP_ERROR StorePrimary802154MACAddress(const uint8_t * buf) = 0; @@ -118,7 +117,6 @@ class ConfigurationManager virtual CHIP_ERROR StoreHardwareVersion(uint16_t hardwareVer) = 0; virtual CHIP_ERROR StoreRegulatoryLocation(uint8_t location) = 0; virtual CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) = 0; - virtual CHIP_ERROR StoreBreadcrumb(uint64_t breadcrumb) = 0; virtual CHIP_ERROR GetRebootCount(uint32_t & rebootCount) = 0; virtual CHIP_ERROR StoreRebootCount(uint32_t rebootCount) = 0; virtual CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) = 0; diff --git a/src/include/platform/DeviceControlServer.h b/src/include/platform/DeviceControlServer.h index d22a67f5b781a2..6dc4ee7d07fdba 100644 --- a/src/include/platform/DeviceControlServer.h +++ b/src/include/platform/DeviceControlServer.h @@ -89,14 +89,12 @@ class DeviceControlServer final // ===== Members for internal use by other Device Layer components. CHIP_ERROR CommissioningComplete(NodeId peerNodeId, FabricIndex accessingFabricIndex); - CHIP_ERROR SetRegulatoryConfig(uint8_t location, const CharSpan & countryCode, uint64_t breadcrumb); + CHIP_ERROR SetRegulatoryConfig(uint8_t location, const CharSpan & countryCode); CHIP_ERROR ConnectNetworkForOperational(ByteSpan networkID); void SetSwitchDelegate(SwitchDeviceControlDelegate * delegate) { mSwitchDelegate = delegate; } SwitchDeviceControlDelegate * GetSwitchDelegate() const { return mSwitchDelegate; } FailSafeContext & GetFailSafeContext() { return mFailSafeContext; } - CHIP_ERROR SetBreadcrumb(uint64_t breadcrumb); - uint64_t GetBreadcrumb(); static DeviceControlServer & DeviceControlSvr(); diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.h b/src/include/platform/internal/GenericConfigurationManagerImpl.h index 9cc4f523049483..7098f2f12471ec 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.h +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.h @@ -98,8 +98,6 @@ class GenericConfigurationManagerImpl : public ConfigurationManager CHIP_ERROR StoreRegulatoryLocation(uint8_t location) override; CHIP_ERROR GetCountryCode(char * buf, size_t bufSize, size_t & codeLen) override; CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) override; - CHIP_ERROR GetBreadcrumb(uint64_t & breadcrumb) override; - CHIP_ERROR StoreBreadcrumb(uint64_t breadcrumb) override; CHIP_ERROR GetRebootCount(uint32_t & rebootCount) override; CHIP_ERROR StoreRebootCount(uint32_t rebootCount) override; CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override; diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp index aaa817ea3a2bd4..166a95c2f508a5 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp @@ -554,18 +554,6 @@ CHIP_ERROR GenericConfigurationManagerImpl::StoreCountryCode(const return WriteConfigValueStr(ConfigClass::kConfigKey_CountryCode, code, codeLen); } -template -CHIP_ERROR GenericConfigurationManagerImpl::GetBreadcrumb(uint64_t & breadcrumb) -{ - return ReadConfigValue(ConfigClass::kConfigKey_Breadcrumb, breadcrumb); -} - -template -CHIP_ERROR GenericConfigurationManagerImpl::StoreBreadcrumb(uint64_t breadcrumb) -{ - return WriteConfigValue(ConfigClass::kConfigKey_Breadcrumb, breadcrumb); -} - template CHIP_ERROR GenericConfigurationManagerImpl::GetRebootCount(uint32_t & rebootCount) { diff --git a/src/platform/Ameba/AmebaConfig.cpp b/src/platform/Ameba/AmebaConfig.cpp index f34f0f6f90c160..3c6026a366aad7 100644 --- a/src/platform/Ameba/AmebaConfig.cpp +++ b/src/platform/Ameba/AmebaConfig.cpp @@ -88,7 +88,6 @@ const AmebaConfig::Key AmebaConfig::kConfigKey_OperationalDeviceICACerts = { k const AmebaConfig::Key AmebaConfig::kConfigKey_OperationalDevicePrivateKey = { kConfigNamespace_ChipConfig, "op-device-key" }; const AmebaConfig::Key AmebaConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" }; const AmebaConfig::Key AmebaConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; -const AmebaConfig::Key AmebaConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" }; // Keys stored in the Chip-counters namespace const AmebaConfig::Key AmebaConfig::kCounterKey_RebootCount = { kConfigNamespace_ChipCounters, "reboot-count" }; diff --git a/src/platform/Ameba/AmebaConfig.h b/src/platform/Ameba/AmebaConfig.h index dc87ed455f9dcd..d53c6abcfcc983 100755 --- a/src/platform/Ameba/AmebaConfig.h +++ b/src/platform/Ameba/AmebaConfig.h @@ -78,7 +78,6 @@ class AmebaConfig static const Key kConfigKey_SetupDiscriminator; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_Spake2pIterationCount; static const Key kConfigKey_Spake2pSalt; static const Key kConfigKey_Spake2pVerifier; diff --git a/src/platform/CYW30739/CYW30739Config.h b/src/platform/CYW30739/CYW30739Config.h index 661b93ef3e5000..80ebe8e09fe442 100644 --- a/src/platform/CYW30739/CYW30739Config.h +++ b/src/platform/CYW30739/CYW30739Config.h @@ -67,7 +67,6 @@ class CYW30739Config static constexpr Key kConfigKey_CountryCode = 18; static constexpr Key kConfigKey_HourFormat = 20; static constexpr Key kConfigKey_CalendarType = 21; - static constexpr Key kConfigKey_Breadcrumb = 22; static constexpr Key kConfigKey_UniqueId = 23; // Set key id limits for each group. diff --git a/src/platform/Darwin/PosixConfig.cpp b/src/platform/Darwin/PosixConfig.cpp index 2ac950b9bdbd35..a9180517fb85bc 100644 --- a/src/platform/Darwin/PosixConfig.cpp +++ b/src/platform/Darwin/PosixConfig.cpp @@ -72,7 +72,6 @@ const PosixConfig::Key PosixConfig::kConfigKey_FailSafeArmed = { kConfigNam const PosixConfig::Key PosixConfig::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" }; const PosixConfig::Key PosixConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" }; const PosixConfig::Key PosixConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; -const PosixConfig::Key PosixConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" }; const PosixConfig::Key PosixConfig::kConfigKey_LocationCapability = { kConfigNamespace_ChipConfig, "location-capability" }; // Keys stored in the Chip-counters namespace diff --git a/src/platform/Darwin/PosixConfig.h b/src/platform/Darwin/PosixConfig.h index 4b39677f611a05..f00b29b9ca1e4c 100644 --- a/src/platform/Darwin/PosixConfig.h +++ b/src/platform/Darwin/PosixConfig.h @@ -73,7 +73,6 @@ class PosixConfig static const Key kConfigKey_SetupDiscriminator; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_Spake2pIterationCount; static const Key kConfigKey_Spake2pSalt; static const Key kConfigKey_Spake2pVerifier; diff --git a/src/platform/DeviceControlServer.cpp b/src/platform/DeviceControlServer.cpp index 30f1821bc38283..9c630c53e17872 100644 --- a/src/platform/DeviceControlServer.cpp +++ b/src/platform/DeviceControlServer.cpp @@ -47,18 +47,7 @@ CHIP_ERROR DeviceControlServer::CommissioningComplete(NodeId peerNodeId, FabricI return PlatformMgr().PostEvent(&event); } -CHIP_ERROR DeviceControlServer::SetBreadcrumb(uint64_t breadcrumb) -{ - return ConfigurationMgr().StoreBreadcrumb(breadcrumb); -} -uint64_t DeviceControlServer::GetBreadcrumb() -{ - uint64_t breadcrumb = 0; - ConfigurationMgr().GetBreadcrumb(breadcrumb); - return breadcrumb; -} - -CHIP_ERROR DeviceControlServer::SetRegulatoryConfig(uint8_t location, const CharSpan & countryCode, uint64_t breadcrumb) +CHIP_ERROR DeviceControlServer::SetRegulatoryConfig(uint8_t location, const CharSpan & countryCode) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -68,9 +57,6 @@ CHIP_ERROR DeviceControlServer::SetRegulatoryConfig(uint8_t location, const Char err = ConfigurationMgr().StoreCountryCode(countryCode.data(), countryCode.size()); SuccessOrExit(err); - err = ConfigurationMgr().StoreBreadcrumb(breadcrumb); - SuccessOrExit(err); - exit: if (err != CHIP_NO_ERROR) { diff --git a/src/platform/EFR32/EFR32Config.h b/src/platform/EFR32/EFR32Config.h index fe9846a926928e..a463dcf57f8bda 100644 --- a/src/platform/EFR32/EFR32Config.h +++ b/src/platform/EFR32/EFR32Config.h @@ -112,7 +112,6 @@ class EFR32Config static constexpr Key kConfigKey_HardwareVersion = EFR32ConfigKey(kMatterConfig_KeyBase, 0x08); static constexpr Key kConfigKey_RegulatoryLocation = EFR32ConfigKey(kMatterConfig_KeyBase, 0x09); static constexpr Key kConfigKey_CountryCode = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0A); - static constexpr Key kConfigKey_Breadcrumb = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0B); static constexpr Key kConfigKey_WiFiSSID = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0C); static constexpr Key kConfigKey_WiFiPSK = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0D); static constexpr Key kConfigKey_WiFiSEC = EFR32ConfigKey(kMatterConfig_KeyBase, 0x0E); diff --git a/src/platform/ESP32/ESP32Config.cpp b/src/platform/ESP32/ESP32Config.cpp index 047edec41c202c..e49dd3aa1c46c9 100644 --- a/src/platform/ESP32/ESP32Config.cpp +++ b/src/platform/ESP32/ESP32Config.cpp @@ -79,7 +79,6 @@ const ESP32Config::Key ESP32Config::kConfigKey_FailSafeArmed = { kConfigNam const ESP32Config::Key ESP32Config::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" }; const ESP32Config::Key ESP32Config::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "reg-location" }; const ESP32Config::Key ESP32Config::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; -const ESP32Config::Key ESP32Config::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" }; const ESP32Config::Key ESP32Config::kConfigKey_UniqueId = { kConfigNamespace_ChipFactory, "unique-id" }; // Keys stored in the Chip-counters namespace diff --git a/src/platform/ESP32/ESP32Config.h b/src/platform/ESP32/ESP32Config.h index 15156113fd4678..c6a1f8ccd0e16b 100644 --- a/src/platform/ESP32/ESP32Config.h +++ b/src/platform/ESP32/ESP32Config.h @@ -72,7 +72,6 @@ class ESP32Config static const Key kConfigKey_SetupDiscriminator; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_Spake2pIterationCount; static const Key kConfigKey_Spake2pSalt; static const Key kConfigKey_Spake2pVerifier; diff --git a/src/platform/Linux/PosixConfig.cpp b/src/platform/Linux/PosixConfig.cpp index 94ffba82c3d476..0c10d01b80d7d6 100644 --- a/src/platform/Linux/PosixConfig.cpp +++ b/src/platform/Linux/PosixConfig.cpp @@ -75,7 +75,6 @@ const PosixConfig::Key PosixConfig::kConfigKey_FailSafeArmed = { kConfigNam const PosixConfig::Key PosixConfig::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" }; const PosixConfig::Key PosixConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" }; const PosixConfig::Key PosixConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; -const PosixConfig::Key PosixConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" }; const PosixConfig::Key PosixConfig::kConfigKey_LocationCapability = { kConfigNamespace_ChipConfig, "location-capability" }; const PosixConfig::Key PosixConfig::kConfigKey_UniqueId = { kConfigNamespace_ChipFactory, "unique-id" }; diff --git a/src/platform/Linux/PosixConfig.h b/src/platform/Linux/PosixConfig.h index b4febb3d68967c..ed75454faeb2ec 100644 --- a/src/platform/Linux/PosixConfig.h +++ b/src/platform/Linux/PosixConfig.h @@ -75,7 +75,6 @@ class PosixConfig static const Key kConfigKey_SetupDiscriminator; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_LocationCapability; static const Key kConfigKey_Spake2pIterationCount; static const Key kConfigKey_Spake2pSalt; diff --git a/src/platform/P6/P6Config.cpp b/src/platform/P6/P6Config.cpp index f6a5dbbe77b67f..37c94fc5fb7181 100644 --- a/src/platform/P6/P6Config.cpp +++ b/src/platform/P6/P6Config.cpp @@ -73,7 +73,6 @@ const P6Config::Key P6Config::kConfigKey_FailSafeArmed = { kConfigNamespace const P6Config::Key P6Config::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" }; const P6Config::Key P6Config::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" }; const P6Config::Key P6Config::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; -const P6Config::Key P6Config::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" }; const P6Config::Key P6Config::kConfigKey_WiFiSSID = { kConfigNamespace_ChipConfig, "wifi-ssid" }; const P6Config::Key P6Config::kConfigKey_WiFiPassword = { kConfigNamespace_ChipConfig, "wifi-password" }; const P6Config::Key P6Config::kConfigKey_WiFiSecurity = { kConfigNamespace_ChipConfig, "wifi-security" }; diff --git a/src/platform/P6/P6Config.h b/src/platform/P6/P6Config.h index ae44ced3261c9d..df3f3fc6c25104 100644 --- a/src/platform/P6/P6Config.h +++ b/src/platform/P6/P6Config.h @@ -76,7 +76,6 @@ class P6Config static const Key kConfigKey_SetupDiscriminator; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_WiFiSSID; static const Key kConfigKey_WiFiPassword; static const Key kConfigKey_WiFiSecurity; diff --git a/src/platform/Tizen/PosixConfig.cpp b/src/platform/Tizen/PosixConfig.cpp index a831325d892d2f..9a424d975aebbe 100644 --- a/src/platform/Tizen/PosixConfig.cpp +++ b/src/platform/Tizen/PosixConfig.cpp @@ -71,7 +71,6 @@ const PosixConfig::Key PosixConfig::kConfigKey_FailSafeArmed = { kConfigNam const PosixConfig::Key PosixConfig::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" }; const PosixConfig::Key PosixConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" }; const PosixConfig::Key PosixConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; -const PosixConfig::Key PosixConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" }; const PosixConfig::Key PosixConfig::kConfigKey_UniqueId = { kConfigNamespace_ChipConfig, "unique-id" }; // Prefix used for NVS keys that contain Chip group encryption keys. diff --git a/src/platform/Tizen/PosixConfig.h b/src/platform/Tizen/PosixConfig.h index 65440f4ce53abb..a714b7c9f6b042 100644 --- a/src/platform/Tizen/PosixConfig.h +++ b/src/platform/Tizen/PosixConfig.h @@ -73,7 +73,6 @@ class PosixConfig static const Key kConfigKey_SetupDiscriminator; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_Spake2pIterationCount; static const Key kConfigKey_Spake2pSalt; static const Key kConfigKey_Spake2pVerifier; diff --git a/src/platform/Zephyr/ZephyrConfig.cpp b/src/platform/Zephyr/ZephyrConfig.cpp index 0b247220c10e2e..15bc6b0cd7c222 100644 --- a/src/platform/Zephyr/ZephyrConfig.cpp +++ b/src/platform/Zephyr/ZephyrConfig.cpp @@ -73,7 +73,6 @@ const ZephyrConfig::Key ZephyrConfig::kConfigKey_LastUsedEpochKeyId = CONFIG_KEY const ZephyrConfig::Key ZephyrConfig::kConfigKey_FailSafeArmed = CONFIG_KEY(NAMESPACE_CONFIG "fail-safe-armed"); const ZephyrConfig::Key ZephyrConfig::kConfigKey_RegulatoryLocation = CONFIG_KEY(NAMESPACE_CONFIG "regulatory-location"); const ZephyrConfig::Key ZephyrConfig::kConfigKey_CountryCode = CONFIG_KEY(NAMESPACE_CONFIG "country-code"); -const ZephyrConfig::Key ZephyrConfig::kConfigKey_Breadcrumb = CONFIG_KEY(NAMESPACE_CONFIG "breadcrumb"); const ZephyrConfig::Key ZephyrConfig::kConfigKey_UniqueId = CONFIG_KEY(NAMESPACE_CONFIG "unique-id"); // Keys stored in the counters namespace @@ -89,7 +88,6 @@ constexpr const char * sAllResettableConfigKeys[] = { ZephyrConfig::kConfigKey_FabricSecret, ZephyrConfig::kConfigKey_GroupKeyIndex, ZephyrConfig::kConfigKey_LastUsedEpochKeyId, ZephyrConfig::kConfigKey_FailSafeArmed, ZephyrConfig::kConfigKey_RegulatoryLocation, ZephyrConfig::kConfigKey_CountryCode, - ZephyrConfig::kConfigKey_Breadcrumb, }; // Data structure to be passed as a parameter of Zephyr's settings_load_subtree_direct() function diff --git a/src/platform/Zephyr/ZephyrConfig.h b/src/platform/Zephyr/ZephyrConfig.h index 668627df6be618..cb2c7affe37289 100644 --- a/src/platform/Zephyr/ZephyrConfig.h +++ b/src/platform/Zephyr/ZephyrConfig.h @@ -63,7 +63,6 @@ class ZephyrConfig static const Key kConfigKey_FailSafeArmed; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_Spake2pIterationCount; static const Key kConfigKey_Spake2pSalt; static const Key kConfigKey_Spake2pVerifier; diff --git a/src/platform/android/AndroidConfig.cpp b/src/platform/android/AndroidConfig.cpp index 68220757072570..ba067c12bf64e5 100644 --- a/src/platform/android/AndroidConfig.cpp +++ b/src/platform/android/AndroidConfig.cpp @@ -94,7 +94,6 @@ const AndroidConfig::Key AndroidConfig::kConfigKey_FailSafeArmed = { kConfi const AndroidConfig::Key AndroidConfig::kConfigKey_WiFiStationSecType = { kConfigNamespace_ChipConfig, "sta-sec-type" }; const AndroidConfig::Key AndroidConfig::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" }; const AndroidConfig::Key AndroidConfig::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" }; -const AndroidConfig::Key AndroidConfig::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" }; // Prefix used for NVS keys that contain Chip group encryption keys. const char AndroidConfig::kGroupKeyNamePrefix[] = "gk-"; diff --git a/src/platform/android/AndroidConfig.h b/src/platform/android/AndroidConfig.h index 2cbf6dd2cd6060..d1f1ad4bc910e1 100644 --- a/src/platform/android/AndroidConfig.h +++ b/src/platform/android/AndroidConfig.h @@ -74,7 +74,6 @@ class AndroidConfig static const Key kConfigKey_SetupDiscriminator; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_ProductId; static const Key kConfigKey_ProductName; static const Key kConfigKey_SoftwareVersion; diff --git a/src/platform/android/java/chip/platform/ConfigurationManager.java b/src/platform/android/java/chip/platform/ConfigurationManager.java index d23ec5ca2918b1..72107cb4ecd88c 100644 --- a/src/platform/android/java/chip/platform/ConfigurationManager.java +++ b/src/platform/android/java/chip/platform/ConfigurationManager.java @@ -62,7 +62,6 @@ public interface ConfigurationManager { String kConfigKey_WiFiStationSecType = "sta-sec-type"; String kConfigKey_RegulatoryLocation = "regulatory-location"; String kConfigKey_CountryCode = "country-code"; - String kConfigKey_Breadcrumb = "breadcrumb"; // Prefix used for NVS keys that contain Chip group encryption keys. String kGroupKeyNamePrefix = "gk-"; diff --git a/src/platform/bouffalolab/BL602/BL602Config.cpp b/src/platform/bouffalolab/BL602/BL602Config.cpp index 025d48ae18cd16..5f370fa88423fe 100644 --- a/src/platform/bouffalolab/BL602/BL602Config.cpp +++ b/src/platform/bouffalolab/BL602/BL602Config.cpp @@ -71,7 +71,6 @@ const BL602Config::Key BL602Config::kConfigKey_OperationalDeviceICACerts = { " const BL602Config::Key BL602Config::kConfigKey_OperationalDevicePrivateKey = { "op-device-key" }; const BL602Config::Key BL602Config::kConfigKey_RegulatoryLocation = { "regulatory-location" }; const BL602Config::Key BL602Config::kConfigKey_CountryCode = { "country-code" }; -const BL602Config::Key BL602Config::kConfigKey_Breadcrumb = { "breadcrumb" }; const BL602Config::Key BL602Config::kConfigKey_UniqueId = { "unique-id" }; // Prefix used for Easyflash keys that contain Chip group encryption keys. diff --git a/src/platform/bouffalolab/BL602/BL602Config.h b/src/platform/bouffalolab/BL602/BL602Config.h index 4422d6d10014ac..999f27f35c582e 100644 --- a/src/platform/bouffalolab/BL602/BL602Config.h +++ b/src/platform/bouffalolab/BL602/BL602Config.h @@ -79,7 +79,6 @@ class BL602Config static const Key kConfigKey_SetupDiscriminator; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_UniqueId; static const Key kConfigKey_Spake2pIterationCount; static const Key kConfigKey_Spake2pSalt; diff --git a/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp b/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp index 3795cf9aa77430..f66f3f38e063e8 100644 --- a/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp +++ b/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp @@ -91,9 +91,8 @@ const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_RegulatoryLocation = .itemID = 0x001a } }; const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_CountryCode = { { .systemID = kCC13X2_26X2ChipConfig_Sysid, .itemID = 0x001b } }; -const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_Breadcrumb = { { .systemID = kCC13X2_26X2ChipConfig_Sysid, - .itemID = 0x001c } }; -const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_UniqueId = { { .systemID = kCC13X2_26X2ChipConfig_Sysid, +// itemID 0x001c is unused (used to be breadcrumb). +const CC13X2_26X2Config::Key CC13X2_26X2Config::kConfigKey_UniqueId = { { .systemID = kCC13X2_26X2ChipConfig_Sysid, .itemID = 0x001d } }; /* Internal for the KVS interface. */ diff --git a/src/platform/cc13x2_26x2/CC13X2_26X2Config.h b/src/platform/cc13x2_26x2/CC13X2_26X2Config.h index a177f1e4f54b3c..1aad506f341d80 100644 --- a/src/platform/cc13x2_26x2/CC13X2_26X2Config.h +++ b/src/platform/cc13x2_26x2/CC13X2_26X2Config.h @@ -66,7 +66,6 @@ class CC13X2_26X2Config static const Key kConfigKey_WiFiStationSecType; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_KVS_key; // special key for KVS system, key storage static const Key kConfigKey_KVS_value; // special key for KVS system, value storage static const Key kConfigKey_Spake2pIterationCount; diff --git a/src/platform/fake/ConfigurationManagerImpl.h b/src/platform/fake/ConfigurationManagerImpl.h index 01af1ac8caa0d0..d01c60e47fdf85 100644 --- a/src/platform/fake/ConfigurationManagerImpl.h +++ b/src/platform/fake/ConfigurationManagerImpl.h @@ -80,8 +80,6 @@ class ConfigurationManagerImpl : public ConfigurationManager CHIP_ERROR StoreRegulatoryLocation(uint8_t location) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR GetCountryCode(char * buf, size_t bufSize, size_t & codeLen) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen) override { return CHIP_ERROR_NOT_IMPLEMENTED; } - CHIP_ERROR GetBreadcrumb(uint64_t & breadcrumb) override { return CHIP_ERROR_NOT_IMPLEMENTED; } - CHIP_ERROR StoreBreadcrumb(uint64_t breadcrumb) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR GetRebootCount(uint32_t & rebootCount) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR StoreRebootCount(uint32_t rebootCount) override { return CHIP_ERROR_NOT_IMPLEMENTED; } CHIP_ERROR GetTotalOperationalHours(uint32_t & totalOperationalHours) override { return CHIP_ERROR_NOT_IMPLEMENTED; } diff --git a/src/platform/mbed/MbedConfig.cpp b/src/platform/mbed/MbedConfig.cpp index afe551b72d0c98..5883182602d853 100644 --- a/src/platform/mbed/MbedConfig.cpp +++ b/src/platform/mbed/MbedConfig.cpp @@ -85,7 +85,6 @@ const MbedConfig::Key MbedConfig::kConfigKey_FailSafeArmed = { CONFIG_KEY(" const MbedConfig::Key MbedConfig::kConfigKey_WiFiStationSecType = { CONFIG_KEY("sta-sec-type") }; const MbedConfig::Key MbedConfig::kConfigKey_RegulatoryLocation = { CONFIG_KEY("regulatory-location") }; const MbedConfig::Key MbedConfig::kConfigKey_CountryCode = { CONFIG_KEY("country-code") }; -const MbedConfig::Key MbedConfig::kConfigKey_Breadcrumb = { CONFIG_KEY("breadcrumb") }; const MbedConfig::Key MbedConfig::kConfigKey_UniqueId = { CONFIG_KEY("unique-id") }; CHIP_ERROR MbedConfig::ReadConfigValue(Key key, bool & val) diff --git a/src/platform/mbed/MbedConfig.h b/src/platform/mbed/MbedConfig.h index bbccfbfd2031ea..69c24ebe555bd6 100644 --- a/src/platform/mbed/MbedConfig.h +++ b/src/platform/mbed/MbedConfig.h @@ -72,7 +72,6 @@ class MbedConfig static const Key kConfigKey_SetupDiscriminator; static const Key kConfigKey_RegulatoryLocation; static const Key kConfigKey_CountryCode; - static const Key kConfigKey_Breadcrumb; static const Key kConfigKey_Spake2pIterationCount; static const Key kConfigKey_Spake2pSalt; static const Key kConfigKey_Spake2pVerifier; diff --git a/src/platform/nxp/k32w/k32w0/K32W0Config.h b/src/platform/nxp/k32w/k32w0/K32W0Config.h index f02bd367036f1a..7fd4a38c31a909 100644 --- a/src/platform/nxp/k32w/k32w0/K32W0Config.h +++ b/src/platform/nxp/k32w/k32w0/K32W0Config.h @@ -89,7 +89,6 @@ class K32WConfig static constexpr Key kConfigKey_FailSafeArmed = K32WConfigKey(kPDMId_ChipConfig, 0x06); static constexpr Key kConfigKey_RegulatoryLocation = K32WConfigKey(kPDMId_ChipConfig, 0x07); static constexpr Key kConfigKey_CountryCode = K32WConfigKey(kPDMId_ChipConfig, 0x08); - static constexpr Key kConfigKey_Breadcrumb = K32WConfigKey(kPDMId_ChipConfig, 0x09); static constexpr Key kConfigKey_UniqueId = K32WConfigKey(kPDMId_ChipConfig, 0x0A); static constexpr Key kConfigKey_SoftwareVersion = K32WConfigKey(kPDMId_ChipConfig, 0x0B); static constexpr Key kConfigKey_FirstRunOfOTAImage = K32WConfigKey(kPDMId_ChipConfig, 0x0C); diff --git a/src/platform/qpg/qpgConfig.h b/src/platform/qpg/qpgConfig.h index 73cf8d09b1f8d2..dedbe3da37c738 100644 --- a/src/platform/qpg/qpgConfig.h +++ b/src/platform/qpg/qpgConfig.h @@ -87,7 +87,6 @@ class QPGConfig static constexpr Key kConfigKey_HardwareVersion = QorvoConfigKey(kFileId_ChipConfig, 0x08); static constexpr Key kConfigKey_RegulatoryLocation = QorvoConfigKey(kFileId_ChipConfig, 0x09); static constexpr Key kConfigKey_CountryCode = QorvoConfigKey(kFileId_ChipConfig, 0x0A); - static constexpr Key kConfigKey_Breadcrumb = QorvoConfigKey(kFileId_ChipConfig, 0x0B); static constexpr Key kConfigKey_UniqueId = QorvoConfigKey(kFileId_ChipConfig, 0x0C); static constexpr Key kConfigKey_GroupKeyBase = QorvoConfigKey(kFileId_ChipConfig, 0x0F); diff --git a/src/platform/tests/TestConfigurationMgr.cpp b/src/platform/tests/TestConfigurationMgr.cpp index 0c426fe558bae4..fc29e0dc7633aa 100644 --- a/src/platform/tests/TestConfigurationMgr.cpp +++ b/src/platform/tests/TestConfigurationMgr.cpp @@ -167,20 +167,6 @@ static void TestConfigurationMgr_CountryCode(nlTestSuite * inSuite, void * inCon NL_TEST_ASSERT(inSuite, strcmp(buf, countryCode) == 0); } -static void TestConfigurationMgr_Breadcrumb(nlTestSuite * inSuite, void * inContext) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - uint64_t breadcrumb = 0; - - err = ConfigurationMgr().StoreBreadcrumb(12345); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - - err = ConfigurationMgr().GetBreadcrumb(breadcrumb); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - - NL_TEST_ASSERT(inSuite, breadcrumb == 12345); -} - static void TestConfigurationMgr_GetPrimaryMACAddress(nlTestSuite * inSuite, void * inContext) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -237,7 +223,6 @@ static const nlTest sTests[] = { NL_TEST_DEF("Test ConfigurationMgr::ManufacturingDate", TestConfigurationMgr_ManufacturingDate), NL_TEST_DEF("Test ConfigurationMgr::HardwareVersion", TestConfigurationMgr_HardwareVersion), NL_TEST_DEF("Test ConfigurationMgr::CountryCode", TestConfigurationMgr_CountryCode), - NL_TEST_DEF("Test ConfigurationMgr::Breadcrumb", TestConfigurationMgr_Breadcrumb), NL_TEST_DEF("Test ConfigurationMgr::GetPrimaryMACAddress", TestConfigurationMgr_GetPrimaryMACAddress), NL_TEST_DEF("Test ConfigurationMgr::GetFailSafeArmed", TestConfigurationMgr_GetFailSafeArmed), NL_TEST_SENTINEL() diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index e8c631020ff9d1..6c41868193d28c 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -40387,11 +40387,13 @@ class TestGeneralCommissioningSuite : public TestCommand { public: TestGeneralCommissioningSuite(CredentialIssuerCommands * credsIssuerConfig) : - TestCommand("TestGeneralCommissioning", 6, credsIssuerConfig) + TestCommand("TestGeneralCommissioning", 31, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("payload", &mPayload); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } @@ -40406,6 +40408,8 @@ class TestGeneralCommissioningSuite : public TestCommand chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mPayload; chip::Optional mTimeout; chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } @@ -40447,6 +40451,175 @@ class TestGeneralCommissioningSuite : public TestCommand } break; case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 0ULL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 1ULL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("errorCode", value.errorCode, 3)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 1ULL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("errorCode", value.errorCode, 4)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 1ULL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 2ULL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("errorCode", value.errorCode, 4)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 2ULL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("errorCode", value.errorCode, 2)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 2ULL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 0ULL)); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0)); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 3ULL)); + } + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("errorCode", value.errorCode, 0)); + } + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint64_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("breadcrumb", value, 0ULL)); + } + break; + case 30: VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); { bool value; @@ -40499,7 +40672,158 @@ class TestGeneralCommissioningSuite : public TestCommand GeneralCommissioning::Attributes::Breadcrumb::Id); } case 5: { - LogStep(5, "Validate presence of SupportsConcurrentConnection"); + LogStep(5, "Reboot to reset Breadcrumb"); + SetIdentity(kIdentityAlpha); + return Reboot(); + } + case 6: { + LogStep(6, "Connect to the device again"); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + case 7: { + LogStep(7, "Read back Breadcrumb after reboot and ensure it was not persisted"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 8: { + LogStep(8, "Set Breadcrumb to nonzero value"); + uint64_t value; + value = 1ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, value); + } + case 9: { + LogStep(9, "Check Breadcrumb set worked"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 10: { + LogStep(10, "Send CommissioningComplete without armed fail-safe"); + chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Commands::CommissioningComplete::Id, value); + } + case 11: { + LogStep(11, "Check Breadcrumb was not touched by invalid CommissioningComplete"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 12: { + LogStep(12, "Open Commissioning Window from alpha"); + chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type value; + value.commissioningTimeout = 180U; + return SendCommand(kIdentityAlpha, GetEndpoint(0), AdministratorCommissioning::Id, + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id, value, + chip::Optional(10000)); + } + case 13: { + LogStep(13, "Try to arm fail-safe"); + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; + value.expiryLengthSeconds = 10U; + value.breadcrumb = 5000ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Commands::ArmFailSafe::Id, value); + } + case 14: { + LogStep(14, "Check Breadcrumb was not touched by ArmFailSafe with commissioning window open"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 15: { + LogStep(15, "Reset Breadcrumb to 0 so we can commission"); + uint64_t value; + value = 0ULL; + return WriteAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id, value); + } + case 16: { + LogStep(16, "Commission from beta"); + SetIdentity(kIdentityBeta); + return PairWithQRCode( + 74565, mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); + } + case 17: { + LogStep(17, "Wait for the commissioned device to be retrieved for beta"); + SetIdentity(kIdentityBeta); + return WaitForCommissionee(74565); + } + case 18: { + LogStep(18, "Arm fail-safe"); + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; + value.expiryLengthSeconds = 500U; + value.breadcrumb = 2ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Commands::ArmFailSafe::Id, value); + } + case 19: { + LogStep(19, "Check Breadcrumb was properly set by ArmFailSafe"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 20: { + LogStep(20, "Try to arm fail-safe from wrong fabric"); + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; + value.expiryLengthSeconds = 10U; + value.breadcrumb = 5000ULL; + return SendCommand(kIdentityBeta, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Commands::ArmFailSafe::Id, value); + } + case 21: { + LogStep(21, "Check Breadcrumb was not touched by ArmFailSafe with existing fail-safe armed"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 22: { + LogStep(22, "Send CommissioningComplete from wrong fabric"); + chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Type value; + return SendCommand(kIdentityBeta, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Commands::CommissioningComplete::Id, value); + } + case 23: { + LogStep(23, "Check Breadcrumb was not touched by CommissioningComplete from wrong fabric"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 24: { + LogStep(24, "Close out the fail-safe gracefully"); + chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Commands::CommissioningComplete::Id, value); + } + case 25: { + LogStep(25, "Check Breadcrumb was reset to 0 by CommissioningComplete"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 26: { + LogStep(26, "Arm fail-safe again"); + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; + value.expiryLengthSeconds = 500U; + value.breadcrumb = 3ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Commands::ArmFailSafe::Id, value); + } + case 27: { + LogStep(27, "Check Breadcrumb was set by arming fail-safe again"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 28: { + LogStep(28, "Force-expire the fail-safe"); + chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type value; + value.expiryLengthSeconds = 0U; + value.breadcrumb = 4ULL; + return SendCommand(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Commands::ArmFailSafe::Id, value); + } + case 29: { + LogStep(29, "Check Breadcrumb was reset by expiring the fail-safe"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, + GeneralCommissioning::Attributes::Breadcrumb::Id); + } + case 30: { + LogStep(30, "Validate presence of SupportsConcurrentConnection"); return ReadAttribute(kIdentityAlpha, GetEndpoint(0), GeneralCommissioning::Id, GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id); }