Skip to content

Commit 6ce2430

Browse files
committedJun 3, 2024
Added missing autogen'd code for DEM changes.
1 parent 26d3030 commit 6ce2430

File tree

2 files changed

+166
-0
lines changed

2 files changed

+166
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package chip.devicecontroller.cluster.structs
18+
19+
import chip.devicecontroller.cluster.*
20+
import matter.tlv.AnonymousTag
21+
import matter.tlv.ContextSpecificTag
22+
import matter.tlv.Tag
23+
import matter.tlv.TlvReader
24+
import matter.tlv.TlvWriter
25+
26+
class DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(
27+
val powerAdjustCapability: List<DeviceEnergyManagementClusterPowerAdjustStruct>?,
28+
val cause: UInt
29+
) {
30+
override fun toString(): String = buildString {
31+
append("DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {\n")
32+
append("\tpowerAdjustCapability : $powerAdjustCapability\n")
33+
append("\tcause : $cause\n")
34+
append("}\n")
35+
}
36+
37+
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
38+
tlvWriter.apply {
39+
startStructure(tlvTag)
40+
if (powerAdjustCapability != null) {
41+
startArray(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
42+
for (item in powerAdjustCapability.iterator()) {
43+
item.toTlv(AnonymousTag, this)
44+
}
45+
endArray()
46+
} else {
47+
putNull(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
48+
}
49+
put(ContextSpecificTag(TAG_CAUSE), cause)
50+
endStructure()
51+
}
52+
}
53+
54+
companion object {
55+
private const val TAG_POWER_ADJUST_CAPABILITY = 0
56+
private const val TAG_CAUSE = 1
57+
58+
fun fromTlv(
59+
tlvTag: Tag,
60+
tlvReader: TlvReader
61+
): DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {
62+
tlvReader.enterStructure(tlvTag)
63+
val powerAdjustCapability =
64+
if (!tlvReader.isNull()) {
65+
buildList<DeviceEnergyManagementClusterPowerAdjustStruct> {
66+
tlvReader.enterArray(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
67+
while (!tlvReader.isEndOfContainer()) {
68+
add(DeviceEnergyManagementClusterPowerAdjustStruct.fromTlv(AnonymousTag, tlvReader))
69+
}
70+
tlvReader.exitContainer()
71+
}
72+
} else {
73+
tlvReader.getNull(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
74+
null
75+
}
76+
val cause = tlvReader.getUInt(ContextSpecificTag(TAG_CAUSE))
77+
78+
tlvReader.exitContainer()
79+
80+
return DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(powerAdjustCapability, cause)
81+
}
82+
}
83+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Project CHIP Authors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package matter.controller.cluster.structs
18+
19+
import matter.controller.cluster.*
20+
import matter.tlv.AnonymousTag
21+
import matter.tlv.ContextSpecificTag
22+
import matter.tlv.Tag
23+
import matter.tlv.TlvReader
24+
import matter.tlv.TlvWriter
25+
26+
class DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(
27+
val powerAdjustCapability: List<DeviceEnergyManagementClusterPowerAdjustStruct>?,
28+
val cause: UByte
29+
) {
30+
override fun toString(): String = buildString {
31+
append("DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {\n")
32+
append("\tpowerAdjustCapability : $powerAdjustCapability\n")
33+
append("\tcause : $cause\n")
34+
append("}\n")
35+
}
36+
37+
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
38+
tlvWriter.apply {
39+
startStructure(tlvTag)
40+
if (powerAdjustCapability != null) {
41+
startArray(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
42+
for (item in powerAdjustCapability.iterator()) {
43+
item.toTlv(AnonymousTag, this)
44+
}
45+
endArray()
46+
} else {
47+
putNull(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
48+
}
49+
put(ContextSpecificTag(TAG_CAUSE), cause)
50+
endStructure()
51+
}
52+
}
53+
54+
companion object {
55+
private const val TAG_POWER_ADJUST_CAPABILITY = 0
56+
private const val TAG_CAUSE = 1
57+
58+
fun fromTlv(
59+
tlvTag: Tag,
60+
tlvReader: TlvReader
61+
): DeviceEnergyManagementClusterPowerAdjustCapabilityStruct {
62+
tlvReader.enterStructure(tlvTag)
63+
val powerAdjustCapability =
64+
if (!tlvReader.isNull()) {
65+
buildList<DeviceEnergyManagementClusterPowerAdjustStruct> {
66+
tlvReader.enterArray(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
67+
while (!tlvReader.isEndOfContainer()) {
68+
add(DeviceEnergyManagementClusterPowerAdjustStruct.fromTlv(AnonymousTag, tlvReader))
69+
}
70+
tlvReader.exitContainer()
71+
}
72+
} else {
73+
tlvReader.getNull(ContextSpecificTag(TAG_POWER_ADJUST_CAPABILITY))
74+
null
75+
}
76+
val cause = tlvReader.getUByte(ContextSpecificTag(TAG_CAUSE))
77+
78+
tlvReader.exitContainer()
79+
80+
return DeviceEnergyManagementClusterPowerAdjustCapabilityStruct(powerAdjustCapability, cause)
81+
}
82+
}
83+
}

0 commit comments

Comments
 (0)