From af349567709cb72d1590a2a993dc3aaeba065657 Mon Sep 17 00:00:00 2001 From: Mikhail Antropov Date: Fri, 26 Jul 2024 10:43:17 +0300 Subject: [PATCH] Revert type DayStruct.Date to epoch Revert implementing Date type as struct --- .../tests/TestCodegenModelViaMocks.cpp | 2 + .../zcl/data-model/chip/chip-types.xml | 2 +- .../chip/energy-calendar-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 9 +- .../chip/devicecontroller/ChipStructs.java | 105 +---- .../chip/devicecontroller/cluster/files.gni | 1 - .../EnergyCalendarClusterDateStruct.kt | 109 ------ .../structs/EnergyCalendarClusterDayStruct.kt | 8 +- .../java/matter/controller/cluster/files.gni | 1 - .../EnergyCalendarClusterDateStruct.kt | 109 ------ .../structs/EnergyCalendarClusterDayStruct.kt | 8 +- .../CHIPAttributeTLVValueDecoder.cpp | 360 ++---------------- .../python/chip/clusters/Objects.py | 21 +- .../MTRAttributeTLVValueDecoder.mm | 88 +---- .../CHIP/zap-generated/MTRStructsObjc.h | 10 +- .../CHIP/zap-generated/MTRStructsObjc.mm | 36 -- .../app-common/zap-generated/attribute-type.h | 1 + .../zap-generated/cluster-objects.h | 5 +- 18 files changed, 53 insertions(+), 824 deletions(-) delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt delete mode 100644 src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt diff --git a/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp b/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp index 7c9597f25b3437..649c6f02195a27 100644 --- a/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp +++ b/src/app/codegen-data-model-provider/tests/TestCodegenModelViaMocks.cpp @@ -329,6 +329,7 @@ const MockNodeConfig gTestNodeConfig({ MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_ENERGY_MWH_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_TOD_ATTRIBUTE_TYPE), + MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_DATE_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_EPOCH_US_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_EPOCH_S_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NON_NULLABLE(ZCL_POSIX_MS_ATTRIBUTE_TYPE), @@ -401,6 +402,7 @@ const MockNodeConfig gTestNodeConfig({ MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_ENERGY_MWH_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_TOD_ATTRIBUTE_TYPE), + MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_DATE_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_EPOCH_US_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_EPOCH_S_ATTRIBUTE_TYPE), MOCK_ATTRIBUTE_CONFIG_NULLABLE(ZCL_POSIX_MS_ATTRIBUTE_TYPE), diff --git a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml index 8ef7ced67251a9..77fcb4df6b4fe1 100644 --- a/src/app/zap-templates/zcl/data-model/chip/chip-types.xml +++ b/src/app/zap-templates/zcl/data-model/chip/chip-types.xml @@ -64,7 +64,7 @@ limitations under the License. - + diff --git a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml index 974c295a50ac4c..f4cc7eae3a8d71 100644 --- a/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/energy-calendar-cluster.xml @@ -55,7 +55,7 @@ limitations under the License. - + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 8f6994ac1672dd..7205f61c237247 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -5444,15 +5444,8 @@ cluster EnergyCalendar = 154 { optional AuxiliaryLoadBitmap auxiliaryLoad = 3; } - struct DateStruct { - nullable int8u year = 0; - nullable int8u month = 1; - nullable int8u day = 2; - nullable int8u dayOfWeek = 3; - } - struct DayStruct { - optional DateStruct date = 0; + optional epoch_s date = 0; optional TransitionDayOfWeekBitmap daysOfWeek = 1; TransitionStruct transitions[] = 2; optional int32u calendarID = 3; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 1e4ef007396d3e..4cbe6c8e2daeb1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -8850,99 +8850,8 @@ public String toString() { return output.toString(); } } -public static class EnergyCalendarClusterDateStruct { - public @Nullable Integer year; - public @Nullable Integer month; - public @Nullable Integer day; - public @Nullable Integer dayOfWeek; - private static final long YEAR_ID = 0L; - private static final long MONTH_ID = 1L; - private static final long DAY_ID = 2L; - private static final long DAY_OF_WEEK_ID = 3L; - - public EnergyCalendarClusterDateStruct( - @Nullable Integer year, - @Nullable Integer month, - @Nullable Integer day, - @Nullable Integer dayOfWeek - ) { - this.year = year; - this.month = month; - this.day = day; - this.dayOfWeek = dayOfWeek; - } - - public StructType encodeTlv() { - ArrayList values = new ArrayList<>(); - values.add(new StructElement(YEAR_ID, year != null ? new UIntType(year) : new NullType())); - values.add(new StructElement(MONTH_ID, month != null ? new UIntType(month) : new NullType())); - values.add(new StructElement(DAY_ID, day != null ? new UIntType(day) : new NullType())); - values.add(new StructElement(DAY_OF_WEEK_ID, dayOfWeek != null ? new UIntType(dayOfWeek) : new NullType())); - - return new StructType(values); - } - - public static EnergyCalendarClusterDateStruct decodeTlv(BaseTLVType tlvValue) { - if (tlvValue == null || tlvValue.type() != TLVType.Struct) { - return null; - } - @Nullable Integer year = null; - @Nullable Integer month = null; - @Nullable Integer day = null; - @Nullable Integer dayOfWeek = null; - for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == YEAR_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - year = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == MONTH_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - month = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == DAY_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - day = castingValue.value(Integer.class); - } - } else if (element.contextTagNum() == DAY_OF_WEEK_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.UInt) { - UIntType castingValue = element.value(UIntType.class); - dayOfWeek = castingValue.value(Integer.class); - } - } - } - return new EnergyCalendarClusterDateStruct( - year, - month, - day, - dayOfWeek - ); - } - - @Override - public String toString() { - StringBuilder output = new StringBuilder(); - output.append("EnergyCalendarClusterDateStruct {\n"); - output.append("\tyear: "); - output.append(year); - output.append("\n"); - output.append("\tmonth: "); - output.append(month); - output.append("\n"); - output.append("\tday: "); - output.append(day); - output.append("\n"); - output.append("\tdayOfWeek: "); - output.append(dayOfWeek); - output.append("\n"); - output.append("}\n"); - return output.toString(); - } -} public static class EnergyCalendarClusterDayStruct { - public Optional date; + public Optional date; public Optional daysOfWeek; public ArrayList transitions; public Optional calendarID; @@ -8952,7 +8861,7 @@ public static class EnergyCalendarClusterDayStruct { private static final long CALENDAR_I_D_ID = 3L; public EnergyCalendarClusterDayStruct( - Optional date, + Optional date, Optional daysOfWeek, ArrayList transitions, Optional calendarID @@ -8965,7 +8874,7 @@ public EnergyCalendarClusterDayStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> nonOptionaldate.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(DATE_ID, date.map((nonOptionaldate) -> new UIntType(nonOptionaldate)).orElse(new EmptyType()))); values.add(new StructElement(DAYS_OF_WEEK_ID, daysOfWeek.map((nonOptionaldaysOfWeek) -> new UIntType(nonOptionaldaysOfWeek)).orElse(new EmptyType()))); values.add(new StructElement(TRANSITIONS_ID, ArrayType.generateArrayType(transitions, (elementtransitions) -> elementtransitions.encodeTlv()))); values.add(new StructElement(CALENDAR_I_D_ID, calendarID.map((nonOptionalcalendarID) -> new UIntType(nonOptionalcalendarID)).orElse(new EmptyType()))); @@ -8977,15 +8886,15 @@ public static EnergyCalendarClusterDayStruct decodeTlv(BaseTLVType tlvValue) { if (tlvValue == null || tlvValue.type() != TLVType.Struct) { return null; } - Optional date = Optional.empty(); + Optional date = Optional.empty(); Optional daysOfWeek = Optional.empty(); ArrayList transitions = null; Optional calendarID = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { if (element.contextTagNum() == DATE_ID) { - if (element.value(BaseTLVType.class).type() == TLVType.Struct) { - StructType castingValue = element.value(StructType.class); - date = Optional.of(ChipStructs.EnergyCalendarClusterDateStruct.decodeTlv(castingValue)); + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + date = Optional.of(castingValue.value(Long.class)); } } else if (element.contextTagNum() == DAYS_OF_WEEK_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index 1de6ae47665239..f63e3f8527068d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -72,7 +72,6 @@ structs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt", - "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt deleted file mode 100644 index 98ddfc3fd2482f..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDateStruct.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * Copyright (c) 2023 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. - */ -package chip.devicecontroller.cluster.structs - -import chip.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class EnergyCalendarClusterDateStruct( - val year: UInt?, - val month: UInt?, - val day: UInt?, - val dayOfWeek: UInt?, -) { - override fun toString(): String = buildString { - append("EnergyCalendarClusterDateStruct {\n") - append("\tyear : $year\n") - append("\tmonth : $month\n") - append("\tday : $day\n") - append("\tdayOfWeek : $dayOfWeek\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - if (year != null) { - put(ContextSpecificTag(TAG_YEAR), year) - } else { - putNull(ContextSpecificTag(TAG_YEAR)) - } - if (month != null) { - put(ContextSpecificTag(TAG_MONTH), month) - } else { - putNull(ContextSpecificTag(TAG_MONTH)) - } - if (day != null) { - put(ContextSpecificTag(TAG_DAY), day) - } else { - putNull(ContextSpecificTag(TAG_DAY)) - } - if (dayOfWeek != null) { - put(ContextSpecificTag(TAG_DAY_OF_WEEK), dayOfWeek) - } else { - putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } - endStructure() - } - } - - companion object { - private const val TAG_YEAR = 0 - private const val TAG_MONTH = 1 - private const val TAG_DAY = 2 - private const val TAG_DAY_OF_WEEK = 3 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDateStruct { - tlvReader.enterStructure(tlvTag) - val year = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_YEAR)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) - null - } - val month = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_MONTH)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) - null - } - val day = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_DAY)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY)) - null - } - val dayOfWeek = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - null - } - - tlvReader.exitContainer() - - return EnergyCalendarClusterDateStruct(year, month, day, dayOfWeek) - } - } -} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt index bf883bb287b1f8..0520e76669c8ea 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDayStruct( - val date: Optional, + val date: Optional, val daysOfWeek: Optional, val transitions: List, val calendarID: Optional, @@ -44,7 +44,7 @@ class EnergyCalendarClusterDayStruct( startStructure(tlvTag) if (date.isPresent) { val optdate = date.get() - optdate.toTlv(ContextSpecificTag(TAG_DATE), this) + put(ContextSpecificTag(TAG_DATE), optdate) } if (daysOfWeek.isPresent) { val optdaysOfWeek = daysOfWeek.get() @@ -73,9 +73,7 @@ class EnergyCalendarClusterDayStruct( tlvReader.enterStructure(tlvTag) val date = if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { - Optional.of( - EnergyCalendarClusterDateStruct.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader) - ) + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_DATE))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index d2c63beeb2b23e..503c7c1bb000c4 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -72,7 +72,6 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterCalendarPeriodStruct.kt", - "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterPeakPeriodStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterTransitionStruct.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt deleted file mode 100644 index 128428ee076f86..00000000000000 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDateStruct.kt +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * Copyright (c) 2023 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. - */ -package matter.controller.cluster.structs - -import matter.controller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class EnergyCalendarClusterDateStruct( - val year: UByte?, - val month: UByte?, - val day: UByte?, - val dayOfWeek: UByte?, -) { - override fun toString(): String = buildString { - append("EnergyCalendarClusterDateStruct {\n") - append("\tyear : $year\n") - append("\tmonth : $month\n") - append("\tday : $day\n") - append("\tdayOfWeek : $dayOfWeek\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - if (year != null) { - put(ContextSpecificTag(TAG_YEAR), year) - } else { - putNull(ContextSpecificTag(TAG_YEAR)) - } - if (month != null) { - put(ContextSpecificTag(TAG_MONTH), month) - } else { - putNull(ContextSpecificTag(TAG_MONTH)) - } - if (day != null) { - put(ContextSpecificTag(TAG_DAY), day) - } else { - putNull(ContextSpecificTag(TAG_DAY)) - } - if (dayOfWeek != null) { - put(ContextSpecificTag(TAG_DAY_OF_WEEK), dayOfWeek) - } else { - putNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } - endStructure() - } - } - - companion object { - private const val TAG_YEAR = 0 - private const val TAG_MONTH = 1 - private const val TAG_DAY = 2 - private const val TAG_DAY_OF_WEEK = 3 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyCalendarClusterDateStruct { - tlvReader.enterStructure(tlvTag) - val year = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_YEAR)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_YEAR)) - null - } - val month = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_MONTH)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_MONTH)) - null - } - val day = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_DAY)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY)) - null - } - val dayOfWeek = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_DAY_OF_WEEK)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_DAY_OF_WEEK)) - null - } - - tlvReader.exitContainer() - - return EnergyCalendarClusterDateStruct(year, month, day, dayOfWeek) - } - } -} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt index e5dd66bb585107..a45936a14060d9 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyCalendarClusterDayStruct.kt @@ -25,7 +25,7 @@ import matter.tlv.TlvReader import matter.tlv.TlvWriter class EnergyCalendarClusterDayStruct( - val date: Optional, + val date: Optional, val daysOfWeek: Optional, val transitions: List, val calendarID: Optional, @@ -44,7 +44,7 @@ class EnergyCalendarClusterDayStruct( startStructure(tlvTag) if (date.isPresent) { val optdate = date.get() - optdate.toTlv(ContextSpecificTag(TAG_DATE), this) + put(ContextSpecificTag(TAG_DATE), optdate) } if (daysOfWeek.isPresent) { val optdaysOfWeek = daysOfWeek.get() @@ -73,9 +73,7 @@ class EnergyCalendarClusterDayStruct( tlvReader.enterStructure(tlvTag) val date = if (tlvReader.isNextTag(ContextSpecificTag(TAG_DATE))) { - Optional.of( - EnergyCalendarClusterDateStruct.fromTlv(ContextSpecificTag(TAG_DATE), tlvReader) - ) + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_DATE))) } else { Optional.empty() } diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 762c4a7c5fc6d0..42c869869bdcb3 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -25568,93 +25568,13 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_3_dateInsideOptional; - jobject newElement_3_dateInsideOptional_year; - if (entry_3.date.Value().year.IsNull()) - { - newElement_3_dateInsideOptional_year = nullptr; - } - else - { - std::string newElement_3_dateInsideOptional_yearClassName = "java/lang/Integer"; - std::string newElement_3_dateInsideOptional_yearCtorSignature = "(I)V"; - jint jninewElement_3_dateInsideOptional_year = static_cast(entry_3.date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_dateInsideOptional_yearClassName.c_str(), - newElement_3_dateInsideOptional_yearCtorSignature.c_str(), - jninewElement_3_dateInsideOptional_year, newElement_3_dateInsideOptional_year); - } - jobject newElement_3_dateInsideOptional_month; - if (entry_3.date.Value().month.IsNull()) - { - newElement_3_dateInsideOptional_month = nullptr; - } - else - { - std::string newElement_3_dateInsideOptional_monthClassName = "java/lang/Integer"; - std::string newElement_3_dateInsideOptional_monthCtorSignature = "(I)V"; - jint jninewElement_3_dateInsideOptional_month = - static_cast(entry_3.date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_dateInsideOptional_monthClassName.c_str(), - newElement_3_dateInsideOptional_monthCtorSignature.c_str(), - jninewElement_3_dateInsideOptional_month, newElement_3_dateInsideOptional_month); - } - jobject newElement_3_dateInsideOptional_day; - if (entry_3.date.Value().day.IsNull()) - { - newElement_3_dateInsideOptional_day = nullptr; - } - else - { - std::string newElement_3_dateInsideOptional_dayClassName = "java/lang/Integer"; - std::string newElement_3_dateInsideOptional_dayCtorSignature = "(I)V"; - jint jninewElement_3_dateInsideOptional_day = static_cast(entry_3.date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_dateInsideOptional_dayClassName.c_str(), - newElement_3_dateInsideOptional_dayCtorSignature.c_str(), - jninewElement_3_dateInsideOptional_day, newElement_3_dateInsideOptional_day); - } - jobject newElement_3_dateInsideOptional_dayOfWeek; - if (entry_3.date.Value().dayOfWeek.IsNull()) - { - newElement_3_dateInsideOptional_dayOfWeek = nullptr; - } - else - { - std::string newElement_3_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; - std::string newElement_3_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; - jint jninewElement_3_dateInsideOptional_dayOfWeek = - static_cast(entry_3.date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_3_dateInsideOptional_dayOfWeekClassName.c_str(), - newElement_3_dateInsideOptional_dayOfWeekCtorSignature.c_str(), - jninewElement_3_dateInsideOptional_dayOfWeek, newElement_3_dateInsideOptional_dayOfWeek); - } - - jclass dateStructStructClass_6; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_6); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); - return nullptr; - } - - jmethodID dateStructStructCtor_6; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructStructClass_6, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", - &dateStructStructCtor_6); - if (err != CHIP_NO_ERROR || dateStructStructCtor_6 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); - return nullptr; - } - - newElement_3_dateInsideOptional = - env->NewObject(dateStructStructClass_6, dateStructStructCtor_6, - newElement_3_dateInsideOptional_year, newElement_3_dateInsideOptional_month, - newElement_3_dateInsideOptional_day, newElement_3_dateInsideOptional_dayOfWeek); + std::string newElement_3_dateInsideOptionalClassName = "java/lang/Long"; + std::string newElement_3_dateInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_3_dateInsideOptional = static_cast(entry_3.date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_3_dateInsideOptionalClassName.c_str(), + newElement_3_dateInsideOptionalCtorSignature.c_str(), jninewElement_3_dateInsideOptional, + newElement_3_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(newElement_3_dateInsideOptional, newElement_3_date); } jobject newElement_3_daysOfWeek; @@ -25874,92 +25794,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject newElement_1_dateInsideOptional; - jobject newElement_1_dateInsideOptional_year; - if (entry_1.date.Value().year.IsNull()) - { - newElement_1_dateInsideOptional_year = nullptr; - } - else - { - std::string newElement_1_dateInsideOptional_yearClassName = "java/lang/Integer"; - std::string newElement_1_dateInsideOptional_yearCtorSignature = "(I)V"; - jint jninewElement_1_dateInsideOptional_year = static_cast(entry_1.date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_dateInsideOptional_yearClassName.c_str(), - newElement_1_dateInsideOptional_yearCtorSignature.c_str(), jninewElement_1_dateInsideOptional_year, - newElement_1_dateInsideOptional_year); - } - jobject newElement_1_dateInsideOptional_month; - if (entry_1.date.Value().month.IsNull()) - { - newElement_1_dateInsideOptional_month = nullptr; - } - else - { - std::string newElement_1_dateInsideOptional_monthClassName = "java/lang/Integer"; - std::string newElement_1_dateInsideOptional_monthCtorSignature = "(I)V"; - jint jninewElement_1_dateInsideOptional_month = static_cast(entry_1.date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_dateInsideOptional_monthClassName.c_str(), - newElement_1_dateInsideOptional_monthCtorSignature.c_str(), - jninewElement_1_dateInsideOptional_month, newElement_1_dateInsideOptional_month); - } - jobject newElement_1_dateInsideOptional_day; - if (entry_1.date.Value().day.IsNull()) - { - newElement_1_dateInsideOptional_day = nullptr; - } - else - { - std::string newElement_1_dateInsideOptional_dayClassName = "java/lang/Integer"; - std::string newElement_1_dateInsideOptional_dayCtorSignature = "(I)V"; - jint jninewElement_1_dateInsideOptional_day = static_cast(entry_1.date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_dateInsideOptional_dayClassName.c_str(), - newElement_1_dateInsideOptional_dayCtorSignature.c_str(), jninewElement_1_dateInsideOptional_day, - newElement_1_dateInsideOptional_day); - } - jobject newElement_1_dateInsideOptional_dayOfWeek; - if (entry_1.date.Value().dayOfWeek.IsNull()) - { - newElement_1_dateInsideOptional_dayOfWeek = nullptr; - } - else - { - std::string newElement_1_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; - std::string newElement_1_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; - jint jninewElement_1_dateInsideOptional_dayOfWeek = - static_cast(entry_1.date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - newElement_1_dateInsideOptional_dayOfWeekClassName.c_str(), - newElement_1_dateInsideOptional_dayOfWeekCtorSignature.c_str(), - jninewElement_1_dateInsideOptional_dayOfWeek, newElement_1_dateInsideOptional_dayOfWeek); - } - - jclass dateStructStructClass_4; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_4); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); - return nullptr; - } - - jmethodID dateStructStructCtor_4; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructStructClass_4, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", - &dateStructStructCtor_4); - if (err != CHIP_NO_ERROR || dateStructStructCtor_4 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); - return nullptr; - } - - newElement_1_dateInsideOptional = - env->NewObject(dateStructStructClass_4, dateStructStructCtor_4, newElement_1_dateInsideOptional_year, - newElement_1_dateInsideOptional_month, newElement_1_dateInsideOptional_day, - newElement_1_dateInsideOptional_dayOfWeek); + std::string newElement_1_dateInsideOptionalClassName = "java/lang/Long"; + std::string newElement_1_dateInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_1_dateInsideOptional = static_cast(entry_1.date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_dateInsideOptionalClassName.c_str(), newElement_1_dateInsideOptionalCtorSignature.c_str(), + jninewElement_1_dateInsideOptional, newElement_1_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(newElement_1_dateInsideOptional, newElement_1_date); } jobject newElement_1_daysOfWeek; @@ -26147,87 +25987,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional; - jobject value_dateInsideOptional_year; - if (cppValue.Value().date.Value().year.IsNull()) - { - value_dateInsideOptional_year = nullptr; - } - else - { - std::string value_dateInsideOptional_yearClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_yearCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_year = static_cast(cppValue.Value().date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_yearClassName.c_str(), value_dateInsideOptional_yearCtorSignature.c_str(), - jnivalue_dateInsideOptional_year, value_dateInsideOptional_year); - } - jobject value_dateInsideOptional_month; - if (cppValue.Value().date.Value().month.IsNull()) - { - value_dateInsideOptional_month = nullptr; - } - else - { - std::string value_dateInsideOptional_monthClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_monthCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_month = static_cast(cppValue.Value().date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_monthClassName.c_str(), value_dateInsideOptional_monthCtorSignature.c_str(), - jnivalue_dateInsideOptional_month, value_dateInsideOptional_month); - } - jobject value_dateInsideOptional_day; - if (cppValue.Value().date.Value().day.IsNull()) - { - value_dateInsideOptional_day = nullptr; - } - else - { - std::string value_dateInsideOptional_dayClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_day = static_cast(cppValue.Value().date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayClassName.c_str(), value_dateInsideOptional_dayCtorSignature.c_str(), - jnivalue_dateInsideOptional_day, value_dateInsideOptional_day); - } - jobject value_dateInsideOptional_dayOfWeek; - if (cppValue.Value().date.Value().dayOfWeek.IsNull()) - { - value_dateInsideOptional_dayOfWeek = nullptr; - } - else - { - std::string value_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayOfWeek = - static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayOfWeekClassName.c_str(), - value_dateInsideOptional_dayOfWeekCtorSignature.c_str(), jnivalue_dateInsideOptional_dayOfWeek, - value_dateInsideOptional_dayOfWeek); - } - - jclass dateStructStructClass_3; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_3); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); - return nullptr; - } - - jmethodID dateStructStructCtor_3; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructStructClass_3, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", &dateStructStructCtor_3); - if (err != CHIP_NO_ERROR || dateStructStructCtor_3 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); - return nullptr; - } - - value_dateInsideOptional = env->NewObject(dateStructStructClass_3, dateStructStructCtor_3, - value_dateInsideOptional_year, value_dateInsideOptional_month, - value_dateInsideOptional_day, value_dateInsideOptional_dayOfWeek); + std::string value_dateInsideOptionalClassName = "java/lang/Long"; + std::string value_dateInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_dateInsideOptional = static_cast(cppValue.Value().date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptionalClassName.c_str(), value_dateInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional, value_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); } jobject value_daysOfWeek; @@ -26407,87 +26172,12 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR else { jobject value_dateInsideOptional; - jobject value_dateInsideOptional_year; - if (cppValue.Value().date.Value().year.IsNull()) - { - value_dateInsideOptional_year = nullptr; - } - else - { - std::string value_dateInsideOptional_yearClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_yearCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_year = static_cast(cppValue.Value().date.Value().year.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_yearClassName.c_str(), value_dateInsideOptional_yearCtorSignature.c_str(), - jnivalue_dateInsideOptional_year, value_dateInsideOptional_year); - } - jobject value_dateInsideOptional_month; - if (cppValue.Value().date.Value().month.IsNull()) - { - value_dateInsideOptional_month = nullptr; - } - else - { - std::string value_dateInsideOptional_monthClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_monthCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_month = static_cast(cppValue.Value().date.Value().month.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_monthClassName.c_str(), value_dateInsideOptional_monthCtorSignature.c_str(), - jnivalue_dateInsideOptional_month, value_dateInsideOptional_month); - } - jobject value_dateInsideOptional_day; - if (cppValue.Value().date.Value().day.IsNull()) - { - value_dateInsideOptional_day = nullptr; - } - else - { - std::string value_dateInsideOptional_dayClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_day = static_cast(cppValue.Value().date.Value().day.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayClassName.c_str(), value_dateInsideOptional_dayCtorSignature.c_str(), - jnivalue_dateInsideOptional_day, value_dateInsideOptional_day); - } - jobject value_dateInsideOptional_dayOfWeek; - if (cppValue.Value().date.Value().dayOfWeek.IsNull()) - { - value_dateInsideOptional_dayOfWeek = nullptr; - } - else - { - std::string value_dateInsideOptional_dayOfWeekClassName = "java/lang/Integer"; - std::string value_dateInsideOptional_dayOfWeekCtorSignature = "(I)V"; - jint jnivalue_dateInsideOptional_dayOfWeek = - static_cast(cppValue.Value().date.Value().dayOfWeek.Value()); - chip::JniReferences::GetInstance().CreateBoxedObject( - value_dateInsideOptional_dayOfWeekClassName.c_str(), - value_dateInsideOptional_dayOfWeekCtorSignature.c_str(), jnivalue_dateInsideOptional_dayOfWeek, - value_dateInsideOptional_dayOfWeek); - } - - jclass dateStructStructClass_3; - err = chip::JniReferences::GetInstance().GetLocalClassRef( - env, "chip/devicecontroller/ChipStructs$EnergyCalendarClusterDateStruct", dateStructStructClass_3); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Zcl, "Could not find class ChipStructs$EnergyCalendarClusterDateStruct"); - return nullptr; - } - - jmethodID dateStructStructCtor_3; - err = chip::JniReferences::GetInstance().FindMethod( - env, dateStructStructClass_3, "", - "(Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Integer;)V", &dateStructStructCtor_3); - if (err != CHIP_NO_ERROR || dateStructStructCtor_3 == nullptr) - { - ChipLogError(Zcl, "Could not find ChipStructs$EnergyCalendarClusterDateStruct constructor"); - return nullptr; - } - - value_dateInsideOptional = env->NewObject(dateStructStructClass_3, dateStructStructCtor_3, - value_dateInsideOptional_year, value_dateInsideOptional_month, - value_dateInsideOptional_day, value_dateInsideOptional_dayOfWeek); + std::string value_dateInsideOptionalClassName = "java/lang/Long"; + std::string value_dateInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_dateInsideOptional = static_cast(cppValue.Value().date.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_dateInsideOptionalClassName.c_str(), value_dateInsideOptionalCtorSignature.c_str(), + jnivalue_dateInsideOptional, value_dateInsideOptional); chip::JniReferences::GetInstance().CreateOptional(value_dateInsideOptional, value_date); } jobject value_daysOfWeek; diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index ab93361cee6424..d0ace456204ad9 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -27057,36 +27057,19 @@ def descriptor(cls) -> ClusterObjectDescriptor: friendlyCredit: 'typing.Optional[bool]' = None auxiliaryLoad: 'typing.Optional[uint]' = None - @dataclass - class DateStruct(ClusterObject): - @ChipUtility.classproperty - def descriptor(cls) -> ClusterObjectDescriptor: - return ClusterObjectDescriptor( - Fields=[ - ClusterObjectFieldDescriptor(Label="year", Tag=0, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="month", Tag=1, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="day", Tag=2, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="dayOfWeek", Tag=3, Type=typing.Union[Nullable, uint]), - ]) - - year: 'typing.Union[Nullable, uint]' = NullValue - month: 'typing.Union[Nullable, uint]' = NullValue - day: 'typing.Union[Nullable, uint]' = NullValue - dayOfWeek: 'typing.Union[Nullable, uint]' = NullValue - @dataclass class DayStruct(ClusterObject): @ChipUtility.classproperty def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="date", Tag=0, Type=typing.Optional[EnergyCalendar.Structs.DateStruct]), + ClusterObjectFieldDescriptor(Label="date", Tag=0, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="daysOfWeek", Tag=1, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="transitions", Tag=2, Type=typing.List[EnergyCalendar.Structs.TransitionStruct]), ClusterObjectFieldDescriptor(Label="calendarID", Tag=3, Type=typing.Optional[uint]), ]) - date: 'typing.Optional[EnergyCalendar.Structs.DateStruct]' = None + date: 'typing.Optional[uint]' = None daysOfWeek: 'typing.Optional[uint]' = None transitions: 'typing.List[EnergyCalendar.Structs.TransitionStruct]' = field(default_factory=lambda: []) calendarID: 'typing.Optional[uint]' = None diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 3281811ce05487..4df101d8800749 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -9795,27 +9795,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt MTREnergyCalendarClusterDayStruct * newElement_3; newElement_3 = [MTREnergyCalendarClusterDayStruct new]; if (entry_3.date.HasValue()) { - newElement_3.date = [MTREnergyCalendarClusterDateStruct new]; - if (entry_3.date.Value().year.IsNull()) { - newElement_3.date.year = nil; - } else { - newElement_3.date.year = [NSNumber numberWithUnsignedChar:entry_3.date.Value().year.Value()]; - } - if (entry_3.date.Value().month.IsNull()) { - newElement_3.date.month = nil; - } else { - newElement_3.date.month = [NSNumber numberWithUnsignedChar:entry_3.date.Value().month.Value()]; - } - if (entry_3.date.Value().day.IsNull()) { - newElement_3.date.day = nil; - } else { - newElement_3.date.day = [NSNumber numberWithUnsignedChar:entry_3.date.Value().day.Value()]; - } - if (entry_3.date.Value().dayOfWeek.IsNull()) { - newElement_3.date.dayOfWeek = nil; - } else { - newElement_3.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_3.date.Value().dayOfWeek.Value()]; - } + newElement_3.date = [NSNumber numberWithUnsignedInt:entry_3.date.Value()]; } else { newElement_3.date = nil; } @@ -9901,27 +9881,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt MTREnergyCalendarClusterDayStruct * newElement_1; newElement_1 = [MTREnergyCalendarClusterDayStruct new]; if (entry_1.date.HasValue()) { - newElement_1.date = [MTREnergyCalendarClusterDateStruct new]; - if (entry_1.date.Value().year.IsNull()) { - newElement_1.date.year = nil; - } else { - newElement_1.date.year = [NSNumber numberWithUnsignedChar:entry_1.date.Value().year.Value()]; - } - if (entry_1.date.Value().month.IsNull()) { - newElement_1.date.month = nil; - } else { - newElement_1.date.month = [NSNumber numberWithUnsignedChar:entry_1.date.Value().month.Value()]; - } - if (entry_1.date.Value().day.IsNull()) { - newElement_1.date.day = nil; - } else { - newElement_1.date.day = [NSNumber numberWithUnsignedChar:entry_1.date.Value().day.Value()]; - } - if (entry_1.date.Value().dayOfWeek.IsNull()) { - newElement_1.date.dayOfWeek = nil; - } else { - newElement_1.date.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_1.date.Value().dayOfWeek.Value()]; - } + newElement_1.date = [NSNumber numberWithUnsignedInt:entry_1.date.Value()]; } else { newElement_1.date = nil; } @@ -9992,27 +9952,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt } else { value = [MTREnergyCalendarClusterDayStruct new]; if (cppValue.Value().date.HasValue()) { - value.date = [MTREnergyCalendarClusterDateStruct new]; - if (cppValue.Value().date.Value().year.IsNull()) { - value.date.year = nil; - } else { - value.date.year = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().year.Value()]; - } - if (cppValue.Value().date.Value().month.IsNull()) { - value.date.month = nil; - } else { - value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; - } - if (cppValue.Value().date.Value().day.IsNull()) { - value.date.day = nil; - } else { - value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; - } - if (cppValue.Value().date.Value().dayOfWeek.IsNull()) { - value.date.dayOfWeek = nil; - } else { - value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; - } + value.date = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; } else { value.date = nil; } @@ -10074,27 +10014,7 @@ static id _Nullable DecodeAttributeValueForEnergyCalendarCluster(AttributeId aAt } else { value = [MTREnergyCalendarClusterDayStruct new]; if (cppValue.Value().date.HasValue()) { - value.date = [MTREnergyCalendarClusterDateStruct new]; - if (cppValue.Value().date.Value().year.IsNull()) { - value.date.year = nil; - } else { - value.date.year = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().year.Value()]; - } - if (cppValue.Value().date.Value().month.IsNull()) { - value.date.month = nil; - } else { - value.date.month = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().month.Value()]; - } - if (cppValue.Value().date.Value().day.IsNull()) { - value.date.day = nil; - } else { - value.date.day = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().day.Value()]; - } - if (cppValue.Value().date.Value().dayOfWeek.IsNull()) { - value.date.dayOfWeek = nil; - } else { - value.date.dayOfWeek = [NSNumber numberWithUnsignedChar:cppValue.Value().date.Value().dayOfWeek.Value()]; - } + value.date = [NSNumber numberWithUnsignedInt:cppValue.Value().date.Value()]; } else { value.date = nil; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index a1d0b14b43bc88..fa2c15f5c90129 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1521,17 +1521,9 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nullable auxiliaryLoad MTR_PROVISIONALLY_AVAILABLE; @end -MTR_PROVISIONALLY_AVAILABLE -@interface MTREnergyCalendarClusterDateStruct : NSObject -@property (nonatomic, copy) NSNumber * _Nullable year MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable month MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable day MTR_PROVISIONALLY_AVAILABLE; -@property (nonatomic, copy) NSNumber * _Nullable dayOfWeek MTR_PROVISIONALLY_AVAILABLE; -@end - MTR_PROVISIONALLY_AVAILABLE @interface MTREnergyCalendarClusterDayStruct : NSObject -@property (nonatomic, copy) MTREnergyCalendarClusterDateStruct * _Nullable date MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable date MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable daysOfWeek MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSArray * _Nonnull transitions MTR_PROVISIONALLY_AVAILABLE; @property (nonatomic, copy) NSNumber * _Nullable calendarID MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index f3b8756d73793a..1be105beadb759 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -6328,42 +6328,6 @@ - (NSString *)description @end -@implementation MTREnergyCalendarClusterDateStruct -- (instancetype)init -{ - if (self = [super init]) { - - _year = nil; - - _month = nil; - - _day = nil; - - _dayOfWeek = nil; - } - return self; -} - -- (id)copyWithZone:(NSZone * _Nullable)zone -{ - auto other = [[MTREnergyCalendarClusterDateStruct alloc] init]; - - other.year = self.year; - other.month = self.month; - other.day = self.day; - other.dayOfWeek = self.dayOfWeek; - - return other; -} - -- (NSString *)description -{ - NSString * descriptionString = [NSString stringWithFormat:@"<%@: year:%@; month:%@; day:%@; dayOfWeek:%@; >", NSStringFromClass([self class]), _year, _month, _day, _dayOfWeek]; - return descriptionString; -} - -@end - @implementation MTREnergyCalendarClusterDayStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h index 467313f91e555b..6f4c3bc90208e2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-type.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-type.h @@ -78,6 +78,7 @@ enum ZCL_VOLTAGE_MV_ATTRIBUTE_TYPE = 0xDB, // Voltage millivolts ZCL_ENERGY_MWH_ATTRIBUTE_TYPE = 0xDC, // Energy milliwatt-hours ZCL_TOD_ATTRIBUTE_TYPE = 0xE0, // Time of day + ZCL_DATE_ATTRIBUTE_TYPE = 0xE1, // Date ZCL_EPOCH_US_ATTRIBUTE_TYPE = 0xE3, // Epoch Microseconds ZCL_EPOCH_S_ATTRIBUTE_TYPE = 0xE4, // Epoch Seconds ZCL_POSIX_MS_ATTRIBUTE_TYPE = 0xE5, // Posix Time Milliseconds diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 75cb21a57e7946..79fb1e25acb9a8 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -24679,7 +24679,6 @@ struct Type using DecodableType = Type; } // namespace TransitionStruct -namespace DateStruct = Clusters::detail::Structs::DateStruct; namespace DayStruct { enum class Fields : uint8_t { @@ -24692,7 +24691,7 @@ enum class Fields : uint8_t struct Type { public: - Optional date; + Optional date; Optional> daysOfWeek; DataModel::List transitions; Optional calendarID; @@ -24705,7 +24704,7 @@ struct Type struct DecodableType { public: - Optional date; + Optional date; Optional> daysOfWeek; DataModel::DecodableList transitions; Optional calendarID;