Skip to content

Commit

Permalink
Update DRLC cluster to spec changes.
Browse files Browse the repository at this point in the history
The DeviceClass attibute has been removed in CHIP-Specifications/connectedhomeip-spec#7762
  • Loading branch information
bzbarsky-apple committed Nov 17, 2023
1 parent 4b515e8 commit 8c40a2f
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 406 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">NumberOfTransistions</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
17 changes: 8 additions & 9 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
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 numberOfTransistions = 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_TRANSISTIONS_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
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),
NumberOfTransistions(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
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
16 changes: 0 additions & 16 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 8c40a2f

Please sign in to comment.