From 7af001e89851bc4fef8d722a7e36877687b5a34a Mon Sep 17 00:00:00 2001 From: Rohit Jadhav Date: Wed, 21 Jun 2023 15:31:50 +0530 Subject: [PATCH] Restructure server implementation to match spec --- .../all-clusters-app.matter | 61 ++- .../all-clusters-common/all-clusters-app.zap | 411 +++++++++++++++++- ...tic-supported-temperature-levels-manager.h | 66 --- .../static-supported-temperature-levels.h | 16 + ...c-supported-temperature-levels-manager.cpp | 65 --- .../static-supported-temperature-levels.cpp | 35 ++ .../ameba/main/chipinterface.cpp | 8 + examples/all-clusters-app/asr/BUILD.gn | 1 + examples/all-clusters-app/linux/BUILD.gn | 1 + examples/all-clusters-app/tizen/BUILD.gn | 1 + .../ameba/chip_main.cmake | 2 +- .../infineon/psoc6/BUILD.gn | 2 +- .../all-clusters-minimal-app/linux/BUILD.gn | 2 +- .../mbed/CMakeLists.txt | 2 +- .../nrfconnect/CMakeLists.txt | 2 +- .../telink/CMakeLists.txt | 2 +- .../all-clusters-minimal-app/tizen/BUILD.gn | 2 +- examples/placeholder/linux/apps/app1/BUILD.gn | 2 +- examples/placeholder/linux/apps/app2/BUILD.gn | 2 +- ...tic-supported-temperature-levels-manager.h | 66 --- ...c-supported-temperature-levels-manager.cpp | 65 --- .../static-supported-temperature-levels.cpp | 33 ++ examples/shell/cc13x2x7_26x2x7/BUILD.gn | 2 +- examples/shell/standalone/BUILD.gn | 5 +- .../supported-temperature-levels-manager.cpp | 40 ++ 25 files changed, 604 insertions(+), 290 deletions(-) delete mode 100644 examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels-manager.h delete mode 100644 examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels-manager.cpp delete mode 100644 examples/placeholder/linux/include/static-supported-temperature-levels-manager.h delete mode 100644 examples/placeholder/linux/static-supported-temperature-levels-manager.cpp create mode 100644 src/app/clusters/temperature-control-server/supported-temperature-levels-manager.cpp diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 7eb4cd56f97bea..4504f2f38d6e18 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -2528,6 +2528,23 @@ server cluster RefrigeratorAlarm = 87 { AlarmMap mask = 3; } +<<<<<<< HEAD +======= + readonly attribute AlarmMap mask = 0; + readonly attribute AlarmMap state = 2; + readonly attribute AlarmMap supported = 3; +/** Attributes and commands for configuring the temperature control, and reporting temperature. */ +server cluster TemperatureControl = 86 { + bitmap Feature : BITMAP32 { + kTemperatureNumber = 0x1; + kTemperatureLevel = 0x2; + kTemperatureStep = 0x4; + } + + readonly attribute temperature temperatureSetpoint = 0; + readonly attribute temperature minTemperature = 1; + readonly attribute temperature maxTemperature = 2; +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -2536,13 +2553,34 @@ server cluster RefrigeratorAlarm = 87 { readonly attribute int16u clusterRevision = 65533; request struct SetTemperatureRequest { - optional INT16S targetTemperature = 0; + optional temperature targetTemperature = 0; optional INT8U targetTemperatureLevel = 1; } command SetTemperature(SetTemperatureRequest): DefaultSuccess = 0; } +/** Attributes and commands for configuring the Refrigerator alarm. */ +server cluster RefrigeratorAlarm = 87 { + bitmap AlarmMap : BITMAP32 { + kDoorOpen = 0x1; + } + + info event Notify = 0 { + AlarmMap active = 0; + AlarmMap inactive = 1; + AlarmMap state = 2; + AlarmMap mask = 3; + } + + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** Attributes for reporting air quality classification */ server cluster AirQuality = 91 { enum AirQualityEnum : ENUM8 { @@ -6500,17 +6538,6 @@ endpoint 0 { ram attribute clusterRevision default = 1; } - server cluster TemperatureControl { - ram attribute currentTemperatureLevelIndex; - callback attribute supportedTemperatureLevels; - callback attribute generatedCommandList; - callback attribute acceptedCommandList; - callback attribute eventList; - callback attribute attributeList; - ram attribute featureMap default = 2; - ram attribute clusterRevision default = 1; - } - server cluster RelativeHumidityMeasurement { ram attribute measuredValue; ram attribute minMeasuredValue default = 0; @@ -6679,13 +6706,23 @@ endpoint 1 { } server cluster TemperatureControl { +<<<<<<< HEAD ram attribute selectedTemperatureLevel default = 0; callback attribute supportedTemperatureLevels; +======= + ram attribute temperatureSetpoint default = 1; + ram attribute minTemperature default = 0; + ram attribute maxTemperature default = 100; +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; +<<<<<<< HEAD ram attribute featureMap default = 2; +======= + ram attribute featureMap default = 1; +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) ram attribute clusterRevision default = 1; } 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 d2d95e49edea70..2a00a9e7eb7529 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 @@ -7034,6 +7034,211 @@ ] }, { +<<<<<<< HEAD +======= + "name": "Temperature Control", + "code": 86, + "mfgCode": null, + "define": "TEMPERATURE_CONTROL_CLUSTER", + "side": "server", + "enabled": 0, + "attributes": [ + { + "name": "TemperatureSetpoint", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "temperature", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MinTemperature", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "temperature", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxTemperature", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "temperature", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Step", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "temperature", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SelectedTemperatureLevel", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportedTemperatureLevels", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) "name": "Door Lock", "code": 257, "mfgCode": null, @@ -13639,7 +13844,11 @@ "mfgCode": null, "side": "server", "type": "temperature", +<<<<<<< HEAD "included": 0, +======= + "included": 1, +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -13655,7 +13864,11 @@ "mfgCode": null, "side": "server", "type": "temperature", +<<<<<<< HEAD "included": 0, +======= + "included": 1, +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -13668,6 +13881,7 @@ { "name": "MaxTemperature", "code": 2, +<<<<<<< HEAD "mfgCode": null, "side": "server", "type": "temperature", @@ -13703,12 +13917,16 @@ "mfgCode": null, "side": "server", "type": "int8u", +======= + "mfgCode": null, + "side": "server", + "type": "temperature", +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", - "defaultValue": "", + "defaultValue": "100", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -13719,8 +13937,8 @@ "code": 3, "mfgCode": null, "side": "server", - "type": "int16s", - "included": 1, + "type": "temperature", + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -13731,7 +13949,7 @@ "reportableChange": 0 }, { - "name": "CurrentTemperatureLevelIndex", + "name": "SelectedTemperatureLevel", "code": 4, "mfgCode": null, "side": "server", @@ -14032,6 +14250,189 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, +<<<<<<< HEAD +======= + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Refrigerator Alarm", + "code": 87, + "mfgCode": null, + "define": "REFRIGERATOR_ALARM", + "side": "client", + "enabled": 0, + "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": "Refrigerator Alarm", + "code": 87, + "mfgCode": null, + "define": "REFRIGERATOR_ALARM", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "Mask", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "AlarmMap", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "State", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "AlarmMap", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) "defaultValue": "1", "reportable": 1, "minInterval": 1, diff --git a/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels-manager.h b/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels-manager.h deleted file mode 100644 index 38e2556a6bbb98..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels-manager.h +++ /dev/null @@ -1,66 +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 { -namespace TemperatureControl { - -/** - * This implementation statically defines the options. - */ - -class StaticSupportedTemperatureLevelsManager : public SupportedTemperatureLevelsManager -{ - using TemperatureLevelStructType = Structs::TemperatureLevelStruct::Type; - using storage_value_type = TemperatureLevelStructType; - - struct EndpointPair - { - EndpointId mEndpointId; - TemperatureLevelStructType * mData; - int mSize; - - EndpointPair(EndpointId aEndpointId, TemperatureLevelStructType * aData, int aSize) : - mEndpointId(aEndpointId), mData(aData), mSize(aSize) - {} - }; - - static storage_value_type temperatureLevelOptions[]; - -public: - static const EndpointPair supportedOptionsByEndpoints[EMBER_AF_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; - - static TemperatureLevelStructType * data; - - ~StaticSupportedTemperatureLevelsManager(){}; - - StaticSupportedTemperatureLevelsManager() {} -}; - -} // namespace TemperatureControl -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h b/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h index 61019203ce1f0f..6a676b8054bf89 100644 --- a/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h +++ b/examples/all-clusters-app/all-clusters-common/include/static-supported-temperature-levels.h @@ -20,7 +20,11 @@ #include #include +<<<<<<< HEAD #include +======= +#include +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) namespace chip { namespace app { @@ -31,7 +35,11 @@ namespace TemperatureControl { * This implementation statically defines the options. */ +<<<<<<< HEAD class AppSupportedTemperatureLevelsDelegate : public SupportedTemperatureLevelsIteratorDelegate +======= +class StaticSupportedTemperatureLevels : public SupportedTemperatureLevelsIterator +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) { struct EndpointPair { @@ -51,11 +59,19 @@ class AppSupportedTemperatureLevelsDelegate : public SupportedTemperatureLevelsI public: static const EndpointPair supportedOptionsByEndpoints[EMBER_AF_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; +<<<<<<< HEAD uint8_t Size() override; CHIP_ERROR Next(chip::MutableCharSpan & item) override; ~AppSupportedTemperatureLevelsDelegate() {} +======= + int Size() override; + + bool Next(chip::MutableCharSpan & item) override; + + ~StaticSupportedTemperatureLevels() {} +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) }; } // namespace TemperatureControl diff --git a/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels-manager.cpp b/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels-manager.cpp deleted file mode 100644 index 02f19655d3e34e..00000000000000 --- a/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels-manager.cpp +++ /dev/null @@ -1,65 +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 -#include - -using namespace std; -using namespace chip; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::TemperatureControl; -using chip::Protocols::InteractionModel::Status; - -using TemperatureLevelStructType = Structs::TemperatureLevelStruct::Type; -using storage_value_type = TemperatureLevelStructType; -namespace { -Structs::TemperatureLevelStruct::Type buildTemperatureLevelStruct(const char * label, uint8_t temperatureLevel) -{ - Structs::TemperatureLevelStruct::Type option; - option.label = CharSpan::fromCharString(label); - option.temperatureLevel = temperatureLevel; - return option; -} -} // namespace - -// TODO: Configure your options for each endpoint -storage_value_type StaticSupportedTemperatureLevelsManager::temperatureLevelOptions[] = { - buildTemperatureLevelStruct("wash Temperature", 1), buildTemperatureLevelStruct("rinse Temperature", 2), - buildTemperatureLevelStruct("dry Temperature", 3) -}; -const StaticSupportedTemperatureLevelsManager::EndpointPair StaticSupportedTemperatureLevelsManager::supportedOptionsByEndpoints - [EMBER_AF_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT] = { - EndpointPair(1, StaticSupportedTemperatureLevelsManager::temperatureLevelOptions, 3) // Options for Endpoint 1 - }; - -bool StaticSupportedTemperatureLevelsManager::SupportedTemperatureLevelsManager::Iterator::Next(TemperatureLevelStructType & item) -{ - for (auto & endpointPair : StaticSupportedTemperatureLevelsManager::supportedOptionsByEndpoints) - { - if (endpointPair.mEndpointId == mEndpoint) - { - if (endpointPair.mSize > mIndex) - { - item = endpointPair.mData[mIndex]; - mIndex++; - return true; - } - } - } - return false; -} diff --git a/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp b/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp index d4d31f4f94f4e9..222e20f34f4bd9 100644 --- a/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp @@ -16,8 +16,13 @@ * limitations under the License. */ +<<<<<<< HEAD #include #include +======= +#include +#include +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) using namespace std; using namespace chip; @@ -26,6 +31,7 @@ using namespace chip::app::Clusters::TemperatureControl; using chip::Protocols::InteractionModel::Status; // TODO: Configure your options for each endpoint +<<<<<<< HEAD chip::CharSpan AppSupportedTemperatureLevelsDelegate::temperatureLevelOptions[] = { chip::CharSpan("Hot", 3), chip::CharSpan("Warm", 4), chip::CharSpan("Freezing", 8) }; @@ -38,6 +44,19 @@ const AppSupportedTemperatureLevelsDelegate::EndpointPair AppSupportedTemperatur uint8_t AppSupportedTemperatureLevelsDelegate::Size() { for (auto & endpointPair : AppSupportedTemperatureLevelsDelegate::supportedOptionsByEndpoints) +======= +chip::CharSpan StaticSupportedTemperatureLevels::temperatureLevelOptions[] = { chip::CharSpan("Cold", 4), chip::CharSpan("Warm", 4), + chip::CharSpan("Hot", 3) }; + +const StaticSupportedTemperatureLevels::EndpointPair + StaticSupportedTemperatureLevels::supportedOptionsByEndpoints[EMBER_AF_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT] = { + EndpointPair(1, StaticSupportedTemperatureLevels::temperatureLevelOptions, 3) // Options for Endpoint 1 + }; + +int StaticSupportedTemperatureLevels::Size() +{ + for (auto & endpointPair : StaticSupportedTemperatureLevels::supportedOptionsByEndpoints) +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) { if (endpointPair.mEndpointId == mEndpoint) { @@ -47,9 +66,15 @@ uint8_t AppSupportedTemperatureLevelsDelegate::Size() return 0; } +<<<<<<< HEAD CHIP_ERROR AppSupportedTemperatureLevelsDelegate::Next(chip::MutableCharSpan & item) { for (auto & endpointPair : AppSupportedTemperatureLevelsDelegate::supportedOptionsByEndpoints) +======= +bool StaticSupportedTemperatureLevels::Next(chip::MutableCharSpan & item) +{ + for (auto & endpointPair : StaticSupportedTemperatureLevels::supportedOptionsByEndpoints) +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) { if (endpointPair.mEndpointId == mEndpoint) { @@ -59,6 +84,7 @@ CHIP_ERROR AppSupportedTemperatureLevelsDelegate::Next(chip::MutableCharSpan & i if (err != CHIP_NO_ERROR) { ChipLogError(Zcl, "Error copying char span to mutable char span %s", chip::ErrorStr(err)); +<<<<<<< HEAD return err; } mIndex++; @@ -67,4 +93,13 @@ CHIP_ERROR AppSupportedTemperatureLevelsDelegate::Next(chip::MutableCharSpan & i } } return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +======= + } + mIndex++; + return true; + } + } + } + return false; +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) } diff --git a/examples/all-clusters-app/ameba/main/chipinterface.cpp b/examples/all-clusters-app/ameba/main/chipinterface.cpp index 55107d380a555f..25d098aac1d5bb 100644 --- a/examples/all-clusters-app/ameba/main/chipinterface.cpp +++ b/examples/all-clusters-app/ameba/main/chipinterface.cpp @@ -62,7 +62,11 @@ app::Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointMain /* Endpoint Id */, &(NetworkCommissioning::AmebaWiFiDriver::GetInstance())); +<<<<<<< HEAD app::Clusters::TemperatureControl::AppSupportedTemperatureLevelsDelegate sAppSupportedTemperatureLevelsDelegate; +======= +app::Clusters::TemperatureControl::StaticSupportedTemperatureLevels instance; +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) } // namespace void NetWorkCommissioningInstInit() @@ -144,7 +148,11 @@ static void InitServer(intptr_t context) #if CONFIG_ENABLE_CHIP_SHELL InitBindingHandler(); #endif +<<<<<<< HEAD app::Clusters::TemperatureControl::SetInstance(&sAppSupportedTemperatureLevelsDelegate); +======= + app::Clusters::TemperatureControl::SupportedTemperatureLevelsIterator::SetInstance(&instance); +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) } extern "C" void ChipTest(void) diff --git a/examples/all-clusters-app/asr/BUILD.gn b/examples/all-clusters-app/asr/BUILD.gn index a701ccf8e2c170..bc3e42a9925259 100755 --- a/examples/all-clusters-app/asr/BUILD.gn +++ b/examples/all-clusters-app/asr/BUILD.gn @@ -76,6 +76,7 @@ asr_executable("clusters_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "${examples_plat_dir}/ButtonHandler.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "${examples_plat_dir}/CHIPDeviceManager.cpp", "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/init_Matter.cpp", diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 3e2f9c40f807a7..b97b6b8064aaa8 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -29,6 +29,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/src/app/clusters/temperature-control-server/supported-temperature-levels-manager.cpp", "AllClustersCommandDelegate.cpp", "AppOptions.cpp", "WindowCoveringManager.cpp", diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index 94e841dd81dbed..438f1ee5266eef 100644 --- a/examples/all-clusters-app/tizen/BUILD.gn +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -28,6 +28,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "${chip_root}/src/app/clusters/temperature-control-server/supported-temperature-levels-manager.cpp", ] deps = [ diff --git a/examples/all-clusters-minimal-app/ameba/chip_main.cmake b/examples/all-clusters-minimal-app/ameba/chip_main.cmake index 2f87c81ccc9d6e..3b1ff990d02fff 100755 --- a/examples/all-clusters-minimal-app/ameba/chip_main.cmake +++ b/examples/all-clusters-minimal-app/ameba/chip_main.cmake @@ -131,7 +131,7 @@ list( ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/bridged-actions-stub.cpp ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/smco-stub.cpp ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/static-supported-modes-manager.cpp - ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/static-supported-temperature-levels-manager.cpp + ${chip_dir}/examples/all-clusters-minimal-app/all-clusters-common/src/static-supported-temperature-levels.cpp ${chip_dir}/examples/all-clusters-minimal-app/ameba/main/chipinterface.cpp ${chip_dir}/examples/all-clusters-minimal-app/ameba/main/DeviceCallbacks.cpp diff --git a/examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn b/examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn index 58d21086d93e4d..70dbacaf509430 100644 --- a/examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn +++ b/examples/all-clusters-minimal-app/infineon/psoc6/BUILD.gn @@ -111,7 +111,7 @@ psoc6_executable("clusters_minimal_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels-manager.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/init_psoc6Platform.cpp", "src/AppTask.cpp", diff --git a/examples/all-clusters-minimal-app/linux/BUILD.gn b/examples/all-clusters-minimal-app/linux/BUILD.gn index 9e61183aace1fd..e417969c151c65 100644 --- a/examples/all-clusters-minimal-app/linux/BUILD.gn +++ b/examples/all-clusters-minimal-app/linux/BUILD.gn @@ -25,7 +25,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels-manager.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "AppOptions.cpp", "include/tv-callbacks.cpp", "include/tv-callbacks.h", diff --git a/examples/all-clusters-minimal-app/mbed/CMakeLists.txt b/examples/all-clusters-minimal-app/mbed/CMakeLists.txt index bd0e24a59db30c..7e4af8f0b51270 100644 --- a/examples/all-clusters-minimal-app/mbed/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/mbed/CMakeLists.txt @@ -62,7 +62,7 @@ target_sources(${APP_TARGET} PRIVATE ${ALL_CLUSTERS_COMMON}/src/bridged-actions-stub.cpp ${ALL_CLUSTERS_COMMON}/src/smco-stub.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp - ${ALL_CLUSTERS_COMMON}/src/static-supported-temperature-levels-manager.cpp + ${ALL_CLUSTERS_COMMON}/src/static-supported-temperature-levels.cpp ) chip_configure_data_model(${APP_TARGET} diff --git a/examples/all-clusters-minimal-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-minimal-app/nrfconnect/CMakeLists.txt index 6073eafbee7bf7..19d03c00beb378 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/nrfconnect/CMakeLists.txt @@ -57,7 +57,7 @@ target_sources(app PRIVATE main/main.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/smco-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-modes-manager.cpp - ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels-manager.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp ${NRFCONNECT_COMMON}/util/LEDWidget.cpp) diff --git a/examples/all-clusters-minimal-app/telink/CMakeLists.txt b/examples/all-clusters-minimal-app/telink/CMakeLists.txt index c91eca49e06f68..d21468a9a34b33 100644 --- a/examples/all-clusters-minimal-app/telink/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/telink/CMakeLists.txt @@ -72,7 +72,7 @@ target_sources(app PRIVATE src/AppTask.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/smco-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-modes-manager.cpp - ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels-manager.cpp + ${ALL_CLUSTERS_COMMON_DIR}/src/static-supported-temperature-levels.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/binding-handler.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp diff --git a/examples/all-clusters-minimal-app/tizen/BUILD.gn b/examples/all-clusters-minimal-app/tizen/BUILD.gn index dd8af642f61f88..34b3c0b27806d5 100644 --- a/examples/all-clusters-minimal-app/tizen/BUILD.gn +++ b/examples/all-clusters-minimal-app/tizen/BUILD.gn @@ -27,7 +27,7 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels-manager.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", ] deps = [ diff --git a/examples/placeholder/linux/apps/app1/BUILD.gn b/examples/placeholder/linux/apps/app1/BUILD.gn index 68315c8dfe4119..cf6920b1d6b107 100644 --- a/examples/placeholder/linux/apps/app1/BUILD.gn +++ b/examples/placeholder/linux/apps/app1/BUILD.gn @@ -32,7 +32,7 @@ source_set("app1") { sources = [ "../../src/bridged-actions-stub.cpp", "../../static-supported-modes-manager.cpp", - "../../static-supported-temperature-levels-manager.cpp", + "../../static-supported-temperature-levels.cpp", ] public_deps = [ ":configuration" ] diff --git a/examples/placeholder/linux/apps/app2/BUILD.gn b/examples/placeholder/linux/apps/app2/BUILD.gn index ea9e4a2764358f..87868f4601a5d9 100644 --- a/examples/placeholder/linux/apps/app2/BUILD.gn +++ b/examples/placeholder/linux/apps/app2/BUILD.gn @@ -32,7 +32,7 @@ source_set("app2") { sources = [ "../../src/bridged-actions-stub.cpp", "../../static-supported-modes-manager.cpp", - "../../static-supported-temperature-levels-manager.cpp", + "../../static-supported-temperature-levels.cpp", ] public_deps = [ ":configuration" ] diff --git a/examples/placeholder/linux/include/static-supported-temperature-levels-manager.h b/examples/placeholder/linux/include/static-supported-temperature-levels-manager.h deleted file mode 100644 index 38e2556a6bbb98..00000000000000 --- a/examples/placeholder/linux/include/static-supported-temperature-levels-manager.h +++ /dev/null @@ -1,66 +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 { -namespace TemperatureControl { - -/** - * This implementation statically defines the options. - */ - -class StaticSupportedTemperatureLevelsManager : public SupportedTemperatureLevelsManager -{ - using TemperatureLevelStructType = Structs::TemperatureLevelStruct::Type; - using storage_value_type = TemperatureLevelStructType; - - struct EndpointPair - { - EndpointId mEndpointId; - TemperatureLevelStructType * mData; - int mSize; - - EndpointPair(EndpointId aEndpointId, TemperatureLevelStructType * aData, int aSize) : - mEndpointId(aEndpointId), mData(aData), mSize(aSize) - {} - }; - - static storage_value_type temperatureLevelOptions[]; - -public: - static const EndpointPair supportedOptionsByEndpoints[EMBER_AF_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT]; - - static TemperatureLevelStructType * data; - - ~StaticSupportedTemperatureLevelsManager(){}; - - StaticSupportedTemperatureLevelsManager() {} -}; - -} // namespace TemperatureControl -} // namespace Clusters -} // namespace app -} // namespace chip diff --git a/examples/placeholder/linux/static-supported-temperature-levels-manager.cpp b/examples/placeholder/linux/static-supported-temperature-levels-manager.cpp deleted file mode 100644 index 02f19655d3e34e..00000000000000 --- a/examples/placeholder/linux/static-supported-temperature-levels-manager.cpp +++ /dev/null @@ -1,65 +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 -#include - -using namespace std; -using namespace chip; -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::TemperatureControl; -using chip::Protocols::InteractionModel::Status; - -using TemperatureLevelStructType = Structs::TemperatureLevelStruct::Type; -using storage_value_type = TemperatureLevelStructType; -namespace { -Structs::TemperatureLevelStruct::Type buildTemperatureLevelStruct(const char * label, uint8_t temperatureLevel) -{ - Structs::TemperatureLevelStruct::Type option; - option.label = CharSpan::fromCharString(label); - option.temperatureLevel = temperatureLevel; - return option; -} -} // namespace - -// TODO: Configure your options for each endpoint -storage_value_type StaticSupportedTemperatureLevelsManager::temperatureLevelOptions[] = { - buildTemperatureLevelStruct("wash Temperature", 1), buildTemperatureLevelStruct("rinse Temperature", 2), - buildTemperatureLevelStruct("dry Temperature", 3) -}; -const StaticSupportedTemperatureLevelsManager::EndpointPair StaticSupportedTemperatureLevelsManager::supportedOptionsByEndpoints - [EMBER_AF_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT] = { - EndpointPair(1, StaticSupportedTemperatureLevelsManager::temperatureLevelOptions, 3) // Options for Endpoint 1 - }; - -bool StaticSupportedTemperatureLevelsManager::SupportedTemperatureLevelsManager::Iterator::Next(TemperatureLevelStructType & item) -{ - for (auto & endpointPair : StaticSupportedTemperatureLevelsManager::supportedOptionsByEndpoints) - { - if (endpointPair.mEndpointId == mEndpoint) - { - if (endpointPair.mSize > mIndex) - { - item = endpointPair.mData[mIndex]; - mIndex++; - return true; - } - } - } - return false; -} diff --git a/examples/placeholder/linux/static-supported-temperature-levels.cpp b/examples/placeholder/linux/static-supported-temperature-levels.cpp index 09eb0cba7a094d..19e83950fa5601 100644 --- a/examples/placeholder/linux/static-supported-temperature-levels.cpp +++ b/examples/placeholder/linux/static-supported-temperature-levels.cpp @@ -18,7 +18,10 @@ #include #include +<<<<<<< HEAD #include +======= +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) using namespace std; using namespace chip; @@ -27,6 +30,7 @@ using namespace chip::app::Clusters::TemperatureControl; using chip::Protocols::InteractionModel::Status; // TODO: Configure your options for each endpoint +<<<<<<< HEAD chip::CharSpan AppSupportedTemperatureLevelsDelegate::temperatureLevelOptions[] = { chip::CharSpan("Hot", 3), chip::CharSpan("Warm", 4), chip::CharSpan("Cold", 4) }; @@ -39,6 +43,19 @@ const AppSupportedTemperatureLevelsDelegate::EndpointPair AppSupportedTemperatur uint8_t AppSupportedTemperatureLevelsDelegate::Size() { for (auto & endpointPair : AppSupportedTemperatureLevelsDelegate::supportedOptionsByEndpoints) +======= +chip::CharSpan StaticSupportedTemperatureLevels::temperatureLevelOptions[] = { chip::CharSpan("Cold", 4), chip::CharSpan("Warm", 4), + chip::CharSpan("Hot", 3) }; + +const StaticSupportedTemperatureLevels::EndpointPair + StaticSupportedTemperatureLevels::supportedOptionsByEndpoints[EMBER_AF_TEMPERATURE_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT] = { + EndpointPair(1, StaticSupportedTemperatureLevels::temperatureLevelOptions, 3) // Options for Endpoint 1 + }; + +int StaticSupportedTemperatureLevels::Size() +{ + for (auto & endpointPair : StaticSupportedTemperatureLevels::supportedOptionsByEndpoints) +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) { if (endpointPair.mEndpointId == mEndpoint) { @@ -48,14 +65,21 @@ uint8_t AppSupportedTemperatureLevelsDelegate::Size() return 0; } +<<<<<<< HEAD CHIP_ERROR AppSupportedTemperatureLevelsDelegate::Next(chip::MutableCharSpan & item) { for (auto & endpointPair : AppSupportedTemperatureLevelsDelegate::supportedOptionsByEndpoints) +======= +bool StaticSupportedTemperatureLevels::Next(chip::CharSpan & item) +{ + for (auto & endpointPair : StaticSupportedTemperatureLevels::supportedOptionsByEndpoints) +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) { if (endpointPair.mEndpointId == mEndpoint) { if (endpointPair.mSize > mIndex) { +<<<<<<< HEAD CHIP_ERROR err = chip::CopyCharSpanToMutableCharSpan(endpointPair.mTemperatureLevels[mIndex], item); if (err != CHIP_NO_ERROR) { @@ -68,4 +92,13 @@ CHIP_ERROR AppSupportedTemperatureLevelsDelegate::Next(chip::MutableCharSpan & i } } return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +======= + item = endpointPair.mTemperatureLevels[mIndex]; + mIndex++; + return true; + } + } + } + return false; +>>>>>>> 07d46e3ba1 (Restructure server implementation to match spec) } diff --git a/examples/shell/cc13x2x7_26x2x7/BUILD.gn b/examples/shell/cc13x2x7_26x2x7/BUILD.gn index 996aa3b1f63ad4..f63e480e7e1cab 100644 --- a/examples/shell/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/shell/cc13x2x7_26x2x7/BUILD.gn @@ -78,7 +78,7 @@ ti_simplelink_executable("shell_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", - "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels-manager.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", "main/AppTask.cpp", "main/main.cpp", ] diff --git a/examples/shell/standalone/BUILD.gn b/examples/shell/standalone/BUILD.gn index 0602af47bb691a..e04c8142e905d1 100644 --- a/examples/shell/standalone/BUILD.gn +++ b/examples/shell/standalone/BUILD.gn @@ -23,7 +23,10 @@ assert(chip_build_tools) project_dir = "./.." executable("chip-shell") { - sources = [ "main.cpp" ] + sources = [ + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", + "main.cpp", + ] deps = [ "${chip_root}/src/lib/shell", diff --git a/src/app/clusters/temperature-control-server/supported-temperature-levels-manager.cpp b/src/app/clusters/temperature-control-server/supported-temperature-levels-manager.cpp new file mode 100644 index 00000000000000..23ebb218b27430 --- /dev/null +++ b/src/app/clusters/temperature-control-server/supported-temperature-levels-manager.cpp @@ -0,0 +1,40 @@ +/* + * + * 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 "supported-temperature-levels-manager.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace TemperatureControl { +static SupportedTemperatureLevelsIterator * sInstance = nullptr; + +SupportedTemperatureLevelsIterator * SupportedTemperatureLevelsIterator::GetInstance() +{ + return sInstance; +} + +void SupportedTemperatureLevelsIterator::SetInstance(SupportedTemperatureLevelsIterator * instance) +{ + sInstance = instance; +} + +} // namespace TemperatureControl +} // namespace Clusters +} // namespace app +} // namespace chip