From 9ec85192b8212494241c5ee7ccc96739eea8da9d Mon Sep 17 00:00:00 2001 From: Shreyas Bhandare <bhandares@google.com> Date: Mon, 3 Mar 2025 19:24:06 +0000 Subject: [PATCH 01/28] Disable ABS feature in windowcovering --- .../rootnode_windowcovering_RLCxaGi9Yx.zap | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap index e608fff6c2c2ab..26cefd63e91a2d 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap @@ -17,13 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "category": "matter", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl.json", @@ -31,6 +24,13 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "category": "matter", + "version": "chip-v1" } ], "endpointTypes": [ @@ -3273,7 +3273,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x1f", + "defaultValue": "0x17", "reportable": 1, "minInterval": 1, "maxInterval": 65534, From 2a36d2be8379fd5f53b2d4898b7ccf8dca3601e4 Mon Sep 17 00:00:00 2001 From: Shreyas Bhandare <bhandares@google.com> Date: Mon, 3 Mar 2025 19:42:20 +0000 Subject: [PATCH 02/28] Add ZAP Generated --- examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter index 7302d71d92f595..aa5b4e84afb216 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter @@ -2014,7 +2014,7 @@ endpoint 1 { callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute attributeList; - ram attribute featureMap default = 0x1f; + ram attribute featureMap default = 0x17; ram attribute clusterRevision default = 5; handle command UpOrOpen; From 3ed124d35a977243e41c00b093a2758b559ff250 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 15:15:34 -0800 Subject: [PATCH 03/28] Add files for window covering chef delegate --- .../common/clusters/window-covering/chef-window-covering.cpp | 1 + .../chef/common/clusters/window-covering/chef-window-covering.h | 1 + examples/chef/linux/BUILD.gn | 1 + examples/chef/nrfconnect/CMakeLists.txt | 1 + 4 files changed, 4 insertions(+) create mode 100644 examples/chef/common/clusters/window-covering/chef-window-covering.cpp create mode 100644 examples/chef/common/clusters/window-covering/chef-window-covering.h diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp new file mode 100644 index 00000000000000..0cba9e5821b3da --- /dev/null +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -0,0 +1 @@ +#include <chef-window-covering.h> diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.h b/examples/chef/common/clusters/window-covering/chef-window-covering.h new file mode 100644 index 00000000000000..21522e7df05e51 --- /dev/null +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.h @@ -0,0 +1 @@ +#include <app/clusters/window-covering-server/window-covering-delegate.h> diff --git a/examples/chef/linux/BUILD.gn b/examples/chef/linux/BUILD.gn index 360c5fb349d147..3dc0934deab611 100644 --- a/examples/chef/linux/BUILD.gn +++ b/examples/chef/linux/BUILD.gn @@ -67,6 +67,7 @@ executable("${sample_name}") { "${project_dir}/common/clusters/target-navigator/TargetNavigatorManager.cpp", "${project_dir}/common/clusters/temperature-control/static-supported-temperature-levels.cpp", "${project_dir}/common/clusters/wake-on-lan/WakeOnLanManager.cpp", + "${project_dir}/common/clusters/window-covering/chef-window-covering.cpp", "${project_dir}/common/stubs.cpp", "${project_dir}/linux/main.cpp", ] diff --git a/examples/chef/nrfconnect/CMakeLists.txt b/examples/chef/nrfconnect/CMakeLists.txt index 32def1dbf41445..20fcc2cdf4be84 100644 --- a/examples/chef/nrfconnect/CMakeLists.txt +++ b/examples/chef/nrfconnect/CMakeLists.txt @@ -104,6 +104,7 @@ target_sources(app PRIVATE ${CHEF}/common/clusters/temperature-control/static-supported-temperature-levels.cpp ${CHEF}/common/clusters/target-navigator/TargetNavigatorManager.cpp ${CHEF}/common/clusters/wake-on-lan/WakeOnLanManager.cpp + ${CHEF}/common/clusters/window-covering/chef-window-covering.cpp ${CHEF}/common/stubs.cpp ${CHEF}/nrfconnect/main.cpp ) From 6154bad74d881109850bc97f1c15c3a97faf27d9 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 15:20:22 -0800 Subject: [PATCH 04/28] Fix compilation --- .../common/clusters/window-covering/chef-window-covering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 0cba9e5821b3da..db3d6749f266f0 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -1 +1 @@ -#include <chef-window-covering.h> +#include "chef-window-covering.h" From 78d98eccc8a0f9f4fab2eb0e6c52a60fea4f3764 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 15:38:35 -0800 Subject: [PATCH 05/28] + --- .../window-covering/chef-window-covering.cpp | 18 +++++ .../window-covering/chef-window-covering.h | 68 +++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index db3d6749f266f0..86dc2c144f6be2 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -1 +1,19 @@ +/* + * + * Copyright (c) 2022 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 "chef-window-covering.h" diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.h b/examples/chef/common/clusters/window-covering/chef-window-covering.h index 21522e7df05e51..3116bee046b5ba 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.h +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.h @@ -1 +1,69 @@ +/* + * + * Copyright (c) 2025 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 <app/clusters/window-covering-server/window-covering-delegate.h> + +#pragma once + +#include <app-common/zap-generated/cluster-objects.h> +#include <app/CommandResponseHelper.h> + +namespace chip { +namespace app { +namespace Clusters { +namespace WindowCovering { + +/** @brief + * Defines methods for implementing application-specific logic for the WindowCovering Cluster. + */ +class DelegateImpl : public Delegate +{ +public: + /** + * @brief + * This method adjusts window covering position so the physical lift/slide and tilt is at the target + * open/up position set before calling this method. This will happen as fast as possible. + * + * @param[in] type window covering type. + * + * @return CHIP_NO_ERROR On success. + * @return Other Value indicating it failed to adjust window covering position. + */ + CHIP_ERROR HandleMovement(WindowCoveringType type) = 0; + + /** + * @brief + * This method stops any adjusting to the physical tilt and lift/slide that is currently occurring. + * + * @return CHIP_NO_ERROR On success. + * @return Other Value indicating it failed to stop any adjusting to the physical tilt and lift/slide that is currently + * occurring.. + */ + CHIP_ERROR HandleStopMotion() = 0; + + ~DelegateImpl() = default; + DelegateImpl() = default; + +protected: + EndpointId mEndpoint = 0; +}; + +} // namespace WindowCovering +} // namespace Clusters +} // namespace app +} // namespace chip From d54904394de2328e9cd9513d4ce9fa03af8b1bc7 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 16:56:10 -0800 Subject: [PATCH 06/28] + --- .../window-covering/chef-window-covering.cpp | 26 +++++++++++++++++++ .../window-covering/chef-window-covering.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 86dc2c144f6be2..4a041bf033e7f4 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -17,3 +17,29 @@ */ #include "chef-window-covering.h" +#include "app/clusters/window-covering-server/window-covering-server.h" + +using namespace chip::app::Clusters; + +void InitChefWindowCoveringCluster() +{ + const uint16_t endpointCount = emberAfEndpointCount(); + + for (uint16_t endpointIndex = 0; endpointIndex < endpointCount; endpointIndex++) + { + chip::EndpointId endpointId = emberAfEndpointFromIndex(endpointIndex); + if (endpointId == kInvalidEndpointId) + { + continue; + } + + // Check if endpoint has WindowCovering cluster enabled + uint16_t epIndex = emberAfGetClusterServerEndpointIndex(endpoint, WindowCovering::Id, + MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); + if (epIndex == kEmberInvalidEndpointIndex) + continue; + WindowCovering::DelegateImpl delegate = new WindowCovering::DelegateImpl(); + delegate->SetEndpoint(endpointId); + WindowCovering::SetDefaultDelegate(endpointId, delegate); + } +} diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.h b/examples/chef/common/clusters/window-covering/chef-window-covering.h index 3116bee046b5ba..91e84f6fea5376 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.h +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.h @@ -67,3 +67,5 @@ class DelegateImpl : public Delegate } // namespace Clusters } // namespace app } // namespace chip + +void InitChefWindowCoveringCluster(); From 73321f095bd6c41c0f9ae4d2fa528181ac985783 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:01:01 -0800 Subject: [PATCH 07/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 4a041bf033e7f4..4c0d777da70725 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -18,6 +18,7 @@ #include "chef-window-covering.h" #include "app/clusters/window-covering-server/window-covering-server.h" +#include <app/util/endpoint-config-api.h> using namespace chip::app::Clusters; From 0b304d300188b87719fb0c3f1d6fc6c075f86445 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:04:42 -0800 Subject: [PATCH 08/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 4c0d777da70725..fe7ee9a8ee1ef8 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -29,13 +29,13 @@ void InitChefWindowCoveringCluster() for (uint16_t endpointIndex = 0; endpointIndex < endpointCount; endpointIndex++) { chip::EndpointId endpointId = emberAfEndpointFromIndex(endpointIndex); - if (endpointId == kInvalidEndpointId) + if (endpointId == chip::kInvalidEndpointId) { continue; } // Check if endpoint has WindowCovering cluster enabled - uint16_t epIndex = emberAfGetClusterServerEndpointIndex(endpoint, WindowCovering::Id, + uint16_t epIndex = emberAfGetClusterServerEndpointIndex(endpointId, WindowCovering::Id, MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); if (epIndex == kEmberInvalidEndpointIndex) continue; From 54a23c29f983bb5ddb05aeb2f5a9f416ac1505cc Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:08:27 -0800 Subject: [PATCH 09/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index fe7ee9a8ee1ef8..2b171a05418d5c 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -18,6 +18,7 @@ #include "chef-window-covering.h" #include "app/clusters/window-covering-server/window-covering-server.h" +#include <app/util/config.h> #include <app/util/endpoint-config-api.h> using namespace chip::app::Clusters; From 06f02d19f75eb88133495965b8968858da73877c Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:19:12 -0800 Subject: [PATCH 10/28] + --- .../clusters/window-covering/chef-window-covering.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 2b171a05418d5c..f3df65246ef4d2 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -40,7 +40,12 @@ void InitChefWindowCoveringCluster() MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); if (epIndex == kEmberInvalidEndpointIndex) continue; - WindowCovering::DelegateImpl delegate = new WindowCovering::DelegateImpl(); + + // Skip if delegate is already registered. + if (WindowCovering::GetDelegate(endpointId)) + continue; + + WindowCovering::DelegateImpl * delegate = new WindowCovering::DelegateImpl(); delegate->SetEndpoint(endpointId); WindowCovering::SetDefaultDelegate(endpointId, delegate); } From 7cb6fea6e7fb013a542600b7065244f6bbb6272a Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:47:32 -0800 Subject: [PATCH 11/28] + --- .../window-covering/chef-window-covering.cpp | 27 ++++++++++++++----- .../window-covering/chef-window-covering.h | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index f3df65246ef4d2..d9c9654cdec594 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -18,17 +18,32 @@ #include "chef-window-covering.h" #include "app/clusters/window-covering-server/window-covering-server.h" +#include <app/util/attribute-storage.h> #include <app/util/config.h> #include <app/util/endpoint-config-api.h> using namespace chip::app::Clusters; +constexpr size_t kWindowCoveringDelegateTableSize = + MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +static_assert(kWindowCoveringDelegateTableSize <= kEmberInvalidEndpointIndex, "WindowCovering Delegate table size error"); + +std::unique_ptr<WindowCovering::ChefDelegate> gDelegateTable[kWindowCoveringDelegateTableSize]; + +std::unique_ptr<WindowCovering::ChefDelegate> * GetDelegate(EndpointId endpoint) +{ + uint16_t ep = + emberAfGetClusterServerEndpointIndex(endpoint, WindowCovering::Id, MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); + return (ep >= kWindowCoveringDelegateTableSize ? nullptr : gDelegateTable[ep]); +} + void InitChefWindowCoveringCluster() { const uint16_t endpointCount = emberAfEndpointCount(); for (uint16_t endpointIndex = 0; endpointIndex < endpointCount; endpointIndex++) { + // Get endpoint ID from index. chip::EndpointId endpointId = emberAfEndpointFromIndex(endpointIndex); if (endpointId == chip::kInvalidEndpointId) { @@ -38,15 +53,15 @@ void InitChefWindowCoveringCluster() // Check if endpoint has WindowCovering cluster enabled uint16_t epIndex = emberAfGetClusterServerEndpointIndex(endpointId, WindowCovering::Id, MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); - if (epIndex == kEmberInvalidEndpointIndex) + if (epIndex >= kWindowCoveringDelegateTableSize) continue; - // Skip if delegate is already registered. - if (WindowCovering::GetDelegate(endpointId)) + // Skip if delegate was already initialized. + if (gDelegateTable[epIndex]) continue; - WindowCovering::DelegateImpl * delegate = new WindowCovering::DelegateImpl(); - delegate->SetEndpoint(endpointId); - WindowCovering::SetDefaultDelegate(endpointId, delegate); + gDelegateTable[epIndex] = std::make_unique<WindowCovering::ChefDelegate>(); + gDelegateTable[epIndex]->SetEndpoint(endpointId); + WindowCovering::SetDefaultDelegate(endpointId, gDelegateTable[epIndex]); } } diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.h b/examples/chef/common/clusters/window-covering/chef-window-covering.h index 91e84f6fea5376..86339398440ce2 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.h +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.h @@ -31,7 +31,7 @@ namespace WindowCovering { /** @brief * Defines methods for implementing application-specific logic for the WindowCovering Cluster. */ -class DelegateImpl : public Delegate +class ChefDelegate : public Delegate { public: /** From 10108bc68ad37503711802d675e1f8162d404c6e Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:48:19 -0800 Subject: [PATCH 12/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index d9c9654cdec594..4ba2f293dddf81 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -62,6 +62,6 @@ void InitChefWindowCoveringCluster() gDelegateTable[epIndex] = std::make_unique<WindowCovering::ChefDelegate>(); gDelegateTable[epIndex]->SetEndpoint(endpointId); - WindowCovering::SetDefaultDelegate(endpointId, gDelegateTable[epIndex]); + WindowCovering::SetDefaultDelegate(endpointId, gDelegateTable[epIndex].get()); } } From 84948b7ec081108d011cd480cec0442f2422961a Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:49:10 -0800 Subject: [PATCH 13/28] + --- .../common/clusters/window-covering/chef-window-covering.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.h b/examples/chef/common/clusters/window-covering/chef-window-covering.h index 86339398440ce2..df3a2cc6a979af 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.h +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.h @@ -56,8 +56,8 @@ class ChefDelegate : public Delegate */ CHIP_ERROR HandleStopMotion() = 0; - ~DelegateImpl() = default; - DelegateImpl() = default; + ~ChefDelegate() = default; + ChefDelegate() = default; protected: EndpointId mEndpoint = 0; From f50c171c1f585fe50ee686616f7df1f586758e65 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:50:34 -0800 Subject: [PATCH 14/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 4ba2f293dddf81..fb00538a204fbe 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -30,7 +30,7 @@ static_assert(kWindowCoveringDelegateTableSize <= kEmberInvalidEndpointIndex, "W std::unique_ptr<WindowCovering::ChefDelegate> gDelegateTable[kWindowCoveringDelegateTableSize]; -std::unique_ptr<WindowCovering::ChefDelegate> * GetDelegate(EndpointId endpoint) +std::unique_ptr<WindowCovering::ChefDelegate> * GetDelegate(chip::EndpointId endpoint) { uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, WindowCovering::Id, MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); From bad46b82385363864e78216c41578d924d53284e Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:51:40 -0800 Subject: [PATCH 15/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index fb00538a204fbe..758d6663776cca 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -30,7 +30,7 @@ static_assert(kWindowCoveringDelegateTableSize <= kEmberInvalidEndpointIndex, "W std::unique_ptr<WindowCovering::ChefDelegate> gDelegateTable[kWindowCoveringDelegateTableSize]; -std::unique_ptr<WindowCovering::ChefDelegate> * GetDelegate(chip::EndpointId endpoint) +std::unique_ptr<WindowCovering::ChefDelegate> GetDelegate(chip::EndpointId endpoint) { uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, WindowCovering::Id, MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); From cf723d3ddd9c3839e4a1c8a8f08bbce06f7b434e Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 17:54:20 -0800 Subject: [PATCH 16/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 758d6663776cca..b50363f929e065 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -30,11 +30,11 @@ static_assert(kWindowCoveringDelegateTableSize <= kEmberInvalidEndpointIndex, "W std::unique_ptr<WindowCovering::ChefDelegate> gDelegateTable[kWindowCoveringDelegateTableSize]; -std::unique_ptr<WindowCovering::ChefDelegate> GetDelegate(chip::EndpointId endpoint) +WindowCovering::ChefDelegate * GetDelegate(chip::EndpointId endpoint) { uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, WindowCovering::Id, MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); - return (ep >= kWindowCoveringDelegateTableSize ? nullptr : gDelegateTable[ep]); + return (ep >= kWindowCoveringDelegateTableSize ? nullptr : gDelegateTable[ep].get()); } void InitChefWindowCoveringCluster() From eb462c987185d1d0aab66b459137141757ceafa8 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 18:49:52 -0800 Subject: [PATCH 17/28] + --- .../window-covering/chef-window-covering.cpp | 60 ++++++++++++++++++- .../window-covering/chef-window-covering.h | 4 +- 2 files changed, 59 insertions(+), 5 deletions(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index b50363f929e065..c60e578b83812e 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -18,11 +18,15 @@ #include "chef-window-covering.h" #include "app/clusters/window-covering-server/window-covering-server.h" +#include <app/reporting/reporting.h> #include <app/util/attribute-storage.h> #include <app/util/config.h> #include <app/util/endpoint-config-api.h> +#include <lib/support/logging/CHIPLogging.h> +using namespace chip; using namespace chip::app::Clusters; +using chip::Protocols::InteractionModel::Status; constexpr size_t kWindowCoveringDelegateTableSize = MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; @@ -30,7 +34,7 @@ static_assert(kWindowCoveringDelegateTableSize <= kEmberInvalidEndpointIndex, "W std::unique_ptr<WindowCovering::ChefDelegate> gDelegateTable[kWindowCoveringDelegateTableSize]; -WindowCovering::ChefDelegate * GetDelegate(chip::EndpointId endpoint) +WindowCovering::ChefDelegate * GetDelegate(EndpointId endpoint) { uint16_t ep = emberAfGetClusterServerEndpointIndex(endpoint, WindowCovering::Id, MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT); @@ -44,8 +48,8 @@ void InitChefWindowCoveringCluster() for (uint16_t endpointIndex = 0; endpointIndex < endpointCount; endpointIndex++) { // Get endpoint ID from index. - chip::EndpointId endpointId = emberAfEndpointFromIndex(endpointIndex); - if (endpointId == chip::kInvalidEndpointId) + EndpointId endpointId = emberAfEndpointFromIndex(endpointIndex); + if (endpointId == kInvalidEndpointId) { continue; } @@ -65,3 +69,53 @@ void InitChefWindowCoveringCluster() WindowCovering::SetDefaultDelegate(endpointId, gDelegateTable[epIndex].get()); } } + +CHIP_ERROR WindowCovering::ChefDelegate::HandleMovement(WindowCoveringType type) +{ + Status status; + app::DataModel::Nullable<Percent100ths> current; + + if (type == WindowCoveringType::Lift) + { + status = WindowCovering::Attributes::TargetPositionLiftPercent100ths::Get(mEndpoint, current); + if (status != Status::Success) + { + ChipLogError(DeviceLayer, "HandleMovement: Failed to get TargetPositionLiftPercent100ths - %d", to_underlying(status)); + return CHIP_ERROR_READ_FAILED; + } + + // Instant update. No transition for now. + status = WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Set(mEndpoint, current); + if (status != Status::Success) + { + ChipLogError(DeviceLayer, "HandleMovement: Failed to set CurrentPositionLiftPercent100ths - %d", to_underlying(status)); + return CHIP_ERROR_WRITE_FAILED; + } + + return CHIP_NO_ERROR; + } + else if (type == WindowCoveringType::Tilt) + { + status = WindowCovering::Attributes::TargetPositionTiltPercent100ths::Get(mEndpoint, current); + if (status != Status::Success) + { + ChipLogError(DeviceLayer, "HandleMovement: Failed to get TargetPositionTiltPercent100ths - %d", to_underlying(status)); + return CHIP_ERROR_READ_FAILED; + } + + // Instant update. No transition for now. + status = WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Set(mEndpoint, current); + if (status != Status::Success) + { + ChipLogError(DeviceLayer, "HandleMovement: Failed to set CurrentPositionTiltPercent100ths - %d", to_underlying(status)); + return CHIP_ERROR_WRITE_FAILED; + } + + return CHIP_NO_ERROR; + } +} + +CHIP_ERROR WindowCovering::ChefDelegate::HandleStopMotion() +{ + return CHIP_NO_ERROR; +} diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.h b/examples/chef/common/clusters/window-covering/chef-window-covering.h index df3a2cc6a979af..5dbdf8b9cf9fc4 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.h +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.h @@ -44,7 +44,7 @@ class ChefDelegate : public Delegate * @return CHIP_NO_ERROR On success. * @return Other Value indicating it failed to adjust window covering position. */ - CHIP_ERROR HandleMovement(WindowCoveringType type) = 0; + CHIP_ERROR HandleMovement(WindowCoveringType type); /** * @brief @@ -54,7 +54,7 @@ class ChefDelegate : public Delegate * @return Other Value indicating it failed to stop any adjusting to the physical tilt and lift/slide that is currently * occurring.. */ - CHIP_ERROR HandleStopMotion() = 0; + CHIP_ERROR HandleStopMotion(); ~ChefDelegate() = default; ChefDelegate() = default; From 1c29255f65bf79c61c12b4b8e6a2480c817fb703 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 18:55:57 -0800 Subject: [PATCH 18/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index c60e578b83812e..9758f2002a46fb 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -18,6 +18,7 @@ #include "chef-window-covering.h" #include "app/clusters/window-covering-server/window-covering-server.h" +#include <app-common/zap-generated/attributes/Accessors.h> #include <app/reporting/reporting.h> #include <app/util/attribute-storage.h> #include <app/util/config.h> From 54e87fc754107f1ac6749f30736aed37cec42768 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 18:56:47 -0800 Subject: [PATCH 19/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 9758f2002a46fb..30ceba893a3484 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -114,6 +114,7 @@ CHIP_ERROR WindowCovering::ChefDelegate::HandleMovement(WindowCoveringType type) return CHIP_NO_ERROR; } + return CHIP_NO_ERROR; } CHIP_ERROR WindowCovering::ChefDelegate::HandleStopMotion() From cf3576235bcbfdeddeb62a1dff81df1ab7fc4595 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 18:59:51 -0800 Subject: [PATCH 20/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 4 ++++ .../common/clusters/window-covering/chef-window-covering.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 30ceba893a3484..992a047243f53c 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -16,6 +16,8 @@ * limitations under the License. */ +#ifdef MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER + #include "chef-window-covering.h" #include "app/clusters/window-covering-server/window-covering-server.h" #include <app-common/zap-generated/attributes/Accessors.h> @@ -121,3 +123,5 @@ CHIP_ERROR WindowCovering::ChefDelegate::HandleStopMotion() { return CHIP_NO_ERROR; } + +#endif // MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.h b/examples/chef/common/clusters/window-covering/chef-window-covering.h index 5dbdf8b9cf9fc4..ffead3c57784f7 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.h +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.h @@ -16,6 +16,8 @@ * limitations under the License. */ +#ifdef MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER + #include <app/clusters/window-covering-server/window-covering-delegate.h> #pragma once @@ -69,3 +71,5 @@ class ChefDelegate : public Delegate } // namespace chip void InitChefWindowCoveringCluster(); + +#endif // MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER From 054d096aa30a56559b6077961c4456233050dd47 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 19:06:38 -0800 Subject: [PATCH 21/28] + --- examples/chef/common/stubs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp index 16e9b1b8694c64..c46671de72e214 100644 --- a/examples/chef/common/stubs.cpp +++ b/examples/chef/common/stubs.cpp @@ -81,6 +81,10 @@ const Clusters::Descriptor::Structs::SemanticTagStruct::Type freezerTagList[] #include "temperature-control/static-supported-temperature-levels.h" #endif // MATTER_DM_PLUGIN_TEMPERATURE_CONTROL_SERVER +#ifdef MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER +#include "window-coveering/window-covering.h" +#endif // MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER + Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer, uint16_t maxReadLength) @@ -350,6 +354,11 @@ void ApplicationInit() SetTagList(kColdCabinetEndpointId, Span<const Clusters::Descriptor::Structs::SemanticTagStruct::Type>(refrigeratorTagList)); SetTagList(kFreezeCabinetEndpointId, Span<const Clusters::Descriptor::Structs::SemanticTagStruct::Type>(freezerTagList)); #endif // MATTER_DM_PLUGIN_REFRIGERATOR_ALARM_SERVER + +#ifdef MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER + ChipLogProgress(NotSpecified, "Initializing WindowCovering cluster delegate."); + InitChefWindowCoveringCluster(); +#endif // MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER } void ApplicationShutdown() From 78e24ef5770660d7fb885bbc6466ccc0a33a8625 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 19:08:39 -0800 Subject: [PATCH 22/28] + --- examples/chef/common/stubs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp index c46671de72e214..812fd83e293130 100644 --- a/examples/chef/common/stubs.cpp +++ b/examples/chef/common/stubs.cpp @@ -82,7 +82,7 @@ const Clusters::Descriptor::Structs::SemanticTagStruct::Type freezerTagList[] #endif // MATTER_DM_PLUGIN_TEMPERATURE_CONTROL_SERVER #ifdef MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER -#include "window-coveering/window-covering.h" +#include "window-coveering/chef-window-covering.h" #endif // MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, From d97444cf3ee487f0251839ffbb96e76222b4b600 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 19:14:38 -0800 Subject: [PATCH 23/28] + --- examples/chef/common/stubs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chef/common/stubs.cpp b/examples/chef/common/stubs.cpp index 812fd83e293130..ace91bf7187ec8 100644 --- a/examples/chef/common/stubs.cpp +++ b/examples/chef/common/stubs.cpp @@ -82,7 +82,7 @@ const Clusters::Descriptor::Structs::SemanticTagStruct::Type freezerTagList[] #endif // MATTER_DM_PLUGIN_TEMPERATURE_CONTROL_SERVER #ifdef MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER -#include "window-coveering/chef-window-covering.h" +#include "window-covering/chef-window-covering.h" #endif // MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, From ad1a76006df42a2203b3a0d07a500a5430276f0a Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 19:17:01 -0800 Subject: [PATCH 24/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 4 ---- .../common/clusters/window-covering/chef-window-covering.h | 4 ---- 2 files changed, 8 deletions(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 992a047243f53c..30ceba893a3484 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -16,8 +16,6 @@ * limitations under the License. */ -#ifdef MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER - #include "chef-window-covering.h" #include "app/clusters/window-covering-server/window-covering-server.h" #include <app-common/zap-generated/attributes/Accessors.h> @@ -123,5 +121,3 @@ CHIP_ERROR WindowCovering::ChefDelegate::HandleStopMotion() { return CHIP_NO_ERROR; } - -#endif // MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.h b/examples/chef/common/clusters/window-covering/chef-window-covering.h index ffead3c57784f7..5dbdf8b9cf9fc4 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.h +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.h @@ -16,8 +16,6 @@ * limitations under the License. */ -#ifdef MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER - #include <app/clusters/window-covering-server/window-covering-delegate.h> #pragma once @@ -71,5 +69,3 @@ class ChefDelegate : public Delegate } // namespace chip void InitChefWindowCoveringCluster(); - -#endif // MATTER_DM_PLUGIN_WINDOW_COVERING_SERVER From 86ff54013a07e37a95fa04d51abef9ef4002164f Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 20:29:33 -0800 Subject: [PATCH 25/28] + --- .../common/clusters/window-covering/chef-window-covering.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.h b/examples/chef/common/clusters/window-covering/chef-window-covering.h index 5dbdf8b9cf9fc4..852354bba31bdc 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.h +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.h @@ -58,9 +58,6 @@ class ChefDelegate : public Delegate ~ChefDelegate() = default; ChefDelegate() = default; - -protected: - EndpointId mEndpoint = 0; }; } // namespace WindowCovering From 714a24192395db33beabd78491cc020b54b2b7d0 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 20:38:10 -0800 Subject: [PATCH 26/28] + --- .../clusters/window-covering/chef-window-covering.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 30ceba893a3484..ef4031bad46d92 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -93,6 +93,9 @@ CHIP_ERROR WindowCovering::ChefDelegate::HandleMovement(WindowCoveringType type) return CHIP_ERROR_WRITE_FAILED; } + MatterReportingAttributeChangeCallback(endpointId, WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); + return CHIP_NO_ERROR; } else if (type == WindowCoveringType::Tilt) @@ -112,6 +115,9 @@ CHIP_ERROR WindowCovering::ChefDelegate::HandleMovement(WindowCoveringType type) return CHIP_ERROR_WRITE_FAILED; } + MatterReportingAttributeChangeCallback(endpointId, WindowCovering::Id, + WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); + return CHIP_NO_ERROR; } return CHIP_NO_ERROR; From 40f6e3594a3305edab8c4d85c8c4d33941aaaa78 Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Mon, 3 Mar 2025 20:39:26 -0800 Subject: [PATCH 27/28] + --- .../common/clusters/window-covering/chef-window-covering.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index ef4031bad46d92..6b762ed1729fba 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -93,7 +93,7 @@ CHIP_ERROR WindowCovering::ChefDelegate::HandleMovement(WindowCoveringType type) return CHIP_ERROR_WRITE_FAILED; } - MatterReportingAttributeChangeCallback(endpointId, WindowCovering::Id, + MatterReportingAttributeChangeCallback(mEndpoint, WindowCovering::Id, WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id); return CHIP_NO_ERROR; @@ -115,7 +115,7 @@ CHIP_ERROR WindowCovering::ChefDelegate::HandleMovement(WindowCoveringType type) return CHIP_ERROR_WRITE_FAILED; } - MatterReportingAttributeChangeCallback(endpointId, WindowCovering::Id, + MatterReportingAttributeChangeCallback(mEndpoint, WindowCovering::Id, WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id); return CHIP_NO_ERROR; From 04ba8a4f96e0ec0f777130e8d09508c71779b1bc Mon Sep 17 00:00:00 2001 From: Shreyas Balakrishna Bhandare <shreyasbalakrishna19@gmail.com> Date: Tue, 4 Mar 2025 10:26:16 -0800 Subject: [PATCH 28/28] Review comments --- .../clusters/window-covering/chef-window-covering.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp index 6b762ed1729fba..ffcd66e08601d6 100644 --- a/examples/chef/common/clusters/window-covering/chef-window-covering.cpp +++ b/examples/chef/common/clusters/window-covering/chef-window-covering.cpp @@ -29,8 +29,7 @@ using namespace chip; using namespace chip::app::Clusters; using chip::Protocols::InteractionModel::Status; -constexpr size_t kWindowCoveringDelegateTableSize = - MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT; +constexpr size_t kWindowCoveringDelegateTableSize = MATTER_DM_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT; static_assert(kWindowCoveringDelegateTableSize <= kEmberInvalidEndpointIndex, "WindowCovering Delegate table size error"); std::unique_ptr<WindowCovering::ChefDelegate> gDelegateTable[kWindowCoveringDelegateTableSize]; @@ -48,7 +47,6 @@ void InitChefWindowCoveringCluster() for (uint16_t endpointIndex = 0; endpointIndex < endpointCount; endpointIndex++) { - // Get endpoint ID from index. EndpointId endpointId = emberAfEndpointFromIndex(endpointIndex); if (endpointId == kInvalidEndpointId) { @@ -81,7 +79,8 @@ CHIP_ERROR WindowCovering::ChefDelegate::HandleMovement(WindowCoveringType type) status = WindowCovering::Attributes::TargetPositionLiftPercent100ths::Get(mEndpoint, current); if (status != Status::Success) { - ChipLogError(DeviceLayer, "HandleMovement: Failed to get TargetPositionLiftPercent100ths - %d", to_underlying(status)); + ChipLogError(DeviceLayer, "HandleMovement: Failed to get TargetPositionLiftPercent100ths with error code %d", + to_underlying(status)); return CHIP_ERROR_READ_FAILED; } @@ -89,7 +88,8 @@ CHIP_ERROR WindowCovering::ChefDelegate::HandleMovement(WindowCoveringType type) status = WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Set(mEndpoint, current); if (status != Status::Success) { - ChipLogError(DeviceLayer, "HandleMovement: Failed to set CurrentPositionLiftPercent100ths - %d", to_underlying(status)); + ChipLogError(DeviceLayer, "HandleMovement: Failed to set CurrentPositionLiftPercent100ths with error code %d", + to_underlying(status)); return CHIP_ERROR_WRITE_FAILED; }