diff --git a/.github/workflows/kotlin-style.yaml b/.github/workflows/kotlin-style.yaml index 2f8df6f486123b..a8d328268951bf 100644 --- a/.github/workflows/kotlin-style.yaml +++ b/.github/workflows/kotlin-style.yaml @@ -22,11 +22,17 @@ jobs: uses: actions/checkout@v4 - name: "detekt" - uses: natiginfo/action-detekt-all@1.23.5 + uses: natiginfo/action-detekt-all@1.23.6 # Detekt seems not to like circular symlinks, so we set up # explicit paths below + # + # In particular, if symlinks exist and recurse, detekt tries to + # follow, so for example `examples/android/CHIPTest` as a path + # will never end (and eventually run out of HEAP) because + # `examples/android/CHIPTest/third_party/connectedhomeip` is + # circular with: - args: --parallel --build-upon-default-config --config kotlin-detect-config.yaml --input examples/android/CHIPTest,examples/android/CHIPTool,examples/java-matter-controller/java,src/controller/java + args: --parallel --build-upon-default-config --config kotlin-detect-config.yaml --input examples/android/CHIPTest/app,examples/android/CHIPTool,examples/java-matter-controller/java,src/controller/java ktlint: name: "Format check" diff --git a/examples/light-switch-app/silabs/openthread.gni b/examples/light-switch-app/silabs/openthread.gni index 17cc5885460379..30c7efbde3d623 100644 --- a/examples/light-switch-app/silabs/openthread.gni +++ b/examples/light-switch-app/silabs/openthread.gni @@ -28,7 +28,7 @@ openthread_external_platform = # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true # Openthread Configuration flags sl_ot_idle_interval_ms = 15000 # 15s Idle Intervals diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter index 60b6480176d518..0cb630900c3ddf 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.matter +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.matter @@ -2355,7 +2355,7 @@ endpoint 1 { callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 3; - ram attribute clusterRevision default = 6; + ram attribute clusterRevision default = 5; handle command MoveToLevel; handle command Move; diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap index 9e293bcd3032d1..437aac9d67bdac 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap @@ -4288,7 +4288,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "6", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, diff --git a/examples/lit-icd-app/silabs/build_for_wifi_args.gni b/examples/lit-icd-app/silabs/build_for_wifi_args.gni index 3531a31ffde406..cdc711cdc1c252 100644 --- a/examples/lit-icd-app/silabs/build_for_wifi_args.gni +++ b/examples/lit-icd-app/silabs/build_for_wifi_args.gni @@ -26,7 +26,7 @@ app_data_model = "${chip_root}/examples/lit-icd-app/lit-icd-common" # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true icd_enforce_sit_slow_poll_limit = true chip_enable_icd_lit = true diff --git a/examples/lit-icd-app/silabs/openthread.gni b/examples/lit-icd-app/silabs/openthread.gni index 9d06737d622a2d..4b49740513c555 100644 --- a/examples/lit-icd-app/silabs/openthread.gni +++ b/examples/lit-icd-app/silabs/openthread.gni @@ -29,7 +29,7 @@ openthread_external_platform = # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true icd_enforce_sit_slow_poll_limit = true chip_icd_report_on_active_mode = true chip_enable_icd_lit = true diff --git a/examples/lock-app/silabs/build_for_wifi_args.gni b/examples/lock-app/silabs/build_for_wifi_args.gni index 25c5a2435d332f..84596e9258fbcc 100644 --- a/examples/lock-app/silabs/build_for_wifi_args.gni +++ b/examples/lock-app/silabs/build_for_wifi_args.gni @@ -24,7 +24,7 @@ app_data_model = "${chip_root}/examples/lock-app/lock-common" # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true # ICD Matter Configuration flags sl_idle_mode_duration_s = 600 # 10min Idle Mode Duration diff --git a/examples/lock-app/silabs/openthread.gni b/examples/lock-app/silabs/openthread.gni index 3bfa566596aeaf..8d1c75d267238c 100644 --- a/examples/lock-app/silabs/openthread.gni +++ b/examples/lock-app/silabs/openthread.gni @@ -28,7 +28,7 @@ openthread_external_platform = # ICD Default configurations chip_enable_icd_server = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true # Openthread Configuration flags sl_ot_idle_interval_ms = 5000 # 5s Idle Intervals diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 9be9f07fe3c759..d85f10d0612ea1 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -54,10 +54,13 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys #endif #include "SilabsDeviceDataProvider.h" -#include "SilabsTestEventTriggerDelegate.h" #include #include +#ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED +#include "SilabsTestEventTriggerDelegate.h" // nogncheck +#endif + #if CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED #include #else @@ -219,12 +222,6 @@ void SilabsMatterConfig::ConnectivityEventCallback(const ChipDeviceEvent * event } } -#if SILABS_TEST_EVENT_TRIGGER_ENABLED -static uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, - 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, - 0xcc, 0xdd, 0xee, 0xff }; -#endif // SILABS_TEST_EVENT_TRIGGER_ENABLED - CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) { CHIP_ERROR err; @@ -283,18 +280,10 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) initParams.reportScheduler = &sReportScheduler; -#if SILABS_TEST_EVENT_TRIGGER_ENABLED - if (Encoding::HexToBytes(SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY, strlen(SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY), - sTestEventTriggerEnableKey, - TestEventTriggerDelegate::kEnableKeyLength) != TestEventTriggerDelegate::kEnableKeyLength) - { - SILABS_LOG("Failed to convert the EnableKey string to octstr type value"); - memset(sTestEventTriggerEnableKey, 0, sizeof(sTestEventTriggerEnableKey)); - } - // TODO(#31723): Show to customers that they can do `Server::GetInstance().GetTestEventTriggerDelegate().AddHandler()` - static SilabsTestEventTriggerDelegate sTestEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; +#ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED + static SilabsTestEventTriggerDelegate sTestEventTriggerDelegate; initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; -#endif // SILABS_TEST_EVENT_TRIGGER_ENABLED +#endif // SL_MATTER_TEST_EVENT_TRIGGER_ENABLED #if CHIP_CRYPTO_PLATFORM && !(defined(SLI_SI91X_MCU_INTERFACE)) // When building with EFR32 crypto, use the opaque key store @@ -303,13 +292,6 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) initParams.operationalKeystore = &gOperationalKeystore; #endif -#ifdef PERFORMANCE_TEST_ENABLED - // Set up Test Event Trigger command of the General Diagnostics cluster. Used only in performance testing - // TODO(#31723): Show to customers that they can do `Server::GetInstance().GetTestEventTriggerDelegate().AddHandler()` - static SilabsTestEventTriggerDelegate sTestEventTriggerDelegate{ ByteSpan(kTestEventTriggerEnableKey) }; - initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; -#endif - // Initialize the remaining (not overridden) providers to the SDK example defaults (void) initParams.InitializeStaticResourcesBeforeServerInit(); diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index 73e70c18e1d7f8..87df30d1a186c9 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -34,9 +34,6 @@ declare_args() { # Argument to force enable WPA3 security on rs91x rs91x_wpa3_transition = true - # use commissionable data for SiWx917 - siwx917_commissionable_data = false - #default WiFi SSID chip_default_wifi_ssid = "" @@ -44,11 +41,11 @@ declare_args() { chip_default_wifi_psk = "" # Enable TestEventTrigger in GeneralDiagnostics cluster - silabs_test_event_trigger_enabled = false + sl_enable_test_event_trigger = false # The EnableKey in hex string format used by TestEventTrigger command in - # GeneralDiagnostics cluster. The length of the string should be 32. - silabs_test_event_trigger_enable_key = "00112233445566778899aabbccddeeff" + # GeneralDiagnostics cluster. The length of the string should be 16 bytes. + sl_test_event_trigger_enable_key = "00112233445566778899AABBCCDDEEFF" } # Sanity check @@ -80,6 +77,30 @@ config("chip_examples_project_config") { ] } +config("test-event-trigger-config") { + defines = [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLED" ] + + if (is_debug) { + defines += [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${sl_test_event_trigger_enable_key}\"" ] + } +} + +source_set("test-event-trigger") { + sources = [ + "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp", + "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.h", + ] + + public_configs = [ ":test-event-trigger-config" ] + + public_deps = [ + ":silabs-factory-data-provider", + "${chip_root}/src/app:test-event-trigger", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support", + ] +} + source_set("siwx917-matter-shell") { if (chip_build_libshell) { defines = [ "ENABLE_CHIP_SHELL" ] @@ -129,6 +150,10 @@ source_set("silabs-factory-data-provider") { ] public_configs = [ ":siwx917-common-config" ] + + if (sl_enable_test_event_trigger) { + public_configs += [ ":test-event-trigger-config" ] + } } config("siwx917-common-config") { @@ -152,10 +177,6 @@ config("siwx917-common-config") { defines += [ "HEAP_MONITORING" ] } - if (siwx917_commissionable_data) { - defines += [ "SIWX917_USE_COMISSIONABLE_DATA=1" ] - } - ldflags = [ "-Wl,--no-warn-rwx-segment" ] } @@ -274,18 +295,16 @@ source_set("siwx917-common") { public_deps += [ ":silabs-factory-data-provider" ] } - if (silabs_test_event_trigger_enabled) { - sources += - [ "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp" ] - defines += [ "SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${silabs_test_event_trigger_enable_key}\"" ] - } - public_deps += [ "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", ] + if (sl_enable_test_event_trigger) { + public_deps += [ ":test-event-trigger" ] + } + if (app_data_model != "") { public_deps += [ app_data_model ] } diff --git a/examples/platform/silabs/SilabsDeviceDataProvider.cpp b/examples/platform/silabs/SilabsDeviceDataProvider.cpp index c487c334819dd5..0bf11cde951ab4 100644 --- a/examples/platform/silabs/SilabsDeviceDataProvider.cpp +++ b/examples/platform/silabs/SilabsDeviceDataProvider.cpp @@ -23,13 +23,6 @@ #include #include -#ifdef SIWX917_USE_COMISSIONABLE_DATA -#include "DeviceConfig.h" -#include "silabs_utils.h" -#include -#include -#endif // SIWX917_USE_COMISSIONABLE_DATA - #include namespace chip { @@ -39,142 +32,6 @@ namespace Silabs { // using namespace chip::Credentials; using namespace chip::DeviceLayer::Internal; -// TODO Remove once Commander supports (doesn't erase) NVM3 for 917 -#ifdef SIWX917_USE_COMISSIONABLE_DATA -void SilabsDeviceDataProvider::setupPayload(uint8_t * outBuf) -{ - SetupPayload payload; - std::string result; - ChipError err = CHIP_NO_ERROR; - payload.version = 0; - payload.discriminator.SetLongValue(discriminatorValue); - payload.setUpPINCode = passcode; - payload.rendezvousInformation.SetValue(static_cast(rendezvousFlag)); - payload.commissioningFlow = static_cast(commissionableFlow); - payload.vendorID = vendorId; - payload.productID = productId; - - QRCodeSetupPayloadGenerator generator(payload); - err = generator.payloadBase38Representation(result); - if (err != CHIP_NO_ERROR) - { - SILABS_LOG("Failed to get the payload: %d", err); - } - SILABS_LOG("Payload value in string format : %s", result.c_str()); - std::vector result1; - // skipping the MT: from the payload during decoding - err = base38Decode(result.substr(3), result1); - if (err == CHIP_NO_ERROR) - { - for (uint8_t i = 0; i < result1.size(); i++) - { - outBuf[i] = result1.at(i); - } - } -} - -// writing to the flash based on the value given in the DeviceConfig.h -CHIP_ERROR SilabsDeviceDataProvider::FlashFactoryData() -{ - // flashing the value to the nvm3 section of the flash - // TODO: remove this once it is removed SiWx917 have the nvm3 simiplicity commander support - CHIP_ERROR err; - // Checking for the value of CM and flag - if ((commissionableFlow > 3) || (rendezvousFlag > 7)) - { - return CHIP_ERROR_INTERNAL; - } - if (discriminatorValue != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_SetupDiscriminator, discriminatorValue); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - uint8_t payload[kTotalPayloadDataSizeInBytes]; - setupPayload(payload); - err = SilabsConfig::WriteConfigValueBin(SilabsConfig::kConfigKey_SetupPayloadBitSet, payload, kTotalPayloadDataSizeInBytes); - if (err != CHIP_NO_ERROR) - { - return err; - } - if (spake2Interation != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_Spake2pIterationCount, spake2Interation); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (spake2Salt != NULL) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_Spake2pSalt, spake2Salt); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (spake2Verifier != NULL) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_Spake2pVerifier, spake2Verifier); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (productId != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_ProductId, productId); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (vendorId != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_VendorId, vendorId); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (strlen(productName) != 0) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_ProductName, productName); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (strlen(vendorName) != 0) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_VendorName, vendorName); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (strlen(hwVersionString) != 0) - { - err = SilabsConfig::WriteConfigValueStr(SilabsConfig::kConfigKey_HardwareVersionString, hwVersionString); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - if (rotatingId != 0) - { - err = SilabsConfig::WriteConfigValue(SilabsConfig::kConfigKey_UniqueId, rotatingId); - if (err != CHIP_NO_ERROR) - { - return err; - } - } - return CHIP_NO_ERROR; -} -#endif - CHIP_ERROR SilabsDeviceDataProvider::GetSetupDiscriminator(uint16_t & setupDiscriminator) { CHIP_ERROR err; @@ -510,6 +367,43 @@ CHIP_ERROR SilabsDeviceDataProvider::GetProductLabel(char * buf, size_t bufSize) return SilabsConfig::ReadConfigValueStr(SilabsConfig::KConfigKey_ProductLabel, buf, bufSize, productLabelLen); } +#ifdef SL_MATTER_TEST_EVENT_TRIGGER_ENABLED +/** + * @brief Reads the test event trigger key from NVM. If the key isn't present, returns default value if defined. + * + * @param[out] keySpan output buffer. Must be at least large enough for 16 bytes (ken length) + * @return CHIP_ERROR + */ +CHIP_ERROR SilabsDeviceDataProvider::GetTestEventTriggerKey(MutableByteSpan & keySpan) +{ + constexpr size_t kEnableKeyLength = 16; // Expected byte size of the EnableKey + CHIP_ERROR err = CHIP_NO_ERROR; + size_t keyLength = 0; + + VerifyOrReturnError(keySpan.size() >= kEnableKeyLength, CHIP_ERROR_BUFFER_TOO_SMALL); + + err = SilabsConfig::ReadConfigValueBin(SilabsConfig::kConfigKey_Test_Event_Trigger_Key, keySpan.data(), kEnableKeyLength, + keyLength); +#ifndef NDEBUG + if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + { + + constexpr char enableKey[] = SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY; + if (Encoding::HexToBytes(enableKey, strlen(enableKey), keySpan.data(), kEnableKeyLength) != kEnableKeyLength) + { + // enableKey Hex String doesn't have the correct length + memset(keySpan.data(), 0, keySpan.size()); + return CHIP_ERROR_INTERNAL; + } + err = CHIP_NO_ERROR; + } +#endif // NDEBUG + + keySpan.reduce_size(kEnableKeyLength); + return err; +} +#endif // SL_MATTER_TEST_EVENT_TRIGGER_ENABLED + SilabsDeviceDataProvider & SilabsDeviceDataProvider::GetDeviceDataProvider() { static SilabsDeviceDataProvider sDataProvider; diff --git a/examples/platform/silabs/SilabsDeviceDataProvider.h b/examples/platform/silabs/SilabsDeviceDataProvider.h index f29e6be24d9d72..76caac04bd60b8 100644 --- a/examples/platform/silabs/SilabsDeviceDataProvider.h +++ b/examples/platform/silabs/SilabsDeviceDataProvider.h @@ -37,12 +37,6 @@ class SilabsDeviceDataProvider : public CommissionableDataProvider, Internal::GenericDeviceInstanceInfoProvider(ConfigurationManagerImpl::GetDefaultInstance()) {} -// TODO Remove once Commander supports (doesn't erase) NVM3 for 917 -#ifdef SIWX917_USE_COMISSIONABLE_DATA - void setupPayload(uint8_t * outBuf); - CHIP_ERROR FlashFactoryData(); -#endif /* SIWX917_USE_COMISSIONABLE_DATA */ - static SilabsDeviceDataProvider & GetDeviceDataProvider(); CHIP_ERROR GetSetupPayload(MutableCharSpan & payloadBuf); // ===== Members functions that implement the CommissionableDataProvider @@ -68,6 +62,9 @@ class SilabsDeviceDataProvider : public CommissionableDataProvider, CHIP_ERROR GetPartNumber(char * buf, size_t bufSize) override; CHIP_ERROR GetProductURL(char * buf, size_t bufSzie) override; CHIP_ERROR GetProductLabel(char * buf, size_t bufSize) override; + + // ===== Member functions that are Silabs Specific + CHIP_ERROR GetTestEventTriggerKey(MutableByteSpan & keySpan); }; } // namespace Silabs diff --git a/examples/platform/silabs/SilabsTestEventTriggerDelegate.cpp b/examples/platform/silabs/SilabsTestEventTriggerDelegate.cpp index f9a11df74d7ae9..ef42c0d3a9dfd2 100644 --- a/examples/platform/silabs/SilabsTestEventTriggerDelegate.cpp +++ b/examples/platform/silabs/SilabsTestEventTriggerDelegate.cpp @@ -17,6 +17,7 @@ */ #include "SilabsTestEventTriggerDelegate.h" +#include "SilabsDeviceDataProvider.h" using namespace ::chip::DeviceLayer; @@ -24,7 +25,14 @@ namespace chip { bool SilabsTestEventTriggerDelegate::DoesEnableKeyMatch(const ByteSpan & enableKey) const { - return !mEnableKey.empty() && mEnableKey.data_equal(enableKey); + uint8_t storedEnableKey[TestEventTriggerDelegate::kEnableKeyLength]; + MutableByteSpan enableKeySpan(storedEnableKey); + + // Return false if we were not able to get the enableKey + VerifyOrReturnValue( + Silabs::SilabsDeviceDataProvider::GetDeviceDataProvider().GetTestEventTriggerKey(enableKeySpan) == CHIP_NO_ERROR, false); + + return (!enableKeySpan.empty() && enableKeySpan.data_equal(enableKey)); } } // namespace chip diff --git a/examples/platform/silabs/SilabsTestEventTriggerDelegate.h b/examples/platform/silabs/SilabsTestEventTriggerDelegate.h index 03ceabd69a7898..8359e489a16029 100644 --- a/examples/platform/silabs/SilabsTestEventTriggerDelegate.h +++ b/examples/platform/silabs/SilabsTestEventTriggerDelegate.h @@ -46,10 +46,7 @@ namespace chip { class SilabsTestEventTriggerDelegate : public TestEventTriggerDelegate, TestEventTriggerHandler { public: - explicit SilabsTestEventTriggerDelegate(const ByteSpan & enableKey) : mEnableKey(enableKey) - { - VerifyOrDie(AddHandler(this) == CHIP_NO_ERROR); - } + explicit SilabsTestEventTriggerDelegate() { VerifyOrDie(AddHandler(this) == CHIP_NO_ERROR); } /** * @brief Checks to see if `enableKey` provided matches value chosen by the manufacturer. @@ -69,9 +66,6 @@ class SilabsTestEventTriggerDelegate : public TestEventTriggerDelegate, TestEven // WARNING: LEGACY SUPPORT ONLY, DO NOT EXTEND FOR STANDARD CLUSTERS return (emberAfHandleEventTrigger(eventTrigger)) ? CHIP_NO_ERROR : CHIP_ERROR_INVALID_ARGUMENT; } - -private: - ByteSpan mEnableKey; }; } // namespace chip diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 8b7b1ebf86e264..ee0b891a2565f8 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -41,11 +41,11 @@ declare_args() { chip_default_wifi_psk = "" # Enable TestEventTrigger in GeneralDiagnostics cluster - silabs_test_event_trigger_enabled = false + sl_enable_test_event_trigger = false # The EnableKey in hex string format used by TestEventTrigger command in - # GeneralDiagnostics cluster. The length of the string should be 32. - silabs_test_event_trigger_enable_key = "00112233445566778899aabbccddeeff" + # GeneralDiagnostics cluster. The length of the string should be 16 bytes. + sl_test_event_trigger_enable_key = "00112233445566778899AABBCCDDEEFF" } silabs_common_plat_dir = "${chip_root}/examples/platform/silabs" @@ -94,6 +94,30 @@ config("chip_examples_project_config") { ] } +config("test-event-trigger-config") { + defines = [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLED" ] + + if (is_debug) { + defines += [ "SL_MATTER_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${sl_test_event_trigger_enable_key}\"" ] + } +} + +source_set("test-event-trigger") { + sources = [ + "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp", + "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.h", + ] + + public_configs = [ ":test-event-trigger-config" ] + + public_deps = [ + ":silabs-factory-data-provider", + "${chip_root}/src/app:test-event-trigger", + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support", + ] +} + source_set("openthread_core_config_efr32_chip_examples") { if (chip_enable_openthread) { sources = [ "project_include/OpenThreadConfig.h" ] @@ -157,6 +181,10 @@ source_set("silabs-factory-data-provider") { "${chip_root}/src/platform:platform_base", "${chip_root}/src/setup_payload", ] + + if (sl_enable_test_event_trigger) { + public_configs = [ ":test-event-trigger-config" ] + } } config("efr32-common-config") { @@ -206,6 +234,7 @@ config("silabs-wifi-config") { if (sl_wfx_config_softap) { defines += [ "SL_WFX_CONFIG_SOFTAP" ] } + if (sl_wfx_config_scan) { defines += [ "SL_WFX_CONFIG_SCAN" ] } @@ -213,6 +242,7 @@ config("silabs-wifi-config") { if (chip_enable_wifi_ipv4) { defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ] } + if (rs91x_wpa3_transition) { # TODO: Change this macro once WF200 support is provided defines += [ "WIFI_ENABLE_SECURITY_WPA3_TRANSITION=1" ] @@ -322,15 +352,6 @@ source_set("efr32-common") { public_deps += [ ":silabs-factory-data-provider" ] } - if (silabs_test_event_trigger_enabled) { - sources += - [ "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp" ] - defines += [ - "SILABS_TEST_EVENT_TRIGGER_ENABLED=true", - "SILABS_TEST_EVENT_TRIGGER_ENABLE_KEY=\"${silabs_test_event_trigger_enable_key}\"", - ] - } - public_deps += [ "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/app/server", @@ -338,6 +359,10 @@ source_set("efr32-common") { "${chip_root}/src/setup_payload", ] + if (sl_enable_test_event_trigger) { + public_deps += [ ":test-event-trigger" ] + } + if (app_data_model != "") { public_deps += [ app_data_model ] } diff --git a/examples/smoke-co-alarm-app/silabs/README.md b/examples/smoke-co-alarm-app/silabs/README.md index b5548b69f24f54..03ff976deca183 100644 --- a/examples/smoke-co-alarm-app/silabs/README.md +++ b/examples/smoke-co-alarm-app/silabs/README.md @@ -384,10 +384,10 @@ features can easily be toggled on or off. Here is a short list of options : ### Enabling test event trigger -`silabs_test_event_trigger_enabled, silabs_test_event_trigger_enable_key` +`sl_enable_test_event_trigger` ``` - The value of silabs_test_event_trigger_enable_key is specific to each device manufacturer + The enable the test event trigger, `sl_enable_test_event_trigger` must be true. - $ ./scripts/examples/gn_silabs_example.sh ./examples/smoke-co-alarm-app/silabs ./out/smoke-co-alarm-app BRD4164A silabs_test_event_trigger_enabled=true silabs_test_event_trigger_enable_key=\"00112233445566778899aabbccddeeff\" + $ ./scripts/examples/gn_silabs_example.sh ./examples/smoke-co-alarm-app/silabs ./out/smoke-co-alarm-app BRD4164A sl_enable_test_event_trigger=true ``` diff --git a/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni b/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni index 047de7f34492df..0619082413530d 100644 --- a/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni +++ b/examples/smoke-co-alarm-app/silabs/build_for_wifi_args.gni @@ -21,3 +21,17 @@ import("${chip_root}/src/platform/silabs/wifi_args.gni") chip_enable_ota_requestor = true app_data_model = "${chip_root}/examples/smoke-co-alarm-app/smoke-co-alarm-common" + +sl_enable_test_event_trigger = true + +# ICD Default configurations +chip_enable_icd_server = true +chip_subscription_timeout_resumption = false +sl_use_subscription_syncing = true +icd_enforce_sit_slow_poll_limit = true +chip_enable_icd_lit = true + +# ICD Matter Configuration flags +sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration +sl_active_mode_duration_ms = 0 # 0 Active Mode Duration +sl_active_mode_threshold_ms = 30000 # 30s Active Mode Threshold diff --git a/examples/smoke-co-alarm-app/silabs/openthread.gni b/examples/smoke-co-alarm-app/silabs/openthread.gni index 650b338de86f93..845b2220b4570a 100644 --- a/examples/smoke-co-alarm-app/silabs/openthread.gni +++ b/examples/smoke-co-alarm-app/silabs/openthread.gni @@ -25,3 +25,22 @@ chip_enable_openthread = true openthread_external_platform = "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32" + +sl_enable_test_event_trigger = true + +# ICD Default configurations +chip_enable_icd_server = true +chip_subscription_timeout_resumption = false +sl_use_subscription_syncing = true +icd_enforce_sit_slow_poll_limit = true +chip_icd_report_on_active_mode = true +chip_enable_icd_lit = true + +# Openthread Configuration flags +sl_ot_idle_interval_ms = 3600000 # 60mins Idle Polling Interval +sl_ot_active_interval_ms = 1000 # 1000ms Active Polling Interval + +# ICD Matter Configuration flags +sl_idle_mode_duration_s = 3600 # 60min Idle Mode Duration +sl_active_mode_duration_ms = 0 # 0 Active Mode Duration +sl_active_mode_threshold_ms = 5000 # 5s Active Mode Threshold diff --git a/examples/virtual-device-app/android/App/app/build.gradle.kts b/examples/virtual-device-app/android/App/app/build.gradle.kts index e5998ddc554d6d..c9b40ccd5abc1d 100644 --- a/examples/virtual-device-app/android/App/app/build.gradle.kts +++ b/examples/virtual-device-app/android/App/app/build.gradle.kts @@ -76,7 +76,8 @@ dependencies { implementation(project(":core:data")) implementation(project(":core:domain")) implementation(project(":core:model")) - implementation(project(":core:ui")) + implementation(project(":core:ui")) + implementation(project(":feature:closure")) implementation(project(":feature:control")) implementation(project(":feature:main")) implementation(project(":feature:qrcode")) diff --git a/examples/virtual-device-app/android/App/app/src/main/res/navigation/nav_graph.xml b/examples/virtual-device-app/android/App/app/src/main/res/navigation/nav_graph.xml index a5e06ead94b64c..87d075c431ea82 100644 --- a/examples/virtual-device-app/android/App/app/src/main/res/navigation/nav_graph.xml +++ b/examples/virtual-device-app/android/App/app/src/main/res/navigation/nav_graph.xml @@ -7,5 +7,6 @@ + \ No newline at end of file diff --git a/examples/virtual-device-app/android/App/core/common/src/main/java/com/matter/virtual/device/app/core/common/DeepLink.kt b/examples/virtual-device-app/android/App/core/common/src/main/java/com/matter/virtual/device/app/core/common/DeepLink.kt index 2e24a9246888b5..8adad6a4495d4d 100644 --- a/examples/virtual-device-app/android/App/core/common/src/main/java/com/matter/virtual/device/app/core/common/DeepLink.kt +++ b/examples/virtual-device-app/android/App/core/common/src/main/java/com/matter/virtual/device/app/core/common/DeepLink.kt @@ -35,6 +35,9 @@ object DeepLink { Device.OnOffSwitch -> "android-app://com.matter.virtual.device.app.feature.control/onOffSwitchFragment/${setting}" .toUri() + Device.DoorLock -> + "android-app://com.matter.virtual.device.app.feature.closure/doorLockFragment/${setting}" + .toUri() Device.Unknown -> throw UnsupportedOperationException("Unsupported device") } diff --git a/examples/virtual-device-app/android/App/core/common/src/main/java/com/matter/virtual/device/app/core/common/Device.kt b/examples/virtual-device-app/android/App/core/common/src/main/java/com/matter/virtual/device/app/core/common/Device.kt index 067898bbd79d93..05b114f3385b70 100644 --- a/examples/virtual-device-app/android/App/core/common/src/main/java/com/matter/virtual/device/app/core/common/Device.kt +++ b/examples/virtual-device-app/android/App/core/common/src/main/java/com/matter/virtual/device/app/core/common/Device.kt @@ -22,6 +22,10 @@ sealed class Device( 3841 ) + @Serializable + object DoorLock : + Device("doorlock", R.string.matter_door_lock, R.drawable.round_lock_24, 0x000A, 3842) + @Serializable object Unknown : Device("unknown", R.string.matter_device, R.drawable.round_device_unknown_24, 65535, 3840) diff --git a/examples/virtual-device-app/android/App/core/common/src/main/res/drawable/round_lock_24.xml b/examples/virtual-device-app/android/App/core/common/src/main/res/drawable/round_lock_24.xml new file mode 100644 index 00000000000000..74cd8a77ffc307 --- /dev/null +++ b/examples/virtual-device-app/android/App/core/common/src/main/res/drawable/round_lock_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MainFragment.kt b/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MainFragment.kt index 0365727b110d25..623c0bbb978a7d 100644 --- a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MainFragment.kt +++ b/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MainFragment.kt @@ -15,10 +15,10 @@ import androidx.navigation.NavOptions import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.LinearLayoutManager import com.matter.virtual.device.app.core.common.DeepLink +import com.matter.virtual.device.app.core.common.Device import com.matter.virtual.device.app.core.common.MatterSettings import com.matter.virtual.device.app.core.ui.SharedViewModel import com.matter.virtual.device.app.feature.main.databinding.FragmentMainBinding -import com.matter.virtual.device.app.feature.main.model.Menu import dagger.hilt.android.AndroidEntryPoint import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.encodeToString @@ -84,15 +84,15 @@ class MainFragment : Fragment() { ) } MainUiState.Start -> { - val itemList = arrayListOf(Menu.ON_OFF_SWITCH) + val itemList = arrayListOf(Device.OnOffSwitch, Device.DoorLock) val menuAdapter = MenuAdapter( object : MenuAdapter.ItemHandler { - override fun onClick(item: Menu) { + override fun onClick(item: Device) { viewModel.consumeUiState() - val matterSettings = MatterSettings(device = item.device) + val matterSettings = MatterSettings(device = item) val jsonSettings = Json.encodeToString(matterSettings) try { findNavController() diff --git a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MenuAdapter.kt b/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MenuAdapter.kt index c3212333d7ec13..8df42477871afc 100644 --- a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MenuAdapter.kt +++ b/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/MenuAdapter.kt @@ -5,17 +5,17 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView +import com.matter.virtual.device.app.core.common.Device import com.matter.virtual.device.app.feature.main.databinding.ItemMenuBinding -import com.matter.virtual.device.app.feature.main.model.Menu internal class MenuAdapter(private val itemHandler: ItemHandler) : - ListAdapter( - object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: Menu, newItem: Menu): Boolean { - return oldItem.titleResId == newItem.titleResId + ListAdapter( + object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: Device, newItem: Device): Boolean { + return oldItem.deviceNameResId == newItem.deviceNameResId } - override fun areContentsTheSame(oldItem: Menu, newItem: Menu): Boolean { + override fun areContentsTheSame(oldItem: Device, newItem: Device): Boolean { return oldItem == newItem } } @@ -23,7 +23,7 @@ internal class MenuAdapter(private val itemHandler: ItemHandler) : inner class MenuViewHolder(private val binding: ItemMenuBinding) : RecyclerView.ViewHolder(binding.root) { - fun bind(item: Menu) { + fun bind(item: Device) { binding.item = item binding.itemHandler = itemHandler } @@ -41,6 +41,6 @@ internal class MenuAdapter(private val itemHandler: ItemHandler) : } interface ItemHandler { - fun onClick(item: Menu) + fun onClick(item: Device) } } diff --git a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/model/Menu.kt b/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/model/Menu.kt deleted file mode 100644 index 67e2658c5bed44..00000000000000 --- a/examples/virtual-device-app/android/App/feature/main/src/main/java/com/matter/virtual/device/app/feature/main/model/Menu.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.matter.virtual.device.app.feature.main.model - -import androidx.annotation.DrawableRes -import androidx.annotation.StringRes -import com.matter.virtual.device.app.core.common.Device -import com.matter.virtual.device.app.feature.main.R - -enum class Menu( - @DrawableRes val iconResId: Int, - @StringRes val titleResId: Int, - val isDim: Boolean = false, - val device: Device = Device.Unknown -) { - ON_OFF_SWITCH( - R.drawable.round_toggle_on_24, - R.string.matter_on_off_switch, - device = Device.OnOffSwitch - ) -} diff --git a/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/item_menu.xml b/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/item_menu.xml index b9b12400969d84..23239f41667e6e 100644 --- a/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/item_menu.xml +++ b/examples/virtual-device-app/android/App/feature/main/src/main/res/layout/item_menu.xml @@ -10,15 +10,14 @@ + type="com.matter.virtual.device.app.core.common.Device" /> @@ -35,10 +34,10 @@ android:layout_marginTop="@dimen/menu_item_image_margin_top" android:layout_marginBottom="@dimen/menu_item_image_margin_bottom" android:tint="@color/device_image_tint" + app:imageSrc="@{item.deviceIconResId}" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:imageSrc="@{item.iconResId}" /> + app:layout_constraintTop_toTopOf="parent" /> - diff --git a/examples/window-app/silabs/openthread.gni b/examples/window-app/silabs/openthread.gni index d3d50ab878b211..9fd09bd510a840 100644 --- a/examples/window-app/silabs/openthread.gni +++ b/examples/window-app/silabs/openthread.gni @@ -29,7 +29,7 @@ openthread_external_platform = chip_enable_icd_server = true enable_synchronized_sed = true chip_subscription_timeout_resumption = false -sl_use_subscription_synching = true +sl_use_subscription_syncing = true # Openthread Configuration flags sl_ot_idle_interval_ms = 1000 # 1s Idle Intervals diff --git a/scripts/setup/bootstrap.sh b/scripts/setup/bootstrap.sh index ce6b12f1df330d..0fb9af207e2c77 100644 --- a/scripts/setup/bootstrap.sh +++ b/scripts/setup/bootstrap.sh @@ -56,6 +56,29 @@ _install_additional_pip_requirements() { unset _SETUP_PLATFORM } +_submodules_need_updating() { + # Validates if a set o submodules that should always be checked out are up to date + + # Pigweed will be up to date on an initial setup, however it may change over time + # the rest are a small subset of things that are always checked out (have no platform attachment) + _SUBMODULE_PATHS=( + "third_party/pigweed/repo" + "third_party/openthread/repo" + "third_party/editline/repo" + ) + + for path in "${_SUBMODULE_PATHS[@]}"; do + if git submodule status "$path" | grep -E '^-' >/dev/null 2>&1; then + echo "git shows that $path has changes" + unset _SUBMODULE_PATHS + return 0 # Success + fi + done + + unset _SUBMODULE_PATHS + return 1 # Failure +} + _bootstrap_or_activate() { if [ -n "$BASH" ]; then local _BOOTSTRAP_PATH="${BASH_SOURCE[0]}" @@ -164,6 +187,20 @@ unset -f _install_additional_pip_requirements pw_cleanup +if _submodules_need_updating; then + # yellow output + if which tput >/dev/null; then tput setaf 3; fi + + echo "Some submodules seem out of date." + echo "For a clean checkout, consider running:" + echo " ./scripts/checkout_submodules.py --shallow --platform " + echo "OR for a full checkout:" + echo " git submodules update -f --init --recursive" + + # reset output + if which tput >/dev/null; then tput sgr0; fi +fi + unset _ACTION_TAKEN unset _CHIP_ROOT unset PW_CIPD_INSTALL_DIR diff --git a/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp b/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp index 88283325c7c380..5f059e73b9a1d3 100644 --- a/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp +++ b/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp @@ -208,7 +208,7 @@ void emberAfLocalizationConfigurationClusterServerInitCallback(EndpointId endpoi it->Release(); - if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND && validLocaleCached) { // If initial value is not one of the allowed values, write the valid value it. status = ActiveLocale::Set(endpoint, validLocale); diff --git a/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp b/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp index 08e90207760603..ff38290c21f8d4 100644 --- a/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp +++ b/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp @@ -78,6 +78,12 @@ class AutoReleaseIterator TimeFormatLocalizationAttrAccess gAttrAccess; +bool HasFeature(EndpointId endpoint, Feature feature) +{ + uint32_t featureMap; + return FeatureMap::Get(endpoint, &featureMap) == Status::Success ? (featureMap & to_underlying(feature)) : false; +} + CHIP_ERROR TimeFormatLocalizationAttrAccess::ReadSupportedCalendarTypes(AttributeValueEncoder & aEncoder) { DeviceLayer::DeviceInfoProvider * provider = DeviceLayer::GetDeviceInfoProvider(); @@ -202,6 +208,10 @@ Protocols::InteractionModel::Status MatterTimeFormatLocalizationClusterServerPre void emberAfTimeFormatLocalizationClusterServerInitCallback(EndpointId endpoint) { + if (!HasFeature(endpoint, Feature::kCalendarFormat)) + { + return; + } CalendarTypeEnum calendarType; CalendarTypeEnum validType; Status status = ActiveCalendarType::Get(endpoint, &calendarType); diff --git a/src/app/util/mock/Functions.h b/src/app/util/mock/Functions.h index 32ba08d316f484..16fe45d9045b9e 100644 --- a/src/app/util/mock/Functions.h +++ b/src/app/util/mock/Functions.h @@ -36,7 +36,15 @@ namespace Test { CHIP_ERROR ReadSingleMockClusterData(FabricIndex aAccessingFabricIndex, const app::ConcreteAttributePath & aPath, app::AttributeReportIBs::Builder & aAttributeReports, app::AttributeValueEncoder::AttributeEncodeState * apEncoderState); + +/// Increase the current value for `GetVersion` void BumpVersion(); + +/// Sets GetVersion to return 0 +void ResetVersion(); + +/// Gets the current value for the version that will +/// be returned by emberAfDataVersionStorage DataVersion GetVersion(); /// Configures the singular global mock attribute storage to use the specified configuration. diff --git a/src/app/util/mock/MockNodeConfig.cpp b/src/app/util/mock/MockNodeConfig.cpp index b4f6b1d27cfc5c..79c886f532a8a2 100644 --- a/src/app/util/mock/MockNodeConfig.cpp +++ b/src/app/util/mock/MockNodeConfig.cpp @@ -70,6 +70,22 @@ MockClusterConfig::MockClusterConfig(ClusterId aId, std::initializer_list(mEmberEventList.size()); mEmberCluster.eventList = mEmberEventList.data(); + + for (auto & attr : attributes) + { + mAttributeMetaData.push_back(attr.attributeMetaData); + } + + // Make sure ember side has access to attribute metadata + mEmberCluster.attributes = mAttributeMetaData.data(); +} + +MockClusterConfig::MockClusterConfig(const MockClusterConfig & other) : + id(other.id), attributes(other.attributes), events(other.events), mEmberCluster(other.mEmberCluster), + mEmberEventList(other.mEmberEventList), mAttributeMetaData(other.mAttributeMetaData) +{ + // Fix self-referencial dependencies after data copy + mEmberCluster.attributes = mAttributeMetaData.data(); } const MockAttributeConfig * MockClusterConfig::attributeById(AttributeId attributeId, ptrdiff_t * outIndex) const @@ -91,6 +107,13 @@ MockEndpointConfig::MockEndpointConfig(EndpointId aId, std::initializer_list #include #include @@ -28,10 +29,35 @@ namespace chip { namespace Test { +namespace internal { + +constexpr EmberAfAttributeMetadata DefaultAttributeMetadata(chip::AttributeId id) +{ + return EmberAfAttributeMetadata{ + .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(static_cast(0)), + .attributeId = id, + .size = 4, + .attributeType = ZCL_INT32U_ATTRIBUTE_TYPE, + .mask = ATTRIBUTE_MASK_WRITABLE | ATTRIBUTE_MASK_NULLABLE, + }; +} + +} // namespace internal + struct MockAttributeConfig { - MockAttributeConfig(AttributeId aId) : id(aId) {} + MockAttributeConfig(AttributeId aId) : id(aId), attributeMetaData(internal::DefaultAttributeMetadata(aId)) {} + MockAttributeConfig(AttributeId aId, EmberAfAttributeType type, + EmberAfAttributeMask mask = ATTRIBUTE_MASK_WRITABLE | ATTRIBUTE_MASK_NULLABLE) : + id(aId), + attributeMetaData(internal::DefaultAttributeMetadata(aId)) + { + attributeMetaData.attributeType = type; + attributeMetaData.mask = mask; + } + const AttributeId id; + EmberAfAttributeMetadata attributeMetaData; }; struct MockEventConfig @@ -45,6 +71,10 @@ struct MockClusterConfig MockClusterConfig(ClusterId aId, std::initializer_list aAttributes = {}, std::initializer_list aEvents = {}); + // Cluster-config is self-referential: mEmberCluster.attributes references mAttributeMetaData.data() + MockClusterConfig(const MockClusterConfig & other); + MockClusterConfig & operator=(const MockClusterConfig &) = delete; + const MockAttributeConfig * attributeById(AttributeId attributeId, ptrdiff_t * outIndex = nullptr) const; const EmberAfCluster * emberCluster() const { return &mEmberCluster; } @@ -55,12 +85,17 @@ struct MockClusterConfig private: EmberAfCluster mEmberCluster; std::vector mEmberEventList; + std::vector mAttributeMetaData; }; struct MockEndpointConfig { MockEndpointConfig(EndpointId aId, std::initializer_list aClusters = {}); + // Endpoint-config is self-referential: mEmberEndpoint.clusters references mEmberClusters.data() + MockEndpointConfig(const MockEndpointConfig & other); + MockEndpointConfig & operator=(const MockEndpointConfig &) = delete; + const MockClusterConfig * clusterById(ClusterId clusterId, ptrdiff_t * outIndex = nullptr) const; const EmberAfEndpointType * emberEndpoint() const { return &mEmberEndpoint; } diff --git a/src/app/util/mock/attribute-storage.cpp b/src/app/util/mock/attribute-storage.cpp index d308316dd8fee5..716460026591ee 100644 --- a/src/app/util/mock/attribute-storage.cpp +++ b/src/app/util/mock/attribute-storage.cpp @@ -258,6 +258,12 @@ const EmberAfCluster * emberAfFindServerCluster(EndpointId endpointId, ClusterId return cluster->emberCluster(); } +DataVersion * emberAfDataVersionStorage(const chip::app::ConcreteClusterPath & aConcreteClusterPath) +{ + // shared data version storage + return &dataVersion; +} + namespace chip { namespace app { @@ -301,8 +307,14 @@ void EnabledEndpointsWithServerCluster::EnsureMatchingEndpoint() } } // namespace app + namespace Test { +void ResetVersion() +{ + dataVersion = 0; +} + void BumpVersion() { dataVersion++; @@ -401,5 +413,15 @@ CHIP_ERROR ReadSingleMockClusterData(FabricIndex aAccessingFabricIndex, const Co return attributeReport.EndOfAttributeReportIB(); } +void SetMockNodeConfig(const MockNodeConfig & config) +{ + mockConfig = &config; +} + +void ResetMockNodeConfig() +{ + mockConfig = nullptr; +} + } // namespace Test } // namespace chip diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index a5ae3904156367..9997b370320e7b 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -1522,14 +1522,14 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) while (readRequestsNext.count) { // Can only read up to 9 paths at a time, per spec if (readRequestsCurrent.count >= 9) { - MTR_LOG_INFO("Batching read attribute work item [%llu]: cannot add more work, item is full [%@:%@:%@:%@]", workItemID, nodeID, endpointID, clusterID, attributeID); + MTR_LOG_INFO("Batching read attribute work item [%llu]: cannot add more work, item is full [0x%016llX:%@:0x%llx:0x%llx]", workItemID, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); return outcome; } // if params don't match then they cannot be merged if (![readRequestsNext[0][MTRDeviceReadRequestFieldParamsIndex] isEqual:readRequestsCurrent[0][MTRDeviceReadRequestFieldParamsIndex]]) { - MTR_LOG_INFO("Batching read attribute work item [%llu]: cannot add more work, parameter mismatch [%@:%@:%@:%@]", workItemID, nodeID, endpointID, clusterID, attributeID); + MTR_LOG_INFO("Batching read attribute work item [%llu]: cannot add more work, parameter mismatch [0x%016llX:%@:0x%llx:0x%llx]", workItemID, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); return outcome; } @@ -1537,8 +1537,8 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) auto readItem = readRequestsNext.firstObject; [readRequestsNext removeObjectAtIndex:0]; [readRequestsCurrent addObject:readItem]; - MTR_LOG_INFO("Batching read attribute work item [%llu]: added %@ (now %tu requests total) [%@:%@:%@:%@]", - workItemID, readItem, readRequestsCurrent.count, nodeID, endpointID, clusterID, attributeID); + MTR_LOG_INFO("Batching read attribute work item [%llu]: added %@ (now %tu requests total) [0x%016llX:%@:0x%llx:0x%llx]", + workItemID, readItem, readRequestsCurrent.count, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); outcome = MTRBatchedPartially; } NSCAssert(readRequestsNext.count == 0, @"should have batched everything or returned early"); @@ -1548,7 +1548,7 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) mtr_hide(self); // don't capture self accidentally for (NSArray * readItem in readRequests) { if ([readItem isEqual:opaqueItemData]) { - MTR_LOG_DEFAULT("Read attribute work item [%llu] report duplicate %@ [%@:%@:%@:%@]", workItemID, readItem, nodeID, endpointID, clusterID, attributeID); + MTR_LOG_DEFAULT("Read attribute work item [%llu] report duplicate %@ [0x%016llX:%@:0x%llx:0x%llx]", workItemID, readItem, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); *isDuplicate = YES; *stop = YES; return; @@ -1585,23 +1585,23 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) if (values) { // Since the format is the same data-value dictionary, this looks like an // attribute report - MTR_LOG_INFO("Read attribute work item [%llu] result: %@ [%@:%@:%@:%@]", workItemID, values, nodeID, endpointID, clusterID, attributeID); + MTR_LOG_INFO("Read attribute work item [%llu] result: %@ [0x%016llX:%@:0x%llX:0x%llX]", workItemID, values, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); [self _handleAttributeReport:values]; } // TODO: better retry logic if (error && (retryCount < 2)) { - MTR_LOG_ERROR("Read attribute work item [%llu] failed (will retry): %@ [%@:%@:%@:%@]", workItemID, error, nodeID, endpointID, clusterID, attributeID); + MTR_LOG_ERROR("Read attribute work item [%llu] failed (will retry): %@ [0x%016llX:%@:0x%llx:0x%llx]", workItemID, error, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); completion(MTRAsyncWorkNeedsRetry); } else { if (error) { - MTR_LOG_DEFAULT("Read attribute work item [%llu] failed (giving up): %@ [%@:%@:%@:%@]", workItemID, error, nodeID, endpointID, clusterID, attributeID); + MTR_LOG_DEFAULT("Read attribute work item [%llu] failed (giving up): %@ [0x%016llX:%@:0x%llx:0x%llx]", workItemID, error, nodeID.unsignedLongLongValue, endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue); } completion(MTRAsyncWorkComplete); } }]; }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"read %@ %@ %@ %@", self.nodeID, endpointID, clusterID, attributeID]; + [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"read %@ 0x%llx 0x%llx", endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue]; } return attributeValueToReturn; @@ -1669,7 +1669,7 @@ - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID completion(MTRAsyncWorkComplete); }]; }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"write %@ %@ %@ %@", self.nodeID, endpointID, clusterID, attributeID]; + [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"write %@ 0x%llx 0x%llx", endpointID, clusterID.unsignedLongLongValue, attributeID.unsignedLongLongValue]; } - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID @@ -1819,7 +1819,7 @@ - (void)_invokeCommandWithEndpointID:(NSNumber *)endpointID workDone(values, error); }]; }]; - [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"invoke %@ %@ %@", endpointID, clusterID, commandID]; + [_asyncWorkQueue enqueueWorkItem:workItem descriptionWithFormat:@"invoke %@ 0x%llx 0x%llx", endpointID, clusterID.unsignedLongLongValue, commandID.unsignedLongLongValue]; } - (void)_invokeKnownCommandWithEndpointID:(NSNumber *)endpointID @@ -2157,13 +2157,9 @@ - (NSArray *)_getAttributesToReportWithReportedValues:(NSArray * fabricList; __block BOOL listFilled = NO; - auto fillListBlock = ^{ + dispatch_sync(_chipWorkQueue, ^{ FabricTable fabricTable; CHIP_ERROR err = [self _initFabricTable:fabricTable]; if (err != CHIP_NO_ERROR) { @@ -399,22 +404,13 @@ - (CHIP_ERROR)_initFabricTable:(FabricTable &)fabricTable } listFilled = YES; - }; - - if ([_controllers count] > 0) { - // We have a controller running already, so our task queue is live. - // Make sure we run on that queue so we don't race against it. - dispatch_sync(_chipWorkQueue, fillListBlock); - } else { - // Not currently running the task queue; just run the block directly. - fillListBlock(); - } + }); if (listFilled == NO) { return nil; } - return [NSArray arrayWithArray:fabricList]; + return fabricList; } - (BOOL)startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParams error:(NSError * __autoreleasing *)error @@ -433,18 +429,13 @@ - (BOOL)_startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParam return YES; } - // Register any tracing backends. This has to be done before starting the event loop to run registering - // the tracing backend in the right queue context - StartupMetricsCollection(); - - DeviceLayer::PlatformMgrImpl().StartEventLoopTask(); - __block CHIP_ERROR errorCode = CHIP_NO_ERROR; dispatch_sync(_chipWorkQueue, ^{ if ([self isRunning]) { return; } + StartupMetricsCollection(); InitializeServerAccessControl(); if (startupParams.hasStorage) { @@ -550,17 +541,17 @@ - (BOOL)_startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParam self->_running = YES; }); - // Make sure to stop the event loop again before returning, so we are not running it while we don't have any controllers. - DeviceLayer::PlatformMgrImpl().StopEventLoopTask(); - if (![self isRunning]) { - [self cleanupStartupObjects]; + dispatch_sync(_chipWorkQueue, ^{ + [self cleanupStartupObjects]; + }); if (error != nil) { *error = [MTRError errorForCHIPErrorCode:errorCode]; } + return NO; } - return [self isRunning]; + return YES; } - (void)stopControllerFactory @@ -575,10 +566,12 @@ - (void)stopControllerFactory [_controllers[0] shutdown]; } - MTR_LOG_INFO("Shutting down the Matter controller factory"); - _controllerFactory->Shutdown(); + dispatch_sync(_chipWorkQueue, ^{ + MTR_LOG_INFO("Shutting down the Matter controller factory"); + _controllerFactory->Shutdown(); - [self cleanupStartupObjects]; + [self cleanupStartupObjects]; + }); // NOTE: we do not call cleanupInitObjects because we can be restarted, and // that does not re-create the objects that we create inside init. @@ -686,9 +679,6 @@ - (MTRDeviceController * _Nullable)_startDeviceController:(MTRDeviceController * } if ([_controllers count] == 0) { - // Bringing up the first controller. Start the event loop now. If we - // fail to bring it up, its cleanup will stop the event loop again. - chip::DeviceLayer::PlatformMgrImpl().StartEventLoopTask(); dispatch_sync(_chipWorkQueue, ^{ self->_operationalBrowser = new MTROperationalBrowser(self, self->_chipWorkQueue); }); @@ -701,8 +691,9 @@ - (MTRDeviceController * _Nullable)_startDeviceController:(MTRDeviceController * os_unfair_lock_unlock(&_controllersLock); __block MTRDeviceControllerStartupParamsInternal * params = nil; - __block CHIP_ERROR fabricError = CHIP_NO_ERROR; + __block CHIP_ERROR fabricError = CHIP_ERROR_INTERNAL; + // Create a temporary FabricTable instance for the fabricChecker logic. // We want the block to end up with just a pointer to the fabric table, // since we know our on-stack instance will outlive the block. FabricTable fabricTableInstance; @@ -1039,18 +1030,6 @@ - (void)controllerShuttingDown:(MTRDeviceController *)controller return; } - if (_groupDataProvider != nullptr) { - dispatch_sync(_chipWorkQueue, ^{ - FabricIndex idx = [controller fabricIndex]; - if (idx != kUndefinedFabricIndex) { - // Clear out out group keys for this fabric index, just in case fabric - // indices get reused later. If a new controller is started on the - // same fabric it will be handed the IPK at that point. - self->_groupDataProvider->RemoveGroupKeys(idx); - } - }); - } - os_unfair_lock_lock(&_controllersLock); // Make sure to set _controllerBeingShutDown and do the remove in the same // locked section, so there is never a time when the controller is gone from @@ -1060,60 +1039,46 @@ - (void)controllerShuttingDown:(MTRDeviceController *)controller [_controllers removeObject:controller]; os_unfair_lock_unlock(&_controllersLock); - // Snapshot the controller's fabric index, if any, before it clears it - // out in shutDownCppController. - __block FabricIndex controllerFabricIndex = controller.fabricIndex; - - // This block runs either during sync dispatch to the Matter queue or after - // Matter queue shutdown, so it can touch any of our members without - // worrying about locking, since nothing else will race it. - auto sharedCleanupBlock = ^{ - assertChipStackLockedByCurrentThread(); - - [controller shutDownCppController]; - - self->_controllerBeingShutDown = nil; - if (self->_controllerBeingStarted == controller) { - controllerFabricIndex = self->_nextAvailableFabricIndex; - self->_controllerBeingStarted = nil; + // Do the controller shutdown on the Matter work queue. + dispatch_sync(_chipWorkQueue, ^{ + FabricIndex fabricIndex = controller.fabricIndex; + if (fabricIndex != kUndefinedFabricIndex) { + // Clear out out group keys for this fabric index, in case fabric + // indices get reused later. If a new controller is started on the + // same fabric it will be handed the IPK at that point. + self->_groupDataProvider->RemoveGroupKeys(fabricIndex); } - }; - if ([_controllers count] == 0) { - dispatch_sync(_chipWorkQueue, ^{ + // If there are no other controllers left, we can shut down some things. + // Do this before we shut down the controller itself, because the + // OtaProviderDelegateBridge uses some services provided by the system + // state without retaining it. + if (_controllers.count == 0) { delete self->_operationalBrowser; self->_operationalBrowser = nullptr; - }); - // That was our last controller. Stop the event loop before it - // shuts down, because shutdown of the last controller will tear - // down most of the world. - DeviceLayer::PlatformMgrImpl().StopEventLoopTask(); - - if (_otaProviderDelegateBridge) { - _otaProviderDelegateBridge->Shutdown(); - _otaProviderDelegateBridge.reset(); - } - if (_otaProviderEndpoint != nil) { - [_otaProviderEndpoint unregisterMatterEndpoint]; - [_otaProviderEndpoint invalidate]; - - [self removeServerEndpoint:_otaProviderEndpoint]; + if (_otaProviderDelegateBridge) { + _otaProviderDelegateBridge->Shutdown(); + _otaProviderDelegateBridge.reset(); + } - _otaProviderEndpoint = nil; + if (_otaProviderEndpoint != nil) { + [_otaProviderEndpoint unregisterMatterEndpoint]; + [_otaProviderEndpoint invalidate]; + [self removeServerEndpoint:_otaProviderEndpoint]; + _otaProviderEndpoint = nil; + } + } else if (_otaProviderDelegateBridge) { + _otaProviderDelegateBridge->ControllerShuttingDown(controller); } - sharedCleanupBlock(); - } else { - // Do the controller shutdown on the Matter work queue. - dispatch_sync(_chipWorkQueue, ^{ - if (_otaProviderDelegateBridge) { - _otaProviderDelegateBridge->ControllerShuttingDown(controller); - } + [controller shutDownCppController]; - sharedCleanupBlock(); - }); - } + self->_controllerBeingShutDown = nil; + if (self->_controllerBeingStarted == controller) { + self->_controllerBeingStarted = nil; + } + }); [controller deinitFromFactory]; } diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 80c451c937e2de..846db8bd08ee26 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -2193,6 +2193,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; @@ -2294,6 +2296,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.csa.matter; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; + STRIP_STYLE = "non-global"; SYSTEM_HEADER_SEARCH_PATHS = ( "$(TEMP_DIR)/out/gen/include", "$(CHIP_ROOT)/src/darwin/Framework/CHIP/", @@ -2361,6 +2364,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -2460,6 +2465,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.csa.matter; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; + STRIP_STYLE = "non-global"; SYSTEM_HEADER_SEARCH_PATHS = ( "$(TEMP_DIR)/out/gen/include", "$(CHIP_ROOT)/src/darwin/Framework/CHIP/", diff --git a/src/inet/tests/TestInetCommonOptions.cpp b/src/inet/tests/TestInetCommonOptions.cpp index fc9c8df320a5c6..fdc79b11954a27 100644 --- a/src/inet/tests/TestInetCommonOptions.cpp +++ b/src/inet/tests/TestInetCommonOptions.cpp @@ -243,6 +243,7 @@ FaultInjectionOptions::FaultInjectionOptions() ExtraCleanupTimeMsec = 0; } +#if defined(CHIP_WITH_NLFAULTINJECTION) && CHIP_WITH_NLFAULTINJECTION bool FaultInjectionOptions::HandleOption(const char * progName, OptionSet * optSet, int id, const char * name, const char * arg) { using namespace nl::FaultInjection; @@ -292,3 +293,4 @@ bool FaultInjectionOptions::HandleOption(const char * progName, OptionSet * optS return true; } +#endif // defined(CHIP_WITH_NLFAULTINJECTION) && CHIP_WITH_NLFAULTINJECTION diff --git a/src/platform/silabs/SilabsConfig.h b/src/platform/silabs/SilabsConfig.h index 0f820f6fb8268e..3bd5abfba1b8f3 100644 --- a/src/platform/silabs/SilabsConfig.h +++ b/src/platform/silabs/SilabsConfig.h @@ -93,34 +93,35 @@ class SilabsConfig // Key definitions for well-known configuration values. // Factory config keys - static constexpr Key kConfigKey_SerialNum = SilabsConfigKey(kMatterFactory_KeyBase, 0x00); - static constexpr Key kConfigKey_MfrDeviceId = SilabsConfigKey(kMatterFactory_KeyBase, 0x01); - static constexpr Key kConfigKey_MfrDeviceCert = SilabsConfigKey(kMatterFactory_KeyBase, 0x02); - static constexpr Key kConfigKey_MfrDevicePrivateKey = SilabsConfigKey(kMatterFactory_KeyBase, 0x03); - static constexpr Key kConfigKey_ManufacturingDate = SilabsConfigKey(kMatterFactory_KeyBase, 0x04); - static constexpr Key kConfigKey_SetupPayloadBitSet = SilabsConfigKey(kMatterFactory_KeyBase, 0x05); - static constexpr Key kConfigKey_MfrDeviceICACerts = SilabsConfigKey(kMatterFactory_KeyBase, 0x06); - static constexpr Key kConfigKey_SetupDiscriminator = SilabsConfigKey(kMatterFactory_KeyBase, 0x07); - static constexpr Key kConfigKey_Spake2pIterationCount = SilabsConfigKey(kMatterFactory_KeyBase, 0x08); - static constexpr Key kConfigKey_Spake2pSalt = SilabsConfigKey(kMatterFactory_KeyBase, 0x09); - static constexpr Key kConfigKey_Spake2pVerifier = SilabsConfigKey(kMatterFactory_KeyBase, 0x0A); - static constexpr Key kConfigKey_ProductId = SilabsConfigKey(kMatterFactory_KeyBase, 0x0B); - static constexpr Key kConfigKey_VendorId = SilabsConfigKey(kMatterFactory_KeyBase, 0x0C); - static constexpr Key kConfigKey_VendorName = SilabsConfigKey(kMatterFactory_KeyBase, 0x0D); - static constexpr Key kConfigKey_ProductName = SilabsConfigKey(kMatterFactory_KeyBase, 0x0E); - static constexpr Key kConfigKey_HardwareVersionString = SilabsConfigKey(kMatterFactory_KeyBase, 0x0F); - static constexpr Key KConfigKey_ProductLabel = SilabsConfigKey(kMatterFactory_KeyBase, 0x10); - static constexpr Key kConfigKey_ProductURL = SilabsConfigKey(kMatterFactory_KeyBase, 0x11); - static constexpr Key kConfigKey_PartNumber = SilabsConfigKey(kMatterFactory_KeyBase, 0x12); - static constexpr Key kConfigKey_UniqueId = SilabsConfigKey(kMatterFactory_KeyBase, 0x1F); - static constexpr Key kConfigKey_Creds_KeyId = SilabsConfigKey(kMatterFactory_KeyBase, 0x20); - static constexpr Key kConfigKey_Creds_Base_Addr = SilabsConfigKey(kMatterFactory_KeyBase, 0x21); - static constexpr Key kConfigKey_Creds_DAC_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x22); - static constexpr Key kConfigKey_Creds_DAC_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x23); - static constexpr Key kConfigKey_Creds_PAI_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x24); - static constexpr Key kConfigKey_Creds_PAI_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x25); - static constexpr Key kConfigKey_Creds_CD_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x26); - static constexpr Key kConfigKey_Creds_CD_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x27); + static constexpr Key kConfigKey_SerialNum = SilabsConfigKey(kMatterFactory_KeyBase, 0x00); + static constexpr Key kConfigKey_MfrDeviceId = SilabsConfigKey(kMatterFactory_KeyBase, 0x01); + static constexpr Key kConfigKey_MfrDeviceCert = SilabsConfigKey(kMatterFactory_KeyBase, 0x02); + static constexpr Key kConfigKey_MfrDevicePrivateKey = SilabsConfigKey(kMatterFactory_KeyBase, 0x03); + static constexpr Key kConfigKey_ManufacturingDate = SilabsConfigKey(kMatterFactory_KeyBase, 0x04); + static constexpr Key kConfigKey_SetupPayloadBitSet = SilabsConfigKey(kMatterFactory_KeyBase, 0x05); + static constexpr Key kConfigKey_MfrDeviceICACerts = SilabsConfigKey(kMatterFactory_KeyBase, 0x06); + static constexpr Key kConfigKey_SetupDiscriminator = SilabsConfigKey(kMatterFactory_KeyBase, 0x07); + static constexpr Key kConfigKey_Spake2pIterationCount = SilabsConfigKey(kMatterFactory_KeyBase, 0x08); + static constexpr Key kConfigKey_Spake2pSalt = SilabsConfigKey(kMatterFactory_KeyBase, 0x09); + static constexpr Key kConfigKey_Spake2pVerifier = SilabsConfigKey(kMatterFactory_KeyBase, 0x0A); + static constexpr Key kConfigKey_ProductId = SilabsConfigKey(kMatterFactory_KeyBase, 0x0B); + static constexpr Key kConfigKey_VendorId = SilabsConfigKey(kMatterFactory_KeyBase, 0x0C); + static constexpr Key kConfigKey_VendorName = SilabsConfigKey(kMatterFactory_KeyBase, 0x0D); + static constexpr Key kConfigKey_ProductName = SilabsConfigKey(kMatterFactory_KeyBase, 0x0E); + static constexpr Key kConfigKey_HardwareVersionString = SilabsConfigKey(kMatterFactory_KeyBase, 0x0F); + static constexpr Key KConfigKey_ProductLabel = SilabsConfigKey(kMatterFactory_KeyBase, 0x10); + static constexpr Key kConfigKey_ProductURL = SilabsConfigKey(kMatterFactory_KeyBase, 0x11); + static constexpr Key kConfigKey_PartNumber = SilabsConfigKey(kMatterFactory_KeyBase, 0x12); + static constexpr Key kConfigKey_UniqueId = SilabsConfigKey(kMatterFactory_KeyBase, 0x1F); + static constexpr Key kConfigKey_Creds_KeyId = SilabsConfigKey(kMatterFactory_KeyBase, 0x20); + static constexpr Key kConfigKey_Creds_Base_Addr = SilabsConfigKey(kMatterFactory_KeyBase, 0x21); + static constexpr Key kConfigKey_Creds_DAC_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x22); + static constexpr Key kConfigKey_Creds_DAC_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x23); + static constexpr Key kConfigKey_Creds_PAI_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x24); + static constexpr Key kConfigKey_Creds_PAI_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x25); + static constexpr Key kConfigKey_Creds_CD_Offset = SilabsConfigKey(kMatterFactory_KeyBase, 0x26); + static constexpr Key kConfigKey_Creds_CD_Size = SilabsConfigKey(kMatterFactory_KeyBase, 0x27); + static constexpr Key kConfigKey_Test_Event_Trigger_Key = SilabsConfigKey(kMatterFactory_KeyBase, 0x28); // Matter Config Keys static constexpr Key kConfigKey_ServiceConfig = SilabsConfigKey(kMatterConfig_KeyBase, 0x01); static constexpr Key kConfigKey_PairedAccountId = SilabsConfigKey(kMatterConfig_KeyBase, 0x02);