From b634ec02ed88b21d767421090daa938d6f59b2a6 Mon Sep 17 00:00:00 2001 From: Erik Hove Date: Wed, 13 Dec 2023 17:41:26 -0600 Subject: [PATCH] cleanup: remove operationalState changes --- .../all-clusters-common/all-clusters-app.zap | 12 +- .../include/oven-operational-state-delegate.h | 141 ------ .../src/oven-operational-state-delegate.cpp | 55 --- .../esp32/main/CMakeLists.txt | 383 ++++++++-------- examples/all-clusters-app/linux/BUILD.gn | 1 - .../all-clusters-app/linux/main-common.cpp | 3 - .../operational-state-oven-cluster-objects.h | 271 ------------ .../operational-state-oven-server.cpp | 411 ------------------ .../operational-state-oven-server.h | 280 ------------ .../zcl/data-model/chip/matter-devices.xml | 2 - .../zcl/zcl-with-test-extensions.json | 61 +-- src/app/zap-templates/zcl/zcl.json | 61 +-- .../data_model/controller-clusters.zap | 272 ++++++++++-- ...nalStateClusterOperationCompletionEvent.kt | 106 ----- ...tionalStateClusterOperationalErrorEvent.kt | 61 --- ...OperationalStateClusterErrorStateStruct.kt | 85 ---- ...ionalStateClusterOperationalStateStruct.kt | 74 ---- .../clusters/OvenOperationalStateCluster.kt | 211 --------- ...nalStateClusterOperationCompletionEvent.kt | 106 ----- ...tionalStateClusterOperationalErrorEvent.kt | 62 --- ...OperationalStateClusterErrorStateStruct.kt | 85 ---- ...ionalStateClusterOperationalStateStruct.kt | 74 ---- 22 files changed, 469 insertions(+), 2348 deletions(-) delete mode 100644 examples/all-clusters-app/all-clusters-common/include/oven-operational-state-delegate.h delete mode 100644 examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp delete mode 100644 src/app/clusters/operational-state-oven-server/operational-state-oven-cluster-objects.h delete mode 100644 src/app/clusters/operational-state-oven-server/operational-state-oven-server.cpp delete mode 100644 src/app/clusters/operational-state-oven-server/operational-state-oven-server.h delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationCompletionEvent.kt delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationalErrorEvent.kt delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenOperationalStateClusterErrorStateStruct.kt delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenOperationalStateClusterOperationalStateStruct.kt delete mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/OvenOperationalStateCluster.kt delete mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationCompletionEvent.kt delete mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationalErrorEvent.kt delete mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/structs/OvenOperationalStateClusterErrorStateStruct.kt delete mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/structs/OvenOperationalStateClusterOperationalStateStruct.kt diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index a2147d313fb6eb..5a1f7dda92b738 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -17,12 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json", @@ -30,6 +24,12 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data with some extensions" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" } ], "endpointTypes": [ diff --git a/examples/all-clusters-app/all-clusters-common/include/oven-operational-state-delegate.h b/examples/all-clusters-app/all-clusters-common/include/oven-operational-state-delegate.h deleted file mode 100644 index 8381792c483d5b..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/include/oven-operational-state-delegate.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include - -namespace chip { -namespace app { -namespace Clusters { - -// class RvcDevice; - -// typedef void (RvcDevice::*HandleOpStateCommand)(Clusters::OperationalState::GenericOperationalError & err); - -namespace OvenCavityOperationalState { - -// This is an application level delegate to handle operational state commands according to the specific business logic. -class OvenCavityOperationalStateDelegate : public OperationalState::Delegate -{ -private: - const Clusters::OperationalState::GenericOperationalState mOperationalStateList[8] = { - OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kStopped)), - OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kRunning)), - OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kPaused)), - OperationalState::GenericOperationalState(to_underlying(OperationalState::OperationalStateEnum::kError)), - // OperationalState::GenericOperationalState(to_underlying(Clusters::OvenCavityOperationalState::OperationalStateEnum::kPreheating)), - // OperationalState::GenericOperationalState(to_underlying(Clusters::OvenCavityOperationalState::OperationalStateEnum::kPreheated)), - // OperationalState::GenericOperationalState(to_underlying(Clusters::OvenCavityOperationalState::OperationalStateEnum::kCoolingDown)), - // OperationalState::GenericOperationalState(to_underlying(Clusters::OvenCavityOperationalState::OperationalStateEnum::kSelfCleaning)) - }; - - const Clusters::OperationalState::GenericOperationalPhase mOperationalPhaseList[1] = { - // Phase List is null - OperationalState::GenericOperationalPhase(DataModel::Nullable()), - }; - - //RvcDevice * mPauseRvcDeviceInstance; - //HandleOpStateCommand mPauseCallback; - //RvcDevice * mResumeRvcDeviceInstance; - //HandleOpStateCommand mResumeCallback; - -public: - /** - * Get the countdown time. This attribute is not supported in our example RVC app. - * @return Null. - */ - DataModel::Nullable GetCountdownTime() override { return {}; }; - - /** - * Fills in the provided GenericOperationalState with the state at index `index` if there is one, - * or returns CHIP_ERROR_NOT_FOUND if the index is out of range for the list of states. - * Note: This is used by the SDK to populate the operational state list attribute. If the contents of this list changes, - * the device SHALL call the Instance's ReportOperationalStateListChange method to report that this attribute has changed. - * @param index The index of the state, with 0 representing the first state. - * @param operationalState The GenericOperationalState is filled. - */ - CHIP_ERROR GetOperationalStateAtIndex(size_t index, - Clusters::OperationalState::GenericOperationalState & operationalState) override; - - /** - * Fills in the provided GenericOperationalPhase with the phase at index `index` if there is one, - * or returns CHIP_ERROR_NOT_FOUND if the index is out of range for the list of phases. - * Note: This is used by the SDK to populate the phase list attribute. If the contents of this list changes, the - * device SHALL call the Instance's ReportPhaseListChange method to report that this attribute has changed. - * @param index The index of the phase, with 0 representing the first phase. - * @param operationalPhase The GenericOperationalPhase is filled. - */ - CHIP_ERROR GetOperationalPhaseAtIndex(size_t index, - Clusters::OperationalState::GenericOperationalPhase & operationalPhase) override; - - // command callback - /** - * Handle Command Callback in application: Pause - * @param[out] get operational error after callback. - */ - void HandlePauseStateCallback(Clusters::OperationalState::GenericOperationalError & err) override{ - // This command in not supported. - }; - - /** - * Handle Command Callback in application: Resume - * @param[out] get operational error after callback. - */ - void HandleResumeStateCallback(Clusters::OperationalState::GenericOperationalError & err) override{ - // This command in not supported. - }; - - /** - * Handle Command Callback in application: Start - * @param[out] get operational error after callback. - */ - void HandleStartStateCallback(Clusters::OperationalState::GenericOperationalError & err) override{ - // This command in not supported. - }; - - /** - * Handle Command Callback in application: Stop - * @param[out] get operational error after callback. - */ - void HandleStopStateCallback(Clusters::OperationalState::GenericOperationalError & err) override{ - // This command in not supported. - }; - - // void SetPauseCallback(HandleOpStateCommand aCallback, RvcDevice * aInstance) - // { - // mPauseCallback = aCallback; - // mPauseRvcDeviceInstance = aInstance; - // }; - - // void SetResumeCallback(HandleOpStateCommand aCallback, RvcDevice * aInstance) - // { - // mResumeCallback = aCallback; - // mResumeRvcDeviceInstance = aInstance; - // }; -}; - -//void Shutdown(); - -} // namespace OvenCavityOperationalState -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp b/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp deleted file mode 100644 index ea8e1f19af2db6..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp +++ /dev/null @@ -1,55 +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 - -using namespace chip; -using namespace chip::app; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::OvenCavityOperationalState; - -CHIP_ERROR OvenCavityOperationalStateDelegate::GetOperationalStateAtIndex(size_t index, - OperationalState::GenericOperationalState & operationalState) -{ - if (index >= ArraySize(mOperationalStateList)) - { - return CHIP_ERROR_NOT_FOUND; - } - operationalState = mOperationalStateList[index]; - return CHIP_NO_ERROR; -} - -CHIP_ERROR OvenCavityOperationalStateDelegate::GetOperationalPhaseAtIndex(size_t index, - OperationalState::GenericOperationalPhase & operationalPhase) -{ - if (index >= ArraySize(mOperationalPhaseList)) - { - return CHIP_ERROR_NOT_FOUND; - } - operationalPhase = mOperationalPhaseList[index]; - return CHIP_NO_ERROR; -} - -// void RvcOperationalStateDelegate::HandlePauseStateCallback(OperationalState::GenericOperationalError & err) -// { -// (mPauseRvcDeviceInstance->*mPauseCallback)(err); -// } - -// void RvcOperationalStateDelegate::HandleResumeStateCallback(OperationalState::GenericOperationalError & err) -// { -// (mResumeRvcDeviceInstance->*mResumeCallback)(err); -// } diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 07a7e383f8d561..62495a64ef6622 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -1,139 +1,139 @@ # -# Copyright (c) 2021 Project CHIP Authors -# All rights reserved. +# Copyright (c) 2021 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 +# 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 +# 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. +# 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. # # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) # The list of src and include dirs must be in sync with that in all-clusters-app/esp32/main/component.mk set(PRIV_INCLUDE_DIRS_LIST - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" - "${CMAKE_CURRENT_LIST_DIR}/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/third_party/nlfaultinjection/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" + "${CMAKE_CURRENT_LIST_DIR}/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/third_party/nlfaultinjection/include" ) set(SRC_DIRS_LIST - "${CMAKE_CURRENT_LIST_DIR}" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/mode-support" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/test-cluster-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fault-injection-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/barrier-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/window-covering-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/color-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/mode-select-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/mode-base-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/low-power-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-user-interface-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/smoke-co-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/refrigerator-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/switch-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/bindings" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/icd-management-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wake-on-lan-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/pump-configuration-and-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/resource-monitoring-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-state-oven-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src" + "${CMAKE_CURRENT_LIST_DIR}" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/shell_extension" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/mode-support" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/icd" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/util" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/reporting" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/administrator-commissioning-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/test-cluster-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/descriptor" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fault-injection-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fan-control-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/fixed-label-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/user-label-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/level-control" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/identify-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/access-control-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/barrier-control-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/window-covering-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/color-control-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/mode-select-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/mode-base-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/low-power-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-user-interface-configuration-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/smoke-co-alarm-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/refrigerator-alarm-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/switch-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/group-key-mgmt-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/basic-information" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/bindings" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/icd-management-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/occupancy-sensor-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/localization-configuration-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-format-localization-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wake-on-lan-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/pump-configuration-and-control-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/resource-monitoring-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src" ) + set(EXCLUDE_SRCS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp") -if(CONFIG_ENABLE_PW_RPC) - # Append additional directories for RPC build - set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/pw_sys_io/public" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/lib/support" - ) +if (CONFIG_ENABLE_PW_RPC) +# Append additional directories for RPC build +set(PRIV_INCLUDE_DIRS_LIST "${PRIV_INCLUDE_DIRS_LIST}" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/pw_sys_io/public" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/lib/support" +) - if(${IDF_VERSION_MAJOR} LESS 5) +if (${IDF_VERSION_MAJOR} LESS 5) list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/include/freertos") - else() +else() list(APPEND PRIV_INCLUDE_DIRS_LIST "${IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos") - endif() +endif() - set(SRC_DIRS_LIST "${SRC_DIRS_LIST}" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32" - ) -endif(CONFIG_ENABLE_PW_RPC) +set(SRC_DIRS_LIST "${SRC_DIRS_LIST}" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/common/pigweed/esp32" +) +endif (CONFIG_ENABLE_PW_RPC) -if(CONFIG_ENABLE_ICD_SERVER) - list(APPEND PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/icd") - list(APPEND SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/icd") +if (CONFIG_ENABLE_ICD_SERVER) + list(APPEND PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/icd") + list(APPEND SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/icd") endif() set(PRIV_REQUIRES_LIST chip QRCode bt app_update nvs_flash spi_flash openthread) if(${IDF_TARGET} STREQUAL "esp32") - list(APPEND PRIV_REQUIRES_LIST spidriver screen-framework) + list(APPEND PRIV_REQUIRES_LIST spidriver screen-framework) endif() if(CONFIG_DEVICE_TYPE_ESP32_C3_DEVKITM) - list(APPEND PRIV_REQUIRES_LIST led_strip) + list(APPEND PRIV_REQUIRES_LIST led_strip) endif() idf_component_register(PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST} - SRC_DIRS ${SRC_DIRS_LIST} - EXCLUDE_SRCS ${EXCLUDE_SRCS} - PRIV_REQUIRES ${PRIV_REQUIRES_LIST}) + SRC_DIRS ${SRC_DIRS_LIST} + EXCLUDE_SRCS ${EXCLUDE_SRCS} + PRIV_REQUIRES ${PRIV_REQUIRES_LIST}) get_filename_component(CHIP_ROOT ${CMAKE_SOURCE_DIR}/third_party/connectedhomeip REALPATH) @@ -145,132 +145,135 @@ chip_app_component_zapgen("${CHIP_ROOT}/examples/all-clusters-app/all-clusters-c set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") target_compile_options(${COMPONENT_LIB} PUBLIC - "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" + "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" ) -if(CONFIG_ENABLE_PW_RPC) - set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo") - include(${PIGWEED_ROOT}/pw_build/pigweed.cmake) - include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake) - set(dir_pw_third_party_nanopb "${CHIP_ROOT}/third_party/nanopb/repo" CACHE STRING "" FORCE) +if (CONFIG_ENABLE_PW_RPC) - pw_proto_library(attributes_service - SOURCES + +set(PIGWEED_ROOT "${CHIP_ROOT}/third_party/pigweed/repo") +include(${PIGWEED_ROOT}/pw_build/pigweed.cmake) +include(${PIGWEED_ROOT}/pw_protobuf_compiler/proto.cmake) +set(dir_pw_third_party_nanopb "${CHIP_ROOT}/third_party/nanopb/repo" CACHE STRING "" FORCE) + +pw_proto_library(attributes_service + SOURCES ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.proto - INPUTS + INPUTS ${CHIP_ROOT}/examples/common/pigweed/protos/attributes_service.options - PREFIX + PREFIX attributes_service - STRIP_PREFIX + STRIP_PREFIX ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS + DEPS pw_protobuf.common_proto - ) +) - pw_proto_library(button_service - SOURCES +pw_proto_library(button_service + SOURCES ${CHIP_ROOT}/examples/common/pigweed/protos/button_service.proto - PREFIX + PREFIX button_service - STRIP_PREFIX + STRIP_PREFIX ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS + DEPS pw_protobuf.common_proto - ) +) - pw_proto_library(descriptor_service - SOURCES +pw_proto_library(descriptor_service + SOURCES ${CHIP_ROOT}/examples/common/pigweed/protos/descriptor_service.proto - PREFIX + PREFIX descriptor_service - STRIP_PREFIX + STRIP_PREFIX ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS + DEPS pw_protobuf.common_proto - ) +) - pw_proto_library(device_service - SOURCES +pw_proto_library(device_service + SOURCES ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.proto - INPUTS + INPUTS ${CHIP_ROOT}/examples/common/pigweed/protos/device_service.options - PREFIX + PREFIX device_service - STRIP_PREFIX + STRIP_PREFIX ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS + DEPS pw_protobuf.common_proto - ) +) - pw_proto_library(lighting_service - SOURCES +pw_proto_library(lighting_service + SOURCES ${CHIP_ROOT}/examples/common/pigweed/protos/lighting_service.proto - PREFIX + PREFIX lighting_service - STRIP_PREFIX + STRIP_PREFIX ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS + DEPS pw_protobuf.common_proto - ) +) - pw_proto_library(locking_service - SOURCES +pw_proto_library(locking_service + SOURCES ${CHIP_ROOT}/examples/common/pigweed/protos/locking_service.proto - PREFIX + PREFIX locking_service - STRIP_PREFIX + STRIP_PREFIX ${CHIP_ROOT}/examples/common/pigweed/protos - DEPS + DEPS pw_protobuf.common_proto - ) +) - pw_proto_library(wifi_service - SOURCES +pw_proto_library(wifi_service + SOURCES ${CHIP_ROOT}/examples/common/pigweed/protos/wifi_service.proto - INPUTS + INPUTS ${CHIP_ROOT}/examples/common/pigweed/protos/wifi_service.options - PREFIX + PREFIX wifi_service - DEPS + DEPS pw_protobuf.common_proto - STRIP_PREFIX + STRIP_PREFIX ${CHIP_ROOT}/examples/common/pigweed/protos - ) +) - target_link_libraries(${COMPONENT_LIB} PUBLIC - attributes_service.nanopb_rpc - button_service.nanopb_rpc - descriptor_service.nanopb_rpc - device_service.nanopb_rpc - lighting_service.nanopb_rpc - locking_service.nanopb_rpc - wifi_service.nanopb_rpc - pw_checksum - pw_hdlc - pw_log - pw_rpc.server - pw_sys_io - pw_trace - pw_trace_tokenized - pw_trace_tokenized.trace_buffer - pw_trace_tokenized.rpc_service - pw_trace_tokenized.protos.nanopb_rpc - ) +target_link_libraries(${COMPONENT_LIB} PUBLIC + attributes_service.nanopb_rpc + button_service.nanopb_rpc + descriptor_service.nanopb_rpc + device_service.nanopb_rpc + lighting_service.nanopb_rpc + locking_service.nanopb_rpc + wifi_service.nanopb_rpc + pw_checksum + pw_hdlc + pw_log + pw_rpc.server + pw_sys_io + pw_trace + pw_trace_tokenized + pw_trace_tokenized.trace_buffer + pw_trace_tokenized.rpc_service + pw_trace_tokenized.protos.nanopb_rpc +) - target_link_options(${COMPONENT_LIB} - PUBLIC +target_link_options(${COMPONENT_LIB} + PUBLIC "-T${PIGWEED_ROOT}/pw_tokenizer/pw_tokenizer_linker_sections.ld" "-L${PIGWEED_ROOT}/pw_tokenizer" - ) +) + +target_compile_options(${COMPONENT_LIB} PRIVATE + "-DPW_RPC_ATTRIBUTE_SERVICE=1" + "-DPW_RPC_BUTTON_SERVICE=1" + "-DPW_RPC_DESCRIPTOR_SERVICE=1" + "-DPW_RPC_DEVICE_SERVICE=1" + "-DPW_RPC_LIGHTING_SERVICE=1" + "-DPW_RPC_LOCKING_SERVICE=1" + "-DPW_RPC_TRACING_SERVICE=1" + "-DPW_RPC_WIFI_SERVICE=1" + "-DPW_TRACE_BACKEND_SET=1") - target_compile_options(${COMPONENT_LIB} PRIVATE - "-DPW_RPC_ATTRIBUTE_SERVICE=1" - "-DPW_RPC_BUTTON_SERVICE=1" - "-DPW_RPC_DESCRIPTOR_SERVICE=1" - "-DPW_RPC_DEVICE_SERVICE=1" - "-DPW_RPC_LIGHTING_SERVICE=1" - "-DPW_RPC_LOCKING_SERVICE=1" - "-DPW_RPC_TRACING_SERVICE=1" - "-DPW_RPC_WIFI_SERVICE=1" - "-DPW_TRACE_BACKEND_SET=1") -endif(CONFIG_ENABLE_PW_RPC) +endif (CONFIG_ENABLE_PW_RPC) diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 7e966774e81919..77d95ed910c595 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -33,7 +33,6 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/microwave-oven-mode.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/operational-state-delegate-impl.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-operational-state-delegate.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-delegates.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", diff --git a/examples/all-clusters-app/linux/main-common.cpp b/examples/all-clusters-app/linux/main-common.cpp index 1707b06800e867..a33107ecdbad25 100644 --- a/examples/all-clusters-app/linux/main-common.cpp +++ b/examples/all-clusters-app/linux/main-common.cpp @@ -26,7 +26,6 @@ #include "microwave-oven-mode.h" #include "operational-state-delegate-impl.h" #include "oven-modes.h" -#include "oven-operational-state-delegate-impl.h" #include "resource-monitoring-delegates.h" #include "rvc-modes.h" #include "tcc-mode.h" @@ -237,9 +236,7 @@ void ApplicationShutdown() Clusters::AirQuality::Shutdown(); Clusters::OperationalState::Shutdown(); Clusters::RvcOperationalState::Shutdown(); - Clusters::OvenMode::Shutdown(); - Clusters::OvenCavityOperationalState::Shutdown(); if (sChipNamedPipeCommands.Stop() != CHIP_NO_ERROR) { diff --git a/src/app/clusters/operational-state-oven-server/operational-state-oven-cluster-objects.h b/src/app/clusters/operational-state-oven-server/operational-state-oven-cluster-objects.h deleted file mode 100644 index 1910e00d20effb..00000000000000 --- a/src/app/clusters/operational-state-oven-server/operational-state-oven-cluster-objects.h +++ /dev/null @@ -1,271 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -namespace chip { -namespace app { -namespace Clusters { -namespace OperationalState { - -inline constexpr size_t kOperationalStateLabelMaxSize = 64u; -inline constexpr size_t kOperationalErrorLabelMaxSize = 64u; -inline constexpr size_t kOperationalErrorDetailsMaxSize = 64u; -inline constexpr size_t kOperationalPhaseNameMaxSize = 64u; - -/** - * A class which represents the operational state of an Operational State cluster derivation instance. - */ -struct GenericOperationalState : public app::Clusters::detail::Structs::OperationalStateStruct::Type -{ - GenericOperationalState(uint8_t state = to_underlying(OperationalStateEnum::kStopped), Optional label = NullOptional) - { - Set(state, label); - } - - GenericOperationalState(const GenericOperationalState & op) { *this = op; } - - GenericOperationalState & operator=(const GenericOperationalState & op) - { - Set(op.operationalStateID, op.operationalStateLabel); - return *this; - } - - void Set(uint8_t state, Optional label = NullOptional) - { - operationalStateID = state; - if (label.HasValue()) - { - memset(mOperationalStateLabelBuffer, 0, sizeof(mOperationalStateLabelBuffer)); - if (label.Value().size() > sizeof(mOperationalStateLabelBuffer)) - { - memcpy(mOperationalStateLabelBuffer, label.Value().data(), sizeof(mOperationalStateLabelBuffer)); - operationalStateLabel.SetValue(CharSpan(mOperationalStateLabelBuffer, sizeof(mOperationalStateLabelBuffer))); - } - else - { - memcpy(mOperationalStateLabelBuffer, label.Value().data(), label.Value().size()); - operationalStateLabel.SetValue(CharSpan(mOperationalStateLabelBuffer, label.Value().size())); - } - } - else - { - operationalStateLabel = NullOptional; - } - } - -private: - char mOperationalStateLabelBuffer[kOperationalStateLabelMaxSize]; -}; - -/** - * A class which represents the operational error of an Operational State cluster derivation instance. - */ -struct GenericOperationalError : public app::Clusters::detail::Structs::ErrorStateStruct::Type -{ - GenericOperationalError(uint8_t state, Optional label = NullOptional, - Optional details = NullOptional) - { - Set(state, label, details); - } - - GenericOperationalError(const GenericOperationalError & error) { *this = error; } - - GenericOperationalError & operator=(const GenericOperationalError & error) - { - Set(error.errorStateID, error.errorStateLabel, error.errorStateDetails); - return *this; - } - - void Set(uint8_t state, Optional label = NullOptional, Optional details = NullOptional) - { - errorStateID = state; - if (label.HasValue()) - { - memset(mErrorStateLabelBuffer, 0, sizeof(mErrorStateLabelBuffer)); - if (label.Value().size() > sizeof(mErrorStateLabelBuffer)) - { - memcpy(mErrorStateLabelBuffer, label.Value().data(), sizeof(mErrorStateLabelBuffer)); - errorStateLabel.SetValue(CharSpan(mErrorStateLabelBuffer, sizeof(mErrorStateLabelBuffer))); - } - else - { - memcpy(mErrorStateLabelBuffer, label.Value().data(), label.Value().size()); - errorStateLabel.SetValue(CharSpan(mErrorStateLabelBuffer, label.Value().size())); - } - } - else - { - errorStateLabel = NullOptional; - } - - if (details.HasValue()) - { - memset(mErrorStateDetailsBuffer, 0, sizeof(mErrorStateDetailsBuffer)); - if (details.Value().size() > sizeof(mErrorStateDetailsBuffer)) - { - memcpy(mErrorStateDetailsBuffer, details.Value().data(), sizeof(mErrorStateDetailsBuffer)); - errorStateDetails.SetValue(CharSpan(mErrorStateDetailsBuffer, sizeof(mErrorStateDetailsBuffer))); - } - else - { - memcpy(mErrorStateDetailsBuffer, details.Value().data(), details.Value().size()); - errorStateDetails.SetValue(CharSpan(mErrorStateDetailsBuffer, details.Value().size())); - } - } - else - { - errorStateDetails = NullOptional; - } - } - - bool IsEqual(const Structs::ErrorStateStruct::Type & rhs) const - { - if (errorStateID != rhs.errorStateID) - { - return false; - } - if (errorStateLabel.HasValue() != rhs.errorStateLabel.HasValue() || - errorStateDetails.HasValue() != rhs.errorStateDetails.HasValue()) - { - return false; - } - if (errorStateLabel.HasValue()) - { - if (!errorStateLabel.Value().data_equal(rhs.errorStateLabel.Value())) - { - return false; - } - } - if (errorStateDetails.HasValue()) - { - if (!errorStateDetails.Value().data_equal(rhs.errorStateDetails.Value())) - { - return false; - } - } - - return true; - } - -private: - char mErrorStateLabelBuffer[kOperationalErrorLabelMaxSize]; - char mErrorStateDetailsBuffer[kOperationalErrorDetailsMaxSize]; -}; - -/** - * A class which represents the operational phase of an Operational State cluster derivation instance. - */ -struct GenericOperationalPhase -{ - GenericOperationalPhase(app::DataModel::Nullable name) { Set(name); } - - GenericOperationalPhase(const GenericOperationalPhase & ph) { *this = ph; } - - GenericOperationalPhase & operator=(const GenericOperationalPhase & ph) - { - Set(ph.mPhaseName); - return *this; - } - - bool IsMissing() const { return mPhaseName.IsNull(); } - app::DataModel::Nullable mPhaseName; - -private: - void Set(app::DataModel::Nullable name) - { - if (name.IsNull()) - { - mPhaseName.SetNull(); - } - else - { - memset(mPhaseNameBuffer, 0, sizeof(mPhaseNameBuffer)); - if (name.Value().size() > sizeof(mPhaseNameBuffer)) - { - memcpy(mPhaseNameBuffer, name.Value().data(), sizeof(mPhaseNameBuffer)); - mPhaseName = app::DataModel::Nullable(CharSpan(mPhaseNameBuffer, sizeof(mPhaseNameBuffer))); - } - else - { - memcpy(mPhaseNameBuffer, name.Value().data(), name.Value().size()); - mPhaseName = app::DataModel::Nullable(CharSpan(mPhaseNameBuffer, name.Value().size())); - } - } - } - - char mPhaseNameBuffer[kOperationalPhaseNameMaxSize]; -}; - -/** - * A class which represents the operational error event of an Operational State cluster derivation instance. - */ -class GenericErrorEvent : private app::Clusters::OperationalState::Events::OperationalError::Type -{ - using super = app::Clusters::OperationalState::Events::OperationalError::Type; - -public: - GenericErrorEvent(ClusterId aClusterId, const Structs::ErrorStateStruct::Type & aError) : mClusterId(aClusterId) - { - errorState = aError; - } - using super::GetEventId; - using super::GetPriorityLevel; - ClusterId GetClusterId() const { return mClusterId; } - using super::Encode; - using super::kIsFabricScoped; - -private: - ClusterId mClusterId; -}; - -/** - * A class which represents the operational completion event of an Operational State cluster derivation instance. - */ -class GenericOperationCompletionEvent : private app::Clusters::OperationalState::Events::OperationCompletion::Type -{ - using super = app::Clusters::OperationalState::Events::OperationCompletion::Type; - -public: - GenericOperationCompletionEvent(ClusterId aClusterId, uint8_t aCompletionErrorCode, - const Optional> & aTotalOperationalTime = NullOptional, - const Optional> & aPausedTime = NullOptional) : - mClusterId(aClusterId) - { - completionErrorCode = aCompletionErrorCode; - totalOperationalTime = aTotalOperationalTime; - pausedTime = aPausedTime; - } - using super::GetEventId; - using super::GetPriorityLevel; - ClusterId GetClusterId() const { return mClusterId; } - using super::Encode; - using super::kIsFabricScoped; - -private: - ClusterId mClusterId; -}; - -} // namespace OperationalState -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/src/app/clusters/operational-state-oven-server/operational-state-oven-server.cpp b/src/app/clusters/operational-state-oven-server/operational-state-oven-server.cpp deleted file mode 100644 index 3c4809401b8db3..00000000000000 --- a/src/app/clusters/operational-state-oven-server/operational-state-oven-server.cpp +++ /dev/null @@ -1,411 +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. - */ - -/**************************************************************************** - * @file - * @brief Implementation for the Operational State Server Cluster - ***************************************************************************/ -#include "operational-state-oven-server.h" -#include -#include -#include -#include -#include -#include - -using namespace chip; -using namespace chip::app; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::OperationalState; -using namespace chip::app::Clusters::OperationalState::Attributes; - -using Status = Protocols::InteractionModel::Status; - -Instance::Instance(Delegate * aDelegate, EndpointId aEndpointId, ClusterId aClusterId) : - CommandHandlerInterface(MakeOptional(aEndpointId), aClusterId), AttributeAccessInterface(MakeOptional(aEndpointId), aClusterId), - mDelegate(aDelegate), mEndpointId(aEndpointId), mClusterId(aClusterId) -{ - mDelegate->SetInstance(this); -} - -Instance::~Instance() -{ - InteractionModelEngine::GetInstance()->UnregisterCommandHandler(this); - unregisterAttributeAccessOverride(this); -} - -CHIP_ERROR Instance::Init() -{ - // Check if the cluster has been selected in zap - if (!emberAfContainsServer(mEndpointId, mClusterId)) - { - ChipLogError(Zcl, "Operational State: The cluster with ID %lu was not enabled in zap.", long(mClusterId)); - return CHIP_ERROR_INVALID_ARGUMENT; - } - - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->RegisterCommandHandler(this)); - - VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR Instance::SetCurrentPhase(const DataModel::Nullable & aPhase) -{ - if (!aPhase.IsNull()) - { - if (!IsSupportedPhase(aPhase.Value())) - { - return CHIP_ERROR_INVALID_ARGUMENT; - } - } - - DataModel::Nullable oldPhase = mCurrentPhase; - mCurrentPhase = aPhase; - if (mCurrentPhase != oldPhase) - { - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::CurrentPhase::Id); - } - return CHIP_NO_ERROR; -} - -CHIP_ERROR Instance::SetOperationalState(uint8_t aOpState) -{ - // Error is only allowed to be set by OnOperationalErrorDetected. - if (aOpState == to_underlying(OperationalStateEnum::kError) || !IsSupportedOperationalState(aOpState)) - { - return CHIP_ERROR_INVALID_ARGUMENT; - } - - if (mOperationalError.errorStateID != to_underlying(ErrorStateEnum::kNoError)) - { - mOperationalError.Set(to_underlying(ErrorStateEnum::kNoError)); - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalError::Id); - } - - uint8_t oldState = mOperationalState; - mOperationalState = aOpState; - if (mOperationalState != oldState) - { - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalState::Id); - } - return CHIP_NO_ERROR; -} - -DataModel::Nullable Instance::GetCurrentPhase() const -{ - return mCurrentPhase; -} - -uint8_t Instance::GetCurrentOperationalState() const -{ - return mOperationalState; -} - -void Instance::GetCurrentOperationalError(GenericOperationalError & error) const -{ - error.Set(mOperationalError.errorStateID, mOperationalError.errorStateLabel, mOperationalError.errorStateDetails); -} - -void Instance::OnOperationalErrorDetected(const Structs::ErrorStateStruct::Type & aError) -{ - ChipLogDetail(Zcl, "OperationalStateServer: OnOperationalErrorDetected"); - // Set the OperationalState attribute to Error - if (mOperationalState != to_underlying(OperationalStateEnum::kError)) - { - mOperationalState = to_underlying(OperationalStateEnum::kError); - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalState::Id); - } - - // Set the OperationalError attribute - if (!mOperationalError.IsEqual(aError)) - { - mOperationalError.Set(aError.errorStateID, aError.errorStateLabel, aError.errorStateDetails); - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalError::Id); - } - - // Generate an ErrorDetected event - GenericErrorEvent event(mClusterId, aError); - EventNumber eventNumber; - CHIP_ERROR error = LogEvent(event, mEndpointId, eventNumber); - - if (error != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "OperationalStateServer: Failed to record OperationalError event: %" CHIP_ERROR_FORMAT, error.Format()); - } -} - -void Instance::OnOperationCompletionDetected(uint8_t aCompletionErrorCode, - const Optional> & aTotalOperationalTime, - const Optional> & aPausedTime) const -{ - ChipLogDetail(Zcl, "OperationalStateServer: OnOperationCompletionDetected"); - - GenericOperationCompletionEvent event(mClusterId, aCompletionErrorCode, aTotalOperationalTime, aPausedTime); - EventNumber eventNumber; - CHIP_ERROR error = LogEvent(event, mEndpointId, eventNumber); - - if (error != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "OperationalStateServer: Failed to record OperationCompletion event: %" CHIP_ERROR_FORMAT, - error.Format()); - } -} - -void Instance::ReportOperationalStateListChange() -{ - MatterReportingAttributeChangeCallback(ConcreteAttributePath(mEndpointId, mClusterId, Attributes::OperationalStateList::Id)); -} - -void Instance::ReportPhaseListChange() -{ - MatterReportingAttributeChangeCallback(ConcreteAttributePath(mEndpointId, mClusterId, Attributes::PhaseList::Id)); -} - -bool Instance::IsSupportedPhase(uint8_t aPhase) -{ - GenericOperationalPhase phase = GenericOperationalPhase(DataModel::Nullable()); - if (mDelegate->GetOperationalPhaseAtIndex(aPhase, phase) != CHIP_ERROR_NOT_FOUND) - { - return true; - } - return false; -} - -bool Instance::IsSupportedOperationalState(uint8_t aState) -{ - GenericOperationalState opState; - for (uint8_t i = 0; mDelegate->GetOperationalStateAtIndex(i, opState) != CHIP_ERROR_NOT_FOUND; i++) - { - if (opState.operationalStateID == aState) - { - return true; - } - } - ChipLogDetail(Zcl, "Cannot find an operational state with value %u", aState); - return false; -} - -// private - -template -void Instance::HandleCommand(HandlerContext & handlerContext, FuncT func) -{ - if (!handlerContext.mCommandHandled && (handlerContext.mRequestPath.mCommandId == RequestT::GetCommandId())) - { - RequestT requestPayload; - - // If the command matches what the caller is looking for, let's mark this as being handled - // even if errors happen after this. This ensures that we don't execute any fall-back strategies - // to handle this command since at this point, the caller is taking responsibility for handling - // the command in its entirety, warts and all. - // - handlerContext.SetCommandHandled(); - - if (DataModel::Decode(handlerContext.mPayload, requestPayload) != CHIP_NO_ERROR) - { - handlerContext.mCommandHandler.AddStatus(handlerContext.mRequestPath, - Protocols::InteractionModel::Status::InvalidCommand); - return; - } - - func(handlerContext, requestPayload); - } -} - -// This function is called by the interaction model engine when a command destined for this instance is received. -void Instance::InvokeCommand(HandlerContext & handlerContext) -{ - ChipLogDetail(Zcl, "OperationalState: InvokeCommand"); - switch (handlerContext.mRequestPath.mCommandId) - { - case Commands::Pause::Id: - ChipLogDetail(Zcl, "OperationalState: Entering handling Pause state"); - - HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & req) { HandlePauseState(ctx, req); }); - break; - - case Commands::Resume::Id: - ChipLogDetail(Zcl, "OperationalState: Entering handling Resume state"); - - HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & req) { HandleResumeState(ctx, req); }); - break; - - case Commands::Start::Id: - ChipLogDetail(Zcl, "OperationalState: Entering handling Start state"); - - HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & req) { HandleStartState(ctx, req); }); - break; - - case Commands::Stop::Id: - ChipLogDetail(Zcl, "OperationalState: Entering handling Stop state"); - - HandleCommand(handlerContext, - [this](HandlerContext & ctx, const auto & req) { HandleStopState(ctx, req); }); - break; - } -} - -CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) -{ - ChipLogError(Zcl, "OperationalState: Reading"); - switch (aPath.mAttributeId) - { - case OperationalState::Attributes::OperationalStateList::Id: { - return aEncoder.EncodeList([delegate = mDelegate](const auto & encoder) -> CHIP_ERROR { - GenericOperationalState opState; - size_t index = 0; - CHIP_ERROR err = CHIP_NO_ERROR; - while ((err = delegate->GetOperationalStateAtIndex(index, opState)) == CHIP_NO_ERROR) - { - ReturnErrorOnFailure(encoder.Encode(opState)); - index++; - } - if (err == CHIP_ERROR_NOT_FOUND) - { - return CHIP_NO_ERROR; - } - return err; - }); - } - break; - - case OperationalState::Attributes::OperationalState::Id: { - ChipLogError(Zcl, "OperationalState: H1"); - ReturnErrorOnFailure(aEncoder.Encode(GetCurrentOperationalState())); - } - break; - - case OperationalState::Attributes::OperationalError::Id: { - ReturnErrorOnFailure(aEncoder.Encode(mOperationalError)); - } - break; - - case OperationalState::Attributes::PhaseList::Id: { - GenericOperationalPhase phase = GenericOperationalPhase(DataModel::Nullable()); - size_t index = 0; - - if (mDelegate->GetOperationalPhaseAtIndex(index, phase) == CHIP_ERROR_NOT_FOUND || phase.IsMissing()) - { - return aEncoder.EncodeNull(); - } - return aEncoder.EncodeList([&](const auto & encoder) -> CHIP_ERROR { - while (this->mDelegate->GetOperationalPhaseAtIndex(index, phase) != CHIP_ERROR_NOT_FOUND) - { - ReturnErrorOnFailure(encoder.Encode(phase.mPhaseName)); - index++; - } - return CHIP_NO_ERROR; - }); - } - break; - - case OperationalState::Attributes::CurrentPhase::Id: { - ReturnErrorOnFailure(aEncoder.Encode(GetCurrentPhase())); - } - break; - - case OperationalState::Attributes::CountdownTime::Id: { - ReturnErrorOnFailure(aEncoder.Encode(mDelegate->GetCountdownTime())); - } - break; - } - return CHIP_NO_ERROR; -} - -void Instance::HandlePauseState(HandlerContext & ctx, const Commands::Pause::DecodableType & req) -{ - ChipLogDetail(Zcl, "OperationalState: HandlePauseState"); - - GenericOperationalError err(to_underlying(ErrorStateEnum::kNoError)); - uint8_t opState = GetCurrentOperationalState(); - - if (opState != to_underlying(OperationalStateEnum::kPaused) && opState != to_underlying(OperationalStateEnum::kRunning)) - { - err.Set(to_underlying(ErrorStateEnum::kCommandInvalidInState)); - } - else if (opState == to_underlying(OperationalStateEnum::kRunning)) - { - mDelegate->HandlePauseStateCallback(err); - } - - Commands::OperationalCommandResponse::Type response; - response.commandResponseState = err; - - ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); -} - -void Instance::HandleStopState(HandlerContext & ctx, const Commands::Stop::DecodableType & req) -{ - ChipLogDetail(Zcl, "OperationalState: HandleStopState"); - - GenericOperationalError err(to_underlying(ErrorStateEnum::kNoError)); - uint8_t opState = GetCurrentOperationalState(); - - if (opState != to_underlying(OperationalStateEnum::kStopped)) - { - mDelegate->HandleStopStateCallback(err); - } - - Commands::OperationalCommandResponse::Type response; - response.commandResponseState = err; - - ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); -} - -void Instance::HandleStartState(HandlerContext & ctx, const Commands::Start::DecodableType & req) -{ - ChipLogDetail(Zcl, "OperationalState: HandleStartState"); - - GenericOperationalError err(to_underlying(ErrorStateEnum::kNoError)); - uint8_t opState = GetCurrentOperationalState(); - - if (opState != to_underlying(OperationalStateEnum::kRunning)) - { - mDelegate->HandleStartStateCallback(err); - } - - Commands::OperationalCommandResponse::Type response; - response.commandResponseState = err; - - ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); -} - -void Instance::HandleResumeState(HandlerContext & ctx, const Commands::Resume::DecodableType & req) -{ - ChipLogDetail(Zcl, "OperationalState: HandleResumeState"); - - GenericOperationalError err(to_underlying(ErrorStateEnum::kNoError)); - uint8_t opState = GetCurrentOperationalState(); - - if (opState != to_underlying(OperationalStateEnum::kPaused) && opState != to_underlying(OperationalStateEnum::kRunning)) - { - err.Set(to_underlying(ErrorStateEnum::kCommandInvalidInState)); - } - else if (opState == to_underlying(OperationalStateEnum::kPaused)) - { - mDelegate->HandleResumeStateCallback(err); - } - - Commands::OperationalCommandResponse::Type response; - response.commandResponseState = err; - - ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); -} diff --git a/src/app/clusters/operational-state-oven-server/operational-state-oven-server.h b/src/app/clusters/operational-state-oven-server/operational-state-oven-server.h deleted file mode 100644 index 23ebba36817d22..00000000000000 --- a/src/app/clusters/operational-state-oven-server/operational-state-oven-server.h +++ /dev/null @@ -1,280 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include "operational-state-oven-cluster-objects.h" -#include -#include -#include -#include - -namespace chip { -namespace app { -namespace Clusters { -namespace OperationalState { - -class Uncopyable -{ -protected: - Uncopyable() {} - ~Uncopyable() = default; - -private: - Uncopyable(const Uncopyable &) = delete; - Uncopyable & operator=(const Uncopyable &) = delete; -}; - -class Delegate; - -/** - * Instance is a class that represents an instance of a derivation of the operational state cluster. - * It implements CommandHandlerInterface so it can generically handle commands for any derivation cluster id. - */ -class Instance : public CommandHandlerInterface, public AttributeAccessInterface, public Uncopyable -{ -public: - /** - * Creates an operational state cluster instance. The Init() function needs to be called for this instance - * to be registered and called by the interaction model at the appropriate times. - * It is possible to set the CurrentPhase and OperationalState via the Set... methods before calling Init(). - * @param aDelegate A pointer to the delegate to be used by this server. - * Note: the caller must ensure that the delegate lives throughout the instance's lifetime. - * @param aEndpointId The endpoint on which this cluster exists. This must match the zap configuration. - * @param aClusterId The ID of the operational state derived cluster to be instantiated. - */ - Instance(Delegate * aDelegate, EndpointId aEndpointId, ClusterId aClusterId); - - ~Instance() override; - - /** - * Initialise the operational state server instance. - * This function must be called after defining an Instance class object. - * @return Returns an error if the given endpoint and cluster ID have not been enabled in zap or if the - * CommandHandler or AttributeHandler registration fails, else returns CHIP_NO_ERROR. - */ - CHIP_ERROR Init(); - - // Attribute setters - /** - * Set operational phase. - * @param aPhase The operational phase that should now be the current one. - * @return CHIP_ERROR_INVALID_ARGUMENT if aPhase is an invalid value. CHIP_NO_ERROR if set was successful. - */ - CHIP_ERROR SetCurrentPhase(const app::DataModel::Nullable & aPhase); - - /** - * Set current operational state to aOpState and the operational error to kNoError. - * NOTE: This method cannot be used to set the error state. The error state must be set via the - * OnOperationalErrorDetected method. - * @param aOpState The operational state that should now be the current one. - * @return CHIP_ERROR_INVALID_ARGUMENT if aOpState is an invalid value. CHIP_NO_ERROR if set was successful. - */ - CHIP_ERROR SetOperationalState(uint8_t aOpState); - - // Attribute getters - /** - * Get current phase. - * @return The current phase. - */ - app::DataModel::Nullable GetCurrentPhase() const; - - /** - * Get the current operational state. - * @return The current operational state value. - */ - uint8_t GetCurrentOperationalState() const; - - /** - * Get current operational error. - * @param error The GenericOperationalError to fill with the current operational error value - */ - void GetCurrentOperationalError(GenericOperationalError & error) const; - - // Event triggers - /** - * @brief Called when the Node detects a OperationalError has been raised. - * Note: This function also sets the OperationalState attribute to Error. - * @param aError OperationalError which detects - */ - void OnOperationalErrorDetected(const Structs::ErrorStateStruct::Type & aError); - - /** - * @brief Called when the Node detects a OperationCompletion has been raised. - * @param aCompletionErrorCode CompletionErrorCode - * @param aTotalOperationalTime TotalOperationalTime - * @param aPausedTime PausedTime - */ - void OnOperationCompletionDetected(uint8_t aCompletionErrorCode, - const Optional> & aTotalOperationalTime = NullOptional, - const Optional> & aPausedTime = NullOptional) const; - - // List change reporting - /** - * Reports that the contents of the operational state list has changed. - * The device SHALL call this method whenever it changes the operational state list. - */ - void ReportOperationalStateListChange(); - - /** - * Reports that the contents of the phase list has changed. - * The device SHALL call this method whenever it changes the phase list. - */ - void ReportPhaseListChange(); - - /** - * This function returns true if the phase value given exists in the PhaseList attribute, otherwise it returns false. - */ - bool IsSupportedPhase(uint8_t aPhase); - - /** - * This function returns true if the operational state value given exists in the OperationalStateList attribute, - * otherwise it returns false. - */ - bool IsSupportedOperationalState(uint8_t aState); - -private: - Delegate * mDelegate; - - EndpointId mEndpointId; - ClusterId mClusterId; - - // Attribute Data Store - app::DataModel::Nullable mCurrentPhase; - uint8_t mOperationalState = 0; // assume 0 for now. - GenericOperationalError mOperationalError = to_underlying(ErrorStateEnum::kNoError); - - // Inherited from CommandHandlerInterface - template - void HandleCommand(HandlerContext & handlerContext, FuncT func); - - // Inherited from CommandHandlerInterface - void InvokeCommand(HandlerContext & ctx) override; - - /** - * IM-level implementation of read - * @return appropriately mapped CHIP_ERROR if applicable (may return CHIP_IM_GLOBAL_STATUS errors) - */ - CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; - - /** - * Handle Command: Pause. - */ - void HandlePauseState(HandlerContext & ctx, const Commands::Pause::DecodableType & req); - - /** - * Handle Command: Stop. - */ - void HandleStopState(HandlerContext & ctx, const Commands::Stop::DecodableType & req); - - /** - * Handle Command: Start. - */ - void HandleStartState(HandlerContext & ctx, const Commands::Start::DecodableType & req); - - /** - * Handle Command: Resume. - */ - void HandleResumeState(HandlerContext & ctx, const Commands::Resume::DecodableType & req); -}; - -/** - * A delegate to handle application logic of the Operational State aliased Cluster. - * The delegate API assumes there will be separate delegate objects for each cluster instance. - * (i.e. each separate operational state cluster derivation, on each separate endpoint), - * since the delegate methods are not handed the cluster id or endpoint. - */ -class Delegate -{ -public: - Delegate() = default; - - virtual ~Delegate() = default; - - /** - * Get the countdown time. - * NOTE: Changes to this attribute should not be reported. - * From the spec: Changes to this value SHALL NOT be reported in a subscription. - * @return The current countdown time. - */ - virtual app::DataModel::Nullable GetCountdownTime() = 0; - - /** - * Fills in the provided GenericOperationalState with the state at index `index` if there is one, - * or returns CHIP_ERROR_NOT_FOUND if the index is out of range for the list of states. - * Note: This is used by the SDK to populate the operational state list attribute. If the contents of this list changes, - * the device SHALL call the Instance's ReportOperationalStateListChange method to report that this attribute has changed. - * @param index The index of the state, with 0 representing the first state. - * @param operationalState The GenericOperationalState is filled. - */ - virtual CHIP_ERROR GetOperationalStateAtIndex(size_t index, GenericOperationalState & operationalState) = 0; - - /** - * Fills in the provided GenericOperationalPhase with the phase at index `index` if there is one, - * or returns CHIP_ERROR_NOT_FOUND if the index is out of range for the list of phases. - * Note: This is used by the SDK to populate the phase list attribute. If the contents of this list changes, the - * device SHALL call the Instance's ReportPhaseListChange method to report that this attribute has changed. - * @param index The index of the phase, with 0 representing the first phase. - * @param operationalPhase The GenericOperationalPhase is filled. - */ - virtual CHIP_ERROR GetOperationalPhaseAtIndex(size_t index, GenericOperationalPhase & operationalPhase) = 0; - - // command callback - /** - * Handle Command Callback in application: Pause - * @param[out] err operational error after callback. - */ - virtual void HandlePauseStateCallback(GenericOperationalError & err) = 0; - - /** - * Handle Command Callback in application: Resume - * @param[out] err operational error after callback. - */ - virtual void HandleResumeStateCallback(GenericOperationalError & err) = 0; - - /** - * Handle Command Callback in application: Start - * @param[out] err operational error after callback. - */ - virtual void HandleStartStateCallback(GenericOperationalError & err) = 0; - - /** - * Handle Command Callback in application: Stop - * @param[out] err operational error after callback. - */ - virtual void HandleStopStateCallback(GenericOperationalError & err) = 0; - -private: - friend class Instance; - - Instance * mInstance = nullptr; - - /** - * This method is used by the SDK to set the instance pointer. This is done during the instantiation of a Instance object. - * @param aInstance A pointer to the Instance object related to this delegate object. - */ - void SetInstance(Instance * aInstance) { mInstance = aInstance; } - -protected: - Instance * GetInstance() const { return mInstance; } -}; - -} // namespace OperationalState -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 9cee15b3178678..e9a93e1c72fc98 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -641,8 +641,6 @@ limitations under the License. - - MA-dimmablepluginunit CHIP diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 21aa0fae99cabd..5feec1016e719a 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -126,15 +126,9 @@ "manufacturersXml": "../../../../src/app/zap-templates/zcl/data-model/manufacturers.xml", "options": { "text": { - "defaultResponsePolicy": [ - "Always", - "Conditional", - "Never" - ] + "defaultResponsePolicy": ["Always", "Conditional", "Never"] }, - "bool": [ - "commandDiscovery" - ] + "bool": ["commandDiscovery"] }, "defaults": { "text": { @@ -180,15 +174,9 @@ "SpecificationVersion", "MaxPathsPerInvoke" ], - "Bridged Device Basic Information": [ - "ProductAppearance" - ], - "Descriptor": [ - "ClusterRevision" - ], - "Device Energy Management": [ - "Forecast" - ], + "Bridged Device Basic Information": ["ProductAppearance"], + "Descriptor": ["ClusterRevision"], + "Device Energy Management": ["Forecast"], "Ethernet Network Diagnostics": [ "PHYRate", "FullDuplex", @@ -327,21 +315,14 @@ "CurrentMaxRate", "OverrunCount" ], - "Channel": [ - "Lineup", - "CurrentChannel" - ], + "Channel": ["Lineup", "CurrentChannel"], "Media Playback": [ "SampledPosition", "ActiveAudioTrack", "ActiveTextTrack" ], - "Application Launcher": [ - "CurrentApp" - ], - "Application Basic": [ - "Application" - ], + "Application Launcher": ["CurrentApp"], + "Application Basic": ["Application"], "Time Synchronization": [ "TrustedTimeSource", "DefaultNTP", @@ -353,9 +334,7 @@ "TimeZoneListMaxSize", "DSTOffsetListMaxSize" ], - "Temperature Control": [ - "SupportedTemperatureLevels" - ], + "Temperature Control": ["SupportedTemperatureLevels"], "Dishwasher Mode": [ "SupportedModes", "CurrentMode", @@ -363,11 +342,7 @@ "OnMode", "FeatureMap" ], - "Microwave Oven Mode": [ - "SupportedModes", - "CurrentMode", - "FeatureMap" - ], + "Microwave Oven Mode": ["SupportedModes", "CurrentMode", "FeatureMap"], "Laundry Washer Mode": [ "SupportedModes", "CurrentMode", @@ -576,24 +551,14 @@ "LevelValue", "FeatureMap" ], - "Air Quality": [ - "AirQuality", - "FeatureMap" - ] + "Air Quality": ["AirQuality", "FeatureMap"] }, "defaultReportingPolicy": "mandatory", - "ZCLDataTypes": [ - "ARRAY", - "BITMAP", - "ENUM", - "NUMBER", - "STRING", - "STRUCT" - ], + "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], "fabricHandling": { "automaticallyCreateFields": true, "indexFieldId": 254, "indexFieldName": "FabricIndex", "indexType": "fabric_idx" } -} \ No newline at end of file +} diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index d9f60b3922e246..3c210efe3040de 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -124,15 +124,9 @@ "manufacturersXml": "../../../../src/app/zap-templates/zcl/data-model/manufacturers.xml", "options": { "text": { - "defaultResponsePolicy": [ - "Always", - "Conditional", - "Never" - ] + "defaultResponsePolicy": ["Always", "Conditional", "Never"] }, - "bool": [ - "commandDiscovery" - ] + "bool": ["commandDiscovery"] }, "defaults": { "text": { @@ -178,15 +172,9 @@ "SpecificationVersion", "MaxPathsPerInvoke" ], - "Bridged Device Basic Information": [ - "ProductAppearance" - ], - "Descriptor": [ - "ClusterRevision" - ], - "Device Energy Management": [ - "Forecast" - ], + "Bridged Device Basic Information": ["ProductAppearance"], + "Descriptor": ["ClusterRevision"], + "Device Energy Management": ["Forecast"], "Ethernet Network Diagnostics": [ "PHYRate", "FullDuplex", @@ -325,21 +313,14 @@ "CurrentMaxRate", "OverrunCount" ], - "Channel": [ - "Lineup", - "CurrentChannel" - ], + "Channel": ["Lineup", "CurrentChannel"], "Media Playback": [ "SampledPosition", "ActiveAudioTrack", "ActiveTextTrack" ], - "Application Launcher": [ - "CurrentApp" - ], - "Application Basic": [ - "Application" - ], + "Application Launcher": ["CurrentApp"], + "Application Basic": ["Application"], "Time Synchronization": [ "TrustedTimeSource", "DefaultNTP", @@ -351,9 +332,7 @@ "TimeZoneListMaxSize", "DSTOffsetListMaxSize" ], - "Temperature Control": [ - "SupportedTemperatureLevels" - ], + "Temperature Control": ["SupportedTemperatureLevels"], "Dishwasher Mode": [ "SupportedModes", "CurrentMode", @@ -361,11 +340,7 @@ "OnMode", "FeatureMap" ], - "Microwave Oven Mode": [ - "SupportedModes", - "CurrentMode", - "FeatureMap" - ], + "Microwave Oven Mode": ["SupportedModes", "CurrentMode", "FeatureMap"], "Laundry Washer Mode": [ "SupportedModes", "CurrentMode", @@ -574,24 +549,14 @@ "LevelValue", "FeatureMap" ], - "Air Quality": [ - "AirQuality", - "FeatureMap" - ] + "Air Quality": ["AirQuality", "FeatureMap"] }, "defaultReportingPolicy": "mandatory", - "ZCLDataTypes": [ - "ARRAY", - "BITMAP", - "ENUM", - "NUMBER", - "STRING", - "STRUCT" - ], + "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], "fabricHandling": { "automaticallyCreateFields": true, "indexFieldId": 254, "indexFieldName": "FabricIndex", "indexType": "fabric_idx" } -} \ No newline at end of file +} diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 688cac8c0a9a3d..fb41ede1f42920 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -17,12 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../app/zap-templates/zcl/zcl.json", @@ -30,6 +24,12 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" } ], "endpointTypes": [ @@ -599,7 +599,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -651,7 +651,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1287,7 +1287,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1839,7 +1839,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1946,6 +1946,75 @@ "source": "client", "isIncoming": 0, "isEnabled": 1 + }, + { + "name": "StayActiveResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Timer", + "code": 71, + "mfgCode": null, + "define": "TIMER_CLUSTER", + "side": "client", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "SetTimer", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddTime", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 } ], "attributes": [ @@ -1990,6 +2059,7 @@ "define": "OPERATIONAL_STATE_OVEN_CLUSTER", "side": "client", "enabled": 1, + "apiMaturity": "provisional", "attributes": [ { "name": "FeatureMap", @@ -2086,6 +2156,48 @@ } ] }, + { + "name": "Laundry Dryer Controls", + "code": 74, + "mfgCode": null, + "define": "LAUNDRY_DRYER_CONTROLS_CLUSTER", + "side": "client", + "enabled": 1, + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Mode Select", "code": 80, @@ -2174,7 +2286,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2234,7 +2346,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2336,7 +2448,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2396,7 +2508,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2550,7 +2662,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2592,7 +2704,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2723,7 +2835,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2891,7 +3003,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2933,6 +3045,110 @@ "storageOption": "External", "singleton": 0, "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Device Energy Management", + "code": 152, + "mfgCode": null, + "define": "DEVICE_ENERGY_MANAGEMENT_CLUSTER", + "side": "client", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Energy EVSE", + "code": 153, + "mfgCode": null, + "define": "ENERGY_EVSE_CLUSTER", + "side": "client", + "enabled": 1, + "apiMaturity": "provisional", + "commands": [ + { + "name": "Disable", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "EnableCharging", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, "defaultValue": "0", "reportable": 1, "minInterval": 1, @@ -3847,7 +4063,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3889,7 +4105,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3931,7 +4147,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3973,7 +4189,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4015,7 +4231,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4057,7 +4273,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4099,7 +4315,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4141,7 +4357,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4183,7 +4399,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4225,7 +4441,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationCompletionEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationCompletionEvent.kt deleted file mode 100644 index cf6ceebf5d48fd..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationCompletionEvent.kt +++ /dev/null @@ -1,106 +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. - */ -package chip.devicecontroller.cluster.eventstructs - -import chip.devicecontroller.cluster.* -import java.util.Optional -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class OvenOperationalStateClusterOperationCompletionEvent( - val completionErrorCode: UInt, - val totalOperationalTime: Optional?, - val pausedTime: Optional? -) { - override fun toString(): String = buildString { - append("OvenOperationalStateClusterOperationCompletionEvent {\n") - append("\tcompletionErrorCode : $completionErrorCode\n") - append("\ttotalOperationalTime : $totalOperationalTime\n") - append("\tpausedTime : $pausedTime\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_COMPLETION_ERROR_CODE), completionErrorCode) - if (totalOperationalTime != null) { - if (totalOperationalTime.isPresent) { - val opttotalOperationalTime = totalOperationalTime.get() - put(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME), opttotalOperationalTime) - } - } else { - putNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)) - } - if (pausedTime != null) { - if (pausedTime.isPresent) { - val optpausedTime = pausedTime.get() - put(ContextSpecificTag(TAG_PAUSED_TIME), optpausedTime) - } - } else { - putNull(ContextSpecificTag(TAG_PAUSED_TIME)) - } - endStructure() - } - } - - companion object { - private const val TAG_COMPLETION_ERROR_CODE = 0 - private const val TAG_TOTAL_OPERATIONAL_TIME = 1 - private const val TAG_PAUSED_TIME = 2 - - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader - ): OvenOperationalStateClusterOperationCompletionEvent { - tlvReader.enterStructure(tlvTag) - val completionErrorCode = tlvReader.getUInt(ContextSpecificTag(TAG_COMPLETION_ERROR_CODE)) - val totalOperationalTime = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) { - Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)) - null - } - val pausedTime = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_PAUSED_TIME))) { - Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_PAUSED_TIME))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_PAUSED_TIME)) - null - } - - tlvReader.exitContainer() - - return OvenOperationalStateClusterOperationCompletionEvent( - completionErrorCode, - totalOperationalTime, - pausedTime - ) - } - } -} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationalErrorEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationalErrorEvent.kt deleted file mode 100644 index 45252fa6422863..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationalErrorEvent.kt +++ /dev/null @@ -1,61 +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. - */ -package chip.devicecontroller.cluster.eventstructs - -import chip.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class OvenOperationalStateClusterOperationalErrorEvent( - val errorState: chip.devicecontroller.cluster.structs.OvenOperationalStateClusterErrorStateStruct -) { - override fun toString(): String = buildString { - append("OvenOperationalStateClusterOperationalErrorEvent {\n") - append("\terrorState : $errorState\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - errorState.toTlv(ContextSpecificTag(TAG_ERROR_STATE), this) - endStructure() - } - } - - companion object { - private const val TAG_ERROR_STATE = 0 - - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader - ): OvenOperationalStateClusterOperationalErrorEvent { - tlvReader.enterStructure(tlvTag) - val errorState = - chip.devicecontroller.cluster.structs.OvenOperationalStateClusterErrorStateStruct.fromTlv( - ContextSpecificTag(TAG_ERROR_STATE), - tlvReader - ) - - tlvReader.exitContainer() - - return OvenOperationalStateClusterOperationalErrorEvent(errorState) - } - } -} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenOperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenOperationalStateClusterErrorStateStruct.kt deleted file mode 100644 index ffe36aeb938a8a..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenOperationalStateClusterErrorStateStruct.kt +++ /dev/null @@ -1,85 +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. - */ -package chip.devicecontroller.cluster.structs - -import chip.devicecontroller.cluster.* -import java.util.Optional -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class OvenOperationalStateClusterErrorStateStruct( - val errorStateID: UInt, - val errorStateLabel: Optional, - val errorStateDetails: Optional -) { - override fun toString(): String = buildString { - append("OvenOperationalStateClusterErrorStateStruct {\n") - append("\terrorStateID : $errorStateID\n") - append("\terrorStateLabel : $errorStateLabel\n") - append("\terrorStateDetails : $errorStateDetails\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) - if (errorStateLabel.isPresent) { - val opterrorStateLabel = errorStateLabel.get() - put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) - } - if (errorStateDetails.isPresent) { - val opterrorStateDetails = errorStateDetails.get() - put(ContextSpecificTag(TAG_ERROR_STATE_DETAILS), opterrorStateDetails) - } - endStructure() - } - } - - companion object { - private const val TAG_ERROR_STATE_I_D = 0 - private const val TAG_ERROR_STATE_LABEL = 1 - private const val TAG_ERROR_STATE_DETAILS = 2 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OvenOperationalStateClusterErrorStateStruct { - tlvReader.enterStructure(tlvTag) - val errorStateID = tlvReader.getUInt(ContextSpecificTag(TAG_ERROR_STATE_I_D)) - val errorStateLabel = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { - Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) - } else { - Optional.empty() - } - val errorStateDetails = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_DETAILS))) { - Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_DETAILS))) - } else { - Optional.empty() - } - - tlvReader.exitContainer() - - return OvenOperationalStateClusterErrorStateStruct( - errorStateID, - errorStateLabel, - errorStateDetails - ) - } - } -} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenOperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenOperationalStateClusterOperationalStateStruct.kt deleted file mode 100644 index 1e68f9d3a6339c..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenOperationalStateClusterOperationalStateStruct.kt +++ /dev/null @@ -1,74 +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. - */ -package chip.devicecontroller.cluster.structs - -import chip.devicecontroller.cluster.* -import java.util.Optional -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class OvenOperationalStateClusterOperationalStateStruct( - val operationalStateID: UInt, - val operationalStateLabel: Optional -) { - override fun toString(): String = buildString { - append("OvenOperationalStateClusterOperationalStateStruct {\n") - append("\toperationalStateID : $operationalStateID\n") - append("\toperationalStateLabel : $operationalStateLabel\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) - if (operationalStateLabel.isPresent) { - val optoperationalStateLabel = operationalStateLabel.get() - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) - } - endStructure() - } - } - - companion object { - private const val TAG_OPERATIONAL_STATE_I_D = 0 - private const val TAG_OPERATIONAL_STATE_LABEL = 1 - - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader - ): OvenOperationalStateClusterOperationalStateStruct { - tlvReader.enterStructure(tlvTag) - val operationalStateID = tlvReader.getUInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) - val operationalStateLabel = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { - Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) - } else { - Optional.empty() - } - - tlvReader.exitContainer() - - return OvenOperationalStateClusterOperationalStateStruct( - operationalStateID, - operationalStateLabel - ) - } - } -} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/OvenOperationalStateCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/OvenOperationalStateCluster.kt deleted file mode 100644 index d05e2591fb6ff2..00000000000000 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/OvenOperationalStateCluster.kt +++ /dev/null @@ -1,211 +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. - */ - -package matter.devicecontroller.cluster.clusters - -import matter.controller.MatterController -import matter.devicecontroller.cluster.structs.* - -class OvenOperationalStateCluster( - private val controller: MatterController, - private val endpointId: UShort -) { - class OperationalCommandResponse( - val commandResponseState: OvenOperationalStateClusterErrorStateStruct - ) - - class PhaseListAttribute(val value: List?) - - class CurrentPhaseAttribute(val value: UByte?) - - class CountdownTimeAttribute(val value: UInt?) - - class OperationalStateListAttribute( - val value: List - ) - - class OperationalErrorAttribute(val value: OvenOperationalStateClusterErrorStateStruct) - - class GeneratedCommandListAttribute(val value: List) - - class AcceptedCommandListAttribute(val value: List) - - class EventListAttribute(val value: List) - - class AttributeListAttribute(val value: List) - - suspend fun pause(timedInvokeTimeoutMs: Int? = null): OperationalCommandResponse { - val commandId = 0L - - if (timedInvokeTimeoutMs != null) { - // Do the action with timedInvokeTimeoutMs - } else { - // Do the action without timedInvokeTimeoutMs - } - } - - suspend fun stop(timedInvokeTimeoutMs: Int? = null): OperationalCommandResponse { - val commandId = 1L - - if (timedInvokeTimeoutMs != null) { - // Do the action with timedInvokeTimeoutMs - } else { - // Do the action without timedInvokeTimeoutMs - } - } - - suspend fun start(timedInvokeTimeoutMs: Int? = null): OperationalCommandResponse { - val commandId = 2L - - if (timedInvokeTimeoutMs != null) { - // Do the action with timedInvokeTimeoutMs - } else { - // Do the action without timedInvokeTimeoutMs - } - } - - suspend fun resume(timedInvokeTimeoutMs: Int? = null): OperationalCommandResponse { - val commandId = 3L - - if (timedInvokeTimeoutMs != null) { - // Do the action with timedInvokeTimeoutMs - } else { - // Do the action without timedInvokeTimeoutMs - } - } - - suspend fun readPhaseListAttribute(): PhaseListAttribute { - // Implementation needs to be added here - } - - suspend fun subscribePhaseListAttribute(minInterval: Int, maxInterval: Int): PhaseListAttribute { - // Implementation needs to be added here - } - - suspend fun readCurrentPhaseAttribute(): CurrentPhaseAttribute { - // Implementation needs to be added here - } - - suspend fun subscribeCurrentPhaseAttribute( - minInterval: Int, - maxInterval: Int - ): CurrentPhaseAttribute { - // Implementation needs to be added here - } - - suspend fun readCountdownTimeAttribute(): CountdownTimeAttribute { - // Implementation needs to be added here - } - - suspend fun subscribeCountdownTimeAttribute( - minInterval: Int, - maxInterval: Int - ): CountdownTimeAttribute { - // Implementation needs to be added here - } - - suspend fun readOperationalStateListAttribute(): OperationalStateListAttribute { - // Implementation needs to be added here - } - - suspend fun subscribeOperationalStateListAttribute( - minInterval: Int, - maxInterval: Int - ): OperationalStateListAttribute { - // Implementation needs to be added here - } - - suspend fun readOperationalStateAttribute(): UByte { - // Implementation needs to be added here - } - - suspend fun subscribeOperationalStateAttribute(minInterval: Int, maxInterval: Int): UByte { - // Implementation needs to be added here - } - - suspend fun readOperationalErrorAttribute(): OperationalErrorAttribute { - // Implementation needs to be added here - } - - suspend fun subscribeOperationalErrorAttribute( - minInterval: Int, - maxInterval: Int - ): OperationalErrorAttribute { - // Implementation needs to be added here - } - - suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { - // Implementation needs to be added here - } - - suspend fun subscribeGeneratedCommandListAttribute( - minInterval: Int, - maxInterval: Int - ): GeneratedCommandListAttribute { - // Implementation needs to be added here - } - - suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { - // Implementation needs to be added here - } - - suspend fun subscribeAcceptedCommandListAttribute( - minInterval: Int, - maxInterval: Int - ): AcceptedCommandListAttribute { - // Implementation needs to be added here - } - - suspend fun readEventListAttribute(): EventListAttribute { - // Implementation needs to be added here - } - - suspend fun subscribeEventListAttribute(minInterval: Int, maxInterval: Int): EventListAttribute { - // Implementation needs to be added here - } - - suspend fun readAttributeListAttribute(): AttributeListAttribute { - // Implementation needs to be added here - } - - suspend fun subscribeAttributeListAttribute( - minInterval: Int, - maxInterval: Int - ): AttributeListAttribute { - // Implementation needs to be added here - } - - suspend fun readFeatureMapAttribute(): UInt { - // Implementation needs to be added here - } - - suspend fun subscribeFeatureMapAttribute(minInterval: Int, maxInterval: Int): UInt { - // Implementation needs to be added here - } - - suspend fun readClusterRevisionAttribute(): UShort { - // Implementation needs to be added here - } - - suspend fun subscribeClusterRevisionAttribute(minInterval: Int, maxInterval: Int): UShort { - // Implementation needs to be added here - } - - companion object { - const val CLUSTER_ID: UInt = 72u - } -} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationCompletionEvent.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationCompletionEvent.kt deleted file mode 100644 index 48ae3a43e7d850..00000000000000 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationCompletionEvent.kt +++ /dev/null @@ -1,106 +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. - */ -package matter.devicecontroller.cluster.eventstructs - -import java.util.Optional -import matter.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class OvenOperationalStateClusterOperationCompletionEvent( - val completionErrorCode: UInt, - val totalOperationalTime: Optional?, - val pausedTime: Optional? -) { - override fun toString(): String = buildString { - append("OvenOperationalStateClusterOperationCompletionEvent {\n") - append("\tcompletionErrorCode : $completionErrorCode\n") - append("\ttotalOperationalTime : $totalOperationalTime\n") - append("\tpausedTime : $pausedTime\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_COMPLETION_ERROR_CODE), completionErrorCode) - if (totalOperationalTime != null) { - if (totalOperationalTime.isPresent) { - val opttotalOperationalTime = totalOperationalTime.get() - put(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME), opttotalOperationalTime) - } - } else { - putNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)) - } - if (pausedTime != null) { - if (pausedTime.isPresent) { - val optpausedTime = pausedTime.get() - put(ContextSpecificTag(TAG_PAUSED_TIME), optpausedTime) - } - } else { - putNull(ContextSpecificTag(TAG_PAUSED_TIME)) - } - endStructure() - } - } - - companion object { - private const val TAG_COMPLETION_ERROR_CODE = 0 - private const val TAG_TOTAL_OPERATIONAL_TIME = 1 - private const val TAG_PAUSED_TIME = 2 - - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader - ): OvenOperationalStateClusterOperationCompletionEvent { - tlvReader.enterStructure(tlvTag) - val completionErrorCode = tlvReader.getUInt(ContextSpecificTag(TAG_COMPLETION_ERROR_CODE)) - val totalOperationalTime = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)) - null - } - val pausedTime = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_PAUSED_TIME))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_PAUSED_TIME))) - } else { - Optional.empty() - } - } else { - tlvReader.getNull(ContextSpecificTag(TAG_PAUSED_TIME)) - null - } - - tlvReader.exitContainer() - - return OvenOperationalStateClusterOperationCompletionEvent( - completionErrorCode, - totalOperationalTime, - pausedTime - ) - } - } -} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationalErrorEvent.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationalErrorEvent.kt deleted file mode 100644 index 2a5615a137a44c..00000000000000 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/OvenOperationalStateClusterOperationalErrorEvent.kt +++ /dev/null @@ -1,62 +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. - */ -package matter.devicecontroller.cluster.eventstructs - -import matter.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class OvenOperationalStateClusterOperationalErrorEvent( - val errorState: - matter.devicecontroller.cluster.structs.OvenOperationalStateClusterErrorStateStruct -) { - override fun toString(): String = buildString { - append("OvenOperationalStateClusterOperationalErrorEvent {\n") - append("\terrorState : $errorState\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - errorState.toTlv(ContextSpecificTag(TAG_ERROR_STATE), this) - endStructure() - } - } - - companion object { - private const val TAG_ERROR_STATE = 0 - - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader - ): OvenOperationalStateClusterOperationalErrorEvent { - tlvReader.enterStructure(tlvTag) - val errorState = - matter.devicecontroller.cluster.structs.OvenOperationalStateClusterErrorStateStruct.fromTlv( - ContextSpecificTag(TAG_ERROR_STATE), - tlvReader - ) - - tlvReader.exitContainer() - - return OvenOperationalStateClusterOperationalErrorEvent(errorState) - } - } -} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/OvenOperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/OvenOperationalStateClusterErrorStateStruct.kt deleted file mode 100644 index 9c46796c30aab6..00000000000000 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/OvenOperationalStateClusterErrorStateStruct.kt +++ /dev/null @@ -1,85 +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. - */ -package matter.devicecontroller.cluster.structs - -import java.util.Optional -import matter.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class OvenOperationalStateClusterErrorStateStruct( - val errorStateID: UInt, - val errorStateLabel: Optional, - val errorStateDetails: Optional -) { - override fun toString(): String = buildString { - append("OvenOperationalStateClusterErrorStateStruct {\n") - append("\terrorStateID : $errorStateID\n") - append("\terrorStateLabel : $errorStateLabel\n") - append("\terrorStateDetails : $errorStateDetails\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) - if (errorStateLabel.isPresent) { - val opterrorStateLabel = errorStateLabel.get() - put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) - } - if (errorStateDetails.isPresent) { - val opterrorStateDetails = errorStateDetails.get() - put(ContextSpecificTag(TAG_ERROR_STATE_DETAILS), opterrorStateDetails) - } - endStructure() - } - } - - companion object { - private const val TAG_ERROR_STATE_I_D = 0 - private const val TAG_ERROR_STATE_LABEL = 1 - private const val TAG_ERROR_STATE_DETAILS = 2 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OvenOperationalStateClusterErrorStateStruct { - tlvReader.enterStructure(tlvTag) - val errorStateID = tlvReader.getUInt(ContextSpecificTag(TAG_ERROR_STATE_I_D)) - val errorStateLabel = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { - Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) - } else { - Optional.empty() - } - val errorStateDetails = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_DETAILS))) { - Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_DETAILS))) - } else { - Optional.empty() - } - - tlvReader.exitContainer() - - return OvenOperationalStateClusterErrorStateStruct( - errorStateID, - errorStateLabel, - errorStateDetails - ) - } - } -} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/OvenOperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/OvenOperationalStateClusterOperationalStateStruct.kt deleted file mode 100644 index 99fe7d6119c6f6..00000000000000 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/OvenOperationalStateClusterOperationalStateStruct.kt +++ /dev/null @@ -1,74 +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. - */ -package matter.devicecontroller.cluster.structs - -import java.util.Optional -import matter.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class OvenOperationalStateClusterOperationalStateStruct( - val operationalStateID: UInt, - val operationalStateLabel: Optional -) { - override fun toString(): String = buildString { - append("OvenOperationalStateClusterOperationalStateStruct {\n") - append("\toperationalStateID : $operationalStateID\n") - append("\toperationalStateLabel : $operationalStateLabel\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) - if (operationalStateLabel.isPresent) { - val optoperationalStateLabel = operationalStateLabel.get() - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) - } - endStructure() - } - } - - companion object { - private const val TAG_OPERATIONAL_STATE_I_D = 0 - private const val TAG_OPERATIONAL_STATE_LABEL = 1 - - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader - ): OvenOperationalStateClusterOperationalStateStruct { - tlvReader.enterStructure(tlvTag) - val operationalStateID = tlvReader.getUInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) - val operationalStateLabel = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { - Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) - } else { - Optional.empty() - } - - tlvReader.exitContainer() - - return OvenOperationalStateClusterOperationalStateStruct( - operationalStateID, - operationalStateLabel - ) - } - } -}