diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 2a1ead454e3ac4..0b195ba9a244e5 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -632,6 +632,7 @@ hci hciattach hciconfig hdlc +HEPA HKDF HMAC hoc @@ -641,7 +642,6 @@ HomePods hostapd hostname href -HEPA HTTPS HW hwadr @@ -652,6 +652,7 @@ IasWd iaszone ibb ICA +ICD iCloud ICMP IDF diff --git a/examples/light-switch-app/silabs/README.md b/examples/light-switch-app/silabs/README.md index 9ca79a80e2bd41..197a2ae7ea424c 100644 --- a/examples/light-switch-app/silabs/README.md +++ b/examples/light-switch-app/silabs/README.md @@ -131,9 +131,9 @@ Silicon Labs platform. ./scripts/examples/gn_silabs_example.sh examples/light-switch-app/silabs/efr32/ out/light-switch-app BRD4187C chip_build_libshell=true -* Build the example as Sleepy End Device (SED) +* Build the example as Intermittently Connected Device (ICD) - $ ./scripts/examples/gn_silabs_example.sh ./examples/light-switch-app/silabs/efr32/ ./out/light-switch-app_SED BRD4187C --sed + $ ./scripts/examples/gn_silabs_example.sh ./examples/light-switch-app/silabs/efr32/ ./out/light-switch-app_ICD BRD4187C --icd or use gn as previously mentioned but adding the following arguments: diff --git a/examples/lighting-app/silabs/README.md b/examples/lighting-app/silabs/README.md index 4d7c873aeff09a..4834ef56a9ac1c 100644 --- a/examples/lighting-app/silabs/README.md +++ b/examples/lighting-app/silabs/README.md @@ -123,9 +123,9 @@ Silicon Labs platform. $ cd ~/connectedhomeip/examples/lighting-app/silabs/efr32 $ rm -rf out/ -* Build the example as Sleepy End Device (SED) +* Build the example as Intermittently Connected Device (ICD) - $ ./scripts/examples/gn_silabs_example.sh ./examples/lighting-app/silabs/efr32/ ./out/lighting-app_SED BRD4187C --sed + $ ./scripts/examples/gn_silabs_example.sh ./examples/lighting-app/silabs/efr32/ ./out/lighting-app_ICD BRD4187C --icd or use gn as previously mentioned but adding the following arguments: diff --git a/examples/lock-app/esp32/main/CMakeLists.txt b/examples/lock-app/esp32/main/CMakeLists.txt index dc5fa500b03434..a6aded6af0065c 100644 --- a/examples/lock-app/esp32/main/CMakeLists.txt +++ b/examples/lock-app/esp32/main/CMakeLists.txt @@ -50,6 +50,7 @@ idf_component_register(INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information" @@ -74,6 +75,7 @@ idf_component_register(INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/icd-management-server" PRIV_REQUIRES bt chip QRCode nvs_flash driver) add_dependencies(${COMPONENT_LIB} app-codegen) @@ -162,6 +164,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information" @@ -189,7 +192,8 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/door-lock-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/lock" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/icd-management-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/lock" PRIV_REQUIRES chip QRCode bt nvs_flash driver) add_dependencies(${COMPONENT_LIB} app-codegen) diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index 1fda0929962ee8..61dbeb11e226af 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -1662,6 +1662,30 @@ server cluster UserLabel = 65 { readonly attribute int16u clusterRevision = 65533; } +/** Allows servers to ensure that listed clients are notified when a server is available for communication. */ +server cluster IcdManagement = 70 { + bitmap Feature : BITMAP32 { + kCheckInProtocolSupport = 0x1; + } + + fabric_scoped struct MonitoringRegistrationStruct { + fabric_sensitive node_id checkInNodeID = 1; + fabric_sensitive int64u monitoredSubject = 2; + fabric_sensitive octet_string<16> key = 3; + fabric_idx fabricIndex = 254; + } + + readonly attribute int32u idleModeInterval = 0; + readonly attribute int32u activeModeInterval = 1; + readonly attribute int16u activeModeThreshold = 2; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** An interface to a generic way to secure a door */ server cluster DoorLock = 257 { enum AlarmCodeEnum : ENUM8 { @@ -2541,6 +2565,14 @@ endpoint 0 { ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; } + + server cluster IcdManagement { + callback attribute idleModeInterval default = 500; + callback attribute activeModeInterval default = 300; + callback attribute activeModeThreshold default = 300; + ram attribute featureMap default = 0x0000; + ram attribute clusterRevision default = 1; + } } endpoint 1 { device type doorlock = 10, version 1; diff --git a/examples/lock-app/lock-common/lock-app.zap b/examples/lock-app/lock-common/lock-app.zap index 3537aa2fb387b7..c097b1b20df20b 100644 --- a/examples/lock-app/lock-common/lock-app.zap +++ b/examples/lock-app/lock-common/lock-app.zap @@ -5322,6 +5322,260 @@ } ] }, + { + "name": "ICD Management", + "code": 70, + "mfgCode": null, + "define": "ICD_MANAGEMENT_CLUSTER", + "side": "client", + "enabled": 0, + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "ICD Management", + "code": 70, + "mfgCode": null, + "define": "ICD_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "RegisterClientResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "IdleModeInterval", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "500", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeInterval", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "300", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "300", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RegisteredClients", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ICDCounter", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientsSupportedPerFabric", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Occupancy Sensing", "code": 1030, diff --git a/examples/lock-app/silabs/README.md b/examples/lock-app/silabs/README.md index 2d6cb8722a8dce..67fb889b41eb7e 100644 --- a/examples/lock-app/silabs/README.md +++ b/examples/lock-app/silabs/README.md @@ -130,10 +130,10 @@ Mac OS X $ rm -rf out/ ``` -* Build the example as Sleepy End Device (SED) +* Build the example as Intermittently Connected Device (ICD) ``` - $ ./scripts/examples/gn_silabs_example.sh ./examples/lock-app/silabs/efr32/ ./out/lock-app_SED BRD4187C --sed + $ ./scripts/examples/gn_silabs_example.sh ./examples/lock-app/silabs/efr32/ ./out/lock-app_ICD BRD4187C --icd ``` or use gn as previously mentioned but adding the following arguments: diff --git a/examples/lock-app/silabs/openthread.gn b/examples/lock-app/silabs/openthread.gn index b05216fc9d7eae..27aa6c766a17e6 100644 --- a/examples/lock-app/silabs/openthread.gn +++ b/examples/lock-app/silabs/openthread.gn @@ -23,7 +23,7 @@ check_system_includes = true default_args = { target_cpu = "arm" target_os = "freertos" - chip_openthread_ftd = true + chip_openthread_ftd = false import("//openthread.gni") } diff --git a/examples/lock-app/silabs/openthread.gni b/examples/lock-app/silabs/openthread.gni index 9d7fbf28634308..570d5e804f6c4d 100644 --- a/examples/lock-app/silabs/openthread.gni +++ b/examples/lock-app/silabs/openthread.gni @@ -24,3 +24,17 @@ chip_enable_openthread = true openthread_external_platform = "${chip_root}/third_party/openthread/platforms/efr32:libopenthread-efr32" + +# ICD Default configurations +chip_enable_icd_server = true +chip_subscription_timeout_resumption = false +sl_use_subscription_synching = true + +# Openthread Configuration flags +sl_ot_idle_interval_ms = 5000 # 5s Idle Intervals +sl_ot_active_interval_ms = 500 # 500ms Active Intervals + +# ICD Matter Configuration flags +sl_idle_mode_interval_ms = 600000 # 10min Idle Mode Interval +sl_active_mode_interval_ms = 10000 # 10s Active Mode Interval +sl_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold diff --git a/examples/platform/silabs/ICDSubscriptionCallback.cpp b/examples/platform/silabs/ICDSubscriptionCallback.cpp deleted file mode 100644 index eba28968085d60..00000000000000 --- a/examples/platform/silabs/ICDSubscriptionCallback.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ICDSubscriptionCallback.h" -#include - -CHIP_ERROR ICDSubscriptionCallback::OnSubscriptionRequested(chip::app::ReadHandler & aReadHandler, - chip::Transport::SecureSession & aSecureSession) -{ - using namespace chip::System::Clock; - - Seconds32 interval_s32 = std::chrono::duration_cast(CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL); - - if (interval_s32 > Seconds16::max()) - { - interval_s32 = Seconds16::max(); - } - uint32_t decidedMaxInterval = interval_s32.count(); - - uint16_t requestedMinInterval = 0; - uint16_t requestedMaxInterval = 0; - aReadHandler.GetReportingIntervals(requestedMinInterval, requestedMaxInterval); - - // If requestedMinInterval is greater than IdleTimeInterval, select next wake up time as max interval - if (requestedMinInterval > decidedMaxInterval) - { - uint16_t ratio = requestedMinInterval / decidedMaxInterval; - if (requestedMinInterval % decidedMaxInterval) - { - ratio++; - } - - decidedMaxInterval *= ratio; - } - - // Verify that decidedMaxInterval is an acceptable value - if (decidedMaxInterval > Seconds16::max().count()) - { - decidedMaxInterval = Seconds16::max().count(); - } - - // Verify that the decidedMaxInterval respects MAX(SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT, MaxIntervalCeiling) - uint16_t maximumMaxInterval = std::max(kSubscriptionMaxIntervalPublisherLimit, requestedMaxInterval); - if (decidedMaxInterval > maximumMaxInterval) - { - decidedMaxInterval = maximumMaxInterval; - } - - return aReadHandler.SetMaxReportingInterval(decidedMaxInterval); -} diff --git a/examples/platform/silabs/ICDSubscriptionCallback.h b/examples/platform/silabs/ICDSubscriptionCallback.h deleted file mode 100644 index c9f77e6df2a3c6..00000000000000 --- a/examples/platform/silabs/ICDSubscriptionCallback.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include - -/** - * @brief The goal of the ICDSubscriptionCallback class is to negotiate the max interval subscription to match the idle interval of - * the IC device. When a subscription is requested, the device will change the requested max interval to match its idle time - * interval through the OnSubscriptionRequested function. - */ -class ICDSubscriptionCallback : public chip::app::ReadHandler::ApplicationCallback -{ - /** - * @brief Function called when a subscription is requested. - * An ICD will use this function to negotiate the subscription max interval to match its idle time interval - */ - CHIP_ERROR OnSubscriptionRequested(chip::app::ReadHandler & aReadHandler, - chip::Transport::SecureSession & aSecureSession) override; -}; diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index 9c2253233f79e7..836e2a777c3699 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -58,10 +58,6 @@ static chip::DeviceLayer::Internal::Efr32PsaOperationalKeystore gOperationalKeys #include #include -#ifdef CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS -ICDSubscriptionCallback SilabsMatterConfig::mICDSubscriptionHandler; -#endif // CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS - #if CHIP_ENABLE_OPENTHREAD #include #include @@ -222,11 +218,6 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) // Init Matter Server and Start Event Loop err = chip::Server::GetInstance().Init(initParams); -#ifdef CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS - // Register ICD subscription callback to match subscription max intervals to its idle time interval - chip::app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(&mICDSubscriptionHandler); -#endif // CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS - chip::DeviceLayer::PlatformMgr().UnlockChipStack(); ReturnErrorOnFailure(err); diff --git a/examples/platform/silabs/MatterConfig.h b/examples/platform/silabs/MatterConfig.h index 4983abac4189b1..2c565f7caa7321 100644 --- a/examples/platform/silabs/MatterConfig.h +++ b/examples/platform/silabs/MatterConfig.h @@ -22,10 +22,6 @@ #include #include -#ifdef CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS -#include "ICDSubscriptionCallback.h" -#endif // CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS - class SilabsMatterConfig { public: @@ -36,8 +32,4 @@ class SilabsMatterConfig static void InitWiFi(void); static void ConnectivityEventCallback(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); static void InitOTARequestorHandler(chip::System::Layer * systemLayer, void * appState); - -#ifdef CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS - static ICDSubscriptionCallback mICDSubscriptionHandler; -#endif // CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS }; diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index 3a965cb01185b1..5bb628ad4f99e6 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -40,9 +40,6 @@ declare_args() { #default Wifi Password chip_default_wifi_psk = "" - # Use default handler to negotiate subscription max interval - chip_config_use_icd_subscription_callbacks = chip_enable_icd_server - # Enable TestEventTrigger in GeneralDiagnostics cluster silabs_test_event_trigger_enabled = false @@ -197,21 +194,6 @@ source_set("silabs-factory-data-provider") { ] } -config("ICD-subscription-callback-config") { - defines = [ "CHIP_CONFIG_USE_ICD_SUBSCRIPTION_CALLBACKS=1" ] -} - -source_set("efr32-ICD-subscription-callback") { - sources = [ - "${silabs_common_plat_dir}/ICDSubscriptionCallback.cpp", - "${silabs_common_plat_dir}/ICDSubscriptionCallback.h", - ] - - public_deps = [ "${chip_root}/src/app:app" ] - - public_configs = [ ":ICD-subscription-callback-config" ] -} - config("efr32-common-config") { defines = [ "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_sec}" ] @@ -356,10 +338,6 @@ source_set("efr32-common") { public_deps += [ ":silabs-factory-data-provider" ] } - if (chip_config_use_icd_subscription_callbacks) { - public_deps += [ ":efr32-ICD-subscription-callback" ] - } - if (silabs_test_event_trigger_enabled) { sources += [ "${silabs_common_plat_dir}/SilabsTestEventTriggerDelegate.cpp" ] diff --git a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h index 90ecfcbf712718..339142894f5e61 100644 --- a/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h +++ b/examples/platform/silabs/efr32/project_include/OpenThreadConfig.h @@ -36,8 +36,7 @@ // Enable use of external heap allocator (calloc/free) for OpenThread. #define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1 -#if CHIP_CONFIG_ENABLE_ICD_SERVER - +#ifdef SL_ICD_ENABLED #define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 0 // In seconds @@ -46,7 +45,7 @@ // Timeout after 2 missed checkin or 4 mins if sleep interval is too short. #define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT ((SL_MLE_TIMEOUT_s < 120) ? 240 : ((SL_MLE_TIMEOUT_s * 2) + 1)) -#endif // CHIP_CONFIG_ENABLE_ICD_SERVER +#endif // SL_ICD_ENABLED /****Uncomment below section for OpenThread Debug logs*/ // #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG diff --git a/examples/pump-app/silabs/README.md b/examples/pump-app/silabs/README.md index 51306b7dd24ea4..f2fc51840965a8 100644 --- a/examples/pump-app/silabs/README.md +++ b/examples/pump-app/silabs/README.md @@ -122,9 +122,9 @@ Labs platform. $ cd ~/connectedhomeip/examples/pump-app/silabs/efr32 $ rm -rf out/ -* Build the example as Sleepy End Device (SED) +* Build the example as Intermittently Connected Device (ICD) - $ ./scripts/examples/gn_silabs_example.sh ./examples/pump-app/silabs/efr32/ ./out/pump-app_SED BRD4187C --sed + $ ./scripts/examples/gn_silabs_example.sh ./examples/pump-app/silabs/efr32/ ./out/pump-app_ICD BRD4187C --icd or use gn as previously mentioned but adding the following arguments: diff --git a/examples/smoke-co-alarm-app/silabs/README.md b/examples/smoke-co-alarm-app/silabs/README.md index 2aec36eb0cb6c9..fc858977604897 100644 --- a/examples/smoke-co-alarm-app/silabs/README.md +++ b/examples/smoke-co-alarm-app/silabs/README.md @@ -126,10 +126,10 @@ Silicon Labs platform. $ rm -rf out/ ``` -* Build the example as Sleepy End Device (SED) +* Build the example as Intermittently Connected Device (ICD) ``` - $ ./scripts/examples/gn_silabs_example.sh ./examples/smoke-co-alarm-app/silabs ./out/smoke-co-alarm-app_SED BRD4187C --sed + $ ./scripts/examples/gn_silabs_example.sh ./examples/smoke-co-alarm-app/silabs ./out/smoke-co-alarm-app_ICD BRD4187C --icd ``` or use gn as previously mentioned but adding the following arguments: diff --git a/examples/thermostat/silabs/README.md b/examples/thermostat/silabs/README.md index 6dc53dc6b2ca2d..cc76d71c1fc083 100644 --- a/examples/thermostat/silabs/README.md +++ b/examples/thermostat/silabs/README.md @@ -131,9 +131,9 @@ Silicon Labs platform. ./scripts/examples/gn_silabs_example.sh examples/thermostat/silabs/efr32/ out/thermostat-app BRD4187C chip_build_libshell=true -* Build the example as Sleepy End Device (SED) +* Build the example as Intermittently Connected Device (ICD) - $ ./scripts/examples/gn_silabs_example.sh ./examples/thermostat/silabs/efr32/ ./out/thermostat-app_SED BRD4187C --sed + $ ./scripts/examples/gn_silabs_example.sh ./examples/thermostat/silabs/efr32/ ./out/thermostat-app_ICD BRD4187C --icd or use gn as previously mentioned but adding the following arguments: diff --git a/examples/window-app/silabs/README.md b/examples/window-app/silabs/README.md index 6152acb87a5503..a7555003b8dc93 100644 --- a/examples/window-app/silabs/README.md +++ b/examples/window-app/silabs/README.md @@ -120,9 +120,9 @@ Silicon Labs platform. $ cd ~/connectedhomeip/examples/window-app/silabs/efr32 $ rm -rf out/ -* Build the example as Sleepy End Device (SED) +* Build the example as Intermittently Connected Device (ICD) - $ ./scripts/examples/gn_silabs_example.sh ./examples/window-app/silabs/efr32/ ./out/window-app_SED BRD4187C --sed + $ ./scripts/examples/gn_silabs_example.sh ./examples/window-app/silabs/efr32/ ./out/window-app_ICD BRD4187C --icd or use gn as previously mentioned but adding the following arguments: diff --git a/scripts/examples/gn_silabs_example.sh b/scripts/examples/gn_silabs_example.sh index f966cebed9dd62..90adc9f9b9ed25 100755 --- a/scripts/examples/gn_silabs_example.sh +++ b/scripts/examples/gn_silabs_example.sh @@ -114,12 +114,12 @@ if [ "$#" == "0" ]; then siwx917_commissionable_data Build with the commissionable data given in DeviceConfig.h (only for SiWx917) Presets - --sed - enable sleepy end device, set thread mtd + --icd + enable ICD features, set thread mtd For minimum consumption, add --low-power --low-power disables all power consuming features for the most power efficient build - This flag is to be used with --sed + This flag is to be used with --icd --wifi build wifi example variant for given exansion board --additional_data_advertising @@ -181,7 +181,7 @@ else shift shift ;; - --sed) + --icd) optArgs+="chip_enable_icd_server=true chip_openthread_ftd=false " shift ;; diff --git a/src/platform/silabs/CHIPDevicePlatformConfig.h b/src/platform/silabs/CHIPDevicePlatformConfig.h index 7ea977bf54aa88..c51a923367ffaf 100644 --- a/src/platform/silabs/CHIPDevicePlatformConfig.h +++ b/src/platform/silabs/CHIPDevicePlatformConfig.h @@ -138,18 +138,6 @@ #define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE (6 * 1024) #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE -#ifndef CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL -#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_IDLE_INTERVAL) -#endif // CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL - -#ifndef CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL -#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_ACTIVE_INTERVAL) -#endif // CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL - -#ifndef CHIP_DEVICE_CONFIG_SED_ACTIVE_THRESHOLD -#define CHIP_DEVICE_CONFIG_SED_ACTIVE_THRESHOLD chip::System::Clock::Milliseconds32(SL_ACTIVE_MODE_THRESHOLD) -#endif // CHIP_DEVICE_CONFIG_SED_ACTIVE_THRESHOLD - #ifndef CHIP_DEVICE_CONFIG_THREAD_TASK_STACK_SIZE #if defined(EFR32MG21) #define CHIP_DEVICE_CONFIG_THREAD_TASK_STACK_SIZE (2 * 1024) @@ -167,3 +155,15 @@ #endif // CHIP_DEVICE_CONFIG_BLE_APP_TASK_NAME #define CHIP_DEVICE_CONFIG_MAX_EVENT_QUEUE_SIZE 25 + +/* + ICD Configuration Defines +*/ + +#ifndef CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL +#define CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_IDLE_INTERVAL) +#endif // CHIP_DEVICE_CONFIG_ICD_SLOW_POLL_INTERVAL + +#ifndef CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL +#define CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL chip::System::Clock::Milliseconds32(SL_OT_ACTIVE_INTERVAL) +#endif // CHIP_DEVICE_CONFIG_ICD_FAST_POLL_INTERVAL diff --git a/src/platform/silabs/CHIPPlatformConfig.h b/src/platform/silabs/CHIPPlatformConfig.h index ec36bc8f46eae2..710cb7c08d72c7 100644 --- a/src/platform/silabs/CHIPPlatformConfig.h +++ b/src/platform/silabs/CHIPPlatformConfig.h @@ -84,6 +84,26 @@ #define CHIP_CONFIG_MAX_FABRICS 5 // 4 fabrics + 1 for rotation slack #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER + +#ifndef CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL +#define CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL SL_IDLE_MODE_INTERVAL +#endif // CHIP_CONFIG_ICD_IDLE_MODE_INTERVAL + +#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL +#define CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL SL_ACTIVE_MODE_INTERVAL +#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_INTERVAL + +#ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD +#define CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD SL_ACTIVE_MODE_THRESHOLD +#endif // CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD + +#ifndef CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC +#define CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC +#endif // CHIP_CONFIG_ICD_CLIENTS_SUPPORTED_PER_FABRIC + +#endif + // ==================== FreeRTOS Configuration Overrides ==================== #ifndef CHIP_CONFIG_FREERTOS_USE_STATIC_TASK #define CHIP_CONFIG_FREERTOS_USE_STATIC_TASK 1 diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 579cc1df7ede98..9c64cd951cd5d9 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -46,10 +46,16 @@ declare_args() { # Enable Segger System View use_system_view = false - # ICD Configuration flags - sl_ot_idle_interval_ms = 30000 # 30s Idle Intervals - sl_ot_active_interval_ms = 200 # 500ms Active Intervals - sl_active_mode_threshold = 1000 # 1s Active mode threshold + # ICD Openthread Configuration flags + sl_ot_idle_interval_ms = 15000 # 15s Idle Intervals + sl_ot_active_interval_ms = 200 # 200ms Active Intervals + + # ICD Matter Configuration flags + sl_idle_mode_interval_ms = 600000 # 10min Idle Mode Interval + sl_active_mode_interval_ms = 1000 # 1s Active Mode Interval + sl_active_mode_threshold_ms = 500 # 500ms Active Mode Threshold + sl_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric + sl_use_subscription_synching = false silabs_log_enabled = true @@ -329,11 +335,21 @@ template("efr32_sdk") { if (chip_enable_icd_server) { defines += [ - "SL_OT_IDLE_INTERVAL=${sl_ot_idle_interval_ms}", - "SL_OT_ACTIVE_INTERVAL=${sl_ot_active_interval_ms}", - "SL_ACTIVE_MODE_THRESHOLD=${sl_active_mode_threshold}", + "SL_ICD_ENABLED=1", + "SL_ACTIVE_MODE_THRESHOLD=${sl_active_mode_threshold_ms}", + "SL_ACTIVE_MODE_INTERVAL=${sl_active_mode_interval_ms}", + "SL_IDLE_MODE_INTERVAL=${sl_idle_mode_interval_ms}", + "SL_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${sl_icd_supported_clients_per_fabric}", ] + if (defined(invoker.chip_enable_openthread) && + invoker.chip_enable_openthread) { + defines += [ + "SL_OT_IDLE_INTERVAL=${sl_ot_idle_interval_ms}", + "SL_OT_ACTIVE_INTERVAL=${sl_ot_active_interval_ms}", + ] + } + if (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) { defines += [ # Used for wifi devices to get packet details @@ -374,9 +390,15 @@ template("efr32_sdk") { "${efr32_sdk_root}/hardware/driver/memlcd/inc/memlcd_usart", ] } + if (invoker.enable_dic) { _include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ] } + + if (sl_use_subscription_synching) { + defines += [ "CHIP_CONFIG_SYNCHRONOUS_REPORTS_ENABLED=1" ] + } + if (silabs_family == "efr32mg12") { _include_dirs += [ "${efr32_sdk_root}/platform/Device/SiliconLabs/EFR32MG12P/Include",