Skip to content

Commit 4420940

Browse files
jadhavrohit924bzbarsky-apple
authored andcommitted
Add temperature-control cluster xml and generate zap (#26548)
* Add temperature-control cluster xml and generate zap * Addressed review comments and zap generated * Changed domain name to Appliences * Fix Android build. * Align feature map naming with what we are doing with other clusters. --------- Co-authored-by: Boris Zbarsky <[email protected]>
1 parent b38165c commit 4420940

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+5444
-2
lines changed

.github/workflows/tests.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ jobs:
188188
src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml \
189189
src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml \
190190
src/app/zap-templates/zcl/data-model/chip/window-covering.xml \
191+
src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml \
191192
src/app/zap-templates/zcl/data-model/chip/matter-devices.xml \
192193
src/app/zap-templates/zcl/data-model/draft/barrier-control-cluster.xml \
193194
src/app/zap-templates/zcl/data-model/draft/electrical-measurement-cluster.xml \

scripts/rules.matterlint

+1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/user-label-cluster.xml";
7171
load "../src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml";
7272
load "../src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml";
7373
load "../src/app/zap-templates/zcl/data-model/chip/window-covering.xml";
74+
load "../src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml";
7475
load "../src/app/zap-templates/zcl/data-model/draft/barrier-control-cluster.xml";
7576
load "../src/app/zap-templates/zcl/data-model/draft/electrical-measurement-cluster.xml";
7677
load "../src/app/zap-templates/zcl/data-model/draft/input-output-value-clusters.xml";

src/app/zap-templates/zcl/data-model/all.xml

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<xi:include href="chip/wake-on-lan-cluster.xml" />
7474
<xi:include href="chip/wifi-network-diagnostics-cluster.xml" />
7575
<xi:include href="chip/window-covering.xml" />
76+
<xi:include href="chip/temperature-control-cluster.xml" />
7677
<xi:include href="chip/matter-devices.xml" />
7778
<xi:include href="draft/barrier-control.xml" />
7879
<xi:include href="draft/electrical-measurement-cluster.xml" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Copyright (c) 2023 Project CHIP Authors
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<configurator>
18+
<domain name="CHIP"/>
19+
20+
<struct name="TemperatureLevelStruct">
21+
<cluster code="0x0056"/>
22+
<item fieldId="0" name="Label" type="char_string" length="64" isNullable="false" writable="false"/>
23+
<item fieldId="1" name="TempLevel" type="int8u" isNullable="false" writable="false"/>
24+
</struct>
25+
26+
<cluster>
27+
<name>Temperature Control</name>
28+
<domain>Appliances</domain>
29+
<description>Attributes and commands for configuring the temperature control, and reporting temperature.</description>
30+
<code>0x0056</code>
31+
<define>TEMPERATURE_CONTROL_CLUSTER</define>
32+
<client tick="false" init="false">true</client>
33+
<server tick="false" init="false">true</server>
34+
<attribute side="server" code="0x0000" define="TEMP_SETPOINT" type="INT16S" writable="false" optional="true">TemperatureSetpoint</attribute>
35+
<attribute side="server" code="0x0001" define="MIN_TEMP" type="INT16S" writable="false" optional="true">MinTemperature</attribute>
36+
<attribute side="server" code="0x0002" define="MAX_TEMP" type="INT16S" writable="false" optional="true">MaxTemperature</attribute>
37+
<attribute side="server" code="0x0003" define="STEP" type="INT16S" writable="false" optional="true">Step</attribute>
38+
<attribute side="server" code="0x0004" define="CURRENT_TEMP_LEVEL_IND" type="INT8U" writable="false" optional="true">CurrentTemperatureLevelIndex</attribute>
39+
<attribute side="server" code="0x0005" define="SUPPORTED_TEMP_LEVELS" type="ARRAY" entryType="TemperatureLevelStruct" writable="false" optional="true">SupportedTemperatureLevels</attribute>
40+
41+
<command source="client" code="0x00" name="SetTemperature" optional="false">
42+
<description>Set Temperature</description>
43+
<arg name="TargetTemperature" type="INT16S" min="MIN_TEMP" max="MAX_TEMP" optional="true"/>
44+
<arg name="TargetTemperatureLevel" type="INT8U" optional="true"/>
45+
</command>
46+
</cluster>
47+
<bitmap name="Feature" type="BITMAP32">
48+
<cluster code="0x0056"/>
49+
<field mask="0x01" name="TemperatureNumber" />
50+
<field mask="0x02" name="TemperatureLevel" />
51+
</bitmap>
52+
</configurator>

src/app/zap-templates/zcl/zcl-with-test-extensions.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"software-diagnostics-cluster.xml",
7979
"switch-cluster.xml",
8080
"target-navigator-cluster.xml",
81+
"temperature-control-cluster.xml",
8182
"temperature-measurement-cluster.xml",
8283
"test-cluster.xml",
8384
"thermostat-cluster.xml",
@@ -286,7 +287,8 @@
286287
"DSTOffset",
287288
"UTCTime",
288289
"LocalTime"
289-
]
290+
],
291+
"Temperature Control": ["SupportedTemperatureLevels"]
290292
},
291293
"defaultReportingPolicy": "mandatory",
292294
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],

