Skip to content

Commit ce3dac7

Browse files
Update src/app/zap-templates/zcl/zcl*.json
1 parent 0d6034f commit ce3dac7

File tree

14 files changed

+548
-895
lines changed

14 files changed

+548
-895
lines changed

src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ limitations under the License.
4747

4848
<struct name="Date">
4949
<cluster code="0x009A"/>
50-
<item fieldId="0" name="Year" type="int16u" default="0" optional="true"/>
51-
<item fieldId="1" name="Month" type="int8u" min="1" max="12" default="1" optional="true"/>
52-
<item fieldId="2" name="Day" type="int8u" min="1" max="31" default="1" optional="true"/>
53-
<item fieldId="3" name="DayOfWeek" type="int8u" min="1" max="7" optional="true"/>
50+
<item fieldId="0" name="Year" type="int16u" default="0" isNullable="true" optional="true"/>
51+
<item fieldId="1" name="Month" type="int8u" min="1" max="12" default="1" isNullable="true" optional="true"/>
52+
<item fieldId="2" name="Day" type="int8u" min="1" max="31" default="1" isNullable="true" optional="true"/>
53+
<item fieldId="3" name="DayOfWeek" type="int8u" min="1" max="7" isNullable="true" optional="true"/>
5454
</struct>
5555

5656
<struct name="CalendarPeriod">
@@ -119,8 +119,8 @@ limitations under the License.
119119
<attribute code="0x0007" side="server" type="DayStruct" define="CURRENT_DAY" isNullable="true" writable="false" optional="false">CurrentDay</attribute>
120120
<attribute code="0x0008" side="server" type="DayStruct" define="NEXT_DAY" isNullable="true" writable="false" optional="false">NextDay</attribute>
121121
<attribute code="0x0009" side="server" type="TransitionStruct" define="CURRENT_TRANSITION" isNullable="true" writable="false" optional="false">CurrentTransition</attribute>
122-
<attribute code="0x000A" side="server" type="PeakPeriodStruct" define="CURRENT_PEAK_PERIOD" isNullable="true" writable="false" optional="false">CurrentPeakPeriod</attribute>
123-
<attribute code="0x000B" side="server" type="PeakPeriodStruct" define="NEXT_PEAK_PERIOD" isNullable="true" writable="false" optional="false">NextPeakPeriod</attribute>
122+
<attribute code="0x000A" side="server" type="PeakPeriodStruct" define="CURRENT_PEAK_PERIOD" isNullable="true" writable="false" optional="true">CurrentPeakPeriod</attribute>
123+
<attribute code="0x000B" side="server" type="PeakPeriodStruct" define="NEXT_PEAK_PERIOD" isNullable="true" writable="false" optional="true">NextPeakPeriod</attribute>
124124
</cluster>
125125

126126
</configurator>

src/app/zap-templates/zcl/zcl-with-test-extensions.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,17 @@
638638
"Power Topology": ["FeatureMap"],
639639
"Valve Configuration and Control": ["RemainingDuration"],
640640
"Boolean State Configuration": ["CurrentSensitivityLevel"],
641-
"Wi-Fi Network Management": ["SSID"]
641+
"Wi-Fi Network Management": ["SSID"],
642+
"Energy Calendar": [
643+
"CalendarPeriods",
644+
"SpecialDays",
645+
"CurrentDay",
646+
"NextDay",
647+
"CurrentTransition",
648+
"CurrentPeakPeriod",
649+
"NextPeakPeriod",
650+
"FeatureMap"
651+
]
642652
},
643653
"defaultReportingPolicy": "mandatory",
644654
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],

src/app/zap-templates/zcl/zcl.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,17 @@
636636
"Power Topology": ["FeatureMap"],
637637
"Valve Configuration and Control": ["RemainingDuration"],
638638
"Boolean State Configuration": ["CurrentSensitivityLevel"],
639-
"Wi-Fi Network Management": ["SSID"]
639+
"Wi-Fi Network Management": ["SSID"],
640+
"Energy Calendar": [
641+
"CalendarPeriods",
642+
"SpecialDays",
643+
"CurrentDay",
644+
"NextDay",
645+
"CurrentTransition",
646+
"CurrentPeakPeriod",
647+
"NextPeakPeriod",
648+
"FeatureMap"
649+
]
640650
},
641651
"defaultReportingPolicy": "mandatory",
642652
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],

