Skip to content

Commit

Permalink
Camera zone management cluster (project-chip#35879)
Browse files Browse the repository at this point in the history
* Generated using ./alchemy zap --attribute="in-progress" ... ZoneManagement.adoc

* Generated using ./alchemy zap --attribute="in-progress" ... ZoneManagement.adoc

* Re-generated using ./scripts/tools/zap_regen_all.py after merge

* Restyled by whitespace

* Restyled by prettier-json

* Re-generated using ./scripts/tools/zap_regen_all.py after update to python generation

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and yyzhong-g committed Dec 11, 2024
1 parent 738e387 commit 30d20a9
Show file tree
Hide file tree
Showing 67 changed files with 10,960 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/sample-mei-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/zone-management-cluster.xml \
"
- name: Build Apps
run: |
Expand Down
1 change: 1 addition & 0 deletions docs/zap_clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ Generally regenerate using one of:
| 1294 | 0x50E | AccountLogin |
| 1295 | 0x50F | ContentControl |
| 1296 | 0x510 | ContentAppObserver |
| 1360 | 0x550 | ZoneManagement |
| 1363 | 0x553 | WebRTCTransportProvider |
| 1364 | 0x554 | WebRTCTransportRequestor |
| 1366 | 0x556 | Chime |
Expand Down
1 change: 1 addition & 0 deletions scripts/rules.matterlint
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.x
load "../src/app/zap-templates/zcl/data-model/chip/sample-mei-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/zone-management-cluster.xml";

all endpoints {
// These attributes follow a different code path and do not have to be
Expand Down
155 changes: 155 additions & 0 deletions src/app/zap-templates/zcl/data-model/chip/zone-management-cluster.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2024 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.
-->
<!--
XML generated by Alchemy; DO NOT EDIT.
Source: src/app_clusters/ZoneManagement.adoc
Parameters: in-progress
Git: 0.9-fall2024-302-gebc8548b3
-->
<configurator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../zcl.xsd">
<domain name="Measurement &amp; Sensing"/>
<enum name="StatusCodeEnum" type="enum8">
<cluster code="0x0550"/>
<item name="ZoneNotFound" value="0x02"/>
<item name="ZoneInUse" value="0x03"/>
</enum>

<enum name="ZoneEventStoppedReasonEnum" type="enum8">
<cluster code="0x0550"/>
<item name="ActionStopped" value="0x00"/>
<item name="Timeout" value="0x01"/>
</enum>

<enum name="ZoneEventTriggeredReasonEnum" type="enum8">
<cluster code="0x0550"/>
<item name="Motion" value="0x00"/>
</enum>

<enum name="ZoneSourceEnum" type="enum8">
<cluster code="0x0550"/>
<item name="Mfg" value="0x00"/>
<item name="User" value="0x01"/>
</enum>

<enum name="ZoneTypeEnum" type="enum8">
<cluster code="0x0550"/>
<item name="TwoDCARTZone" value="0x00"/>
</enum>

<enum name="ZoneUseEnum" type="enum8">
<cluster code="0x0550"/>
<item name="Motion" value="0x00"/>
<item name="Privacy" value="0x01"/>
<item name="Focus" value="0x02"/>
</enum>

<struct name="TwoDCartesianVertexStruct" apiMaturity="provisional">
<cluster code="0x0550"/>
<item fieldId="0" name="X" type="int16u" default="0"/>
<item fieldId="1" name="Y" type="int16u" default="0"/>
</struct>

<struct name="TwoDCartesianZoneStruct" apiMaturity="provisional">
<cluster code="0x0550"/>
<item fieldId="0" name="Name" type="char_string" length="16"/>
<item fieldId="1" name="Use" type="ZoneUseEnum" min="0x00" max="0x02"/>
<item fieldId="2" name="Vertices" array="true" type="TwoDCartesianVertexStruct" length="12" minLength="3"/>
<item fieldId="3" name="Color" type="char_string" optional="true" length="9" minLength="7"/>
</struct>

<struct name="ZoneInformationStruct" apiMaturity="provisional">
<cluster code="0x0550"/>
<item fieldId="0" name="ZoneID" type="int16u"/>
<item fieldId="1" name="ZoneType" type="ZoneTypeEnum" min="0x00" max="0x00"/>
<item fieldId="2" name="ZoneSource" type="ZoneSourceEnum" min="0x00" max="0x01"/>
</struct>

<struct name="ZoneTriggeringTimeControlStruct" apiMaturity="provisional">
<cluster code="0x0550"/>
<item fieldId="0" name="InitialDuration" type="int16u" default="10"/>
<item fieldId="1" name="AugmentationDuration" type="int16u" default="5"/>
<item fieldId="2" name="MaxDuration" type="elapsed_s" default="30"/>
<item fieldId="3" name="BlindDuration" type="int16u" default="30"/>
</struct>

<cluster apiMaturity="provisional">
<domain name="Measurement &amp; Sensing"/>
<name>Zone Management</name>
<code>0x0550</code>
<define>ZONE_MANAGEMENT_CLUSTER</define>
<description>This cluster provides an interface to manage regions of interest, or Zones, which can be either manufacturer or user defined.</description>
<client init="false" tick="false">true</client>
<features>
<feature bit="0" code="TWODCART" name="TwoDimensionalCartesianZone" summary="Devices support Two Dimensional Cartesian Zones">
<mandatoryConform/>
</feature>
</features>
<server init="false" tick="false">true</server>
<globalAttribute code="0xFFFD" side="either" value="1"/>
<attribute code="0x0000" side="server" define="SUPPORTED_ZONE_SOURCES" type="array" entryType="ZoneSourceEnum">SupportedZoneSources</attribute>
<attribute code="0x0001" side="server" define="ZONES" type="array" entryType="ZoneInformationStruct" optional="true">Zones</attribute>
<attribute code="0x0002" side="server" define="TIME_CONTROL" type="array" entryType="ZoneTriggeringTimeControlStruct" writable="true">TimeControl</attribute>
<attribute code="0x0003" side="server" define="SENSITIVITY" type="int8u" min="1" max="10" default="5" writable="true">Sensitivity</attribute>
<command code="0x00" source="client" name="CreateTwoDCartesianZone" optional="true" response="CreateTwoDCartesianZoneResponse">
<description>This command SHALL create and store a TwoD Cartesian Zone.</description>
<access op="invoke" privilege="manage"/>
<arg id="0" name="Zone" type="TwoDCartesianZoneStruct"/>
</command>

<command code="0x01" source="server" name="CreateTwoDCartesianZoneResponse" optional="true">
<description/>
<arg id="0" name="ZoneID" type="int16u"/>
</command>

<command code="0x02" source="client" name="UpdateTwoDCartesianZone" optional="true">
<description>The UpdateTwoDCartesianZone SHALL update a stored TwoD Cartesian Zone.</description>
<access op="invoke" privilege="manage"/>
<arg id="0" name="ZoneID" type="int16u"/>
<arg id="1" name="Zone" type="TwoDCartesianZoneStruct"/>
</command>

<command code="0x03" source="client" name="GetTwoDCartesianZone" optional="true" response="GetTwoDCartesianZoneResponse">
<description>The GetTwoDCartesianZone SHALL return the TwoD Cartesian Zone for the passed in ZoneID.</description>
<access op="invoke" privilege="manage"/>
<arg id="0" name="ZoneID" type="int16u" optional="true" isNullable="true"/>
</command>

<command code="0x04" source="server" name="GetTwoDCartesianZoneResponse" optional="true" disableDefaultResponse="true">
<description>This command SHALL be generated in response to a GetTwoDCartesianZone command.</description>
<arg id="0" name="Zones" array="true" type="TwoDCartesianZoneStruct"/>
</command>

<command code="0x05" source="client" name="RemoveZone" optional="false">
<description>This command SHALL remove the Zone mapped to the passed in ZoneID.</description>
<access op="invoke" privilege="manage"/>
<arg id="0" name="ZoneID" type="int16u"/>
</command>

<event code="0x0000" name="ZoneTriggered" priority="info" side="server">
<field id="0" name="Zones" array="true" type="int16u"/>
<field id="1" name="Reason" type="ZoneEventTriggeredReasonEnum" min="0x00" max="0x00"/>
<description>This event SHALL be generated when a Zone is first triggered.</description>
</event>

<event code="0x0001" name="ZoneStopped" priority="info" side="server">
<field id="0" name="Zones" array="true" type="int16u"/>
<field id="1" name="Reason" type="ZoneEventStoppedReasonEnum" min="0x00" max="0x01"/>
<description>This event SHALL be generated when either when the TriggerDetectedDuration value is exceeded by the TimeSinceInitialTrigger value or when the MaxDuration value is exceeded by the TimeSinceInitialTrigger value as described in ZoneTriggeringTimeControlStruct.</description>
</event>

</cluster>
</configurator>
3 changes: 2 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 @@ -140,7 +140,8 @@
"sample-mei-cluster.xml",
"types/door-lock.xml",
"types/occupancy-sensing.xml",
"types/thermostat-user-interface-configuration.xml"
"types/thermostat-user-interface-configuration.xml",
"zone-management-cluster.xml"
],
"manufacturersXml": "../../../../src/app/zap-templates/zcl/data-model/manufacturers.xml",
"options": {
Expand Down
3 changes: 2 additions & 1 deletion src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@
"sample-mei-cluster.xml",
"types/door-lock.xml",
"types/occupancy-sensing.xml",
"types/thermostat-user-interface-configuration.xml"
"types/thermostat-user-interface-configuration.xml",
"zone-management-cluster.xml"
],
"manufacturersXml": "../../../../src/app/zap-templates/zcl/data-model/manufacturers.xml",
"options": {
Expand Down
6 changes: 4 additions & 2 deletions src/app/zap_cluster_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@
"WEB_RTC_PROVIDER_CLUSTER": [],
"WEBRTC_REQUESTOR_CLUSTER": [],
"WIFI_NETWORK_DIAGNOSTICS_CLUSTER": [],
"WINDOW_COVERING_CLUSTER": []
"WINDOW_COVERING_CLUSTER": [],
"ZONE_MANAGEMENT_CLUSTER": []
},
"ServerDirectories": {
"ACCESS_CONTROL_CLUSTER": ["access-control-server"],
Expand Down Expand Up @@ -318,6 +319,7 @@
"WIFI_NETWORK_MANAGEMENT_CLUSTER": ["wifi-network-management-server"],
"WINDOW_COVERING_CLUSTER": ["window-covering-server"],
"WATER_HEATER_MANAGEMENT_CLUSTER": ["water-heater-management-server"],
"WATER_HEATER_MODE_CLUSTER": ["mode-base-server"]
"WATER_HEATER_MODE_CLUSTER": ["mode-base-server"],
"ZONE_MANAGEMENT_CLUSTER": []
}
}
118 changes: 118 additions & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -9416,6 +9416,124 @@ provisional cluster ContentAppObserver = 1296 {
command ContentAppMessage(ContentAppMessageRequest): ContentAppMessageResponse = 0;
}

