From cd47f90f13c9b896e4e158a0e6ee89e949e66082 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 27 Apr 2022 16:11:48 -0400 Subject: [PATCH] Stop storing breadcrumb in persistent storage. (#17769) 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 --- .../chip-tool-darwin/templates/tests/tests.js | 3 +- .../general-commissioning-server.cpp | 51 ++- .../suites/TestGeneralCommissioning.yaml | 214 ++++++++++++ .../Framework/CHIP/templates/tests/tests.js | 4 +- .../Framework/CHIPTests/CHIPClustersTests.m | 120 ------- 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 | 3 +- 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 - .../zap-generated/test/Commands.h | 206 ----------- .../chip-tool/zap-generated/test/Commands.h | 328 +++++++++++++++++- 41 files changed, 570 insertions(+), 442 deletions(-) diff --git a/examples/chip-tool-darwin/templates/tests/tests.js b/examples/chip-tool-darwin/templates/tests/tests.js index 8439bed5f3dec6..c07769440a5dd3 100644 --- a/examples/chip-tool-darwin/templates/tests/tests.js +++ b/examples/chip-tool-darwin/templates/tests/tests.js @@ -277,7 +277,8 @@ function getTests() 'TestDescriptorCluster', // TestBasicInformation needs Reboot //'TestBasicInformation', - 'TestGeneralCommissioning', + // TestGeneralCommissioning needs Reboot + //'TestGeneralCommissioning', 'TestGroupsCluster', 'TestGroupKeyManagementCluster', 'TestIdentifyCluster', 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 aa54647a79220b..b4f0dbdd57df1a 100644 --- a/src/darwin/Framework/CHIP/templates/tests/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests/tests.js @@ -273,7 +273,9 @@ function getTests() 'TestDescriptorCluster', // TestBasicInformation needs support for Reboot with no discriminator //'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/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index e656b0acbc87a6..1bdb545620108c 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -48858,126 +48858,6 @@ - (void)testSendClusterTestDescriptorCluster_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestGeneralCommissioning_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGeneralCommissioning_000001_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write Breadcrumb (1/2)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id breadcrumbArgument; - breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:137438953472ULL]; - [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write Breadcrumb (1/2) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGeneralCommissioning_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back Breadcrumb (1/2)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBreadcrumbWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back Breadcrumb (1/2) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 137438953472ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGeneralCommissioning_000003_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write Breadcrumb (2/2)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - id breadcrumbArgument; - breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:81ULL]; - [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write Breadcrumb (2/2) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGeneralCommissioning_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back Breadcrumb (2/2)"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeBreadcrumbWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back Breadcrumb (2/2) Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedLongLongValue], 81ULL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestGeneralCommissioning_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Validate presence of SupportsConcurrentConnection"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device endpoint:0 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSupportsConcurrentConnectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate presence of SupportsConcurrentConnection Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - - (void)testSendClusterTestGroupsCluster_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; diff --git a/src/include/platform/ConfigurationManager.h b/src/include/platform/ConfigurationManager.h index d4779dd46f305d..7816b80ff6ea86 100644 --- a/src/include/platform/ConfigurationManager.h +++ b/src/include/platform/ConfigurationManager.h @@ -108,14 +108,12 @@ 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 StoreManufacturingDate(const char * mfgDate, size_t mfgDateLen) = 0; virtual CHIP_ERROR StoreSoftwareVersion(uint32_t softwareVer) = 0; 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 5e33e04e2088e0..65d8281f70b1c8 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.h +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.h @@ -96,8 +96,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 91423c452ebc49..11b368dbd81f3c 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp @@ -542,18 +542,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 34c8cc1d53b5a7..d9a34c92f5cd6c 100644 --- a/src/platform/Ameba/AmebaConfig.cpp +++ b/src/platform/Ameba/AmebaConfig.cpp @@ -85,7 +85,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 6c518132432634..e2af3ea97826c7 100755 --- a/src/platform/Ameba/AmebaConfig.h +++ b/src/platform/Ameba/AmebaConfig.h @@ -74,7 +74,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 51795a261dc28b..00975a89f77fb6 100644 --- a/src/platform/CYW30739/CYW30739Config.h +++ b/src/platform/CYW30739/CYW30739Config.h @@ -65,7 +65,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 919ebc6d618e68..7740d6637344a1 100644 --- a/src/platform/Darwin/PosixConfig.cpp +++ b/src/platform/Darwin/PosixConfig.cpp @@ -60,7 +60,6 @@ const PosixConfig::Key PosixConfig::kConfigKey_ProductId = { kConfig const PosixConfig::Key PosixConfig::kConfigKey_FailSafeArmed = { kConfigNamespace_ChipConfig, "fail-safe-armed" }; 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 bdad020f308c74..ea4a7222568170 100644 --- a/src/platform/Darwin/PosixConfig.h +++ b/src/platform/Darwin/PosixConfig.h @@ -61,7 +61,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 d59632b6614ebd..1943b902ca2e61 100644 --- a/src/platform/EFR32/EFR32Config.h +++ b/src/platform/EFR32/EFR32Config.h @@ -110,7 +110,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 c52d68ba030e1d..8152c89092b052 100644 --- a/src/platform/ESP32/ESP32Config.cpp +++ b/src/platform/ESP32/ESP32Config.cpp @@ -77,7 +77,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 f873a623849b20..01d9609aaf2e70 100644 --- a/src/platform/ESP32/ESP32Config.h +++ b/src/platform/ESP32/ESP32Config.h @@ -69,7 +69,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 da52f00a0001d1..69a570a8f6e242 100644 --- a/src/platform/Linux/PosixConfig.cpp +++ b/src/platform/Linux/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" }; 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 52263d4aea0c71..c2965e2ea8b205 100644 --- a/src/platform/Linux/PosixConfig.h +++ b/src/platform/Linux/PosixConfig.h @@ -72,7 +72,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 19a4cb35cb62ea..ecaa219979e65f 100644 --- a/src/platform/P6/P6Config.cpp +++ b/src/platform/P6/P6Config.cpp @@ -71,7 +71,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 336a91d17d82cc..0be7aa5abb7696 100644 --- a/src/platform/P6/P6Config.h +++ b/src/platform/P6/P6Config.h @@ -73,7 +73,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 28577d22cc6abb..9b9e57a55ef0dc 100644 --- a/src/platform/Tizen/PosixConfig.cpp +++ b/src/platform/Tizen/PosixConfig.cpp @@ -68,7 +68,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" }; CHIP_ERROR PosixConfig::Init() diff --git a/src/platform/Tizen/PosixConfig.h b/src/platform/Tizen/PosixConfig.h index 05cb43cbcebd10..aa5203bf989f7e 100644 --- a/src/platform/Tizen/PosixConfig.h +++ b/src/platform/Tizen/PosixConfig.h @@ -70,7 +70,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 822d37a10171cd..0ffb96d3f07744 100644 --- a/src/platform/Zephyr/ZephyrConfig.cpp +++ b/src/platform/Zephyr/ZephyrConfig.cpp @@ -70,7 +70,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 @@ -84,7 +83,7 @@ constexpr const char * sAllResettableConfigKeys[] = { ZephyrConfig::kConfigKey_ServiceConfig, ZephyrConfig::kConfigKey_PairedAccountId, ZephyrConfig::kConfigKey_ServiceId, ZephyrConfig::kConfigKey_LastUsedEpochKeyId, ZephyrConfig::kConfigKey_FailSafeArmed, ZephyrConfig::kConfigKey_RegulatoryLocation, - ZephyrConfig::kConfigKey_CountryCode, ZephyrConfig::kConfigKey_Breadcrumb, + ZephyrConfig::kConfigKey_CountryCode, }; // 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 bd6f8e8591dd79..bf18c131965125 100644 --- a/src/platform/Zephyr/ZephyrConfig.h +++ b/src/platform/Zephyr/ZephyrConfig.h @@ -60,7 +60,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 9b95a93fcce068..5750ae9c59fbb3 100644 --- a/src/platform/android/AndroidConfig.cpp +++ b/src/platform/android/AndroidConfig.cpp @@ -88,7 +88,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" }; void AndroidConfig::InitializeWithObject(jobject managerObject) { diff --git a/src/platform/android/AndroidConfig.h b/src/platform/android/AndroidConfig.h index 1fbae97846174b..2d265ca6b9b6b7 100644 --- a/src/platform/android/AndroidConfig.h +++ b/src/platform/android/AndroidConfig.h @@ -71,7 +71,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 5079c5aedb2945..b05b061e757c36 100644 --- a/src/platform/android/java/chip/platform/ConfigurationManager.java +++ b/src/platform/android/java/chip/platform/ConfigurationManager.java @@ -56,7 +56,6 @@ public interface ConfigurationManager { String kConfigKey_WiFiStationSecType = "sta-sec-type"; String kConfigKey_RegulatoryLocation = "regulatory-location"; String kConfigKey_CountryCode = "country-code"; - String kConfigKey_Breadcrumb = "breadcrumb"; long readConfigValueLong(String namespace, String name) throws AndroidChipPlatformException; diff --git a/src/platform/bouffalolab/BL602/BL602Config.cpp b/src/platform/bouffalolab/BL602/BL602Config.cpp index ffeb2f72f0099d..11cbdfbddd6bfb 100644 --- a/src/platform/bouffalolab/BL602/BL602Config.cpp +++ b/src/platform/bouffalolab/BL602/BL602Config.cpp @@ -69,7 +69,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" }; CHIP_ERROR BL602Config::Init() diff --git a/src/platform/bouffalolab/BL602/BL602Config.h b/src/platform/bouffalolab/BL602/BL602Config.h index b4ded47ae49c45..d8367cc1c2cbba 100644 --- a/src/platform/bouffalolab/BL602/BL602Config.h +++ b/src/platform/bouffalolab/BL602/BL602Config.h @@ -76,7 +76,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 daaafa4ea22f9b..6c3dbef4573f35 100644 --- a/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp +++ b/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp @@ -85,9 +85,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 c71c72cbaf67da..b9a91e05367233 100644 --- a/src/platform/cc13x2_26x2/CC13X2_26X2Config.h +++ b/src/platform/cc13x2_26x2/CC13X2_26X2Config.h @@ -63,7 +63,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 e7ebe3ffefa752..9e0c4b26588552 100644 --- a/src/platform/fake/ConfigurationManagerImpl.h +++ b/src/platform/fake/ConfigurationManagerImpl.h @@ -78,8 +78,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 686c97df706f55..e8891a7699c579 100644 --- a/src/platform/mbed/MbedConfig.cpp +++ b/src/platform/mbed/MbedConfig.cpp @@ -83,7 +83,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 9c03bbaf69d897..4e2cb7a6507563 100644 --- a/src/platform/mbed/MbedConfig.h +++ b/src/platform/mbed/MbedConfig.h @@ -69,7 +69,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 a875142cd50f00..bae56b39845996 100644 --- a/src/platform/nxp/k32w/k32w0/K32W0Config.h +++ b/src/platform/nxp/k32w/k32w0/K32W0Config.h @@ -87,7 +87,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 7af2c5be1664c1..3500ec23f69dbd 100644 --- a/src/platform/qpg/qpgConfig.h +++ b/src/platform/qpg/qpgConfig.h @@ -85,7 +85,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-darwin/zap-generated/test/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h index e11d010f474978..f0d0e3b3716b9a 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -179,7 +179,6 @@ class TestList : public Command { printf("TestConstraints\n"); printf("TestDelayCommands\n"); printf("TestDescriptorCluster\n"); - printf("TestGeneralCommissioning\n"); printf("TestGroupsCluster\n"); printf("TestGroupKeyManagementCluster\n"); printf("TestIdentifyCluster\n"); @@ -61456,210 +61455,6 @@ class TestDescriptorCluster : public TestCommandBridge { } }; -class TestGeneralCommissioning : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - TestGeneralCommissioning() - : TestCommandBridge("TestGeneralCommissioning") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~TestGeneralCommissioning() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: TestGeneralCommissioning\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: TestGeneralCommissioning\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write Breadcrumb (1/2)\n"); - err = TestWriteBreadcrumb12_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read back Breadcrumb (1/2)\n"); - err = TestReadBackBreadcrumb12_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Write Breadcrumb (2/2)\n"); - err = TestWriteBreadcrumb22_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read back Breadcrumb (2/2)\n"); - err = TestReadBackBreadcrumb22_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Validate presence of SupportsConcurrentConnection\n"); - err = TestValidatePresenceOfSupportsConcurrentConnection_5(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWriteBreadcrumb12_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device - endpoint:0 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id breadcrumbArgument; - breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:137438953472ULL]; - [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write Breadcrumb (1/2) Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackBreadcrumb12_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device - endpoint:0 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeBreadcrumbWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back Breadcrumb (1/2) Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("Breadcrumb", actualValue, 137438953472ULL)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWriteBreadcrumb22_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device - endpoint:0 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id breadcrumbArgument; - breadcrumbArgument = [NSNumber numberWithUnsignedLongLong:81ULL]; - [cluster writeAttributeBreadcrumbWithValue:breadcrumbArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write Breadcrumb (2/2) Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackBreadcrumb22_4() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device - endpoint:0 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeBreadcrumbWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back Breadcrumb (2/2) Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("Breadcrumb", actualValue, 81ULL)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestValidatePresenceOfSupportsConcurrentConnection_5() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestGeneralCommissioning * cluster = [[CHIPTestGeneralCommissioning alloc] initWithDevice:device - endpoint:0 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster - readAttributeSupportsConcurrentConnectionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Validate presence of SupportsConcurrentConnection Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("supportsConcurrentConnection", "", "bool")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - class TestGroupsCluster : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -64718,7 +64513,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 5a8d514cbac275..f3d3199fd090fb 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -40695,11 +40695,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); } @@ -40714,6 +40716,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; } @@ -40755,6 +40759,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; @@ -40807,7 +40980,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); }