src/controller/data_model/controller-clusters.matter

+6-6
Original file line numberDiff line numberDiff line change
@@ -5039,10 +5039,10 @@ cluster EnergyCalendar = 154 {
50395039
}
50405040

50415041
struct Date {
5042-
optional int16u year = 0;
5043-
optional int8u month = 1;
5044-
optional int8u day = 2;
5045-
optional int8u dayOfWeek = 3;
5042+
optional nullable int16u year = 0;
5043+
optional nullable int8u month = 1;
5044+
optional nullable int8u day = 2;
5045+
optional nullable int8u dayOfWeek = 3;
50465046
}
50475047

50485048
struct DayStruct {
@@ -5074,8 +5074,8 @@ cluster EnergyCalendar = 154 {
50745074
readonly attribute nullable DayStruct currentDay = 7;
50755075
readonly attribute nullable DayStruct nextDay = 8;
50765076
readonly attribute nullable TransitionStruct currentTransition = 9;
5077-
readonly attribute nullable PeakPeriodStruct currentPeakPeriod = 10;
5078-
readonly attribute nullable PeakPeriodStruct nextPeakPeriod = 11;
5077+
readonly attribute optional nullable PeakPeriodStruct currentPeakPeriod = 10;
5078+
readonly attribute optional nullable PeakPeriodStruct nextPeakPeriod = 11;
50795079
readonly attribute command_id generatedCommandList[] = 65528;
50805080
readonly attribute command_id acceptedCommandList[] = 65529;
50815081
readonly attribute event_id eventList[] = 65530;

src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java

+16-16
Original file line numberDiff line numberDiff line change
@@ -8382,20 +8382,20 @@ public String toString() {
83828382
}
83838383
}
83848384
public static class EnergyCalendarClusterDate {
8385-
public Optional<Integer> year;
8386-
public Optional<Integer> month;
8387-
public Optional<Integer> day;
8388-
public Optional<Integer> dayOfWeek;
8385+
public @Nullable Optional<Integer> year;
8386+
public @Nullable Optional<Integer> month;
8387+
public @Nullable Optional<Integer> day;
8388+
public @Nullable Optional<Integer> dayOfWeek;
83898389
private static final long YEAR_ID = 0L;
83908390
private static final long MONTH_ID = 1L;
83918391
private static final long DAY_ID = 2L;
83928392
private static final long DAY_OF_WEEK_ID = 3L;
83938393

83948394
public EnergyCalendarClusterDate(
8395-
Optional<Integer> year,
8396-
Optional<Integer> month,
8397-
Optional<Integer> day,
8398-
Optional<Integer> dayOfWeek
8395+
@Nullable Optional<Integer> year,
8396+
@Nullable Optional<Integer> month,
8397+
@Nullable Optional<Integer> day,
8398+
@Nullable Optional<Integer> dayOfWeek
83998399
) {
84008400
this.year = year;
84018401
this.month = month;
@@ -8405,10 +8405,10 @@ public EnergyCalendarClusterDate(
84058405

84068406
public StructType encodeTlv() {
84078407
ArrayList<StructElement> values = new ArrayList<>();
8408-
values.add(new StructElement(YEAR_ID, year.<BaseTLVType>map((nonOptionalyear) -> new UIntType(nonOptionalyear)).orElse(new EmptyType())));
8409-
values.add(new StructElement(MONTH_ID, month.<BaseTLVType>map((nonOptionalmonth) -> new UIntType(nonOptionalmonth)).orElse(new EmptyType())));
8410-
values.add(new StructElement(DAY_ID, day.<BaseTLVType>map((nonOptionalday) -> new UIntType(nonOptionalday)).orElse(new EmptyType())));
8411-
values.add(new StructElement(DAY_OF_WEEK_ID, dayOfWeek.<BaseTLVType>map((nonOptionaldayOfWeek) -> new UIntType(nonOptionaldayOfWeek)).orElse(new EmptyType())));
8408+
values.add(new StructElement(YEAR_ID, year != null ? year.<BaseTLVType>map((nonOptionalyear) -> new UIntType(nonOptionalyear)).orElse(new EmptyType()) : new NullType()));
8409+
values.add(new StructElement(MONTH_ID, month != null ? month.<BaseTLVType>map((nonOptionalmonth) -> new UIntType(nonOptionalmonth)).orElse(new EmptyType()) : new NullType()));
8410+
values.add(new StructElement(DAY_ID, day != null ? day.<BaseTLVType>map((nonOptionalday) -> new UIntType(nonOptionalday)).orElse(new EmptyType()) : new NullType()));
8411+
values.add(new StructElement(DAY_OF_WEEK_ID, dayOfWeek != null ? dayOfWeek.<BaseTLVType>map((nonOptionaldayOfWeek) -> new UIntType(nonOptionaldayOfWeek)).orElse(new EmptyType()) : new NullType()));
84128412

84138413
return new StructType(values);
84148414
}
@@ -8417,10 +8417,10 @@ public static EnergyCalendarClusterDate decodeTlv(BaseTLVType tlvValue) {
84178417
if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
84188418
return null;
84198419
}
8420-
Optional<Integer> year = Optional.empty();
8421-
Optional<Integer> month = Optional.empty();
8422-
Optional<Integer> day = Optional.empty();
8423-
Optional<Integer> dayOfWeek = Optional.empty();
8420+
@Nullable Optional<Integer> year = null;
8421+
@Nullable Optional<Integer> month = null;
8422+
@Nullable Optional<Integer> day = null;
8423+
@Nullable Optional<Integer> dayOfWeek = null;
84248424
for (StructElement element: ((StructType)tlvValue).value()) {
84258425
if (element.contextTagNum() == YEAR_ID) {
84268426
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {

src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDate.kt

+64-28
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import matter.tlv.TlvReader
2424
import matter.tlv.TlvWriter
2525

2626
class EnergyCalendarClusterDate(
27-
val year: Optional<UInt>,
28-
val month: Optional<UInt>,
29-
val day: Optional<UInt>,
30-
val dayOfWeek: Optional<UInt>
27+
val year: Optional<UInt>?,
28+
val month: Optional<UInt>?,
29+
val day: Optional<UInt>?,
30+
val dayOfWeek: Optional<UInt>?
3131
) {
3232
override fun toString(): String = buildString {
3333
append("EnergyCalendarClusterDate {\n")
@@ -41,21 +41,37 @@ class EnergyCalendarClusterDate(
4141
fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
4242
tlvWriter.apply {
4343
startStructure(tlvTag)
44-
if (year.isPresent) {
45-
val optyear = year.get()
46-
put(ContextSpecificTag(TAG_YEAR), optyear)
44+
if (year != null) {
45+
if (year.isPresent) {
46+
val optyear = year.get()
47+
put(ContextSpecificTag(TAG_YEAR), optyear)
48+
}
49+
} else {
50+
putNull(ContextSpecificTag(TAG_YEAR))
4751
}
48-
if (month.isPresent) {
49-
val optmonth = month.get()
50-
put(ContextSpecificTag(TAG_MONTH), optmonth)
52+
if (month != null) {
53+
if (month.isPresent) {
54+
val optmonth = month.get()
55+
put(ContextSpecificTag(TAG_MONTH), optmonth)
56+
}
57+
} else {
58+
putNull(ContextSpecificTag(TAG_MONTH))
5159
}
52-
if (day.isPresent) {
53-
val optday = day.get()
54-
put(ContextSpecificTag(TAG_DAY), optday)
60+
if (day != null) {
61+
if (day.isPresent) {
62+
val optday = day.get()
63+
put(ContextSpecificTag(TAG_DAY), optday)
64+
}
65+
} else {
66+
putNull(ContextSpecificTag(TAG_DAY))
5567
}
56-
if (dayOfWeek.isPresent) {
57-
val optdayOfWeek = dayOfWeek.get()
58-
put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek)
68+
if (dayOfWeek != null) {
69+
if (dayOfWeek.isPresent) {
70+
val optdayOfWeek = dayOfWeek.get()
71+
put(ContextSpecificTag(TAG_DAY_OF_WEEK), optdayOfWeek)
72+
}
73+
} else {
74+
putNull(ContextSpecificTag(TAG_DAY_OF_WEEK))
5975
}
6076
endStructure()
6177
}
@@ -70,28 +86,48 @@ class EnergyCalendarClusterDate(
7086
fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDate {
7187
tlvReader.enterStructure(tlvTag)
7288
val year =
73-
if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) {
74-
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_YEAR)))
89+
if (!tlvReader.isNull()) {
90+
if (tlvReader.isNextTag(ContextSpecificTag(TAG_YEAR))) {
91+
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_YEAR)))
92+
} else {
93+
Optional.empty()
94+
}
7595
} else {
76-
Optional.empty()
96+
tlvReader.getNull(ContextSpecificTag(TAG_YEAR))
97+
null
7798
}
7899
val month =
79-
if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) {
80-
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MONTH)))
100+
if (!tlvReader.isNull()) {
101+
if (tlvReader.isNextTag(ContextSpecificTag(TAG_MONTH))) {
102+
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MONTH)))
103+
} else {
104+
Optional.empty()
105+
}
81106
} else {
82-
Optional.empty()
107+
tlvReader.getNull(ContextSpecificTag(TAG_MONTH))
108+
null
83109
}
84110
val day =
85-
if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) {
86-
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY)))
111+
if (!tlvReader.isNull()) {
112+
if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY))) {
113+
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY)))
114+
} else {
115+
Optional.empty()
116+
}
87117
} else {
88-
Optional.empty()
118+
tlvReader.getNull(ContextSpecificTag(TAG_DAY))
119+
null
89120
}
90121
val dayOfWeek =
91-
if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) {
92-
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK)))
122+
if (!tlvReader.isNull()) {
123+
if (tlvReader.isNextTag(ContextSpecificTag(TAG_DAY_OF_WEEK))) {
124+
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK)))
125+
} else {
126+
Optional.empty()
127+
}
93128
} else {
94-
Optional.empty()
129+
tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK))
130+
null
95131
}
96132