/** This cluster provides an interface to manage regions of interest, or Zones, which can be either manufacturer or user defined. */
provisional cluster ZoneManagement = 1360 {
revision 1;

enum StatusCodeEnum : enum8 {
kZoneNotFound = 2;
kZoneInUse = 3;
}

enum ZoneEventStoppedReasonEnum : enum8 {
kActionStopped = 0;
kTimeout = 1;
}

enum ZoneEventTriggeredReasonEnum : enum8 {
kMotion = 0;
}

enum ZoneSourceEnum : enum8 {
kMfg = 0;
kUser = 1;
}

enum ZoneTypeEnum : enum8 {
kTwoDCARTZone = 0;
}

enum ZoneUseEnum : enum8 {
kMotion = 0;
kPrivacy = 1;
kFocus = 2;
}

bitmap Feature : bitmap32 {
kTwoDimensionalCartesianZone = 0x1;
}

struct TwoDCartesianVertexStruct {
int16u x = 0;
int16u y = 1;
}

struct TwoDCartesianZoneStruct {
char_string<16> name = 0;
ZoneUseEnum use = 1;
TwoDCartesianVertexStruct vertices[] = 2;
optional char_string<9> color = 3;
}

struct ZoneInformationStruct {
int16u zoneID = 0;
ZoneTypeEnum zoneType = 1;
ZoneSourceEnum zoneSource = 2;
}

struct ZoneTriggeringTimeControlStruct {
int16u initialDuration = 0;
int16u augmentationDuration = 1;
elapsed_s maxDuration = 2;
int16u blindDuration = 3;
}

info event ZoneTriggered = 0 {
int16u zones[] = 0;
ZoneEventTriggeredReasonEnum reason = 1;
}

info event ZoneStopped = 1 {
int16u zones[] = 0;
ZoneEventStoppedReasonEnum reason = 1;
}

readonly attribute ZoneSourceEnum supportedZoneSources[] = 0;
readonly attribute optional ZoneInformationStruct zones[] = 1;
attribute ZoneTriggeringTimeControlStruct timeControl[] = 2;
attribute int8u sensitivity = 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;

request struct CreateTwoDCartesianZoneRequest {
TwoDCartesianZoneStruct zone = 0;
}

response struct CreateTwoDCartesianZoneResponse = 1 {
int16u zoneID = 0;
}

request struct UpdateTwoDCartesianZoneRequest {
int16u zoneID = 0;
TwoDCartesianZoneStruct zone = 1;
}

request struct GetTwoDCartesianZoneRequest {
optional nullable int16u zoneID = 0;
}

response struct GetTwoDCartesianZoneResponse = 4 {
TwoDCartesianZoneStruct zones[] = 0;
}

request struct RemoveZoneRequest {
int16u zoneID = 0;
}

/** This command SHALL create and store a TwoD Cartesian Zone. */
command access(invoke: manage) CreateTwoDCartesianZone(CreateTwoDCartesianZoneRequest): CreateTwoDCartesianZoneResponse = 0;
/** The UpdateTwoDCartesianZone SHALL update a stored TwoD Cartesian Zone. */
command access(invoke: manage) UpdateTwoDCartesianZone(UpdateTwoDCartesianZoneRequest): DefaultSuccess = 2;
/** The GetTwoDCartesianZone SHALL return the TwoD Cartesian Zone for the passed in ZoneID. */
command access(invoke: manage) GetTwoDCartesianZone(GetTwoDCartesianZoneRequest): GetTwoDCartesianZoneResponse = 3;
/** This command SHALL remove the Zone mapped to the passed in ZoneID. */
command access(invoke: manage) RemoveZone(RemoveZoneRequest): DefaultSuccess = 5;
}

/** The WebRTC transport provider cluster provides a way for stream providers (e.g. Cameras) to stream or receive their data through WebRTC. */
provisional cluster WebRTCTransportProvider = 1363 {
revision 1;
Expand Down
Loading

0 comments on commit 30d20a9

Please sign in to comment.