-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure kotlin files are kept up to date (#30172)
Co-authored-by: Andrei Litvin <andreilitvin@google.com>
- Loading branch information
Showing
8 changed files
with
262 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
.../java/generated/java/matter/devicecontroller/cluster/clusters/MicrowaveOvenModeCluster.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
.../java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeOptionStruct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
...ted/java/matter/devicecontroller/cluster/structs/MicrowaveOvenModeClusterModeTagStruct.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |