Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Timer Cluster XML implementation #30035

Merged
merged 8 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/timer-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/user-label-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/unit-localization-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/wake-on-lan-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 @@ -79,6 +79,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/thermostat-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/thread-network-diagnostics-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/time-format-localization-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/timer-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/unit-localization-cluster.xml";
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";
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 @@ -80,6 +80,7 @@
<xi:include href="chip/thread-network-diagnostics-cluster.xml" />
<xi:include href="chip/time-format-localization-cluster.xml" />
<xi:include href="chip/time-synchronization-cluster.xml" />
<xi:include href="chip/timer-cluster.xml" />
<xi:include href="chip/channel-cluster.xml" />
<xi:include href="chip/user-label-cluster.xml" />
<xi:include href="chip/unit-localization-cluster.xml" />
Expand Down
76 changes: 76 additions & 0 deletions src/app/zap-templates/zcl/data-model/chip/timer-cluster.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?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="Feature" type="bitmap32">
<cluster code="0x0047"/>
<field mask="0x01" name="Reset"/>
</bitmap>

<enum name="TimerStatusEnum" type="enum8">
<cluster code="0x0047" />
<item name="Running" value="0x0" />
<item name="Paused" value="0x1" />
<item name="Expired" value="0x2" />
<item name="Ready" value="0x3" />
</enum>

<cluster apiMaturity="provisional">
<domain>General</domain>
<name>Timer</name>
<code>0x0047</code>
<define>TIMER_CLUSTER</define>
<client init="false" tick="false">true</client>
<server init="false" tick="false">true</server>
<description>This cluster supports creating a simple timer functionality.</description>

<globalAttribute side="server" code="0xFFFD" value="1" />

<attribute side="server" code="0x0000" define="SET_TIME" type="elapsed_s" writable="false" isNullable="false" optional="false">SetTime</attribute>
<attribute side="server" code="0x0001" define="TIME_REMAINING" type="elapsed_s" writable="false" isNullable="false" optional="false">TimeRemaining</attribute>
<attribute side="server" code="0x0002" define="TIMER_STATE" type="TimerStatusEnum" writable="false" isNullable="false" optional="false">TimerState</attribute>

<command source="client" code="0x00" name="SetTimer" optional="false">
<description>
This command is used to set the timer.
</description>
<arg name="NewTime" type="elapsed_s" optional="false"/>
</command>

<command source="client" code="0x01" name="ResetTimer" optional="true">
<description>
This command is used to reset the timer to the original value.
</description>
</command>

<command source="client" code="0x02" name="AddTime" optional="false">
<description>
This command is used to add time to the existing timer.
</description>
<arg name="AdditionalTime" type="elapsed_s" optional="false"/>
</command>

<command source="client" code="0x03" name="ReduceTime" optional="true">
<description>
This command is used to reduce time on the existing timer.
</description>
<arg name="TimeReduction" type="elapsed_s" optional="false"/>
</command>
</cluster>
</configurator>
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 @@ -100,6 +100,7 @@
"thread-network-diagnostics-cluster.xml",
"time-format-localization-cluster.xml",
"time-synchronization-cluster.xml",
"timer-cluster.xml",
"user-label-cluster.xml",
"unit-localization-cluster.xml",
"wake-on-lan-cluster.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 @@ -98,6 +98,7 @@
"thread-network-diagnostics-cluster.xml",
"time-format-localization-cluster.xml",
"time-synchronization-cluster.xml",
"timer-cluster.xml",
"user-label-cluster.xml",
"unit-localization-cluster.xml",
"wake-on-lan-cluster.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 @@ -104,6 +104,7 @@
"TIME_CLUSTER": [],
"TIME_FORMAT_LOCALIZATION_CLUSTER": [],
"TIME_SYNCHRONIZATION_CLUSTER": [],
"TIMER_CLUSTER": [],
"TRUSTED_ROOT_CERTIFICATES_CLUSTER": [],
"UNIT_LOCALIZATION_CLUSTER": [],
"UNIT_TESTING_CLUSTER": [],
Expand Down Expand Up @@ -255,6 +256,7 @@
"TIME_CLUSTER": [],
"TIME_FORMAT_LOCALIZATION_CLUSTER": ["time-format-localization-server"],
"TIME_SYNCHRONIZATION_CLUSTER": ["time-synchronization-server"],
"TIMER_CLUSTER": ["timer-server"],
"TVOC_CONCENTRATION_MEASUREMENT_CLUSTER": [
"concentration-measurement-server"
],
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 @@ -248,6 +248,8 @@ if (current_os == "android" || matter_enable_java_compilation) {
"jni/TimeFormatLocalizationClient-ReadImpl.cpp",
"jni/TimeSynchronizationClient-InvokeSubscribeImpl.cpp",
"jni/TimeSynchronizationClient-ReadImpl.cpp",
"jni/TimerClient-InvokeSubscribeImpl.cpp",
"jni/TimerClient-ReadImpl.cpp",
"jni/TotalVolatileOrganicCompoundsConcentrationMeasurementClient-InvokeSubscribeImpl.cpp",
"jni/TotalVolatileOrganicCompoundsConcentrationMeasurementClient-ReadImpl.cpp",
"jni/UnitLocalizationClient-InvokeSubscribeImpl.cpp",
Expand Down
45 changes: 45 additions & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2803,6 +2803,51 @@ client cluster IcdManagement = 70 {
command access(invoke: manage) StayActiveRequest(): DefaultSuccess = 3;
}

/** This cluster supports creating a simple timer functionality. */
provisional client cluster Timer = 71 {
enum TimerStatusEnum : enum8 {
kRunning = 0;
kPaused = 1;
kExpired = 2;
kReady = 3;
}

bitmap Feature : bitmap32 {
kReset = 0x1;
}

readonly attribute elapsed_s setTime = 0;
readonly attribute elapsed_s timeRemaining = 1;
readonly attribute TimerStatusEnum timerState = 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 SetTimerRequest {
elapsed_s newTime = 0;
}

request struct AddTimeRequest {
elapsed_s additionalTime = 0;
}

request struct ReduceTimeRequest {
elapsed_s timeReduction = 0;
}

/** This command is used to set the timer. */
command SetTimer(SetTimerRequest): DefaultSuccess = 0;
/** This command is used to reset the timer to the original value. */
command ResetTimer(): DefaultSuccess = 1;
/** This command is used to add time to the existing timer. */
command AddTime(AddTimeRequest): DefaultSuccess = 2;
/** This command is used to reduce time on the existing timer. */
command ReduceTime(ReduceTimeRequest): DefaultSuccess = 3;
}

/** Attributes and commands for selecting a mode from a list of supported options. */
client cluster ModeSelect = 80 {
bitmap Feature : bitmap32 {
Expand Down
64 changes: 63 additions & 1 deletion src/controller/data_model/controller-clusters.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,67 @@
}
]
},
{
"name": "Timer",
"code": 71,
"mfgCode": null,
"define": "TIMER_CLUSTER",
"side": "client",
"enabled": 1,
"apiMaturity": "provisional",
"commands": [
{
"name": "SetTimer",
"code": 0,
"mfgCode": null,
"source": "client",
"isIncoming": 0,
"isEnabled": 1
},
{
"name": "AddTime",
"code": 2,
"mfgCode": null,
"source": "client",
"isIncoming": 0,
"isEnabled": 1
}
],
"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": "Mode Select",
"code": 80,
Expand Down Expand Up @@ -5175,5 +5236,6 @@
"endpointId": 1,
"networkId": 0
}
]
],
"log": []
}
Loading