From 1593cceeb1546f6b39bb72b8d0c55069ff19dc6c Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk <66371704+kkasperczyk-no@users.noreply.github.com> Date: Wed, 14 Feb 2024 10:28:02 +0100 Subject: [PATCH] [icd] Introduced gn flags to allow conditional code compilation (#31795) The ICD implementation is compiled with a full set of features, even if the device uses SIT configuration. It results in a big flash memory waste on a functionalities that cannot be used by certain configuration. Introduced new gn flags corresponding to the ICD features - LIT, CIP and UAT. Modified the ICD Manager implementation and icd-management-server code to use created defines and cut off unused code by the preprocessor. --- .github/workflows/unit_integration_test.yaml | 2 +- BUILD.gn | 6 +- config/nrfconnect/chip-module/CMakeLists.txt | 6 + config/standalone/toolchain/BUILD.gn | 9 ++ config/telink/chip-module/CMakeLists.txt | 6 + config/zephyr/Kconfig | 39 ++++- examples/light-switch-app/qpg/args.gni | 1 + examples/lit-icd-app/linux/args.gni | 1 + .../silabs/build_for_wifi_args.gni | 1 + examples/lit-icd-app/silabs/openthread.gni | 1 + examples/smoke-co-alarm-app/telink/prj.conf | 2 + .../icd-management-server.cpp | 134 ++++++++++------ .../icd-management-server.h | 28 +++- src/app/icd/icd.gni | 8 + src/app/icd/server/BUILD.gn | 17 +- src/app/icd/server/ICDManager.cpp | 148 ++++++++++-------- src/app/icd/server/ICDManager.h | 48 ++++-- src/app/server/Server.cpp | 4 +- src/app/tests/BUILD.gn | 13 +- src/platform/nrfconnect/CHIPPlatformConfig.h | 12 +- src/platform/nxp/zephyr/CHIPPlatformConfig.h | 12 +- src/platform/telink/CHIPPlatformConfig.h | 12 +- .../SubscriptionResumptionCapacityTest.py | 2 +- .../SubscriptionResumptionTest.py | 2 +- 24 files changed, 345 insertions(+), 169 deletions(-) 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/BUILD.gn b/BUILD.gn index e201b56ceac00d..838ea743f348c8 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -626,8 +626,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { if (enable_linux_lit_icd_app_build) { group("linux_lit_icd_app") { - deps = - [ "${chip_root}/examples/lit-icd-app/linux(${standalone_toolchain})" ] + lit_icd_standalone_toolchain = + "${chip_root}/config/standalone/toolchain:lit_icd" + + deps = [ "${chip_root}/examples/lit-icd-app/linux(${lit_icd_standalone_toolchain})" ] } extra_build_deps += [ ":linux_lit_icd_app" ] 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/standalone/toolchain/BUILD.gn b/config/standalone/toolchain/BUILD.gn index 8e9160fe097216..58e284cdc38a77 100644 --- a/config/standalone/toolchain/BUILD.gn +++ b/config/standalone/toolchain/BUILD.gn @@ -25,3 +25,12 @@ gcc_toolchain("standalone") { import("${chip_root}/config/standalone/args.gni") } } + +gcc_toolchain("lit_icd") { + toolchain_args = { + current_os = host_os + current_cpu = host_cpu + is_clang = false + import("${chip_root}/examples/lit-icd-app/linux/args.gni") + } +} 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 139297d45a03db..3531a31ffde406 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_duration_s = 3600 # 60min Idle Mode Duration diff --git a/examples/lit-icd-app/silabs/openthread.gni b/examples/lit-icd-app/silabs/openthread.gni index 8a3bb36475c49c..9d06737d622a2d 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 cac9e2dce3146e..27ecfe778a33bb 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 @@ -51,9 +50,11 @@ class IcdManagementAttributeAccess : public AttributeAccessInterface void Init(PersistentStorageDelegate & storage, Crypto::SymmetricKeystore * 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; } @@ -63,6 +64,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); @@ -70,7 +73,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) @@ -88,6 +93,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); @@ -96,6 +102,7 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath & case IcdManagement::Attributes::ClientsSupportedPerFabric::Id: return ReadClientsSupportedPerFabric(aPath.mEndpointId, aEncoder); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP } return CHIP_NO_ERROR; @@ -116,6 +123,60 @@ 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 + */ +#if CHIP_CONFIG_ENABLE_ICD_CIP +PersistentStorageDelegate * ICDManagementServer::mStorage = nullptr; +Crypto::SymmetricKeystore * ICDManagementServer::mSymmetricKeystore = nullptr; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP + +ICDConfigurationData * ICDManagementServer::mICDConfigurationData = nullptr; + +namespace { +IcdManagementAttributeAccess gAttribute; +#if CHIP_CONFIG_ENABLE_ICD_CIP +IcdManagementFabricDelegate gFabricDelegate; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP +} // namespace + +#if CHIP_CONFIG_ENABLE_ICD_CIP + +namespace { + CHIP_ERROR IcdManagementAttributeAccess::ReadRegisteredClients(EndpointId endpoint, AttributeValueEncoder & encoder) { uint16_t supported_clients = mICDConfigurationData->GetClientsSupportedPerFabric(); @@ -159,37 +220,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 * @@ -216,14 +246,6 @@ 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; - Status ICDManagementServer::RegisterClient(CommandHandler * commandObj, const ConcreteCommandPath & commandPath, const Commands::RegisterClient::DecodableType & commandData, uint32_t & icdCounter) { @@ -335,6 +357,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 @@ -343,16 +372,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, ICDConfigurationData & icdConfigurationData) { - mStorage = &storage; - mSymmetricKeystore = symmetricKeystore; +#if CHIP_CONFIG_ENABLE_ICD_CIP + mStorage = &storage; + mSymmetricKeystore = symmetricKeystore; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP mICDConfigurationData = &icdConfigurationData; } @@ -360,6 +386,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) * @@ -398,6 +425,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) @@ -415,13 +443,15 @@ bool emberAfIcdManagementClusterStayActiveRequestCallback(CommandHandler * comma void MatterIcdManagementPluginServerInitCallback() { PersistentStorageDelegate & storage = Server::GetInstance().GetPersistentStorage(); - FabricTable & fabricTable = Server::GetInstance().GetFabricTable(); Crypto::SymmetricKeystore * 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 0763f4863d1f0b..4462cb96d9c9f2 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,29 @@ #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; + +namespace chip { +namespace Crypto { +using SymmetricKeystore = SessionKeystore; +} // namespace Crypto +} // namespace chip + class ICDManagementServer { public: @@ -37,6 +50,7 @@ class ICDManagementServer static void Init(chip::PersistentStorageDelegate & storage, chip::Crypto::SymmetricKeystore * symmetricKeystore, chip::ICDConfigurationData & ICDConfigurationData); +#if CHIP_CONFIG_ENABLE_ICD_CIP /** * @brief Function that executes the business logic of the RegisterClient Command * @@ -52,17 +66,23 @@ class ICDManagementServer chip::Protocols::InteractionModel::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 chip::Protocols::InteractionModel::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 2388f7b9b63265..057cc089e9624f 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 @@ -43,14 +42,17 @@ 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, - Messaging::ExchangeManager * exchangeManager, SubscriptionsInfoProvider * manager) + Messaging::ExchangeManager * exchangeManager, SubscriptionsInfoProvider * subInfoProvider) { +#if CHIP_CONFIG_ENABLE_ICD_CIP VerifyOrDie(storage != nullptr); VerifyOrDie(fabricTable != nullptr); VerifyOrDie(symmetricKeystore != nullptr); VerifyOrDie(exchangeManager != nullptr); - VerifyOrDie(manager != nullptr); + VerifyOrDie(subInfoProvider != nullptr); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP +#if CHIP_CONFIG_ENABLE_ICD_LIT // LIT ICD Verification Checks if (SupportsFeature(Feature::kLongIdleTimeSupport)) { @@ -65,18 +67,21 @@ 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; mExchangeManager = exchangeManager; - mSubManager = manager; + mSubInfoProvider = subInfoProvider; VerifyOrDie(ICDConfigurationData::GetInstance().GetICDCounter().Init(mStorage, DefaultStorageKeyAllocator::ICDCheckInCounter(), ICDConfigurationData::kICDCounterPersistenceIncrement) == CHIP_NO_ERROR); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP UpdateICDMode(); UpdateOperationState(OperationalState::IdleMode); @@ -93,13 +98,14 @@ void ICDManager::Shutdown() ICDConfigurationData::GetInstance().SetICDMode(ICDConfigurationData::ICDMode::SIT); mOperationalState = OperationalState::ActiveMode; - - mStorage = nullptr; - mFabricTable = nullptr; - mSubManager = nullptr; - mStateObserverPool.ReleaseAll(); + +#if CHIP_CONFIG_ENABLE_ICD_CIP + mStorage = nullptr; + mFabricTable = nullptr; + mSubInfoProvider = nullptr; mICDSenderPool.ReleaseAll(); +#endif // CHIP_CONFIG_ENABLE_ICD_CIP } bool ICDManager::SupportsFeature(Feature feature) @@ -114,6 +120,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 @@ -150,7 +157,7 @@ void ICDManager::SendCheckInMsgs() continue; } - bool active = mSubManager->SubjectHasActiveSubscription(entry.fabricIndex, entry.monitoredSubject); + bool active = mSubInfoProvider->SubjectHasActiveSubscription(entry.fabricIndex, entry.monitoredSubject); if (active) { continue; @@ -181,12 +188,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(mSubInfoProvider->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)) { @@ -204,6 +265,7 @@ void ICDManager::UpdateICDMode() } } } +#endif // CHIP_CONFIG_ENABLE_ICD_LIT if (ICDConfigurationData::GetInstance().GetICDMode() != tempMode) { @@ -238,15 +300,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) @@ -287,10 +355,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); } @@ -373,12 +443,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 */); } @@ -408,6 +480,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. @@ -426,6 +499,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)) { @@ -508,57 +582,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..396e6be20d0606 100644 --- a/src/app/icd/server/ICDManager.h +++ b/src/app/icd/server/ICDManager.h @@ -17,18 +17,32 @@ #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 +namespace chip { +namespace Crypto { +using SymmetricKeystore = SessionKeystore; +} +} // namespace chip + namespace chip { namespace app { @@ -94,8 +108,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 +130,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 +144,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 +160,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; + SubscriptionsInfoProvider * mSubInfoProvider = nullptr; 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 7d9a3fa9efe376..d8f80e20162fc3 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 6c724a185d460c..90af43c0a10c6b 100644 --- a/src/platform/nrfconnect/CHIPPlatformConfig.h +++ b/src/platform/nrfconnect/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/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 diff --git a/src/test_driver/linux-cirque/SubscriptionResumptionCapacityTest.py b/src/test_driver/linux-cirque/SubscriptionResumptionCapacityTest.py index d99d25e5d2b8b2..af6544d8856020 100755 --- a/src/test_driver/linux-cirque/SubscriptionResumptionCapacityTest.py +++ b/src/test_driver/linux-cirque/SubscriptionResumptionCapacityTest.py @@ -52,7 +52,7 @@ TEST_EXTPANID = "fedcba9876543210" TEST_DISCRIMINATOR = 3840 MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" -TEST_END_DEVICE_APP = "lit-icd-app" +TEST_END_DEVICE_APP = "chip-all-clusters-app" TEST_SUBSCRIPTION_CAPACITY = 3 diff --git a/src/test_driver/linux-cirque/SubscriptionResumptionTest.py b/src/test_driver/linux-cirque/SubscriptionResumptionTest.py index 47de0f4f4a1d79..18fa1205289efd 100755 --- a/src/test_driver/linux-cirque/SubscriptionResumptionTest.py +++ b/src/test_driver/linux-cirque/SubscriptionResumptionTest.py @@ -46,7 +46,7 @@ TEST_EXTPANID = "fedcba9876543210" TEST_DISCRIMINATOR = 3840 MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" -TEST_END_DEVICE_APP = "lit-icd-app" +TEST_END_DEVICE_APP = "chip-all-clusters-app" DEVICE_CONFIG = { 'device0': {