Skip to content

Commit

Permalink
Initial XML for Power Topology cluster (#31689)
Browse files Browse the repository at this point in the history
* Initial XML for Power Topology cluster

* Regen

* Restyled really wants newlines at the end of every JSON file

* Rename LeafTopology to TreeTopology
  • Loading branch information
hasty authored Feb 6, 2024
1 parent 4b3c37e commit 819a4f1
Show file tree
Hide file tree
Showing 40 changed files with 3,716 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ jobs:
src/app/zap-templates/zcl/data-model/chip/operational-state-oven-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/operational-state-rvc-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/oven-mode-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/pressure-measurement-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml \
src/app/zap-templates/zcl/data-model/chip/power-source-configuration-cluster.xml \
Expand Down
1 change: 1 addition & 0 deletions docs/clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Generally regenerate using one of:
| 152 | 0x98 | DeviceEnergyManagement |
| 153 | 0x99 | EnergyEvse |
| 155 | 0x9B | EnergyPreference |
| 156 | 0x9C | PowerTopology |
| 157 | 0x9D | EnergyEvseMode |
| 159 | 0x9F | DeviceEnergyManagementMode |
| 257 | 0x101 | DoorLock |
Expand Down
1 change: 1 addition & 0 deletions scripts/rules.matterlint
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/operational-state-rvc-cluster
load "../src/app/zap-templates/zcl/data-model/chip/oven-mode-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/power-source-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/power-source-configuration-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/power-topology-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/pressure-measurement-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/proxy-configuration-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/proxy-discovery-cluster.xml";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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.
-->
<configurator>
<domain name="Measurement &amp; Sensing"/>
<bitmap name="Feature" type="bitmap32">
<cluster code="0x009C"/>
<field name="NodeTopology" mask="0x01"/>
<field name="TreeTopology" mask="0x02"/>
<field name="SetTopology" mask="0x04"/>
<field name="DynamicPowerFlow" mask="0x08"/>
</bitmap>
<cluster code="0x009C">
<domain>Measurement &amp; Sensing</domain>
<name>Power Topology</name>
<code>0x009C</code>
<define>POWER_TOPOLOGY_CLUSTER</define>
<description>The Power Topology Cluster provides a mechanism for expressing how power is flowing between endpoints.</description>
<client init="false" tick="false">true</client>
<server init="false" tick="false">true</server>
<globalAttribute code="0xFFFD" side="either" value="1"/>
<attribute code="0x0000" side="server" define="AVAILABLE_ENDPOINTS" type="array" entryType="endpoint_no" length="20" optional="true">AvailableEndpoints</attribute>
<attribute code="0x0001" side="server" define="ACTIVE_ENDPOINTS" type="array" entryType="endpoint_no" length="20" optional="true">ActiveEndpoints</attribute>
</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 @@ -88,6 +88,7 @@
"operational-state-oven-cluster.xml",
"operational-state-rvc-cluster.xml",
"oven-mode-cluster.xml",
"power-topology-cluster.xml",
"pressure-measurement-cluster.xml",
"power-source-cluster.xml",
"power-source-configuration-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 @@ -85,6 +85,7 @@
"operational-state-oven-cluster.xml",
"operational-state-rvc-cluster.xml",
"oven-mode-cluster.xml",
"power-topology-cluster.xml",
"pressure-measurement-cluster.xml",
"power-source-cluster.xml",
"power-source-configuration-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 @@ -68,6 +68,7 @@
"MESSAGES_CLUSTER": [],
"MODE_SELECT_CLUSTER": [],
"NETWORK_COMMISSIONING_CLUSTER": [],
"POWER_TOPOLOGY_CLUSTER": [],
"SAMPLE_MEI_CLUSTER": [],
"NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_CLUSTER": [],
"OCCUPANCY_SENSING_CLUSTER": ["occupancy-sensor-server"],
Expand Down Expand Up @@ -227,6 +228,7 @@
"SAMPLE_MEI_CLUSTER": ["sample-mei-server"],
"OCCUPANCY_SENSING_CLUSTER": ["occupancy-sensor-server"],
"ON_OFF_CLUSTER": ["on-off-server"],
"POWER_TOPOLOGY_CLUSTER": [],
"ON_OFF_SWITCH_CONFIGURATION_CLUSTER": [],
"OPERATIONAL_CREDENTIALS_CLUSTER": ["operational-credentials-server"],
"OPERATIONAL_STATE_CLUSTER": ["operational-state-server"],
Expand Down
21 changes: 21 additions & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -4994,6 +4994,27 @@ cluster EnergyPreference = 155 {
readonly attribute int16u clusterRevision = 65533;
}

/** The Power Topology Cluster provides a mechanism for expressing how power is flowing between endpoints. */
cluster PowerTopology = 156 {
revision 1;

bitmap Feature : bitmap32 {
kNodeTopology = 0x1;
kTreeTopology = 0x2;
kSetTopology = 0x4;
kDynamicPowerFlow = 0x8;
}

readonly attribute optional endpoint_no availableEndpoints[] = 0;
readonly attribute optional endpoint_no activeEndpoints[] = 1;
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;
}

/** Attributes and commands for selecting a mode from a list of supported options. */
provisional cluster EnergyEvseMode = 157 {
revision 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32073,6 +32073,253 @@ public void onSuccess(byte[] tlv) {
}
}

public static class PowerTopologyCluster extends BaseChipCluster {
public static final long CLUSTER_ID = 156L;

private static final long AVAILABLE_ENDPOINTS_ATTRIBUTE_ID = 0L;
private static final long ACTIVE_ENDPOINTS_ATTRIBUTE_ID = 1L;
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;
private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L;
private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L;
private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L;

public PowerTopologyCluster(long devicePtr, int endpointId) {
super(devicePtr, endpointId, CLUSTER_ID);
}

@Override
@Deprecated
public long initWithDevice(long devicePtr, int endpointId) {
return 0L;
}

public interface AvailableEndpointsAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<Integer> value);
}

public interface ActiveEndpointsAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<Integer> value);
}

public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<Long> value);
}

public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<Long> value);
}

public interface EventListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<Long> value);
}

public interface AttributeListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<Long> value);
}

public void readAvailableEndpointsAttribute(
AvailableEndpointsAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID);

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

public void subscribeAvailableEndpointsAttribute(
AvailableEndpointsAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID);

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

public void readActiveEndpointsAttribute(
ActiveEndpointsAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID);

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

public void subscribeActiveEndpointsAttribute(
ActiveEndpointsAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_ENDPOINTS_ATTRIBUTE_ID);

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

public void readGeneratedCommandListAttribute(
GeneratedCommandListAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<Long> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true);
}

public void subscribeGeneratedCommandListAttribute(
GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<Long> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readAcceptedCommandListAttribute(
AcceptedCommandListAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<Long> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true);
}

public void subscribeAcceptedCommandListAttribute(
AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<Long> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readEventListAttribute(
EventListAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<Long> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, EVENT_LIST_ATTRIBUTE_ID, true);
}

public void subscribeEventListAttribute(
EventListAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<Long> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readAttributeListAttribute(
AttributeListAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<Long> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, ATTRIBUTE_LIST_ATTRIBUTE_ID, true);
}

public void subscribeAttributeListAttribute(
AttributeListAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<Long> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readFeatureMapAttribute(
LongAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID);

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

public void subscribeFeatureMapAttribute(
LongAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID);

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

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

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

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

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

public static class EnergyEvseModeCluster extends BaseChipCluster {
public static final long CLUSTER_ID = 157L;

Expand Down
Loading

0 comments on commit 819a4f1

Please sign in to comment.