From d9cf790ca7c5689e40641a1f8b126ee90a9d59b0 Mon Sep 17 00:00:00 2001 From: Andrii Bilynskyi Date: Thu, 21 Sep 2023 02:00:19 +0300 Subject: [PATCH] [Telink] Remove custom subscriptions handling, to meet the ICD max subscription interval requirement (#29344) --- config/telink/chip-module/Kconfig | 20 ---------- .../telink/common/src/AppTaskCommon.cpp | 9 ----- src/platform/telink/BUILD.gn | 1 - src/platform/telink/ICDUtil.cpp | 40 ------------------- src/platform/telink/ICDUtil.h | 33 --------------- 5 files changed, 103 deletions(-) delete mode 100644 src/platform/telink/ICDUtil.cpp delete mode 100644 src/platform/telink/ICDUtil.h diff --git a/config/telink/chip-module/Kconfig b/config/telink/chip-module/Kconfig index 325eb4172f198c..fb1f20e0dfbc63 100644 --- a/config/telink/chip-module/Kconfig +++ b/config/telink/chip-module/Kconfig @@ -188,26 +188,6 @@ config SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE int default 255 if SHELL_BACKEND_SERIAL -config CHIP_ICD_SUBSCRIPTION_HANDLING - bool "Enables platform specific handling of ICD subscriptions" - default PM - help - Enables platform specific implementation that handles ICD subscription requests - and selects subscription report interval value considering maximum interval preferred - by the publisher. - -config CHIP_MAX_PREFERRED_SUBSCRIPTION_REPORT_INTERVAL - int "Maximum preferred interval of sending subscription reports (s)" - default 60 - help - Provides maximum preferred interval to be used by a publisher for negotiation - of the final maximum subscription report interval, after receiving a subscription - request from the initiator. This value should be selected as a compromise between - keeping the power consumption low due to not sending reports too often, and allowing - the initiator device to detect the publisher absence reasonably fast due to not sending - the reports too rarely. The current algorithm is to select bigger value from the one - requested by the initiator and the one preferred by the publisher. - config CHIP_ENABLE_POWER_ON_FACTORY_RESET bool "Enable power on factory reset sequence" default n diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 969f3c14638ae3..bf7c87efe70c33 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -34,11 +34,6 @@ #include "OTAUtil.h" #endif -#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING -#include "ICDUtil.h" -#include -#endif - #include #include @@ -322,10 +317,6 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); #endif -#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING - chip::app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(&GetICDUtil()); -#endif - // We need to disable OpenThread to prevent writing to the NVS storage when factory reset occurs // The OpenThread thread is running during factory reset. The nvs_clear function is called during // factory reset, which makes the NVS storage innaccessible, but the OpenThread knows nothing diff --git a/src/platform/telink/BUILD.gn b/src/platform/telink/BUILD.gn index 00fe34e81093bc..9864ae4b5dfd09 100644 --- a/src/platform/telink/BUILD.gn +++ b/src/platform/telink/BUILD.gn @@ -43,7 +43,6 @@ static_library("telink") { "ConfigurationManagerImpl.h", "ConnectivityManagerImpl.cpp", "ConnectivityManagerImpl.h", - "ICDUtil.cpp", "InetPlatformConfig.h", "KeyValueStoreManagerImpl.h", "PlatformManagerImpl.h", diff --git a/src/platform/telink/ICDUtil.cpp b/src/platform/telink/ICDUtil.cpp deleted file mode 100644 index b3dc9c80bbc9dd..00000000000000 --- a/src/platform/telink/ICDUtil.cpp +++ /dev/null @@ -1,40 +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 "ICDUtil.h" - -ICDUtil ICDUtil::sICDUtil; - -CHIP_ERROR ICDUtil::OnSubscriptionRequested(chip::app::ReadHandler & aReadHandler, chip::Transport::SecureSession & aSecureSession) -{ - uint16_t agreedMaxInterval = CONFIG_CHIP_MAX_PREFERRED_SUBSCRIPTION_REPORT_INTERVAL; - uint16_t requestedMinInterval = 0; - uint16_t requestedMaxInterval = 0; - aReadHandler.GetReportingIntervals(requestedMinInterval, requestedMaxInterval); - - if (requestedMaxInterval > agreedMaxInterval) - { - agreedMaxInterval = requestedMaxInterval; - } - else if (agreedMaxInterval > kSubscriptionMaxIntervalPublisherLimit) - { - agreedMaxInterval = kSubscriptionMaxIntervalPublisherLimit; - } - - return aReadHandler.SetMaxReportingInterval(agreedMaxInterval); -} diff --git a/src/platform/telink/ICDUtil.h b/src/platform/telink/ICDUtil.h deleted file mode 100644 index 33db1e97a051ac..00000000000000 --- a/src/platform/telink/ICDUtil.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * 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 - -class ICDUtil : public chip::app::ReadHandler::ApplicationCallback -{ - CHIP_ERROR OnSubscriptionRequested(chip::app::ReadHandler & aReadHandler, - chip::Transport::SecureSession & aSecureSession) override; - friend ICDUtil & GetICDUtil(); - static ICDUtil sICDUtil; -}; - -inline ICDUtil & GetICDUtil() -{ - return ICDUtil::sICDUtil; -}