Skip to content

Commit

Permalink
[ICD] Operating Mode (#31376)
Browse files Browse the repository at this point in the history
* Modified xml

* Regenerated .matter files

* Regenerated the datamodel files

* Added support for read OperatingMode in the server

* Removed custom read access and add reportability for new attribute

* Renamed enum options and regenerated zap files

* Fixed copy pasted comment
  • Loading branch information
lpbeliveau-silabs authored and pull[bot] committed Apr 18, 2024
1 parent f5b43dd commit 1149444
Show file tree
Hide file tree
Showing 34 changed files with 551 additions and 56 deletions.
127 changes: 71 additions & 56 deletions data_model/clusters/ICDManagement.xml
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
<?xml version="1.0"?>
<!--
Copyright (C) Connectivity Standards Alliance (2021). All rights reserved.
The information within this document is the property of the Connectivity
Standards Alliance and its use and disclosure are restricted, except as
expressly set forth herein.
Connectivity Standards Alliance hereby grants you a fully-paid, non-exclusive,
nontransferable, worldwide, limited and revocable license (without the right to
sublicense), under Connectivity Standards Alliance's applicable copyright
rights, to view, download, save, reproduce and use the document solely for your
own internal purposes and in accordance with the terms of the license set forth
herein. This license does not authorize you to, and you expressly warrant that
you shall not: (a) permit others (outside your organization) to use this
document; (b) post or publish this document; (c) modify, adapt, translate, or
otherwise change this document in any manner or create any derivative work
based on this document; (d) remove or modify any notice or label on this
document, including this Copyright Notice, License and Disclaimer. The
Connectivity Standards Alliance does not grant you any license hereunder other
than as expressly stated herein.
Elements of this document may be subject to third party intellectual property
rights, including without limitation, patent, copyright or trademark rights,
and any such third party may or may not be a member of the Connectivity
Standards Alliance. Connectivity Standards Alliance members grant other
Connectivity Standards Alliance members certain intellectual property rights as
set forth in the Connectivity Standards Alliance IPR Policy. Connectivity
Standards Alliance members do not grant you any rights under this license. The
Connectivity Standards Alliance is not responsible for, and shall not be held
responsible in any manner for, identifying or failing to identify any or all
such third party intellectual property rights. Please visit www.csa-iot.org for
more information on how to become a member of the Connectivity Standards
Alliance.
This document and the information contained herein are provided on an “AS IS”
basis and the Connectivity Standards Alliance DISCLAIMS ALL WARRANTIES EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO (A) ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING
WITHOUT LIMITATION ANY INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT
OR TRADEMARK RIGHTS); OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, TITLE OR NONINFRINGEMENT. IN NO EVENT WILL THE
CONNECTIVITY STANDARDS ALLIANCE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF
BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR ANY OTHER
DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
DAMAGES OF ANY KIND, IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT
OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
LOSS OR DAMAGE.
All company, brand and product names in this document may be trademarks that
are the sole property of their respective owners.
This notice and disclaimer must be included on all copies of this document.
Connectivity Standards Alliance
508 Second Street, Suite 206
Davis, CA 95616, USA
<!--
Copyright (C) Connectivity Standards Alliance (2021). All rights reserved.
The information within this document is the property of the Connectivity
Standards Alliance and its use and disclosure are restricted, except as
expressly set forth herein.
Connectivity Standards Alliance hereby grants you a fully-paid, non-exclusive,
nontransferable, worldwide, limited and revocable license (without the right to
sublicense), under Connectivity Standards Alliance's applicable copyright
rights, to view, download, save, reproduce and use the document solely for your
own internal purposes and in accordance with the terms of the license set forth
herein. This license does not authorize you to, and you expressly warrant that
you shall not: (a) permit others (outside your organization) to use this
document; (b) post or publish this document; (c) modify, adapt, translate, or
otherwise change this document in any manner or create any derivative work
based on this document; (d) remove or modify any notice or label on this
document, including this Copyright Notice, License and Disclaimer. The
Connectivity Standards Alliance does not grant you any license hereunder other
than as expressly stated herein.
Elements of this document may be subject to third party intellectual property
rights, including without limitation, patent, copyright or trademark rights,
and any such third party may or may not be a member of the Connectivity
Standards Alliance. Connectivity Standards Alliance members grant other
Connectivity Standards Alliance members certain intellectual property rights as
set forth in the Connectivity Standards Alliance IPR Policy. Connectivity
Standards Alliance members do not grant you any rights under this license. The
Connectivity Standards Alliance is not responsible for, and shall not be held
responsible in any manner for, identifying or failing to identify any or all
such third party intellectual property rights. Please visit www.csa-iot.org for
more information on how to become a member of the Connectivity Standards
Alliance.
This document and the information contained herein are provided on an “AS IS”
basis and the Connectivity Standards Alliance DISCLAIMS ALL WARRANTIES EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO (A) ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING
WITHOUT LIMITATION ANY INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT
OR TRADEMARK RIGHTS); OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, TITLE OR NONINFRINGEMENT. IN NO EVENT WILL THE
CONNECTIVITY STANDARDS ALLIANCE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF
BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR ANY OTHER
DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
DAMAGES OF ANY KIND, IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT
OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
LOSS OR DAMAGE.
All company, brand and product names in this document may be trademarks that
are the sole property of their respective owners.
This notice and disclaimer must be included on all copies of this document.
Connectivity Standards Alliance
508 Second Street, Suite 206
Davis, CA 95616, USA
-->
<cluster xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="types types.xsd cluster cluster.xsd" id="0x0046" name="ICDManagement" revision="1">
<revisionHistory>
Expand Down Expand Up @@ -83,6 +83,14 @@ Davis, CA 95616, USA
</field>
<access fabricScoped="true"/>
</struct>
<enum name="OperatingModeEnum">
<item value="0" name="SIT" summary="ICD is operating as a Short Idle Time ICD.">
<mandatoryConform/>
</item>
<item value="1" name="LIT" summary="ICD is operating as a Long Idle Time ICD.">
<mandatoryConform/>
</item>
</enum>
</dataTypes>
<attributes>
<attribute id="0x0000" name="IdleModeDuration" type="uint32" default="1">
Expand Down Expand Up @@ -125,6 +133,13 @@ Davis, CA 95616, USA
</mandatoryConform>
<constraint type="min" value="1"/>
</attribute>
<attribute id="0x0008" name="OperatingMode" type="OperatingModeEnum" default="0">
<access read="true" readPrivilege="view"/>
<quality changeOmitted="false" nullable="false" scene="false" persistence="fixed" reportable="true"/>
<mandatoryConform>
<feature name="LITS"/>
</mandatoryConform>
</attribute>
</attributes>
<commands>
<command id="0x00" name="RegisterClient" response="RegisterClientResponse">
Expand Down Expand Up @@ -195,4 +210,4 @@ Davis, CA 95616, USA
</field>
</command>
</commands>
</cluster>
</cluster>
Original file line number Diff line number Diff line change
Expand Up @@ -2115,6 +2115,11 @@ cluster UserLabel = 65 {
cluster IcdManagement = 70 {
revision 2;

enum OperatingModeEnum : enum8 {
kSIT = 0;
kLIT = 1;
}

bitmap Feature : bitmap32 {
kCheckInProtocolSupport = 0x1;
kUserActiveModeTrigger = 0x2;
Expand Down Expand Up @@ -2158,6 +2163,7 @@ cluster IcdManagement = 70 {
readonly attribute optional int16u clientsSupportedPerFabric = 5;
readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6;
readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7;
readonly attribute optional OperatingModeEnum operatingMode = 8;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
6 changes: 6 additions & 0 deletions examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,11 @@ cluster UserLabel = 65 {
cluster IcdManagement = 70 {
revision 2;

enum OperatingModeEnum : enum8 {
kSIT = 0;
kLIT = 1;
}

bitmap Feature : bitmap32 {
kCheckInProtocolSupport = 0x1;
kUserActiveModeTrigger = 0x2;
Expand Down Expand Up @@ -1423,6 +1428,7 @@ cluster IcdManagement = 70 {
readonly attribute optional int16u clientsSupportedPerFabric = 5;
readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6;
readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7;
readonly attribute optional OperatingModeEnum operatingMode = 8;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
6 changes: 6 additions & 0 deletions examples/lock-app/lock-common/lock-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,11 @@ cluster UserLabel = 65 {
cluster IcdManagement = 70 {
revision 2;

enum OperatingModeEnum : enum8 {
kSIT = 0;
kLIT = 1;
}

bitmap Feature : bitmap32 {
kCheckInProtocolSupport = 0x1;
kUserActiveModeTrigger = 0x2;
Expand Down Expand Up @@ -1783,6 +1788,7 @@ cluster IcdManagement = 70 {
readonly attribute optional int16u clientsSupportedPerFabric = 5;
readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6;
readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7;
readonly attribute optional OperatingModeEnum operatingMode = 8;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
6 changes: 6 additions & 0 deletions examples/lock-app/qpg/zap/lock.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1396,6 +1396,11 @@ cluster UserLabel = 65 {
cluster IcdManagement = 70 {
revision 2;

enum OperatingModeEnum : enum8 {
kSIT = 0;
kLIT = 1;
}

bitmap Feature : bitmap32 {
kCheckInProtocolSupport = 0x1;
kUserActiveModeTrigger = 0x2;
Expand Down Expand Up @@ -1439,6 +1444,7 @@ cluster IcdManagement = 70 {
readonly attribute optional int16u clientsSupportedPerFabric = 5;
readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6;
readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7;
readonly attribute optional OperatingModeEnum operatingMode = 8;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1716,6 +1716,11 @@ cluster UserLabel = 65 {
cluster IcdManagement = 70 {
revision 2;

enum OperatingModeEnum : enum8 {
kSIT = 0;
kLIT = 1;
}

bitmap Feature : bitmap32 {
kCheckInProtocolSupport = 0x1;
kUserActiveModeTrigger = 0x2;
Expand Down Expand Up @@ -1759,6 +1764,7 @@ cluster IcdManagement = 70 {
readonly attribute optional int16u clientsSupportedPerFabric = 5;
readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6;
readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7;
readonly attribute optional OperatingModeEnum operatingMode = 8;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
5 changes: 5 additions & 0 deletions src/app/icd/ICDManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ void ICDManager::UpdateICDMode()
{
ICDConfigurationData::GetInstance().SetICDMode(tempMode);
postObserverEvent(ObserverEventType::ICDModeChange);

// Can't use attribute accessors/Attributes::OperatingMode::Set in unit tests
#if !CONFIG_BUILD_FOR_HOST_UNIT_TEST
Attributes::OperatingMode::Set(kRootEndpointId, static_cast<OperatingModeEnum>(tempMode));
#endif
}

// When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ limitations under the License.
<!-- RESERVED = 0x03 -->
</struct>

<enum name="OperatingModeEnum" type="enum8">
<cluster code="0x0046" />
<item value="0" name="SIT" />
<item value="1" name="LIT" />
</enum>

<cluster>
<domain>General</domain>
<name>ICD Management</name>
Expand All @@ -79,6 +85,7 @@ limitations under the License.
<attribute side="server" code="0x05" define="CLIENTS_SUPPORTED_PER_FABRIC" type="int16u" min="1" default="1" writable="false" optional="true" isNullable="false">ClientsSupportedPerFabric</attribute>
<attribute side="server" code="0x06" define="USER_ACTIVE_MODE_TRIGGER_HINT" type="UserActiveModeTriggerBitmap" writable="false" optional="true" isNullable="false">UserActiveModeTriggerHint</attribute>
<attribute side="server" code="0x07" define="USER_ACTIVE_MODE_TRIGGER_INSTRUCTION" type="char_string" length="128" writable="false" optional="true" isNullable="false">UserActiveModeTriggerInstruction</attribute>
<attribute side="server" code="0x08" define="OPERATING_MODE" type="OperatingModeEnum" default="0" writable="false" optional="true" isNullable="false">OperatingMode</attribute>

<event side="server" code="0x00" priority="critical" name="OnTransitionToActiveMode" optional="true">
<description>OnTransitionToActiveMode</description>
Expand Down
6 changes: 6 additions & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2848,6 +2848,11 @@ cluster BooleanState = 69 {
cluster IcdManagement = 70 {
revision 2;

enum OperatingModeEnum : enum8 {
kSIT = 0;
kLIT = 1;
}

bitmap Feature : bitmap32 {
kCheckInProtocolSupport = 0x1;
kUserActiveModeTrigger = 0x2;
Expand Down Expand Up @@ -2891,6 +2896,7 @@ cluster IcdManagement = 70 {
readonly attribute optional int16u clientsSupportedPerFabric = 5;
readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6;
readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7;
readonly attribute optional OperatingModeEnum operatingMode = 8;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19011,6 +19011,7 @@ public static class IcdManagementCluster extends BaseChipCluster {
private static final long CLIENTS_SUPPORTED_PER_FABRIC_ATTRIBUTE_ID = 5L;
private static final long USER_ACTIVE_MODE_TRIGGER_HINT_ATTRIBUTE_ID = 6L;
private static final long USER_ACTIVE_MODE_TRIGGER_INSTRUCTION_ATTRIBUTE_ID = 7L;
private static final long OPERATING_MODE_ATTRIBUTE_ID = 8L;
private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L;
Expand Down Expand Up @@ -19353,6 +19354,31 @@ public void onSuccess(byte[] tlv) {
}, USER_ACTIVE_MODE_TRIGGER_INSTRUCTION_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readOperatingModeAttribute(
IntegerAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OPERATING_MODE_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, OPERATING_MODE_ATTRIBUTE_ID, true);
}

public void subscribeOperatingModeAttribute(
IntegerAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, OPERATING_MODE_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, OPERATING_MODE_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readGeneratedCommandListAttribute(
GeneratedCommandListAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6035,6 +6035,7 @@ public enum Attribute {
ClientsSupportedPerFabric(5L),
UserActiveModeTriggerHint(6L),
UserActiveModeTriggerInstruction(7L),
OperatingMode(8L),
GeneratedCommandList(65528L),
AcceptedCommandList(65529L),
EventList(65530L),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5950,6 +5950,17 @@ private static Map<String, InteractionInfo> readIcdManagementInteractionInfo() {
readIcdManagementUserActiveModeTriggerInstructionCommandParams
);
result.put("readUserActiveModeTriggerInstructionAttribute", readIcdManagementUserActiveModeTriggerInstructionAttributeInteractionInfo);
Map<String, CommandParameterInfo> readIcdManagementOperatingModeCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readIcdManagementOperatingModeAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.IcdManagementCluster) cluster).readOperatingModeAttribute(
(ChipClusters.IntegerAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readIcdManagementOperatingModeCommandParams
);
result.put("readOperatingModeAttribute", readIcdManagementOperatingModeAttributeInteractionInfo);
Map<String, CommandParameterInfo> readIcdManagementGeneratedCommandListCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readIcdManagementGeneratedCommandListAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
Expand Down
Loading

0 comments on commit 1149444

Please sign in to comment.