Skip to content

Commit

Permalink
Update DRLC cluster to spec changes. (#30557)
Browse files Browse the repository at this point in the history
The DeviceClass attibute has been removed in
https://github.com/CHIP-Specifications/connectedhomeip-spec/pull/7762

NumberOfTransitions was spelled wrong.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Feb 19, 2024
1 parent 59325a8 commit 1172233
Show file tree
Hide file tree
Showing 24 changed files with 167 additions and 478 deletions.
19 changes: 9 additions & 10 deletions src/app/zap-templates/zcl/data-model/chip/drlc-cluster.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ limitations under the License.
<item fieldId="4" name="RandomDurationMinutes" type="int8u" isNullable="true" min="0x00" max="0x3C"/>
</struct>

<cluster>
<cluster apiMaturity="provisional">
<name>Demand Response Load Control</name>
<domain>Energy</domain>
<description>This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control.</description>
Expand All @@ -192,19 +192,18 @@ limitations under the License.
<server tick="false" init="false">true</server>
<globalAttribute side="either" code="0xFFFD" value="4"/>

<attribute side="server" code="0x0000" define="DEVICE_CLASS" type="DeviceClassBitmap" default="0" writable="false">DeviceClass</attribute>
<attribute side="server" code="0x0001" define="LOAD_CONTROL_PROGRAMS" type="ARRAY" entryType="LoadControlProgramStruct" writable="false">LoadControlPrograms</attribute>
<attribute side="server" code="0x0002" define="NUMBER_OF_LOAD_CONTROL_PROGRAMS" type="int8u" min="5" writable="false" default="5">NumberOfLoadControlPrograms</attribute>
<attribute side="server" code="0x0003" define="LOAD_CONTROL_EVENTS" type="ARRAY" entryType="LoadControlEventStruct" writable="false">Events</attribute>
<attribute side="server" code="0x0004" define="LOAD_CONTROL_ACTIVE_EVENTS" type="ARRAY" entryType="LoadControlEventStruct" writable="false">ActiveEvents</attribute>
<attribute side="server" code="0x0005" define="NUMBER_OF_EVENTS_PER_PROGRAM" type="int8u" min="10" writable="false" default="10">NumberOfEventsPerProgram</attribute>
<attribute side="server" code="0x0006" define="NUMBER_OF_TRANSITIONS" type="int8u" min="3" writable="false" default="3">NumberOfTransistions</attribute>
<attribute side="server" code="0x0007" define="DEFAULT_RANDOM_START" type="int8u" min="0" max="0x3C" default="0x1E" writable="true">
<attribute side="server" code="0x0000" define="LOAD_CONTROL_PROGRAMS" type="ARRAY" entryType="LoadControlProgramStruct" writable="false">LoadControlPrograms</attribute>
<attribute side="server" code="0x0001" define="NUMBER_OF_LOAD_CONTROL_PROGRAMS" type="int8u" min="5" writable="false" default="5">NumberOfLoadControlPrograms</attribute>
<attribute side="server" code="0x0002" define="LOAD_CONTROL_EVENTS" type="ARRAY" entryType="LoadControlEventStruct" writable="false">Events</attribute>
<attribute side="server" code="0x0003" define="LOAD_CONTROL_ACTIVE_EVENTS" type="ARRAY" entryType="LoadControlEventStruct" writable="false">ActiveEvents</attribute>
<attribute side="server" code="0x0004" define="NUMBER_OF_EVENTS_PER_PROGRAM" type="int8u" min="10" writable="false" default="10">NumberOfEventsPerProgram</attribute>
<attribute side="server" code="0x0005" define="NUMBER_OF_TRANSITIONS" type="int8u" min="3" writable="false" default="3">NumberOfTransitions</attribute>
<attribute side="server" code="0x0006" define="DEFAULT_RANDOM_START" type="int8u" min="0" max="0x3C" default="0x1E" writable="true">
<description>DefaultRandomStart</description>
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
</attribute>
<attribute side="server" code="0x0008" define="DEFAULT_RANDOM_DURATION" type="int8u" min="0" max="0x3C" default="0" writable="true">
<attribute side="server" code="0x0007" define="DEFAULT_RANDOM_DURATION" type="int8u" min="0" max="0x3C" default="0" writable="true">
<description>DefaultRandomDuration</description>
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
Expand Down
19 changes: 9 additions & 10 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -3888,7 +3888,7 @@ provisional client cluster ValveConfigurationAndControl = 129 {
}

/** This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. */
client cluster DemandResponseLoadControl = 150 {
provisional client cluster DemandResponseLoadControl = 150 {
enum CriticalityLevelEnum : enum8 {
kUnknown = 0;
kGreen = 1;
Expand Down Expand Up @@ -4043,15 +4043,14 @@ client cluster DemandResponseLoadControl = 150 {
optional nullable HeatingSourceControlStruct heatingSourceControl = 9;
}

readonly attribute DeviceClassBitmap deviceClass = 0;
readonly attribute LoadControlProgramStruct loadControlPrograms[] = 1;
readonly attribute int8u numberOfLoadControlPrograms = 2;
readonly attribute LoadControlEventStruct events[] = 3;
readonly attribute LoadControlEventStruct activeEvents[] = 4;
readonly attribute int8u numberOfEventsPerProgram = 5;
readonly attribute int8u numberOfTransistions = 6;
attribute access(write: manage) int8u defaultRandomStart = 7;
attribute access(write: manage) int8u defaultRandomDuration = 8;
readonly attribute LoadControlProgramStruct loadControlPrograms[] = 0;
readonly attribute int8u numberOfLoadControlPrograms = 1;
readonly attribute LoadControlEventStruct events[] = 2;
readonly attribute LoadControlEventStruct activeEvents[] = 3;
readonly attribute int8u numberOfEventsPerProgram = 4;
readonly attribute int8u numberOfTransitions = 5;
attribute access(write: manage) int8u defaultRandomStart = 6;
attribute access(write: manage) int8u defaultRandomDuration = 7;
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 @@ -27573,15 +27573,14 @@ public void onSuccess(byte[] tlv) {
public static class DemandResponseLoadControlCluster extends BaseChipCluster {
public static final long CLUSTER_ID = 150L;

private static final long DEVICE_CLASS_ATTRIBUTE_ID = 0L;
private static final long LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 1L;
private static final long NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 2L;
private static final long EVENTS_ATTRIBUTE_ID = 3L;
private static final long ACTIVE_EVENTS_ATTRIBUTE_ID = 4L;
private static final long NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID = 5L;
private static final long NUMBER_OF_TRANSISTIONS_ATTRIBUTE_ID = 6L;
private static final long DEFAULT_RANDOM_START_ATTRIBUTE_ID = 7L;
private static final long DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID = 8L;
private static final long LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 0L;
private static final long NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID = 1L;
private static final long EVENTS_ATTRIBUTE_ID = 2L;
private static final long ACTIVE_EVENTS_ATTRIBUTE_ID = 3L;
private static final long NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID = 4L;
private static final long NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID = 5L;
private static final long DEFAULT_RANDOM_START_ATTRIBUTE_ID = 6L;
private static final long DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID = 7L;
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 @@ -27727,31 +27726,6 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<Long> value);
}

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

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

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

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

public void readLoadControlProgramsAttribute(
LoadControlProgramsAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID);
Expand Down Expand Up @@ -27877,29 +27851,29 @@ public void onSuccess(byte[] tlv) {
}, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readNumberOfTransistionsAttribute(
public void readNumberOfTransitionsAttribute(
IntegerAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSISTIONS_ATTRIBUTE_ID);
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID);

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

public void subscribeNumberOfTransistionsAttribute(
public void subscribeNumberOfTransitionsAttribute(
IntegerAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSISTIONS_ATTRIBUTE_ID);
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID);

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

public void readDefaultRandomStartAttribute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8813,15 +8813,14 @@ public long getID() {
}

public enum Attribute {
DeviceClass(0L),
LoadControlPrograms(1L),
NumberOfLoadControlPrograms(2L),
Events(3L),
ActiveEvents(4L),
NumberOfEventsPerProgram(5L),
NumberOfTransistions(6L),
DefaultRandomStart(7L),
DefaultRandomDuration(8L),
LoadControlPrograms(0L),
NumberOfLoadControlPrograms(1L),
Events(2L),
ActiveEvents(3L),
NumberOfEventsPerProgram(4L),
NumberOfTransitions(5L),
DefaultRandomStart(6L),
DefaultRandomDuration(7L),
GeneratedCommandList(65528L),
AcceptedCommandList(65529L),
EventList(65530L),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8715,18 +8715,7 @@ private static Map<String, InteractionInfo> readValveConfigurationAndControlInte
return result;
}
private static Map<String, InteractionInfo> readDemandResponseLoadControlInteractionInfo() {
Map<String, InteractionInfo> result = new LinkedHashMap<>();Map<String, CommandParameterInfo> readDemandResponseLoadControlDeviceClassCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readDemandResponseLoadControlDeviceClassAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.DemandResponseLoadControlCluster) cluster).readDeviceClassAttribute(
(ChipClusters.LongAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
readDemandResponseLoadControlDeviceClassCommandParams
);
result.put("readDeviceClassAttribute", readDemandResponseLoadControlDeviceClassAttributeInteractionInfo);
Map<String, CommandParameterInfo> readDemandResponseLoadControlLoadControlProgramsCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
Map<String, InteractionInfo> result = new LinkedHashMap<>();Map<String, CommandParameterInfo> readDemandResponseLoadControlLoadControlProgramsCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readDemandResponseLoadControlLoadControlProgramsAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.DemandResponseLoadControlCluster) cluster).readLoadControlProgramsAttribute(
Expand Down Expand Up @@ -8781,17 +8770,17 @@ private static Map<String, InteractionInfo> readDemandResponseLoadControlInterac
readDemandResponseLoadControlNumberOfEventsPerProgramCommandParams
);
result.put("readNumberOfEventsPerProgramAttribute", readDemandResponseLoadControlNumberOfEventsPerProgramAttributeInteractionInfo);
Map<String, CommandParameterInfo> readDemandResponseLoadControlNumberOfTransistionsCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readDemandResponseLoadControlNumberOfTransistionsAttributeInteractionInfo = new InteractionInfo(
Map<String, CommandParameterInfo> readDemandResponseLoadControlNumberOfTransitionsCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readDemandResponseLoadControlNumberOfTransitionsAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.DemandResponseLoadControlCluster) cluster).readNumberOfTransistionsAttribute(
((ChipClusters.DemandResponseLoadControlCluster) cluster).readNumberOfTransitionsAttribute(
(ChipClusters.IntegerAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readDemandResponseLoadControlNumberOfTransistionsCommandParams
readDemandResponseLoadControlNumberOfTransitionsCommandParams
);
result.put("readNumberOfTransistionsAttribute", readDemandResponseLoadControlNumberOfTransistionsAttributeInteractionInfo);
result.put("readNumberOfTransitionsAttribute", readDemandResponseLoadControlNumberOfTransitionsAttributeInteractionInfo);
Map<String, CommandParameterInfo> readDemandResponseLoadControlDefaultRandomStartCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readDemandResponseLoadControlDefaultRandomStartAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,6 @@ class DemandResponseLoadControlCluster(
}
}

suspend fun readDeviceClassAttribute(): UInt {
// Implementation needs to be added here
}

suspend fun subscribeDeviceClassAttribute(minInterval: Int, maxInterval: Int): UInt {
// Implementation needs to be added here
}

suspend fun readLoadControlProgramsAttribute(): LoadControlProgramsAttribute {
// Implementation needs to be added here
}
Expand Down Expand Up @@ -165,11 +157,11 @@ class DemandResponseLoadControlCluster(
// Implementation needs to be added here
}

suspend fun readNumberOfTransistionsAttribute(): UByte {
suspend fun readNumberOfTransitionsAttribute(): UByte {
// Implementation needs to be added here
}

suspend fun subscribeNumberOfTransistionsAttribute(minInterval: Int, maxInterval: Int): UByte {
suspend fun subscribeNumberOfTransitionsAttribute(minInterval: Int, maxInterval: Int): UByte {
// Implementation needs to be added here
}

Expand Down
20 changes: 2 additions & 18 deletions src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 13 additions & 19 deletions src/controller/python/chip/clusters/CHIPClusters.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1172233

Please sign in to comment.