src/app/zap-templates/zcl/zcl.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"software-diagnostics-cluster.xml",
7777
"switch-cluster.xml",
7878
"target-navigator-cluster.xml",
79+
"temperature-control-cluster.xml",
7980
"temperature-measurement-cluster.xml",
8081
"test-cluster.xml",
8182
"thermostat-cluster.xml",
@@ -284,7 +285,8 @@
284285
"DSTOffset",
285286
"UTCTime",
286287
"LocalTime"
287-
]
288+
],
289+
"Temperature Control": ["SupportedTemperatureLevels"]
288290
},
289291
"defaultReportingPolicy": "mandatory",
290292
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],

src/app/zap_cluster_list.json

+2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
"WATER_TANK_MONITORING_CLUSTER": [],
9898
"WIFI_NETWORK_DIAGNOSTICS_CLUSTER": [],
9999
"WINDOW_COVERING_CLUSTER": [],
100+
"TEMPERATURE_CONTROL_CLUSTER": [],
100101
"ZEOLITE_FILTER_MONITORING_CLUSTER": [],
101102
"ZLL_COMMISSIONING_CLUSTER": []
102103
},
@@ -199,6 +200,7 @@
199200
"WAKE_ON_LAN_CLUSTER": ["wake-on-lan-server"],
200201
"WIFI_NETWORK_DIAGNOSTICS_CLUSTER": ["wifi-network-diagnostics-server"],
201202
"WINDOW_COVERING_CLUSTER": ["window-covering-server"],
203+
"TEMPERATURE_CONTROL_CLUSTER": ["temperature-control-server"],
202204
"ZLL_COMMISSIONING_CLUSTER": []
203205
}
204206
}

