From 38fa9022af69e9c7dec0f04597addc81cb21b846 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 2 Nov 2023 12:04:48 -0400 Subject: [PATCH] Make sure kotlin files are kept up to date (#30172) Co-authored-by: Andrei Litvin --- scripts/tools/zap_regen_all.py | 5 + .../clusters/ApplicationLauncherCluster.kt | 11 -- .../clusters/GeneralDiagnosticsCluster.kt | 8 -- .../clusters/MicrowaveOvenModeCluster.kt | 112 ++++++++++++++++++ .../cluster/clusters/OnOffCluster.kt | 2 +- .../matter/devicecontroller/cluster/files.gni | 3 + ...icrowaveOvenModeClusterModeOptionStruct.kt | 76 ++++++++++++ .../MicrowaveOvenModeClusterModeTagStruct.kt | 65 ++++++++++ 8 files changed, 262 insertions(+), 20 deletions(-) create mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/MicrowaveOvenModeCluster.kt create mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeOptionStruct.kt create mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeTagStruct.kt diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index a274ea84597a15..6650740c4b734a 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -433,6 +433,11 @@ def getCodegenTemplates(): idl_path="src/controller/data_model/controller-clusters.matter", output_directory="src/controller/java/generated")) + targets.append(JinjaCodegenTarget( + generator="kotlin-class", + idl_path="src/controller/data_model/controller-clusters.matter", + output_directory="src/controller/java/generated")) + return targets diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ApplicationLauncherCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ApplicationLauncherCluster.kt index 7e07a8ed18e36e..ceec6c2afd73e7 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ApplicationLauncherCluster.kt +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ApplicationLauncherCluster.kt @@ -83,17 +83,6 @@ class ApplicationLauncherCluster(private val endpointId: UShort) { // Implementation needs to be added here } - suspend fun writeCurrentAppAttribute(value: ApplicationLauncherClusterApplicationEPStruct) { - // Implementation needs to be added here - } - - suspend fun writeCurrentAppAttribute( - value: ApplicationLauncherClusterApplicationEPStruct, - timedWriteTimeoutMs: Int - ) { - // Implementation needs to be added here - } - suspend fun subscribeCurrentAppAttribute( minInterval: Int, maxInterval: Int diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/GeneralDiagnosticsCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/GeneralDiagnosticsCluster.kt index 1a3b9d434bc57a..5d6b2222c717f7 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/GeneralDiagnosticsCluster.kt +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/GeneralDiagnosticsCluster.kt @@ -145,14 +145,6 @@ class GeneralDiagnosticsCluster(private val endpointId: UShort) { // Implementation needs to be added here } - suspend fun readAverageWearCountAttribute(): UInt { - // Implementation needs to be added here - } - - suspend fun subscribeAverageWearCountAttribute(minInterval: Int, maxInterval: Int): UInt { - // Implementation needs to be added here - } - suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { // Implementation needs to be added here } diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/MicrowaveOvenModeCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/MicrowaveOvenModeCluster.kt new file mode 100644 index 00000000000000..b09b0be629a172 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/MicrowaveOvenModeCluster.kt @@ -0,0 +1,112 @@ +/* + * + * 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.devicecontroller.cluster.clusters + +import matter.devicecontroller.cluster.structs.* + +class MicrowaveOvenModeCluster(private val endpointId: UShort) { + class SupportedModesAttribute(val value: List) + + class GeneratedCommandListAttribute(val value: List) + + class AcceptedCommandListAttribute(val value: List) + + class EventListAttribute(val value: List) + + class AttributeListAttribute(val value: List) + + suspend fun readSupportedModesAttribute(): SupportedModesAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeSupportedModesAttribute( + minInterval: Int, + maxInterval: Int + ): SupportedModesAttribute { + // Implementation needs to be added here + } + + suspend fun readCurrentModeAttribute(): UByte { + // Implementation needs to be added here + } + + suspend fun subscribeCurrentModeAttribute(minInterval: Int, maxInterval: Int): UByte { + // Implementation needs to be added here + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): GeneratedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): AcceptedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun readEventListAttribute(): EventListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeEventListAttribute(minInterval: Int, maxInterval: Int): EventListAttribute { + // Implementation needs to be added here + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int + ): AttributeListAttribute { + // Implementation needs to be added here + } + + suspend fun readFeatureMapAttribute(): UInt { + // Implementation needs to be added here + } + + suspend fun subscribeFeatureMapAttribute(minInterval: Int, maxInterval: Int): UInt { + // Implementation needs to be added here + } + + suspend fun readClusterRevisionAttribute(): UShort { + // Implementation needs to be added here + } + + suspend fun subscribeClusterRevisionAttribute(minInterval: Int, maxInterval: Int): UShort { + // Implementation needs to be added here + } + + companion object { + const val CLUSTER_ID: UInt = 94u + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/OnOffCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/OnOffCluster.kt index 912d623f0e8bbe..0a71a64888a866 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/OnOffCluster.kt +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/OnOffCluster.kt @@ -56,7 +56,7 @@ class OnOffCluster(private val endpointId: UShort) { suspend fun offWithEffect( effectIdentifier: UInt, - effectVariant: UByte, + effectVariant: UInt, timedInvokeTimeoutMs: Int? = null ) { if (timedInvokeTimeoutMs != null) { diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni index 0788d700b4f130..25bafdf86f1d13 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni @@ -41,6 +41,8 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/LaundryWasherModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MediaInputClusterInputInfoStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MediaPlaybackClusterPlaybackPositionStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeOptionStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ModeSelectClusterModeOptionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ModeSelectClusterSemanticTagStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt", @@ -192,6 +194,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/MediaInputCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/MediaPlaybackCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/MicrowaveOvenControlCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/MicrowaveOvenModeCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ModeSelectCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/NetworkCommissioningCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/NitrogenDioxideConcentrationMeasurementCluster.kt", diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeOptionStruct.kt new file mode 100644 index 00000000000000..481ae34118a03b --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeOptionStruct.kt @@ -0,0 +1,76 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import matter.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class MicrowaveOvenModeClusterModeOptionStruct( + val label: String, + val mode: UByte, + val modeTags: List +) { + override fun toString(): String = buildString { + append("MicrowaveOvenModeClusterModeOptionStruct {\n") + append("\tlabel : $label\n") + append("\tmode : $mode\n") + append("\tmodeTags : $modeTags\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_MODE), mode) + startArray(ContextSpecificTag(TAG_MODE_TAGS)) + for (item in modeTags.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_MODE = 1 + private const val TAG_MODE_TAGS = 2 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MicrowaveOvenModeClusterModeOptionStruct { + tlvReader.enterStructure(tlvTag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val mode = tlvReader.getUByte(ContextSpecificTag(TAG_MODE)) + val modeTags = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_MODE_TAGS)) + while (!tlvReader.isEndOfContainer()) { + add(MicrowaveOvenModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return MicrowaveOvenModeClusterModeOptionStruct(label, mode, modeTags) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeTagStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeTagStruct.kt new file mode 100644 index 00000000000000..d0d088a1d77b42 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeTagStruct.kt @@ -0,0 +1,65 @@ +/* + * + * 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.devicecontroller.cluster.structs + +import java.util.Optional +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class MicrowaveOvenModeClusterModeTagStruct(val mfgCode: Optional, val value: UInt) { + override fun toString(): String = buildString { + append("MicrowaveOvenModeClusterModeTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (mfgCode.isPresent) { + val optmfgCode = mfgCode.get() + put(ContextSpecificTag(TAG_MFG_CODE), optmfgCode) + } + put(ContextSpecificTag(TAG_VALUE), value) + endStructure() + } + } + + companion object { + private const val TAG_MFG_CODE = 0 + private const val TAG_VALUE = 1 + + fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MicrowaveOvenModeClusterModeTagStruct { + tlvReader.enterStructure(tlvTag) + val mfgCode = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_MFG_CODE))) + } else { + Optional.empty() + } + val value = tlvReader.getUInt(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return MicrowaveOvenModeClusterModeTagStruct(mfgCode, value) + } + } +}