Skip to content

Commit

Permalink
Merge branch 'master' into remove_if_enabled_clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed May 19, 2023
2 parents 785be9c + a271d56 commit b9c96b7
Show file tree
Hide file tree
Showing 65 changed files with 5,285 additions and 88 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/proxy-valid-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/pump-configuration-and-control-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/pwm-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml \
src/app/zap-templates/zcl/data-model/chip/relative-humidity-measurement-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/scene.xml \
src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@
{%- endfor -%}
{%- elif encodable.is_enum -%}
{{target}} = static_cast<std::remove_reference_t<decltype({{target}})>>(chip::JniReferences::GetInstance().IntegerToPrimitive({{source}}));
{%- elif encodable.is_bitmap -%}
{%- elif encodable.is_untyped_bitmap -%}
{{target}} = static_cast<std::remove_reference_t<decltype({{target}})>>(chip::JniReferences::GetInstance().{{encodable.boxed_java_type}}ToPrimitive({{source}}));
{%- elif encodable.is_bitmap -%}
{{target}}.SetRaw(static_cast<std::remove_reference_t<decltype({{target}})>::IntegerType>(chip::JniReferences::GetInstance().{{encodable.boxed_java_type}}ToPrimitive({{source}})));
{% else -%}
{{target}} = static_cast<std::remove_reference_t<decltype({{target}})>>(chip::JniReferences::GetInstance().{{encodable.boxed_java_type}}ToPrimitive({{source}}));
{% endif -%}
Expand Down
6 changes: 5 additions & 1 deletion scripts/py_matter_idl/matter_idl/generators/java/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ def is_enum(self):

@property
def is_bitmap(self):
self.context.is_bitmap_type(self.data_type.name)
return self.context.is_bitmap_type(self.data_type.name)

@property
def is_untyped_bitmap(self):
return self.context.is_untyped_bitmap_type(self.data_type.name)