src/controller/data_model/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ if (current_os == "android" || build_java_matter_controller) {
184184
"jni/SwitchClient-ReadImpl.cpp",
185185
"jni/TargetNavigatorClient-InvokeSubscribeImpl.cpp",
186186
"jni/TargetNavigatorClient-ReadImpl.cpp",
187+
"jni/TemperatureControlClient-InvokeSubscribeImpl.cpp",
188+
"jni/TemperatureControlClient-ReadImpl.cpp",
187189
"jni/TemperatureMeasurementClient-InvokeSubscribeImpl.cpp",
188190
"jni/TemperatureMeasurementClient-ReadImpl.cpp",
189191
"jni/ThermostatClient-InvokeSubscribeImpl.cpp",

src/controller/data_model/controller-clusters.matter

+34
Original file line numberDiff line numberDiff line change
@@ -2772,6 +2772,40 @@ client cluster ModeSelect = 80 {
27722772
command ChangeToMode(ChangeToModeRequest): DefaultSuccess = 0;
27732773
}
27742774

2775+
/** Attributes and commands for configuring the temperature control, and reporting temperature. */
2776+
client cluster TemperatureControl = 86 {
2777+
bitmap Feature : BITMAP32 {
2778+
kTemperatureNumber = 0x1;
2779+
kTemperatureLevel = 0x2;
2780+
}
2781+
2782+
struct TemperatureLevelStruct {
2783+
char_string<64> label = 0;
2784+
int8u tempLevel = 1;
2785+
}
2786+
2787+
readonly attribute optional int16s temperatureSetpoint = 0;
2788+
readonly attribute optional int16s minTemperature = 1;
2789+
readonly attribute optional int16s maxTemperature = 2;
2790+
readonly attribute optional int16s step = 3;
2791+
readonly attribute optional int8u currentTemperatureLevelIndex = 4;
2792+
readonly attribute optional TemperatureLevelStruct supportedTemperatureLevels[] = 5;
2793+
readonly attribute command_id generatedCommandList[] = 65528;
2794+
readonly attribute command_id acceptedCommandList[] = 65529;
2795+
readonly attribute event_id eventList[] = 65530;
2796+
readonly attribute attrib_id attributeList[] = 65531;
2797+
readonly attribute bitmap32 featureMap = 65532;
2798+
readonly attribute int16u clusterRevision = 65533;
2799+
2800+
request struct SetTemperatureRequest {
2801+
optional INT16S targetTemperature = 0;
2802+
optional INT8U targetTemperatureLevel = 1;
2803+
}
2804+
2805+
/** Set Temperature */
2806+
command SetTemperature(SetTemperatureRequest): DefaultSuccess = 0;
2807+
}
2808+
27752809
/** Attributes for reporting air quality classification */
27762810
client cluster AirQuality = 91 {
27772811
enum AirQualityEnum : ENUM8 {

src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java

+180
Original file line numberDiff line numberDiff line change
@@ -7779,6 +7779,185 @@ private static Map<String, InteractionInfo> readModeSelectInteractionInfo() {
77797779
return result;
77807780
}
77817781

7782+
private static Map<String, InteractionInfo> readTemperatureControlInteractionInfo() {
7783+
Map<String, InteractionInfo> result = new LinkedHashMap<>();
7784+
Map<String, CommandParameterInfo> readTemperatureControlTemperatureSetpointCommandParams =
7785+
new LinkedHashMap<String, CommandParameterInfo>();
7786+
InteractionInfo readTemperatureControlTemperatureSetpointAttributeInteractionInfo =
7787+
new InteractionInfo(
7788+
(cluster, callback, commandArguments) -> {
7789+
((ChipClusters.TemperatureControlCluster) cluster)
7790+
.readTemperatureSetpointAttribute(
7791+
(ChipClusters.IntegerAttributeCallback) callback);
7792+
},
7793+
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
7794+
readTemperatureControlTemperatureSetpointCommandParams);
7795+
result.put(
7796+
"readTemperatureSetpointAttribute",
7797+
readTemperatureControlTemperatureSetpointAttributeInteractionInfo);
7798+
Map<String, CommandParameterInfo> readTemperatureControlMinTemperatureCommandParams =
7799+
new LinkedHashMap<String, CommandParameterInfo>();
7800+
InteractionInfo readTemperatureControlMinTemperatureAttributeInteractionInfo =
7801+
new InteractionInfo(
7802+
(cluster, callback, commandArguments) -> {
7803+
((ChipClusters.TemperatureControlCluster) cluster)
7804+
.readMinTemperatureAttribute((ChipClusters.IntegerAttributeCallback) callback);
7805+
},
7806+
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
7807+
readTemperatureControlMinTemperatureCommandParams);
7808+
result.put(
7809+
"readMinTemperatureAttribute",
7810+
readTemperatureControlMinTemperatureAttributeInteractionInfo);
7811+
Map<String, CommandParameterInfo> readTemperatureControlMaxTemperatureCommandParams =
7812+
new LinkedHashMap<String, CommandParameterInfo>();
7813+
InteractionInfo readTemperatureControlMaxTemperatureAttributeInteractionInfo =
7814+
new InteractionInfo(
7815+
(cluster, callback, commandArguments) -> {
7816+
((ChipClusters.TemperatureControlCluster) cluster)
7817+
.readMaxTemperatureAttribute((ChipClusters.IntegerAttributeCallback) callback);
7818+
},
7819+
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
7820+
readTemperatureControlMaxTemperatureCommandParams);
7821+
result.put(
7822+
"readMaxTemperatureAttribute",
7823+
readTemperatureControlMaxTemperatureAttributeInteractionInfo);
7824+
Map<String, CommandParameterInfo> readTemperatureControlStepCommandParams =
7825+
new LinkedHashMap<String, CommandParameterInfo>();
7826+
InteractionInfo readTemperatureControlStepAttributeInteractionInfo =
7827+
new InteractionInfo(
7828+
(cluster, callback, commandArguments) -> {
7829+
((ChipClusters.TemperatureControlCluster) cluster)
7830+
.readStepAttribute((ChipClusters.IntegerAttributeCallback) callback);
7831+
},
7832+
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
7833+
readTemperatureControlStepCommandParams);
7834+
result.put("readStepAttribute", readTemperatureControlStepAttributeInteractionInfo);
7835+
Map<String, CommandParameterInfo>
7836+
readTemperatureControlCurrentTemperatureLevelIndexCommandParams =
7837+
new LinkedHashMap<String, CommandParameterInfo>();
7838+
InteractionInfo readTemperatureControlCurrentTemperatureLevelIndexAttributeInteractionInfo =
7839+
new InteractionInfo(
7840+
(cluster, callback, commandArguments) -> {
7841+
((ChipClusters.TemperatureControlCluster) cluster)
7842+
.readCurrentTemperatureLevelIndexAttribute(
7843+
(ChipClusters.IntegerAttributeCallback) callback);
7844+
},
7845+
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
7846+
readTemperatureControlCurrentTemperatureLevelIndexCommandParams);
7847+
result.put(
7848+
"readCurrentTemperatureLevelIndexAttribute",
7849+
readTemperatureControlCurrentTemperatureLevelIndexAttributeInteractionInfo);
7850+
Map<String, CommandParameterInfo>
7851+
readTemperatureControlSupportedTemperatureLevelsCommandParams =
7852+
new LinkedHashMap<String, CommandParameterInfo>();
7853+
InteractionInfo readTemperatureControlSupportedTemperatureLevelsAttributeInteractionInfo =
7854+
new InteractionInfo(
7855+
(cluster, callback, commandArguments) -> {
7856+
((ChipClusters.TemperatureControlCluster) cluster)
7857+
.readSupportedTemperatureLevelsAttribute(
7858+
(ChipClusters.TemperatureControlCluster
7859+
.SupportedTemperatureLevelsAttributeCallback)
7860+
callback);
7861+
},
7862+
() ->
7863+
new ClusterInfoMapping
7864+
.DelegatedTemperatureControlClusterSupportedTemperatureLevelsAttributeCallback(),
7865+
readTemperatureControlSupportedTemperatureLevelsCommandParams);
7866+
result.put(
7867+
"readSupportedTemperatureLevelsAttribute",
7868+
readTemperatureControlSupportedTemperatureLevelsAttributeInteractionInfo);
7869+
Map<String, CommandParameterInfo> readTemperatureControlGeneratedCommandListCommandParams =
7870+
new LinkedHashMap<String, CommandParameterInfo>();
7871+
InteractionInfo readTemperatureControlGeneratedCommandListAttributeInteractionInfo =
7872+
new InteractionInfo(
7873+
(cluster, callback, commandArguments) -> {
7874+
((ChipClusters.TemperatureControlCluster) cluster)
7875+
.readGeneratedCommandListAttribute(
7876+
(ChipClusters.TemperatureControlCluster.GeneratedCommandListAttributeCallback)
7877+
callback);
7878+
},
7879+
() ->
7880+
new ClusterInfoMapping
7881+
.DelegatedTemperatureControlClusterGeneratedCommandListAttributeCallback(),
7882+
readTemperatureControlGeneratedCommandListCommandParams);
7883+
result.put(
7884+
"readGeneratedCommandListAttribute",
7885+
readTemperatureControlGeneratedCommandListAttributeInteractionInfo);
7886+
Map<String, CommandParameterInfo> readTemperatureControlAcceptedCommandListCommandParams =
7887+
new LinkedHashMap<String, CommandParameterInfo>();
7888+
InteractionInfo readTemperatureControlAcceptedCommandListAttributeInteractionInfo =
7889+
new InteractionInfo(
7890+
(cluster, callback, commandArguments) -> {
7891+
((ChipClusters.TemperatureControlCluster) cluster)
7892+
.readAcceptedCommandListAttribute(
7893+
(ChipClusters.TemperatureControlCluster.AcceptedCommandListAttributeCallback)
7894+
callback);
7895+
},
7896+
() ->
7897+
new ClusterInfoMapping
7898+
.DelegatedTemperatureControlClusterAcceptedCommandListAttributeCallback(),
7899+
readTemperatureControlAcceptedCommandListCommandParams);
7900+
result.put(
7901+
"readAcceptedCommandListAttribute",
7902+
readTemperatureControlAcceptedCommandListAttributeInteractionInfo);
7903+
Map<String, CommandParameterInfo> readTemperatureControlEventListCommandParams =
7904+
new LinkedHashMap<String, CommandParameterInfo>();
7905+
InteractionInfo readTemperatureControlEventListAttributeInteractionInfo =
7906+
new InteractionInfo(
7907+
(cluster, callback, commandArguments) -> {
7908+
((ChipClusters.TemperatureControlCluster) cluster)
7909+
.readEventListAttribute(
7910+
(ChipClusters.TemperatureControlCluster.EventListAttributeCallback) callback);
7911+
},
7912+
() ->
7913+
new ClusterInfoMapping
7914+
.DelegatedTemperatureControlClusterEventListAttributeCallback(),
7915+
readTemperatureControlEventListCommandParams);
7916+
result.put("readEventListAttribute", readTemperatureControlEventListAttributeInteractionInfo);
7917+
Map<String, CommandParameterInfo> readTemperatureControlAttributeListCommandParams =
7918+
new LinkedHashMap<String, CommandParameterInfo>();
7919+
InteractionInfo readTemperatureControlAttributeListAttributeInteractionInfo =
7920+
new InteractionInfo(
7921+
(cluster, callback, commandArguments) -> {
7922+
((ChipClusters.TemperatureControlCluster) cluster)
7923+
.readAttributeListAttribute(
7924+
(ChipClusters.TemperatureControlCluster.AttributeListAttributeCallback)
7925+
callback);
7926+
},
7927+
() ->
7928+
new ClusterInfoMapping
7929+
.DelegatedTemperatureControlClusterAttributeListAttributeCallback(),
7930+
readTemperatureControlAttributeListCommandParams);
7931+
result.put(
7932+
"readAttributeListAttribute", readTemperatureControlAttributeListAttributeInteractionInfo);
7933+
Map<String, CommandParameterInfo> readTemperatureControlFeatureMapCommandParams =
7934+
new LinkedHashMap<String, CommandParameterInfo>();
7935+
InteractionInfo readTemperatureControlFeatureMapAttributeInteractionInfo =
7936+
new InteractionInfo(
7937+
(cluster, callback, commandArguments) -> {
7938+
((ChipClusters.TemperatureControlCluster) cluster)
7939+
.readFeatureMapAttribute((ChipClusters.LongAttributeCallback) callback);
7940+
},
7941+
() -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
7942+
readTemperatureControlFeatureMapCommandParams);
7943+
result.put("readFeatureMapAttribute", readTemperatureControlFeatureMapAttributeInteractionInfo);
7944+
Map<String, CommandParameterInfo> readTemperatureControlClusterRevisionCommandParams =
7945+
new LinkedHashMap<String, CommandParameterInfo>();
7946+
InteractionInfo readTemperatureControlClusterRevisionAttributeInteractionInfo =
7947+
new InteractionInfo(
7948+
(cluster, callback, commandArguments) -> {
7949+
((ChipClusters.TemperatureControlCluster) cluster)
7950+
.readClusterRevisionAttribute((ChipClusters.IntegerAttributeCallback) callback);
7951+
},
7952+
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
7953+
readTemperatureControlClusterRevisionCommandParams);
7954+
result.put(
7955+
"readClusterRevisionAttribute",
7956+
readTemperatureControlClusterRevisionAttributeInteractionInfo);
7957+
7958+
return result;
7959+
}
7960+
77827961
private static Map<String, InteractionInfo> readAirQualityInteractionInfo() {
77837962
Map<String, InteractionInfo> result = new LinkedHashMap<>();
77847963
Map<String, CommandParameterInfo> readAirQualityAirQualityCommandParams =
@@ -19524,6 +19703,7 @@ public Map<String, Map<String, InteractionInfo>> getReadAttributeMap() {
1952419703
put("booleanState", readBooleanStateInteractionInfo());
1952519704
put("icdManagement", readIcdManagementInteractionInfo());
1952619705
put("modeSelect", readModeSelectInteractionInfo());
19706+
put("temperatureControl", readTemperatureControlInteractionInfo());
1952719707
put("airQuality", readAirQualityInteractionInfo());
1952819708
put("smokeCoAlarm", readSmokeCoAlarmInteractionInfo());
1952919709
put("hepaFilterMonitoring", readHepaFilterMonitoringInteractionInfo());

0 commit comments

Comments
 (0)