Skip to content

Commit

Permalink
Add temperature-control cluster xml and generate zap (#26548)
Browse files Browse the repository at this point in the history
* 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 <bzbarsky@apple.com>
  • Loading branch information
jadhavrohit924 and bzbarsky-apple committed May 19, 2023
1 parent 2affb17 commit e75e729
Show file tree
Hide file tree
Showing 50 changed files with 5,444 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/window-covering.xml \
src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/matter-devices.xml \
src/app/zap-templates/zcl/data-model/draft/barrier-control-cluster.xml \
src/app/zap-templates/zcl/data-model/draft/electrical-measurement-cluster.xml \
Expand Down
1 change: 1 addition & 0 deletions scripts/rules.matterlint
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/user-label-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/wake-on-lan-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/window-covering.xml";
load "../src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/draft/barrier-control-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/draft/electrical-measurement-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/draft/input-output-value-clusters.xml";
Expand Down
1 change: 1 addition & 0 deletions src/app/zap-templates/zcl/data-model/all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<xi:include href="chip/wake-on-lan-cluster.xml" />
<xi:include href="chip/wifi-network-diagnostics-cluster.xml" />
<xi:include href="chip/window-covering.xml" />
<xi:include href="chip/temperature-control-cluster.xml" />
<xi:include href="chip/matter-devices.xml" />
<xi:include href="draft/barrier-control.xml" />
<xi:include href="draft/electrical-measurement-cluster.xml" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.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.
-->
<configurator>
<domain name="CHIP"/>

<struct name="TemperatureLevelStruct">
<cluster code="0x0056"/>
<item fieldId="0" name="Label" type="char_string" length="64" isNullable="false" writable="false"/>
<item fieldId="1" name="TempLevel" type="int8u" isNullable="false" writable="false"/>
</struct>

<cluster>
<name>Temperature Control</name>
<domain>Appliances</domain>
<description>Attributes and commands for configuring the temperature control, and reporting temperature.</description>
<code>0x0056</code>
<define>TEMPERATURE_CONTROL_CLUSTER</define>
<client tick="false" init="false">true</client>
<server tick="false" init="false">true</server>
<attribute side="server" code="0x0000" define="TEMP_SETPOINT" type="INT16S" writable="false" optional="true">TemperatureSetpoint</attribute>
<attribute side="server" code="0x0001" define="MIN_TEMP" type="INT16S" writable="false" optional="true">MinTemperature</attribute>
<attribute side="server" code="0x0002" define="MAX_TEMP" type="INT16S" writable="false" optional="true">MaxTemperature</attribute>
<attribute side="server" code="0x0003" define="STEP" type="INT16S" writable="false" optional="true">Step</attribute>
<attribute side="server" code="0x0004" define="CURRENT_TEMP_LEVEL_IND" type="INT8U" writable="false" optional="true">CurrentTemperatureLevelIndex</attribute>
<attribute side="server" code="0x0005" define="SUPPORTED_TEMP_LEVELS" type="ARRAY" entryType="TemperatureLevelStruct" writable="false" optional="true">SupportedTemperatureLevels</attribute>

<command source="client" code="0x00" name="SetTemperature" optional="false">
<description>Set Temperature</description>
<arg name="TargetTemperature" type="INT16S" min="MIN_TEMP" max="MAX_TEMP" optional="true"/>
<arg name="TargetTemperatureLevel" type="INT8U" optional="true"/>
</command>
</cluster>
<bitmap name="Feature" type="BITMAP32">
<cluster code="0x0056"/>
<field mask="0x01" name="TemperatureNumber" />
<field mask="0x02" name="TemperatureLevel" />
</bitmap>
</configurator>
4 changes: 3 additions & 1 deletion src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"software-diagnostics-cluster.xml",
"switch-cluster.xml",
"target-navigator-cluster.xml",
"temperature-control-cluster.xml",
"temperature-measurement-cluster.xml",
"test-cluster.xml",
"thermostat-cluster.xml",
Expand Down Expand Up @@ -286,7 +287,8 @@
"DSTOffset",
"UTCTime",
"LocalTime"
]
],
"Temperature Control": ["SupportedTemperatureLevels"]
},
"defaultReportingPolicy": "mandatory",
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],
Expand Down
4 changes: 3 additions & 1 deletion src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"software-diagnostics-cluster.xml",
"switch-cluster.xml",
"target-navigator-cluster.xml",
"temperature-control-cluster.xml",
"temperature-measurement-cluster.xml",
"test-cluster.xml",
"thermostat-cluster.xml",
Expand Down Expand Up @@ -284,7 +285,8 @@
"DSTOffset",
"UTCTime",
"LocalTime"
]
],
"Temperature Control": ["SupportedTemperatureLevels"]
},
"defaultReportingPolicy": "mandatory",
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],
Expand Down
2 changes: 2 additions & 0 deletions src/app/zap_cluster_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"WATER_TANK_MONITORING_CLUSTER": [],
"WIFI_NETWORK_DIAGNOSTICS_CLUSTER": [],
"WINDOW_COVERING_CLUSTER": [],
"TEMPERATURE_CONTROL_CLUSTER": [],
"ZEOLITE_FILTER_MONITORING_CLUSTER": [],
"ZLL_COMMISSIONING_CLUSTER": []
},
Expand Down Expand Up @@ -199,6 +200,7 @@
"WAKE_ON_LAN_CLUSTER": ["wake-on-lan-server"],
"WIFI_NETWORK_DIAGNOSTICS_CLUSTER": ["wifi-network-diagnostics-server"],
"WINDOW_COVERING_CLUSTER": ["window-covering-server"],
"TEMPERATURE_CONTROL_CLUSTER": ["temperature-control-server"],
"ZLL_COMMISSIONING_CLUSTER": []
}
}
2 changes: 2 additions & 0 deletions src/controller/data_model/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ if (current_os == "android" || build_java_matter_controller) {
"jni/SwitchClient-ReadImpl.cpp",
"jni/TargetNavigatorClient-InvokeSubscribeImpl.cpp",
"jni/TargetNavigatorClient-ReadImpl.cpp",
"jni/TemperatureControlClient-InvokeSubscribeImpl.cpp",
"jni/TemperatureControlClient-ReadImpl.cpp",
"jni/TemperatureMeasurementClient-InvokeSubscribeImpl.cpp",
"jni/TemperatureMeasurementClient-ReadImpl.cpp",
"jni/ThermostatClient-InvokeSubscribeImpl.cpp",
Expand Down
34 changes: 34 additions & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2772,6 +2772,40 @@ client cluster ModeSelect = 80 {
command ChangeToMode(ChangeToModeRequest): DefaultSuccess = 0;
}

/** Attributes and commands for configuring the temperature control, and reporting temperature. */
client cluster TemperatureControl = 86 {
bitmap Feature : BITMAP32 {
kTemperatureNumber = 0x1;
kTemperatureLevel = 0x2;
}

struct TemperatureLevelStruct {
char_string<64> label = 0;
int8u tempLevel = 1;
}

readonly attribute optional int16s temperatureSetpoint = 0;
readonly attribute optional int16s minTemperature = 1;
readonly attribute optional int16s maxTemperature = 2;
readonly attribute optional int16s step = 3;
readonly attribute optional int8u currentTemperatureLevelIndex = 4;
readonly attribute optional TemperatureLevelStruct supportedTemperatureLevels[] = 5;
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;

request struct SetTemperatureRequest {
optional INT16S targetTemperature = 0;
optional INT8U targetTemperatureLevel = 1;
}

/** Set Temperature */
command SetTemperature(SetTemperatureRequest): DefaultSuccess = 0;
}

/** Attributes for reporting air quality classification */
client cluster AirQuality = 91 {
enum AirQualityEnum : ENUM8 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7779,6 +7779,185 @@ private static Map<String, InteractionInfo> readModeSelectInteractionInfo() {
return result;
}

private static Map<String, InteractionInfo> readTemperatureControlInteractionInfo() {
Map<String, InteractionInfo> result = new LinkedHashMap<>();
Map<String, CommandParameterInfo> readTemperatureControlTemperatureSetpointCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlTemperatureSetpointAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readTemperatureSetpointAttribute(
(ChipClusters.IntegerAttributeCallback) callback);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readTemperatureControlTemperatureSetpointCommandParams);
result.put(
"readTemperatureSetpointAttribute",
readTemperatureControlTemperatureSetpointAttributeInteractionInfo);
Map<String, CommandParameterInfo> readTemperatureControlMinTemperatureCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlMinTemperatureAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readMinTemperatureAttribute((ChipClusters.IntegerAttributeCallback) callback);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readTemperatureControlMinTemperatureCommandParams);
result.put(
"readMinTemperatureAttribute",
readTemperatureControlMinTemperatureAttributeInteractionInfo);
Map<String, CommandParameterInfo> readTemperatureControlMaxTemperatureCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlMaxTemperatureAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readMaxTemperatureAttribute((ChipClusters.IntegerAttributeCallback) callback);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readTemperatureControlMaxTemperatureCommandParams);
result.put(
"readMaxTemperatureAttribute",
readTemperatureControlMaxTemperatureAttributeInteractionInfo);
Map<String, CommandParameterInfo> readTemperatureControlStepCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlStepAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readStepAttribute((ChipClusters.IntegerAttributeCallback) callback);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readTemperatureControlStepCommandParams);
result.put("readStepAttribute", readTemperatureControlStepAttributeInteractionInfo);
Map<String, CommandParameterInfo>
readTemperatureControlCurrentTemperatureLevelIndexCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlCurrentTemperatureLevelIndexAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readCurrentTemperatureLevelIndexAttribute(
(ChipClusters.IntegerAttributeCallback) callback);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readTemperatureControlCurrentTemperatureLevelIndexCommandParams);
result.put(
"readCurrentTemperatureLevelIndexAttribute",
readTemperatureControlCurrentTemperatureLevelIndexAttributeInteractionInfo);
Map<String, CommandParameterInfo>
readTemperatureControlSupportedTemperatureLevelsCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlSupportedTemperatureLevelsAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readSupportedTemperatureLevelsAttribute(
(ChipClusters.TemperatureControlCluster
.SupportedTemperatureLevelsAttributeCallback)
callback);
},
() ->
new ClusterInfoMapping
.DelegatedTemperatureControlClusterSupportedTemperatureLevelsAttributeCallback(),
readTemperatureControlSupportedTemperatureLevelsCommandParams);
result.put(
"readSupportedTemperatureLevelsAttribute",
readTemperatureControlSupportedTemperatureLevelsAttributeInteractionInfo);
Map<String, CommandParameterInfo> readTemperatureControlGeneratedCommandListCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlGeneratedCommandListAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readGeneratedCommandListAttribute(
(ChipClusters.TemperatureControlCluster.GeneratedCommandListAttributeCallback)
callback);
},
() ->
new ClusterInfoMapping
.DelegatedTemperatureControlClusterGeneratedCommandListAttributeCallback(),
readTemperatureControlGeneratedCommandListCommandParams);
result.put(
"readGeneratedCommandListAttribute",
readTemperatureControlGeneratedCommandListAttributeInteractionInfo);
Map<String, CommandParameterInfo> readTemperatureControlAcceptedCommandListCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlAcceptedCommandListAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readAcceptedCommandListAttribute(
(ChipClusters.TemperatureControlCluster.AcceptedCommandListAttributeCallback)
callback);
},
() ->
new ClusterInfoMapping
.DelegatedTemperatureControlClusterAcceptedCommandListAttributeCallback(),
readTemperatureControlAcceptedCommandListCommandParams);
result.put(
"readAcceptedCommandListAttribute",
readTemperatureControlAcceptedCommandListAttributeInteractionInfo);
Map<String, CommandParameterInfo> readTemperatureControlEventListCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlEventListAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readEventListAttribute(
(ChipClusters.TemperatureControlCluster.EventListAttributeCallback) callback);
},
() ->
new ClusterInfoMapping
.DelegatedTemperatureControlClusterEventListAttributeCallback(),
readTemperatureControlEventListCommandParams);
result.put("readEventListAttribute", readTemperatureControlEventListAttributeInteractionInfo);
Map<String, CommandParameterInfo> readTemperatureControlAttributeListCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlAttributeListAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readAttributeListAttribute(
(ChipClusters.TemperatureControlCluster.AttributeListAttributeCallback)
callback);
},
() ->
new ClusterInfoMapping
.DelegatedTemperatureControlClusterAttributeListAttributeCallback(),
readTemperatureControlAttributeListCommandParams);
result.put(
"readAttributeListAttribute", readTemperatureControlAttributeListAttributeInteractionInfo);
Map<String, CommandParameterInfo> readTemperatureControlFeatureMapCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlFeatureMapAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readFeatureMapAttribute((ChipClusters.LongAttributeCallback) callback);
},
() -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
readTemperatureControlFeatureMapCommandParams);
result.put("readFeatureMapAttribute", readTemperatureControlFeatureMapAttributeInteractionInfo);
Map<String, CommandParameterInfo> readTemperatureControlClusterRevisionCommandParams =
new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readTemperatureControlClusterRevisionAttributeInteractionInfo =
new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.TemperatureControlCluster) cluster)
.readClusterRevisionAttribute((ChipClusters.IntegerAttributeCallback) callback);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readTemperatureControlClusterRevisionCommandParams);
result.put(
"readClusterRevisionAttribute",
readTemperatureControlClusterRevisionAttributeInteractionInfo);

return result;
}

private static Map<String, InteractionInfo> readAirQualityInteractionInfo() {
Map<String, InteractionInfo> result = new LinkedHashMap<>();
Map<String, CommandParameterInfo> readAirQualityAirQualityCommandParams =
Expand Down Expand Up @@ -19524,6 +19703,7 @@ public Map<String, Map<String, InteractionInfo>> getReadAttributeMap() {
put("booleanState", readBooleanStateInteractionInfo());
put("icdManagement", readIcdManagementInteractionInfo());
put("modeSelect", readModeSelectInteractionInfo());
put("temperatureControl", readTemperatureControlInteractionInfo());
put("airQuality", readAirQualityInteractionInfo());
put("smokeCoAlarm", readSmokeCoAlarmInteractionInfo());
put("hepaFilterMonitoring", readHepaFilterMonitoringInteractionInfo());
Expand Down

0 comments on commit e75e729

Please sign in to comment.