diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index f1be1a194a1b46..62231116bb92c1 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -65,7 +65,7 @@ jobs: "clang") GN_ARGS='is_clang=true';; "mbedtls") GN_ARGS='chip_crypto="mbedtls"';; "rotating_device_id") GN_ARGS='chip_crypto="boringssl" chip_enable_rotating_device_id=true';; - "icd") GN_ARGS='chip_enable_icd_server=true';; + "icd") GN_ARGS='chip_enable_icd_server=true chip_enable_icd_lit=true';; *) ;; esac diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 672bf5834da196..9b81d7cf30282e 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -139,6 +139,12 @@ matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_EN matter_add_gn_arg_bool ("chip_enable_factory_data" CONFIG_CHIP_FACTORY_DATA) matter_add_gn_arg_bool ("chip_enable_read_client" CONFIG_CHIP_ENABLE_READ_CLIENT) +if (CONFIG_CHIP_ENABLE_ICD_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT) +endif() + if (CONFIG_CHIP_FACTORY_DATA OR CONFIG_CHIP_FACTORY_DATA_CUSTOM_BACKEND) matter_add_gn_arg_bool("chip_use_transitional_commissionable_data_provider" FALSE) matter_add_gn_arg_bool("chip_use_transitional_device_instance_info_provider" FALSE) diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index 418dbc07e0ba0b..7862d5f8b95d8e 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -104,6 +104,12 @@ matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_ matter_add_gn_arg_bool ("chip_automation_logging" FALSE) matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT) +if (CONFIG_CHIP_ENABLE_ICD_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_lit" CONFIG_CHIP_ICD_LIT_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_checkin" CONFIG_CHIP_ICD_CHECK_IN_SUPPORT) + matter_add_gn_arg_bool ("chip_enable_icd_user_active_mode_trigger" CONFIG_CHIP_ICD_UAT_SUPPORT) +endif() + if (CONFIG_CHIP_FACTORY_DATA) matter_add_gn_arg_bool ("chip_use_transitional_commissionable_data_provider" "false") matter_add_gn_arg_bool ("chip_enable_factory_data" "true") diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index 8df6c418aa42e3..ad36a663b5fd1f 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -334,6 +334,7 @@ if CHIP_ENABLE_ICD_SUPPORT config CHIP_ICD_SLOW_POLL_INTERVAL int "Intermittently Connected Device slow polling interval (ms)" + default 30000 if CHIP_ICD_LIT_SUPPORT default 1000 help Provides the Intermittently Connected Device slow polling interval in milliseconds while the @@ -347,33 +348,57 @@ config CHIP_ICD_FAST_POLLING_INTERVAL Provides the Intermittently Connected Device fast polling interval in milliseconds while the device is in the active mode. It determines the fastest frequency at which the device will be able to receive the messages in the active mode. The CHIP_ICD_FAST_POLLING_INTERVAL shall be smaller than - CHIP_ICD_ACTIVE_MODE_INTERVAL. + CHIP_ICD_ACTIVE_MODE_DURATION. -config CHIP_ICD_IDLE_MODE_INTERVAL - int "Intermittently Connected Device idle mode interval (s)" +config CHIP_ICD_IDLE_MODE_DURATION + int "Intermittently Connected Device idle mode duration (s)" + default 300 if CHIP_ICD_LIT_SUPPORT default 120 help - Provides the Intermittently Connected Device idle mode interval in seconds. + Provides the Intermittently Connected Device idle mode duration in seconds. It determines the maximum amount of time the device can stay in the idle mode, which means the device may be unreachable and not able to receive messages. -config CHIP_ICD_ACTIVE_MODE_INTERVAL - int "Intermittently Connected Device active mode interval (ms)" +config CHIP_ICD_ACTIVE_MODE_DURATION + int "Intermittently Connected Device active mode duration (ms)" default 300 help - Provides the Intermittently Connected Device active mode interval in milliseconds. + Provides the Intermittently Connected Device active mode duration in milliseconds. It determines the minimum amount of time the device shall stay in the active mode. config CHIP_ICD_ACTIVE_MODE_THRESHOLD int "Intermittently Connected Device active mode threshold (ms)" + default 5000 if CHIP_ICD_LIT_SUPPORT default 300 help Provides the Intermittently Connected Device active mode threshold in milliseconds. It determines the minimum amount of time the device shall stay in the active mode after the network activity. + For LIT devices it cannot be set to a value smaller than 5000 ms. + +config CHIP_ICD_LIT_SUPPORT + bool "Intermittenly Connected Device Long Idle Time support" + imply CHIP_ICD_CHECK_IN_SUPPORT + imply CHIP_ICD_UAT_SUPPORT + help + Enables the Intermittently Connected Device Long Idle Time support in Matter. + It also implies the ICD Check-In and UAT features support that are mandatory for LIT device. + +config CHIP_ICD_CHECK_IN_SUPPORT + bool "Intermittenly Connected Device Check-In protocol support" + help + Enables the Check-In protocol support in Matter. It allows an ICD device to notify the registered + ICD clients that it is available for communication. + +config CHIP_ICD_UAT_SUPPORT + bool "Intermittenly Connected Device User Active Mode Trigger support" + help + Enables the User Active Mode Trigger (UAT) support in Matter. It allows the User to use application specific + means (e.g. button press) to trigger an ICD device to enter the active mode and become responsive. config CHIP_ICD_CLIENTS_PER_FABRIC int "Intermittently Connected Device number of clients per fabric" default 2 + depends on CHIP_ICD_CHECK_IN_SUPPORT help Provides the Intermittently Connected Device number of clients per fabric. It determines the maximum number of clients per fabric that can be registered to receive notification from a device if their subscription is lost. diff --git a/examples/light-switch-app/qpg/args.gni b/examples/light-switch-app/qpg/args.gni index d5dcdfe217c635..64db0987b3d7d6 100644 --- a/examples/light-switch-app/qpg/args.gni +++ b/examples/light-switch-app/qpg/args.gni @@ -23,6 +23,7 @@ chip_enable_ota_requestor = true chip_openthread_ftd = false enable_sleepy_device = true chip_enable_icd_server = true +chip_enable_icd_lit = true # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder diff --git a/examples/lit-icd-app/linux/args.gni b/examples/lit-icd-app/linux/args.gni index c1421b0c721f9b..09ea58ef2a51d5 100644 --- a/examples/lit-icd-app/linux/args.gni +++ b/examples/lit-icd-app/linux/args.gni @@ -30,3 +30,4 @@ matter_enable_tracing_support = true chip_enable_icd_server = true chip_subscription_timeout_resumption = false chip_icd_report_on_active_mode = true +chip_enable_icd_lit = true 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 630cb65b53f45d..d8bdeba3f69d49 100644 --- a/examples/lit-icd-app/silabs/build_for_wifi_args.gni +++ b/examples/lit-icd-app/silabs/build_for_wifi_args.gni @@ -28,6 +28,7 @@ chip_enable_icd_server = true chip_subscription_timeout_resumption = false sl_use_subscription_synching = true icd_enforce_sit_slow_poll_limit = true +chip_enable_icd_lit = true # ICD Matter Configuration flags sl_idle_mode_interval_s = 3600 # 60min Idle Mode Interval diff --git a/examples/lit-icd-app/silabs/openthread.gni b/examples/lit-icd-app/silabs/openthread.gni index 69bd7b88e6bdc6..bd93778a53016f 100644 --- a/examples/lit-icd-app/silabs/openthread.gni +++ b/examples/lit-icd-app/silabs/openthread.gni @@ -32,6 +32,7 @@ chip_subscription_timeout_resumption = false sl_use_subscription_synching = 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 diff --git a/examples/smoke-co-alarm-app/telink/prj.conf b/examples/smoke-co-alarm-app/telink/prj.conf index 36f00385d93d53..3a6c279a6cb9dd 100755 --- a/examples/smoke-co-alarm-app/telink/prj.conf +++ b/examples/smoke-co-alarm-app/telink/prj.conf @@ -50,3 +50,5 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n # Enable Power Management CONFIG_PM=y + +CONFIG_CHIP_ICD_LIT_SUPPORT=y diff --git a/src/app/clusters/icd-management-server/icd-management-server.cpp b/src/app/clusters/icd-management-server/icd-management-server.cpp index 90953e3b814dd2..ee9b85a3abd403 100644 --- a/src/app/clusters/icd-management-server/icd-management-server.cpp +++ b/src/app/clusters/icd-management-server/icd-management-server.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -46,12 +45,14 @@ class IcdManagementAttributeAccess : public AttributeAccessInterface public: IcdManagementAttributeAccess() : AttributeAccessInterface(MakeOptional(kRootEndpointId), IcdManagement::Id) {} - void Init(PersistentStorageDelegate & storage, Crypto::SymmetricKeystore * symmetricKeystore, FabricTable & fabricTable, + void Init(PersistentStorageDelegate & storage, Crypto::SessionKeystore * symmetricKeystore, FabricTable & fabricTable, ICDConfigurationData & icdConfigurationData) { - mStorage = &storage; - mSymmetricKeystore = symmetricKeystore; - mFabricTable = &fabricTable; +#if CHIP_CONFIG_ENABLE_ICD_CIP + mStorage = &storage; + mSymmetricKeystore = symmetricKeystore; + mFabricTable = &fabricTable; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP mICDConfigurationData = &icdConfigurationData; } @@ -61,6 +62,8 @@ class IcdManagementAttributeAccess : public AttributeAccessInterface CHIP_ERROR ReadIdleModeDuration(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadActiveModeDuration(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadActiveModeThreshold(EndpointId endpoint, AttributeValueEncoder & encoder); + +#if CHIP_CONFIG_ENABLE_ICD_CIP CHIP_ERROR ReadRegisteredClients(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadICDCounter(EndpointId endpoint, AttributeValueEncoder & encoder); CHIP_ERROR ReadClientsSupportedPerFabric(EndpointId endpoint, AttributeValueEncoder & encoder); @@ -68,7 +71,9 @@ class IcdManagementAttributeAccess : public AttributeAccessInterface PersistentStorageDelegate * mStorage = nullptr; Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; FabricTable * mFabricTable = nullptr; - ICDConfigurationData * mICDConfigurationData = nullptr; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + + ICDConfigurationData * mICDConfigurationData = nullptr; }; CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) @@ -86,6 +91,7 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath & case IcdManagement::Attributes::ActiveModeThreshold::Id: return ReadActiveModeThreshold(aPath.mEndpointId, aEncoder); +#if CHIP_CONFIG_ENABLE_ICD_CIP case IcdManagement::Attributes::RegisteredClients::Id: return ReadRegisteredClients(aPath.mEndpointId, aEncoder); @@ -94,6 +100,10 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath & case IcdManagement::Attributes::ClientsSupportedPerFabric::Id: return ReadClientsSupportedPerFabric(aPath.mEndpointId, aEncoder); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + + default: + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; } return CHIP_NO_ERROR; @@ -114,6 +124,52 @@ CHIP_ERROR IcdManagementAttributeAccess::ReadActiveModeThreshold(EndpointId endp return encoder.Encode(mICDConfigurationData->GetActiveModeThreshold().count()); } +#if CHIP_CONFIG_ENABLE_ICD_CIP +/** + * @brief Implementation of Fabric Delegate for ICD Management cluster + */ +class IcdManagementFabricDelegate : public FabricTable::Delegate +{ +public: + void Init(PersistentStorageDelegate & storage, Crypto::SymmetricKeystore * symmetricKeystore, + ICDConfigurationData & icdConfigurationData) + { + mStorage = &storage; + mSymmetricKeystore = symmetricKeystore; + mICDConfigurationData = &icdConfigurationData; + } + + void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override + { + uint16_t supported_clients = mICDConfigurationData->GetClientsSupportedPerFabric(); + ICDMonitoringTable table(*mStorage, fabricIndex, supported_clients, mSymmetricKeystore); + table.RemoveAll(); + ICDNotifier::GetInstance().NotifyICDManagementEvent(ICDListener::ICDManagementEvents::kTableUpdated); + } + +private: + PersistentStorageDelegate * mStorage = nullptr; + Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; + ICDConfigurationData * mICDConfigurationData = nullptr; +}; + +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + +} // namespace + +/* + * ICD Management Implementation + */ + +ICDConfigurationData * ICDManagementServer::mICDConfigurationData = nullptr; +IcdManagementAttributeAccess gAttribute; + +#if CHIP_CONFIG_ENABLE_ICD_CIP + +namespace { + +IcdManagementFabricDelegate gFabricDelegate; + CHIP_ERROR IcdManagementAttributeAccess::ReadRegisteredClients(EndpointId endpoint, AttributeValueEncoder & encoder) { uint16_t supported_clients = mICDConfigurationData->GetClientsSupportedPerFabric(); @@ -157,37 +213,6 @@ CHIP_ERROR IcdManagementAttributeAccess::ReadClientsSupportedPerFabric(EndpointI return encoder.Encode(mICDConfigurationData->GetClientsSupportedPerFabric()); } -/** - * @brief Implementation of Fabric Delegate for ICD Management cluster - */ -class IcdManagementFabricDelegate : public FabricTable::Delegate -{ -public: - void Init(PersistentStorageDelegate & storage, Crypto::SymmetricKeystore * symmetricKeystore, - ICDConfigurationData & icdConfigurationData) - { - mStorage = &storage; - mSymmetricKeystore = symmetricKeystore; - mICDConfigurationData = &icdConfigurationData; - } - - void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override - { - uint16_t supported_clients = mICDConfigurationData->GetClientsSupportedPerFabric(); - ICDMonitoringTable table(*mStorage, fabricIndex, supported_clients, mSymmetricKeystore); - table.RemoveAll(); - ICDNotifier::GetInstance().NotifyICDManagementEvent(ICDListener::ICDManagementEvents::kTableUpdated); - } - -private: - PersistentStorageDelegate * mStorage = nullptr; - Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; - ICDConfigurationData * mICDConfigurationData = nullptr; -}; - -IcdManagementFabricDelegate gFabricDelegate; -IcdManagementAttributeAccess gAttribute; - /** * @brief Function checks if the client has admin permissions to the cluster in the commandPath * @@ -214,13 +239,8 @@ CHIP_ERROR CheckAdmin(CommandHandler * commandObj, const ConcreteCommandPath & c } // namespace -/* - * ICD Management Implementation - */ - -PersistentStorageDelegate * ICDManagementServer::mStorage = nullptr; -Crypto::SymmetricKeystore * ICDManagementServer::mSymmetricKeystore = nullptr; -ICDConfigurationData * ICDManagementServer::mICDConfigurationData = nullptr; +PersistentStorageDelegate * ICDManagementServer::mStorage = nullptr; +Crypto::SessionKeystore * ICDManagementServer::mSymmetricKeystore = nullptr; Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::RegisterClient::DecodableType & commandData, uint32_t & icdCounter) @@ -333,6 +353,13 @@ Status ICDManagementServer::UnregisterClient(CommandHandler * commandObj, const return InteractionModel::Status::Success; } +void ICDManagementServer::TriggerICDMTableUpdatedEvent() +{ + ICDNotifier::GetInstance().NotifyICDManagementEvent(ICDListener::ICDManagementEvents::kTableUpdated); +} + +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + Status ICDManagementServer::StayActiveRequest(FabricIndex fabricIndex) { // TODO: Implementent stay awake logic for end device @@ -341,16 +368,13 @@ Status ICDManagementServer::StayActiveRequest(FabricIndex fabricIndex) return InteractionModel::Status::UnsupportedCommand; } -void ICDManagementServer::TriggerICDMTableUpdatedEvent() -{ - ICDNotifier::GetInstance().NotifyICDManagementEvent(ICDListener::ICDManagementEvents::kTableUpdated); -} - -void ICDManagementServer::Init(PersistentStorageDelegate & storage, Crypto::SymmetricKeystore * symmetricKeystore, +void ICDManagementServer::Init(PersistentStorageDelegate & storage, Crypto::SessionKeystore * symmetricKeystore, ICDConfigurationData & icdConfigurationData) { - mStorage = &storage; - mSymmetricKeystore = symmetricKeystore; +#if CHIP_CONFIG_ENABLE_ICD_CIP + mStorage = &storage; + mSymmetricKeystore = symmetricKeystore; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP mICDConfigurationData = &icdConfigurationData; } @@ -358,6 +382,7 @@ void ICDManagementServer::Init(PersistentStorageDelegate & storage, Crypto::Symm * Callbacks Implementation *********************************************************/ +#if CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief ICD Management Cluster RegisterClient Command callback (from client) * @@ -396,6 +421,7 @@ bool emberAfIcdManagementClusterUnregisterClientCallback(CommandHandler * comman commandObj->AddStatus(commandPath, status); return true; } +#endif // CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief ICD Management Cluster StayActiveRequest Command callback (from client) @@ -412,14 +438,16 @@ bool emberAfIcdManagementClusterStayActiveRequestCallback(CommandHandler * comma void MatterIcdManagementPluginServerInitCallback() { - PersistentStorageDelegate & storage = Server::GetInstance().GetPersistentStorage(); - FabricTable & fabricTable = Server::GetInstance().GetFabricTable(); - Crypto::SymmetricKeystore * symmetricKeystore = Server::GetInstance().GetSessionKeystore(); - ICDConfigurationData & icdConfigurationData = ICDConfigurationData::GetInstance().GetInstance(); + PersistentStorageDelegate & storage = Server::GetInstance().GetPersistentStorage(); + Crypto::SessionKeystore * symmetricKeystore = Server::GetInstance().GetSessionKeystore(); + FabricTable & fabricTable = Server::GetInstance().GetFabricTable(); + ICDConfigurationData & icdConfigurationData = ICDConfigurationData::GetInstance().GetInstance(); +#if CHIP_CONFIG_ENABLE_ICD_CIP // Configure and register Fabric delegate gFabricDelegate.Init(storage, symmetricKeystore, icdConfigurationData); fabricTable.AddFabricDelegate(&gFabricDelegate); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP // Configure and register Attribute Access Override gAttribute.Init(storage, symmetricKeystore, fabricTable, icdConfigurationData); diff --git a/src/app/clusters/icd-management-server/icd-management-server.h b/src/app/clusters/icd-management-server/icd-management-server.h index 308d50859d2d4b..b22483e190c3df 100644 --- a/src/app/clusters/icd-management-server/icd-management-server.h +++ b/src/app/clusters/icd-management-server/icd-management-server.h @@ -19,16 +19,21 @@ #include #include -#include #include -#include #include #include -#include #include #include #include +#include + +#if CHIP_CONFIG_ENABLE_ICD_CIP +#include +#include +#include +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + using chip::Protocols::InteractionModel::Status; class ICDManagementServer @@ -36,9 +41,10 @@ class ICDManagementServer public: ICDManagementServer() = default; - static void Init(chip::PersistentStorageDelegate & storage, chip::Crypto::SymmetricKeystore * symmetricKeystore, + static void Init(chip::PersistentStorageDelegate & storage, chip::Crypto::SessionKeystore * symmetricKeystore, chip::ICDConfigurationData & ICDConfigurationData); +#if CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief Function that executes the business logic of the RegisterClient Command * @@ -52,17 +58,23 @@ class ICDManagementServer Status UnregisterClient(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::IcdManagement::Commands::UnregisterClient::DecodableType & commandData); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP Status StayActiveRequest(chip::FabricIndex fabricIndex); private: +#if CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief Triggers table update events to notify subscribers that an entry was added or removed * from the ICDMonitoringTable. */ void TriggerICDMTableUpdatedEvent(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + static chip::ICDConfigurationData * mICDConfigurationData; + +#if CHIP_CONFIG_ENABLE_ICD_CIP static chip::PersistentStorageDelegate * mStorage; static chip::Crypto::SymmetricKeystore * mSymmetricKeystore; - static chip::ICDConfigurationData * mICDConfigurationData; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP }; diff --git a/src/app/icd/icd.gni b/src/app/icd/icd.gni index 1f2ac247f6fb38..8994cf486106aa 100644 --- a/src/app/icd/icd.gni +++ b/src/app/icd/icd.gni @@ -17,6 +17,8 @@ declare_args() { # TODO - Add Specifics when the design is refined chip_enable_icd_server = false + chip_enable_icd_lit = false + # Matter SDK Configuration flag to enable ICD client functionality # TODO - Add Specifics when the design is refined chip_enable_icd_client = false @@ -29,3 +31,9 @@ declare_args() { # Set to true to enforce SIT Slow Polling Max value to 15seconds (spec 9.16.1.5) icd_enforce_sit_slow_poll_limit = false } + +# Set the defaults for CIP and UAT features to be consistent with the LIT value. +declare_args() { + chip_enable_icd_checkin = chip_enable_icd_lit + chip_enable_icd_user_active_mode_trigger = chip_enable_icd_lit +} diff --git a/src/app/icd/server/BUILD.gn b/src/app/icd/server/BUILD.gn index 41c73b5f7e6bbc..9a10430a3303ff 100644 --- a/src/app/icd/server/BUILD.gn +++ b/src/app/icd/server/BUILD.gn @@ -22,8 +22,15 @@ buildconfig_header("icd-server-buildconfig") { header = "ICDServerBuildConfig.h" header_dir = "app/icd/server" + if (chip_enable_icd_lit) { + assert(chip_enable_icd_checkin && chip_enable_icd_user_active_mode_trigger) + } + defines = [ "CHIP_CONFIG_ENABLE_ICD_SERVER=${chip_enable_icd_server}", + "CHIP_CONFIG_ENABLE_ICD_LIT=${chip_enable_icd_lit}", + "CHIP_CONFIG_ENABLE_ICD_CIP=${chip_enable_icd_checkin}", + "CHIP_CONFIG_ENABLE_ICD_UAT=${chip_enable_icd_user_active_mode_trigger}", "ICD_REPORT_ON_ENTER_ACTIVE_MODE=${chip_icd_report_on_active_mode}", "ICD_MAX_NOTIFICATION_SUBSCRIBERS=${icd_max_notification_subscribers}", "ICD_ENFORCE_SIT_SLOW_POLL_LIMIT=${icd_enforce_sit_slow_poll_limit}", @@ -66,13 +73,19 @@ source_set("manager") { public_deps = [ ":configuration-data", - ":monitoring-table", ":notifier", ":observer", - ":sender", "${chip_root}/src/app:subscription-manager", "${chip_root}/src/credentials:credentials", + "${chip_root}/src/messaging", ] + + if (chip_enable_icd_checkin) { + public_deps += [ + ":monitoring-table", + ":sender", + ] + } } source_set("sender") { diff --git a/src/app/icd/server/ICDManager.cpp b/src/app/icd/server/ICDManager.cpp index 05948feb3406a1..0c61bb093034e2 100644 --- a/src/app/icd/server/ICDManager.cpp +++ b/src/app/icd/server/ICDManager.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -40,15 +39,18 @@ using namespace System::Clock; static_assert(UINT8_MAX >= CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS, "ICDManager::mOpenExchangeContextCount cannot hold count for the max exchange count"); -void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricTable, Crypto::SymmetricKeystore * symmetricKeystore, +void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricTable, Crypto::SessionKeystore * symmetricKeystore, Messaging::ExchangeManager * exchangeManager, SubscriptionsInfoProvider * manager) { +#if CHIP_CONFIG_ENABLE_ICD_CIP VerifyOrDie(storage != nullptr); VerifyOrDie(fabricTable != nullptr); VerifyOrDie(symmetricKeystore != nullptr); VerifyOrDie(exchangeManager != nullptr); VerifyOrDie(manager != nullptr); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP +#if CHIP_CONFIG_ENABLE_ICD_LIT // LIT ICD Verification Checks if (SupportsFeature(Feature::kLongIdleTimeSupport)) { @@ -63,9 +65,11 @@ void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricT // VerifyOrDieWithMsg((GetSlowPollingInterval() <= GetSITPollingThreshold()) , AppServer, // "LIT support is required for slow polling intervals superior to 15 seconds"); } +#endif // CHIP_CONFIG_ENABLE_ICD_LIT VerifyOrDie(ICDNotifier::GetInstance().Subscribe(this) == CHIP_NO_ERROR); +#if CHIP_CONFIG_ENABLE_ICD_CIP mStorage = storage; mFabricTable = fabricTable; mSymmetricKeystore = symmetricKeystore; @@ -75,6 +79,7 @@ void ICDManager::Init(PersistentStorageDelegate * storage, FabricTable * fabricT VerifyOrDie(ICDConfigurationData::GetInstance().GetICDCounter().Init(mStorage, DefaultStorageKeyAllocator::ICDCheckInCounter(), ICDConfigurationData::kICDCounterPersistenceIncrement) == CHIP_NO_ERROR); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP UpdateICDMode(); UpdateOperationState(OperationalState::IdleMode); @@ -91,13 +96,14 @@ void ICDManager::Shutdown() ICDConfigurationData::GetInstance().SetICDMode(ICDConfigurationData::ICDMode::SIT); mOperationalState = OperationalState::ActiveMode; + mStateObserverPool.ReleaseAll(); +#if CHIP_CONFIG_ENABLE_ICD_CIP mStorage = nullptr; mFabricTable = nullptr; mSubManager = nullptr; - - mStateObserverPool.ReleaseAll(); mICDSenderPool.ReleaseAll(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP } bool ICDManager::SupportsFeature(Feature feature) @@ -112,6 +118,7 @@ bool ICDManager::SupportsFeature(Feature feature) #endif // !CONFIG_BUILD_FOR_HOST_UNIT_TEST } +#if CHIP_CONFIG_ENABLE_ICD_CIP void ICDManager::SendCheckInMsgs() { #if !CONFIG_BUILD_FOR_HOST_UNIT_TEST @@ -179,12 +186,66 @@ void ICDManager::SendCheckInMsgs() #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST } +bool ICDManager::CheckInMessagesWouldBeSent() +{ + for (const auto & fabricInfo : *mFabricTable) + { + uint16_t supported_clients = ICDConfigurationData::GetInstance().GetClientsSupportedPerFabric(); + + ICDMonitoringTable table(*mStorage, fabricInfo.GetFabricIndex(), supported_clients /*Table entry limit*/, + mSymmetricKeystore); + if (table.IsEmpty()) + { + continue; + } + + for (uint16_t i = 0; i < table.Limit(); i++) + { + ICDMonitoringEntry entry(mSymmetricKeystore); + CHIP_ERROR err = table.Get(i, entry); + if (err == CHIP_ERROR_NOT_FOUND) + { + break; + } + + if (err != CHIP_NO_ERROR) + { + // Try to fetch the next entry upon failure (should not happen). + ChipLogError(AppServer, "Failed to retrieved ICDMonitoring entry, will try next entry."); + continue; + } + + // At least one registration would require a Check-In message + VerifyOrReturnValue(mSubManager->SubjectHasActiveSubscription(entry.fabricIndex, entry.monitoredSubject), true); + } + } + + // None of the registrations would require a Check-In message + return false; +} + +void ICDManager::TriggerCheckInMessages() +{ + VerifyOrReturn(SupportsFeature(Feature::kCheckInProtocolSupport)); + + // Only trigger Check-In messages when we are in IdleMode. + // If we are already in ActiveMode, Check-In messages have already been sent. + VerifyOrReturn(mOperationalState == OperationalState::IdleMode); + + // If we don't have any Check-In messages to send, do nothing + VerifyOrReturn(CheckInMessagesWouldBeSent()); + + UpdateOperationState(OperationalState::ActiveMode); +} +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + void ICDManager::UpdateICDMode() { assertChipStackLockedByCurrentThread(); ICDConfigurationData::ICDMode tempMode = ICDConfigurationData::ICDMode::SIT; +#if CHIP_CONFIG_ENABLE_ICD_LIT // Device can only switch to the LIT operating mode if LIT support is present if (SupportsFeature(Feature::kLongIdleTimeSupport)) { @@ -202,6 +263,7 @@ void ICDManager::UpdateICDMode() } } } +#endif // CHIP_CONFIG_ENABLE_ICD_LIT if (ICDConfigurationData::GetInstance().GetICDMode() != tempMode) { @@ -236,15 +298,21 @@ void ICDManager::UpdateOperationState(OperationalState state) // When the active mode interval is 0, we stay in idleMode until a notification brings the icd into active mode // unless the device would need to send Check-In messages // TODO(#30281) : Verify how persistent subscriptions affects this at ICDManager::Init - if (ICDConfigurationData::GetInstance().GetActiveModeDuration() > kZero || CheckInMessagesWouldBeSent()) + if (ICDConfigurationData::GetInstance().GetActiveModeDuration() > kZero +#if CHIP_CONFIG_ENABLE_ICD_CIP + || CheckInMessagesWouldBeSent() +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + ) { DeviceLayer::SystemLayer().StartTimer(ICDConfigurationData::GetInstance().GetIdleModeDuration(), OnIdleModeDone, this); } Milliseconds32 slowPollInterval = ICDConfigurationData::GetInstance().GetSlowPollingInterval(); +#if CHIP_CONFIG_ENABLE_ICD_CIP // Going back to Idle, all Check-In messages are sent mICDSenderPool.ReleaseAll(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP CHIP_ERROR err = DeviceLayer::ConnectivityMgr().SetPollingInterval(slowPollInterval); if (err != CHIP_NO_ERROR) @@ -285,10 +353,12 @@ void ICDManager::UpdateOperationState(OperationalState state) ChipLogError(AppServer, "Failed to set Fast Polling Interval: err %" CHIP_ERROR_FORMAT, err.Format()); } +#if CHIP_CONFIG_ENABLE_ICD_CIP if (SupportsFeature(Feature::kCheckInProtocolSupport)) { SendCheckInMsgs(); } +#endif // CHIP_CONFIG_ENABLE_ICD_CIP postObserverEvent(ObserverEventType::EnterActiveMode); } @@ -371,12 +441,14 @@ void ICDManager::OnKeepActiveRequest(KeepActiveFlags request) this->mOpenExchangeContextCount++; } +#if CHIP_CONFIG_ENABLE_ICD_CIP if (request.Has(KeepActiveFlag::kCheckInInProgress)) { // There can be multiple check-in at the same time. // Keep track of the requests count. this->mCheckInRequestCount++; } +#endif // CHIP_CONFIG_ENABLE_ICD_CIP this->SetKeepActiveModeRequirements(request, true /* state */); } @@ -406,6 +478,7 @@ void ICDManager::OnActiveRequestWithdrawal(KeepActiveFlags request) } } +#if CHIP_CONFIG_ENABLE_ICD_CIP if (request.Has(KeepActiveFlag::kCheckInInProgress)) { // There can be multiple open exchange contexts at the same time. @@ -424,6 +497,7 @@ void ICDManager::OnActiveRequestWithdrawal(KeepActiveFlags request) this->SetKeepActiveModeRequirements(KeepActiveFlag::kCheckInInProgress, false /* state */); } } +#endif // CHIP_CONFIG_ENABLE_ICD_CIP if (request.Has(KeepActiveFlag::kCommissioningWindowOpen) || request.Has(KeepActiveFlag::kFailSafeArmed)) { @@ -506,57 +580,5 @@ void ICDManager::postObserverEvent(ObserverEventType event) }); } -bool ICDManager::CheckInMessagesWouldBeSent() -{ - for (const auto & fabricInfo : *mFabricTable) - { - uint16_t supported_clients = ICDConfigurationData::GetInstance().GetClientsSupportedPerFabric(); - - ICDMonitoringTable table(*mStorage, fabricInfo.GetFabricIndex(), supported_clients /*Table entry limit*/, - mSymmetricKeystore); - if (table.IsEmpty()) - { - continue; - } - - for (uint16_t i = 0; i < table.Limit(); i++) - { - ICDMonitoringEntry entry(mSymmetricKeystore); - CHIP_ERROR err = table.Get(i, entry); - if (err == CHIP_ERROR_NOT_FOUND) - { - break; - } - - if (err != CHIP_NO_ERROR) - { - // Try to fetch the next entry upon failure (should not happen). - ChipLogError(AppServer, "Failed to retrieved ICDMonitoring entry, will try next entry."); - continue; - } - - // At least one registration would require a Check-In message - VerifyOrReturnValue(mSubManager->SubjectHasActiveSubscription(entry.fabricIndex, entry.monitoredSubject), true); - } - } - - // None of the registrations would require a Check-In message - return false; -} - -void ICDManager::TriggerCheckInMessages() -{ - VerifyOrReturn(SupportsFeature(Feature::kCheckInProtocolSupport)); - - // Only trigger Check-In messages when we are in IdleMode. - // If we are already in ActiveMode, Check-In messages have already been sent. - VerifyOrReturn(mOperationalState == OperationalState::IdleMode); - - // If we don't have any Check-In messages to send, do nothing - VerifyOrReturn(CheckInMessagesWouldBeSent()); - - UpdateOperationState(OperationalState::ActiveMode); -} - } // namespace app } // namespace chip diff --git a/src/app/icd/server/ICDManager.h b/src/app/icd/server/ICDManager.h index f115a41bdddcc8..d9807e794fac11 100644 --- a/src/app/icd/server/ICDManager.h +++ b/src/app/icd/server/ICDManager.h @@ -17,14 +17,22 @@ #pragma once #include + +#include + +#if CHIP_CONFIG_ENABLE_ICD_CIP +#include // nogncheck +#include // nogncheck +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + #include -#include #include -#include #include #include #include +#include #include +#include #include #include #include @@ -66,7 +74,7 @@ class ICDManager : public ICDListener }; ICDManager() {} - void Init(PersistentStorageDelegate * storage, FabricTable * fabricTable, Crypto::SymmetricKeystore * symmetricKeyStore, + void Init(PersistentStorageDelegate * storage, FabricTable * fabricTable, Crypto::SessionKeystore * symmetricKeyStore, Messaging::ExchangeManager * exchangeManager, SubscriptionsInfoProvider * manager); void Shutdown(); void UpdateICDMode(); @@ -94,8 +102,16 @@ class ICDManager : public ICDListener */ void postObserverEvent(ObserverEventType event); OperationalState GetOperationalState() { return mOperationalState; } + +#if CHIP_CONFIG_ENABLE_ICD_CIP void SendCheckInMsgs(); + /** + * @brief Trigger the ICDManager to send Check-In message if necessary + */ + void TriggerCheckInMessages(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + #ifdef CONFIG_BUILD_FOR_HOST_UNIT_TEST void SetTestFeatureMapValue(uint32_t featureMap) { mFeatureMap = featureMap; }; #endif @@ -108,11 +124,6 @@ class ICDManager : public ICDListener void OnICDManagementServerEvent(ICDManagementEvents event) override; void OnSubscriptionReport() override; - /** - * @brief Trigger the ICDManager to send Check-In message if necessary - */ - void TriggerCheckInMessages(); - protected: friend class TestICDManager; @@ -127,10 +138,14 @@ class ICDManager : public ICDListener */ static void OnTransitionToIdle(System::Layer * aLayer, void * appState); +#if CHIP_CONFIG_ENABLE_ICD_CIP + uint8_t mCheckInRequestCount = 0; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + uint8_t mOpenExchangeContextCount = 0; - uint8_t mCheckInRequestCount = 0; private: +#if CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief Function checks if at least one client registration would require a Check-In message * @@ -139,22 +154,23 @@ class ICDManager : public ICDListener * they all have associated subscriptions. */ bool CheckInMessagesWouldBeSent(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP KeepActiveFlags mKeepActiveFlags{ 0 }; // Initialize mOperationalState to ActiveMode so the init sequence at bootup triggers the IdleMode behaviour first. OperationalState mOperationalState = OperationalState::ActiveMode; + bool mTransitionToIdleCalled = false; + ObjectPool mStateObserverPool; +#if CHIP_CONFIG_ENABLE_ICD_CIP PersistentStorageDelegate * mStorage = nullptr; FabricTable * mFabricTable = nullptr; Messaging::ExchangeManager * mExchangeManager = nullptr; Crypto::SymmetricKeystore * mSymmetricKeystore = nullptr; SubscriptionsInfoProvider * mSubManager = nullptr; - - bool mTransitionToIdleCalled = false; - - ObjectPool mStateObserverPool; ObjectPool mICDSenderPool; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP #ifdef CONFIG_BUILD_FOR_HOST_UNIT_TEST // feature map that can be changed at runtime for testing purposes diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 6228c10bb46698..f2a562020091a3 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -436,7 +436,7 @@ void Server::OnPlatformEvent(const DeviceLayer::ChipDeviceEvent & event) } break; case DeviceEventType::kServerReady: -#if CHIP_CONFIG_ENABLE_ICD_SERVER +#if CHIP_CONFIG_ENABLE_ICD_SERVER && CHIP_CONFIG_ENABLE_ICD_CIP // Only Trigger Check-In messages if we are not in the middle of a commissioning. // This check is only necessary for the first commissioiner since the kServerReady event // is triggered once we join the network. @@ -445,7 +445,7 @@ void Server::OnPlatformEvent(const DeviceLayer::ChipDeviceEvent & event) { mICDManager.TriggerCheckInMessages(); } -#endif // CHIP_CONFIG_ENABLE_ICD_SERVER +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && CHIP_CONFIG_ENABLE_ICD_CIP #if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS ResumeSubscriptions(); #endif diff --git a/src/app/tests/BUILD.gn b/src/app/tests/BUILD.gn index 245e939fc39799..8f0c7084968baf 100644 --- a/src/app/tests/BUILD.gn +++ b/src/app/tests/BUILD.gn @@ -141,8 +141,6 @@ chip_test_suite_using_nltest("tests") { "TestEventOverflow.cpp", "TestEventPathParams.cpp", "TestFabricScopedEventLogging.cpp", - "TestICDManager.cpp", - "TestICDMonitoringTable.cpp", "TestInteractionModelEngine.cpp", "TestMessageDef.cpp", "TestNumericAttributeTraits.cpp", @@ -208,7 +206,6 @@ chip_test_suite_using_nltest("tests") { "${chip_root}/src/app", "${chip_root}/src/app/common:cluster-objects", "${chip_root}/src/app/icd/client:manager", - "${chip_root}/src/app/icd/server:manager", "${chip_root}/src/app/tests:helpers", "${chip_root}/src/app/util/mock:mock_ember", "${chip_root}/src/lib/core", @@ -218,6 +215,16 @@ chip_test_suite_using_nltest("tests") { "${nlunit_test_root}:nlunit-test", ] + if (chip_enable_icd_server) { + public_deps += [ "${chip_root}/src/app/icd/server:manager" ] + + test_sources += [ "TestICDManager.cpp" ] + } + + if (chip_enable_icd_checkin) { + test_sources += [ "TestICDMonitoringTable.cpp" ] + } + if (chip_device_platform != "android") { test_sources += [ "TestExtensionFieldSets.cpp", diff --git a/src/platform/nrfconnect/CHIPPlatformConfig.h b/src/platform/nrfconnect/CHIPPlatformConfig.h index c8187675c4a100..778372394b35ae 100644 --- a/src/platform/nrfconnect/CHIPPlatformConfig.h +++ b/src/platform/nrfconnect/CHIPPlatformConfig.h @@ -113,15 +113,15 @@ #endif // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#ifdef CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_IDLE_MODE_DURATION #endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS -#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION #endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS diff --git a/src/platform/nxp/zephyr/CHIPPlatformConfig.h b/src/platform/nxp/zephyr/CHIPPlatformConfig.h index cd9873051e5fed..d5ed1717bd64d4 100644 --- a/src/platform/nxp/zephyr/CHIPPlatformConfig.h +++ b/src/platform/nxp/zephyr/CHIPPlatformConfig.h @@ -114,15 +114,15 @@ #endif // CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#ifdef CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_IDLE_MODE_DURATION #endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS -#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION #endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS diff --git a/src/platform/telink/CHIPPlatformConfig.h b/src/platform/telink/CHIPPlatformConfig.h index 9e0dc3dd36e8f7..1bb4ab7b07203d 100644 --- a/src/platform/telink/CHIPPlatformConfig.h +++ b/src/platform/telink/CHIPPlatformConfig.h @@ -133,15 +133,15 @@ #endif #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#ifdef CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_IDLE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC CONFIG_CHIP_ICD_IDLE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_IDLE_MODE_DURATION #endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS -#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL -#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_INTERVAL +#ifdef CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION +#endif // CONFIG_CHIP_ICD_ACTIVE_MODE_DURATION #endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS