Skip to content

Commit

Permalink
Make sure kotlin files are kept up to date (#30172)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Litvin <andreilitvin@google.com>
  • Loading branch information
2 people authored and pull[bot] committed Feb 28, 2024
1 parent 08630f3 commit 4344747
Show file tree
Hide file tree
Showing 8 changed files with 262 additions and 20 deletions.
5 changes: 5 additions & 0 deletions scripts/tools/zap_regen_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<MicrowaveOvenModeClusterModeOptionStruct>)

class GeneratedCommandListAttribute(val value: List<UInt>)

class AcceptedCommandListAttribute(val value: List<UInt>)

class EventListAttribute(val value: List<UInt>)

class AttributeListAttribute(val value: List<UInt>)

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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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<MicrowaveOvenModeClusterModeTagStruct>
) {
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<MicrowaveOvenModeClusterModeTagStruct> {
tlvReader.enterArray(ContextSpecificTag(TAG_MODE_TAGS))
while (!tlvReader.isEndOfContainer()) {
add(MicrowaveOvenModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader))
}
tlvReader.exitContainer()
}

tlvReader.exitContainer()

return MicrowaveOvenModeClusterModeOptionStruct(label, mode, modeTags)
}
}
}
Original file line number Diff line number Diff line change
@@ -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<UShort>, 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)
}
}
}

0 comments on commit 4344747

Please sign in to comment.