97133
tlvReader.exitContainer()

src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyCalendarCluster.kt

+20-4
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,11 @@ class EnergyCalendarCluster(
11711171
val tlvReader = TlvReader(attributeData.data)
11721172
val decodedValue: EnergyCalendarClusterPeakPeriodStruct? =
11731173
if (!tlvReader.isNull()) {
1174-
EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader)
1174+
if (tlvReader.isNextTag(AnonymousTag)) {
1175+
EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader)
1176+
} else {
1177+
null
1178+
}
11751179
} else {
11761180
tlvReader.getNull(AnonymousTag)
11771181
null
@@ -1223,7 +1227,11 @@ class EnergyCalendarCluster(
12231227
val tlvReader = TlvReader(attributeData.data)
12241228
val decodedValue: EnergyCalendarClusterPeakPeriodStruct? =
12251229
if (!tlvReader.isNull()) {
1226-
EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader)
1230+
if (tlvReader.isNextTag(AnonymousTag)) {
1231+
EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader)
1232+
} else {
1233+
null
1234+
}
12271235
} else {
12281236
tlvReader.getNull(AnonymousTag)
12291237
null
@@ -1266,7 +1274,11 @@ class EnergyCalendarCluster(
12661274
val tlvReader = TlvReader(attributeData.data)
12671275
val decodedValue: EnergyCalendarClusterPeakPeriodStruct? =
12681276
if (!tlvReader.isNull()) {
1269-
EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader)
1277+
if (tlvReader.isNextTag(AnonymousTag)) {
1278+
EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader)
1279+
} else {
1280+
null
1281+
}
12701282
} else {
12711283
tlvReader.getNull(AnonymousTag)
12721284
null
@@ -1318,7 +1330,11 @@ class EnergyCalendarCluster(
13181330
val tlvReader = TlvReader(attributeData.data)
13191331
val decodedValue: EnergyCalendarClusterPeakPeriodStruct? =
13201332
if (!tlvReader.isNull()) {
1321-
EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader)
1333+
if (tlvReader.isNextTag(AnonymousTag)) {
1334+
EnergyCalendarClusterPeakPeriodStruct.fromTlv(AnonymousTag, tlvReader)
1335+
} else {
1336+
null
1337+
}
13221338
} else {
13231339
tlvReader.getNull(AnonymousTag)
13241340
null

0 commit comments

Comments
 (0)