def clone(self):
return EncodableValue(self.context, self.data_type, self.attrs)
Expand Down
6 changes: 5 additions & 1 deletion scripts/py_matter_idl/matter_idl/generators/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,18 @@ def is_struct_type(self, name: str):
"""
return any(map(lambda s: s.name == name, self.all_structs))

def is_untyped_bitmap_type(self, name: str):
"""Determine if the given type is a untyped bitmap (just an interger size)."""
return name.lower() in {"bitmap8", "bitmap16", "bitmap24", "bitmap32", "bitmap64"}

def is_bitmap_type(self, name: str):
"""
Determine if the given type name is type that is known to be a bitmap.
Handles both standard/zcl names (like bitmap32) and types defined within
the current lookup context.
"""
if name.lower() in ["bitmap8", "bitmap16", "bitmap24", "bitmap32", "bitmap64"]:
if self.is_untyped_bitmap_type(name):
return True

return any(map(lambda s: s.name == name, self.all_bitmaps))
Expand Down
1 change: 1 addition & 0 deletions scripts/rules.matterlint
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ 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/chip/refrigerator-alarm.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 @@ -74,6 +74,7 @@
<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/refrigerator-alarm.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
Expand Up @@ -69,7 +69,7 @@ limitations under the License.
<define>BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER</define>
<client tick="false" init="false">true</client>
<server tick="false" init="false">true</server>
<globalAttribute side="either" code="0xFFFD" value="1"/>
<globalAttribute side="either" code="0xFFFD" value="2"/>

<attribute side="server" code="1" define="VENDOR_NAME" type="char_string" length="32" optional="true">VendorName</attribute>
<attribute side="server" code="2" define="VENDOR_ID" type="vendor_id" optional="true">VendorID</attribute>
Expand Down
49 changes: 49 additions & 0 deletions src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?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"/>
<bitmap name="AlarmMap" type="BITMAP32">
<cluster code="0x0057" />
<field name="DoorOpen" mask="0x01"/>
</bitmap>
<cluster>
<name>Refrigerator Alarm</name>
<domain>Appliances</domain>
<description>Attributes and commands for configuring the Refrigerator alarm.</description>
<code>0x0057</code>
<define>REFRIGERATOR_ALARM</define>
<client tick="false" init="false">true</client>
<server tick="false" init="false">true</server>
<attribute side="server" code="0x0000" define="MASK" type="AlarmMap" default="0" writable="true" optional="false">Mask</attribute>
<attribute side="server" code="0x0001" define="LATCH" type="AlarmMap" default="0" writable="false" optional="false">Latch</attribute>
<attribute side="server" code="0x0002" define="STATE" type="AlarmMap" default="0" writable="false" optional="false">State</attribute>

<command source="client" code="0x00" name="Reset" optional="false">
<description>Reset alarm</description>
<arg name="Alarms" type="AlarmMap" optional="false"/>
<arg name="Mask" type="AlarmMap" optional="true"/>
</command>

<event side="server" code="0x00" priority="info" name="Notify" optional="false">
<description>Notify</description>
<field id="0" name="Active" type="AlarmMap" />
<field id="1" name="Inactive" type="AlarmMap" />
<field id="2" name="State" type="AlarmMap" />
<field id="3" name="Mask" type="AlarmMap" />
</event>
</cluster>
</configurator>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
<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"/>
<item fieldId="1" name="TemperatureLevel" type="int8u" isNullable="false" writable="false"/>
</struct>

<cluster>
Expand Down
1 change: 1 addition & 0 deletions src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"proxy-valid-cluster.xml",
"pump-configuration-and-control-cluster.xml",
"pwm-cluster.xml",
"refrigerator-alarm.xml",
"relative-humidity-measurement-cluster.xml",
"replacable-monitoring-cluster.xml",
"scene.xml",
Expand Down
1 change: 1 addition & 0 deletions src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"proxy-valid-cluster.xml",
"pump-configuration-and-control-cluster.xml",
"pwm-cluster.xml",
"refrigerator-alarm.xml",
"relative-humidity-measurement-cluster.xml",
"replacable-monitoring-cluster.xml",
"scene.xml",
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 @@ -74,6 +74,7 @@
"pump-configuration-and-control-client"
],
"PWM_CLUSTER": [],
"REFRIGERATOR_ALARM": [],
"RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER": [],
"SCENES_CLUSTER": [],
"SMOKE_CO_ALARM_CLUSTER": [],
Expand Down Expand Up @@ -177,6 +178,7 @@
"pump-configuration-and-control-server"
],
"PWM_CLUSTER": [],
"REFRIGERATOR_ALARM_CLUSTER": ["refrigerator-alarm-server"],
"RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER": [],
"SCENES_CLUSTER": ["scenes"],
"SMOKE_CO_ALARM_CLUSTER": [],
Expand Down
2 changes: 2 additions & 0 deletions src/controller/data_model/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ if (current_os == "android" || build_java_matter_controller) {
"jni/PulseWidthModulationClient-ReadImpl.cpp",
"jni/PumpConfigurationAndControlClient-InvokeSubscribeImpl.cpp",
"jni/PumpConfigurationAndControlClient-ReadImpl.cpp",
"jni/RefrigeratorAlarmClient-InvokeSubscribeImpl.cpp",
"jni/RefrigeratorAlarmClient-ReadImpl.cpp",
"jni/RelativeHumidityMeasurementClient-InvokeSubscribeImpl.cpp",
"jni/RelativeHumidityMeasurementClient-ReadImpl.cpp",
"jni/ScenesClient-InvokeSubscribeImpl.cpp",
Expand Down
34 changes: 33 additions & 1 deletion src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2781,7 +2781,7 @@ client cluster TemperatureControl = 86 {

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

readonly attribute optional int16s temperatureSetpoint = 0;
Expand All @@ -2806,6 +2806,38 @@ client cluster TemperatureControl = 86 {
command SetTemperature(SetTemperatureRequest): DefaultSuccess = 0;
}

/** Attributes and commands for configuring the Refrigerator alarm. */
client cluster RefrigeratorAlarm = 87 {
bitmap AlarmMap : BITMAP32 {
kDoorOpen = 0x1;
}

info event Notify = 0 {
AlarmMap active = 0;
AlarmMap inactive = 1;
AlarmMap state = 2;
AlarmMap mask = 3;
}

attribute AlarmMap mask = 0;
readonly attribute AlarmMap latch = 1;
readonly attribute AlarmMap state = 2;
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 ResetRequest {
AlarmMap alarms = 0;
optional AlarmMap mask = 1;
}

/** Reset alarm */
command Reset(ResetRequest): DefaultSuccess = 0;
}

/** Attributes for reporting air quality classification */
client cluster AirQuality = 91 {
enum AirQualityEnum : ENUM8 {
Expand Down
Loading

0 comments on commit b9c96b7

Please sign in to comment.