diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 0e6033035f7297..32fbcef6f52a44 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -45,7 +45,12 @@ jobs: uses: ./.github/actions/checkout-submodules-and-bootstrap with: platform: linux - + # Java formatting requires a newer java to run ktfmt + # TODO: this should be eventually inside Docker files + - name: Update java + run: | + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -fy --fix-missing openjdk-17-jre - name: Generate all run: ./scripts/run_in_build_env.sh scripts/tools/zap_regen_all.py - name: Ensure git works in current working directory diff --git a/kotlin-detect-config.yaml b/kotlin-detect-config.yaml index f6d723a9b638ac..3af04f5b389369 100644 --- a/kotlin-detect-config.yaml +++ b/kotlin-detect-config.yaml @@ -38,6 +38,8 @@ style: - "**/src/controller/java/src/chip/tlv/values.kt" - "**/src/controller/java/src/chip/WildcardImport examples/android/CHIPTest/app/src/androidTest/java/com/tcl/chip/chiptest/ExampleInstrumentedTest.kt" + - "**/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterEventStructTest.kt" + - "**/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterStructTest.kt" - "**/src/controller/java/tests/chip/jsontlv/JsonToTlvToJsonTest.kt" - "**/src/controller/java/tests/chip/onboardingpayload/ManualCodeTest.kt" - "**/src/controller/java/tests/chip/onboardingpayload/QRCodeTest.kt" @@ -58,6 +60,7 @@ style: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt" - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/setuppayloadscanner/BarcodeFragment.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/Main.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/jsontlv/JsonToTlv.kt" - "**/src/controller/java/src/chip/jsontlv/TlvToJson.kt" - "**/src/controller/java/tests/chip/jsontlv/JsonToTlvToJsonTest.kt" @@ -123,6 +126,7 @@ style: - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/common/MatterCommand.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImSubscribeCommand.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/jsontlv/TlvToJson.kt" - "**/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt" - "**/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadParser.kt" @@ -133,12 +137,14 @@ style: UnusedParameter: excludes: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/bluetooth/BluetoothManager.kt" + - "**/src/controller/java/generated/java/**/*" ReturnCount: excludes: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt" - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt" - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/EnterNetworkFragment.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CommandManager.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/Verhoeff.kt" - "**/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt" UnusedPrivateProperty: @@ -162,6 +168,7 @@ style: ThrowsCount: excludes: - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CommandManager.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/tlv/TlvReader.kt" - "**/src/controller/java/src/chip/jsontlv/JsonToTlv.kt" - "**/src/controller/java/src/chip/jsontlv/TlvToJson.kt" @@ -174,13 +181,16 @@ style: UnusedPrivateMember: excludes: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/setuppayloadscanner/BarcodeFragment.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt" UseCheckOrError: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/tlv/tags.kt" - "**/src/controller/java/src/chip/tlv/types.kt" UseRequire: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/jsontlv/JsonToTlv.kt" - "**/src/controller/java/src/chip/onboardingpayload/Verhoeff10.kt" UtilityClassWithPublicConstructor: @@ -188,9 +198,11 @@ style: - "**/src/controller/java/src/chip/onboardingpayload/Verhoeff.kt" MayBeConst: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/Base38.kt" FunctionOnlyReturningConstant: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/QRCodeOnboardingPayloadGenerator.kt" exceptions: @@ -202,6 +214,7 @@ exceptions: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/setuppayloadscanner/BarcodeFragment.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/common/Argument.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/Main.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/tests/chip/onboardingpayload/ManualCodeTest.kt" - "**/src/controller/java/tests/chip/onboardingpayload/QRCodeTest.kt" SwallowedException: @@ -211,14 +224,17 @@ exceptions: TooGenericExceptionThrown: excludes: - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/discover/DiscoverCommissionablesCommand.kt" + - "**/src/controller/java/generated/java/**/*" ThrowingExceptionsWithoutMessageOrCause: excludes: - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CommandManager.kt" + - "**/src/controller/java/generated/java/**/*" naming: FunctionNaming: excludes: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/SelectActionFragment.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/tests/chip/tlv/TlvReadWriteTest.kt" - "**/src/controller/java/tests/chip/tlv/TlvWriterTest.kt" - "**/src/controller/java/tests/chip/tlv/TlvReaderTest.kt" @@ -229,21 +245,26 @@ naming: ConstructorParameterNaming: excludes: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/HistoryCommandAdapter.kt" + - "**/src/controller/java/generated/java/**/*" TopLevelPropertyNaming: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt" performance: SpreadOperator: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/tests/chip/tlv/TlvReaderTest.kt" potential-bugs: EqualsWithHashCodeExist: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt" ImplicitDefaultLocale: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt" - "**/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt" @@ -262,6 +283,7 @@ complexity: - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/common/Command.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CommandManager.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairingCommand.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/jsontlv/JsonToTlv.kt" - "**/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt" - "**/src/controller/java/src/chip/tlv/TlvReader.kt" @@ -273,15 +295,18 @@ complexity: NestedBlockDepth: excludes: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt" + - "**/src/controller/java/generated/java/**/*" LongParameterList: excludes: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/common/Command.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/OnboardingPayload.kt" LongMethod: excludes: - "**/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/provisioning/AddressCommissioningFragment.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/common/CommandManager.kt" + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/Base38.kt" - "**/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt" - "**/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadParser.kt" @@ -291,15 +316,18 @@ complexity: - "**/src/controller/java/tests/chip/tlv/TlvReaderTest.kt" LargeClass: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/tests/chip/tlv/TlvReadWriteTest.kt" - "**/src/controller/java/tests/chip/jsontlv/JsonToTlvToJsonTest.kt" CyclomaticComplexMethod: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/tlv/TlvReader.kt" - "**/src/controller/java/src/chip/tlv/types.kt" - "**/src/controller/java/src/chip/jsontlv/TlvToJson.kt" ComplexCondition: excludes: + - "**/src/controller/java/generated/java/**/*" - "**/src/controller/java/src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt" empty-blocks: @@ -324,3 +352,4 @@ empty-blocks: - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkShortCommand.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/PairOnNetworkVendorCommand.kt" - "**/examples/java-matter-controller/java/src/com/matter/controller/commands/pairing/UnpairCommand.kt" + - "**/src/controller/java/generated/java/**/*" diff --git a/scripts/build/builders/android.py b/scripts/build/builders/android.py index cd358798c218fc..7b12090b9f15f5 100644 --- a/scripts/build/builders/android.py +++ b/scripts/build/builders/android.py @@ -235,6 +235,8 @@ def copyToSrcAndroid(self): "OnboardingPayload.jar": "src/controller/java/OnboardingPayload.jar", "AndroidPlatform.jar": "src/platform/android/AndroidPlatform.jar", "libCHIPTlv.jar": "src/controller/java/libCHIPTlv.jar", + "CHIPClusters.jar": "src/controller/java/CHIPClusters.jar", + "CHIPClusterID.jar": "src/controller/java/CHIPClusterID.jar", } for jarName in jars.keys(): @@ -573,6 +575,16 @@ def build_outputs(self): "lib", "src/controller/java/OnboardingPayload.jar", ), + "CHIPClusters.jar": os.path.join( + self.output_dir, + "lib", + "src/controller/java/CHIPClusters.jar", + ), + "CHIPClusterID.jar": os.path.join( + self.output_dir, + "lib", + "src/controller/java/CHIPClusterID.jar", + ), "jni/%s/libCHIPController.so" % self.board.AbiName(): os.path.join( self.output_dir, diff --git a/scripts/build/testdata/dry_run_android-arm64-chip-tool.txt b/scripts/build/testdata/dry_run_android-arm64-chip-tool.txt index b62ee9eb522803..766a82be3bb318 100644 --- a/scripts/build/testdata/dry_run_android-arm64-chip-tool.txt +++ b/scripts/build/testdata/dry_run_android-arm64-chip-tool.txt @@ -31,5 +31,9 @@ cp {out}/android-arm64-chip-tool/lib/src/platform/android/AndroidPlatform.jar {r cp {out}/android-arm64-chip-tool/lib/src/controller/java/libCHIPTlv.jar {root}/examples/android/CHIPTool/app/libs/libCHIPTlv.jar +cp {out}/android-arm64-chip-tool/lib/src/controller/java/CHIPClusters.jar {root}/examples/android/CHIPTool/app/libs/CHIPClusters.jar + +cp {out}/android-arm64-chip-tool/lib/src/controller/java/CHIPClusterID.jar {root}/examples/android/CHIPTool/app/libs/CHIPClusterID.jar + # Building APP android-arm64-chip-tool {root}/examples/android/CHIPTool/gradlew -p {root}/examples/android/CHIPTool -PmatterBuildSrcDir={out}/android-arm64-chip-tool -PmatterSdkSourceBuild=false -PbuildDir={out}/android-arm64-chip-tool assembleDebug diff --git a/scripts/py_matter_idl/files.gni b/scripts/py_matter_idl/files.gni index 1f7a7b0271196d..bfcfd27aec6fcd 100644 --- a/scripts/py_matter_idl/files.gni +++ b/scripts/py_matter_idl/files.gni @@ -10,8 +10,10 @@ matter_idl_generator_templates = [ "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/CHIPCallbackTypes.jinja", "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersCpp.jinja", "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/ChipClustersRead.jinja", + "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/ChipEventStructs.jinja", "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/CHIPGlobalCallbacks_cpp.jinja", "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/CHIPReadCallbacks_h.jinja", + "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/ChipStructs.jinja", "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/ClusterIDMapping.jinja", "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/ClusterReadMapping.jinja", "${chip_root}/scripts/py_matter_idl/matter_idl/generators/java/ClusterWriteMapping.jinja", diff --git a/scripts/py_matter_idl/matter_idl/generators/java/ChipEventStructs.jinja b/scripts/py_matter_idl/matter_idl/generators/java/ChipEventStructs.jinja new file mode 100644 index 00000000000000..4ce1f2f19d5861 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/generators/java/ChipEventStructs.jinja @@ -0,0 +1,153 @@ +{%- macro encode_value(source, encodable, depth) -%} + {%- if encodable.is_nullable -%} + {{encode_value(source, encodable.without_nullable(), depth + 1)}}? + {%- elif encodable.is_optional -%} + Optional<{{encode_value(source, encodable.without_optional(), depth + 1)}}> + {%- elif encodable.is_list -%} + List<{{encode_value(source, encodable.without_list(), depth + 1)}}> + {%- elif encodable.is_struct -%} + {%- set struct = encodable.get_underlying_struct() -%} + chip.devicecontroller.cluster.structs.{{source.name}}Cluster{{struct.name}} + {%- else -%} + {{encodable.kotlin_type}} + {%- endif -%} +{%- endmacro -%} + +{%- macro encode_tlv(encodable, tag, name, depth) %} + {%- if encodable.is_nullable -%} + if ({{name}} != null) { + {{encode_tlv(encodable.without_nullable(), tag, name, depth + 1)}} + } else { + putNull({{tag}}) + } + {%- elif encodable.is_optional -%} + if ({{name}}.isPresent) { + val opt{{name}} = {{name}}.get() + {{encode_tlv(encodable.without_optional(), tag, "opt" + name, depth + 1)}} + } + {%- elif encodable.is_list -%} + startList({{tag}}) + for (item in {{name}}.iterator()) { + {{encode_tlv(encodable.without_list(), "AnonymousTag", "item", depth + 1)}} + } + endList() + {%- elif encodable.is_struct -%} + {{name}}.toTlv({{tag}}, this) + {%- else -%} + put({{tag}}, {{name}}) + {%- endif -%} +{%- endmacro -%} + +{%- macro decode_tlv(source, encodable, tag, depth) %} + {%- if encodable.is_nullable -%} + if (!tlvReader.isNull()) { + {{decode_tlv(source, encodable.without_nullable(), tag, depth + 1)}} + } else { + tlvReader.getNull({{tag}}) + null + } + {%- elif encodable.is_optional -%} + if (tlvReader.isNextTag({{tag}})) { + Optional.of({{decode_tlv(source, encodable.without_optional(), tag, depth + 1)}}) + } else { + Optional.empty() + } + {%- elif encodable.is_list -%} + {%- set encodablewithoutlist = encodable.without_list() -%} + buildList <{{encode_value(source, encodablewithoutlist, depth + 1)}}> { + tlvReader.enterList({{tag}}) + while(!tlvReader.isEndOfContainer()) { + this.add({{decode_tlv(source, encodablewithoutlist, "AnonymousTag", depth + 1)}}) + } + tlvReader.exitContainer() + } + {%- elif encodable.is_struct -%} + {%- set struct = encodable.get_underlying_struct() -%} + chip.devicecontroller.cluster.structs.{{source.name}}Cluster{{struct.name}}.fromTlv({{tag}}, tlvReader) + {%- else -%} + tlvReader.get{{encodable.kotlin_type}}({{tag}}) + {%- endif -%} +{%- endmacro -%} + +{%- macro contextSpecificTag(field) -%} + ContextSpecificTag(TAG_{{field.name | constcase}}) +{%- endmacro -%} + +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvParsingException +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +import java.util.Optional + +class {{cluster.name}}Cluster{{event.name}}Event ( + {%- for field in event.fields -%} + {%- set encodable = field | asEncodable(typeLookup) %} + val {{field.name}}: {{encode_value(cluster, encodable, 0)}} + {%- if loop.index0 < loop.length - 1 -%}{{","}}{%- endif -%} + {%- endfor -%}) { + override fun toString(): String = buildString { + append("{{cluster.name}}Cluster{{event.name}}Event {\n") + {%- for field in event.fields %} + append("\t{{field.name}} : ${{field.name}}\n") + {%- endfor %} + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + {% for field in event.fields %} + {%- set encodable = field | asEncodable(typeLookup) %} + {%- set tag = contextSpecificTag(field) -%} + {{encode_tlv(encodable, tag, field.name, 0)}} + {% endfor -%} + endStructure() + } + } + + companion object { + {%- for field in event.fields %} + private const val TAG_{{field.name | constcase}} = {{field.code}} + {%- endfor %} + + fun fromTlv(tag: Tag, tlvReader: TlvReader) : {{cluster.name}}Cluster{{event.name}}Event { + tlvReader.enterStructure(tag) + {% for field in event.fields %} + {%- set decodable = field | asEncodable(typeLookup) %} + {%- set tag = contextSpecificTag(field) -%} + val {{field.name}} = {{decode_tlv(cluster, decodable, tag, 0)}} + {% endfor %} + tlvReader.exitContainer() + + return {{cluster.name}}Cluster{{event.name}}Event( + {%- for field in event.fields -%} + {%- set encodable = field | asEncodable(typeLookup) -%} + {{field.name}} + {%- if loop.index0 < loop.length - 1 -%}{{", "}}{%- endif -%} + {%- endfor -%} + ) + } + } +} diff --git a/scripts/py_matter_idl/matter_idl/generators/java/ChipStructs.jinja b/scripts/py_matter_idl/matter_idl/generators/java/ChipStructs.jinja new file mode 100644 index 00000000000000..7463e6f26c7a2c --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/generators/java/ChipStructs.jinja @@ -0,0 +1,153 @@ +{%- macro encode_value(source, encodable, depth) -%} + {%- if encodable.is_nullable -%} + {{encode_value(source, encodable.without_nullable(), depth + 1)}}? + {%- elif encodable.is_optional -%} + Optional<{{encode_value(source, encodable.without_optional(), depth + 1)}}> + {%- elif encodable.is_list -%} + List<{{encode_value(source, encodable.without_list(), depth + 1)}}> + {%- elif encodable.is_struct -%} + {%- set struct = encodable.get_underlying_struct() -%} + {{source.name}}Cluster{{struct.name}} + {%- else -%} + {{encodable.kotlin_type}} + {%- endif -%} +{%- endmacro -%} + +{%- macro encode_tlv(encodable, tag, name, depth) %} + {%- if encodable.is_nullable -%} + if ({{name}} != null) { + {{encode_tlv(encodable.without_nullable(), tag, name, depth + 1)}} + } else { + putNull({{tag}}) + } + {%- elif encodable.is_optional -%} + if ({{name}}.isPresent) { + val opt{{name}} = {{name}}.get() + {{encode_tlv(encodable.without_optional(), tag, "opt" + name, depth + 1)}} + } + {%- elif encodable.is_list -%} + startList({{tag}}) + for (item in {{name}}.iterator()) { + {{encode_tlv(encodable.without_list(), "AnonymousTag", "item", depth + 1)}} + } + endList() + {%- elif encodable.is_struct -%} + {{name}}.toTlv({{tag}}, this) + {%- else -%} + put({{tag}}, {{name}}) + {%- endif -%} +{%- endmacro -%} + +{%- macro decode_tlv(source, encodable, tag, depth) %} + {%- if encodable.is_nullable -%} + if (!tlvReader.isNull()) { + {{decode_tlv(source, encodable.without_nullable(), tag, depth + 1)}} + } else { + tlvReader.getNull({{tag}}) + null + } + {%- elif encodable.is_optional -%} + if (tlvReader.isNextTag({{tag}})) { + Optional.of({{decode_tlv(source, encodable.without_optional(), tag, depth + 1)}}) + } else { + Optional.empty() + } + {%- elif encodable.is_list -%} + {%- set encodablewithoutlist = encodable.without_list() -%} + buildList<{{encode_value(source, encodablewithoutlist, depth + 1)}}> { + tlvReader.enterList({{tag}}) + while(!tlvReader.isEndOfContainer()) { + add({{decode_tlv(source, encodablewithoutlist, "AnonymousTag", depth + 1)}}) + } + tlvReader.exitContainer() + } + {%- elif encodable.is_struct -%} + {%- set struct = encodable.get_underlying_struct() -%} + {{source.name}}Cluster{{struct.name}}.fromTlv({{tag}}, tlvReader) + {%- else -%} + tlvReader.get{{encodable.kotlin_type}}({{tag}}) + {%- endif -%} +{%- endmacro -%} + +{%- macro contextSpecificTag(field) -%} + ContextSpecificTag(TAG_{{field.name | constcase}}) +{%- endmacro -%} + +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvParsingException +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +import java.util.Optional + +class {{cluster.name}}Cluster{{struct.name}} ( + {%- for field in struct.fields %} + {%- set encodable = field | asEncodable(typeLookup) %} + val {{field.name}}: {{encode_value(cluster, encodable, 0)}} + {%- if loop.index0 < loop.length - 1 -%}{{","}}{%- endif -%} + {%- endfor -%}) { + override fun toString(): String = buildString { + append("{{cluster.name}}Cluster{{struct.name}} {\n") + {%- for field in struct.fields %} + append("\t{{field.name}} : ${{field.name}}\n") + {%- endfor %} + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + {% for field in struct.fields %} + {%- set encodable = field | asEncodable(typeLookup) %} + {%- set tag = contextSpecificTag(field) -%} + {{encode_tlv(encodable, tag, field.name, 0)}} + {% endfor -%} + endStructure() + } + } + + companion object { + {%- for field in struct.fields %} + private const val TAG_{{field.name | constcase}} = {{field.code}} + {%- endfor %} + + fun fromTlv(tag: Tag, tlvReader: TlvReader) : {{cluster.name}}Cluster{{struct.name}} { + tlvReader.enterStructure(tag) + {% for field in struct.fields %} + {%- set decodable = field | asEncodable(typeLookup) %} + {%- set tag = contextSpecificTag(field) -%} + val {{field.name}} = {{decode_tlv(cluster, decodable, tag, 0)}} + {% endfor %} + tlvReader.exitContainer() + + return {{cluster.name}}Cluster{{struct.name}}( + {%- for field in struct.fields -%} + {%- set encodable = field | asEncodable(typeLookup) -%} + {{field.name}} + {%- if loop.index0 < loop.length - 1 -%}{{", "}}{%- endif -%} + {%- endfor -%} + ) + } + } +} diff --git a/scripts/py_matter_idl/matter_idl/generators/java/__init__.py b/scripts/py_matter_idl/matter_idl/generators/java/__init__.py index 84b9badd7a1e27..5abc912ebabd34 100644 --- a/scripts/py_matter_idl/matter_idl/generators/java/__init__.py +++ b/scripts/py_matter_idl/matter_idl/generators/java/__init__.py @@ -478,6 +478,43 @@ def boxed_java_type(self): else: return "Object" + @property + def kotlin_type(self): + t = ParseDataType(self.data_type, self.context) + + if isinstance(t, FundamentalType): + if t == FundamentalType.BOOL: + return "Boolean" + elif t == FundamentalType.FLOAT: + return "Float" + elif t == FundamentalType.DOUBLE: + return "Double" + else: + raise Exception("Unknown fundamental type") + elif isinstance(t, BasicInteger): + # the >= 3 will include int24_t to be considered "long" + if t.byte_count >= 3: + return "Long" + else: + return "Int" + elif isinstance(t, BasicString): + if t.is_binary: + return "ByteArray" + else: + return "String" + elif isinstance(t, IdlEnumType): + if t.base_type.byte_count >= 3: + return "Long" + else: + return "Int" + elif isinstance(t, IdlBitmapType): + if t.base_type.byte_count >= 3: + return "Long" + else: + return "Int" + else: + return "Any" + @property def unboxed_java_signature(self): if self.is_optional or self.is_list: @@ -752,3 +789,43 @@ def internal_render_all(self): 'clientClusters': clientClusters, } ) + + # Every cluster has its own impl, to avoid + # very large compilations (running out of RAM) + for cluster in self.idl.clusters: + if cluster.side != ClusterSide.CLIENT: + continue + + for struct in cluster.structs: + if struct.tag: + continue + + output_name = "java/chip/devicecontroller/cluster/structs/{cluster_name}Cluster{struct_name}.kt" + self.internal_render_one_output( + template_path="ChipStructs.jinja", + output_file_name=output_name.format( + cluster_name=cluster.name, + struct_name=struct.name), + vars={ + 'cluster': cluster, + 'struct': struct, + 'typeLookup': TypeLookupContext(self.idl, cluster), + } + ) + + for event in cluster.events: + if not event.fields: + continue + + output_name = "java/chip/devicecontroller/cluster/eventstructs/{cluster_name}Cluster{event_name}Event.kt" + self.internal_render_one_output( + template_path="ChipEventStructs.jinja", + output_file_name=output_name.format( + cluster_name=cluster.name, + event_name=event.name), + vars={ + 'cluster': cluster, + 'event': event, + 'typeLookup': TypeLookupContext(self.idl, cluster), + } + ) diff --git a/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml b/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml index 3a50ebc076dcb8..de117835790d10 100644 --- a/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml +++ b/scripts/py_matter_idl/matter_idl/tests/available_tests.yaml @@ -52,6 +52,7 @@ java-jni: java-class: inputs/several_clusters.matter: + java/chip/devicecontroller/cluster/structs/SecondClusterFabricDescriptorStruct.kt: outputs/several_clusters/java/SecondClusterFabricDescriptorStruct.kt java/chip/devicecontroller/ClusterWriteMapping.java: outputs/several_clusters/java/ClusterWriteMapping.java java/chip/devicecontroller/ClusterReadMapping.java: outputs/several_clusters/java/ClusterReadMapping.java java/chip/devicecontroller/ClusterIDMapping.java: outputs/several_clusters/java/ClusterIDMapping.java diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/SecondClusterFabricDescriptorStruct.kt b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/SecondClusterFabricDescriptorStruct.kt new file mode 100644 index 00000000000000..e86ce5788fd642 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/SecondClusterFabricDescriptorStruct.kt @@ -0,0 +1,82 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvParsingException +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +import java.util.Optional + +class SecondClusterFabricDescriptorStruct ( + val rootPublicKey: ByteArray, + val vendorID: Int, + val fabricID: Long, + val nodeID: Long, + val label: String, + val fabricIndex: Int) { + override fun toString(): String = buildString { + append("SecondClusterFabricDescriptorStruct {\n") + append("\trootPublicKey : $rootPublicKey\n") + append("\tvendorID : $vendorID\n") + append("\tfabricID : $fabricID\n") + append("\tnodeID : $nodeID\n") + append("\tlabel : $label\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY), rootPublicKey) + put(ContextSpecificTag(TAG_VENDOR_I_D), vendorID) + put(ContextSpecificTag(TAG_FABRIC_I_D), fabricID) + put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_ROOT_PUBLIC_KEY = 1 + private const val TAG_VENDOR_I_D = 2 + private const val TAG_FABRIC_I_D = 3 + private const val TAG_NODE_I_D = 4 + private const val TAG_LABEL = 5 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader) : SecondClusterFabricDescriptorStruct { + tlvReader.enterStructure(tag) + val rootPublicKey = tlvReader.getByteArray(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY)) + val vendorID = tlvReader.getInt(ContextSpecificTag(TAG_VENDOR_I_D)) + val fabricID = tlvReader.getLong(ContextSpecificTag(TAG_FABRIC_I_D)) + val nodeID = tlvReader.getLong(ContextSpecificTag(TAG_NODE_I_D)) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return SecondClusterFabricDescriptorStruct(rootPublicKey, vendorID, fabricID, nodeID, label, fabricIndex) + } + } +} diff --git a/scripts/tools/zap_regen_all.py b/scripts/tools/zap_regen_all.py index 2dca8db565480b..03a1ee12b20753 100755 --- a/scripts/tools/zap_regen_all.py +++ b/scripts/tools/zap_regen_all.py @@ -19,11 +19,14 @@ import logging import multiprocessing import os +import os.path import shutil import subprocess import sys import tempfile import time +import traceback +import urllib.request from dataclasses import dataclass from enum import Flag, auto from pathlib import Path @@ -270,11 +273,43 @@ def __init__(self, generator: str, output_directory: str, idl_path: str): self.command = ["./scripts/codegen.py", "--output-dir", output_directory, "--generator", generator, idl_path] + def formatKotlinFiles(self, paths): + try: + logging.info("Prettifying %d kotlin files:", len(paths)) + for name in paths: + logging.info(" %s" % name) + + VERSION = "0.44" + JAR_NAME = f"ktfmt-{VERSION}-jar-with-dependencies.jar" + jar_url = f"https://repo1.maven.org/maven2/com/facebook/ktfmt/{VERSION}/{JAR_NAME}" + + with tempfile.TemporaryDirectory(prefix='ktfmt') as tmpdir: + path, http_message = urllib.request.urlretrieve(jar_url, Path(tmpdir).joinpath(JAR_NAME).as_posix()) + subprocess.check_call(['java', '-jar', path, '--google-style'] + paths) + except Exception: + traceback.print_exc() + + def codeFormat(self): + outputs = subprocess.check_output(["./scripts/codegen.py", "--name-only", "--generator", + self.generator, "--log-level", "fatal", self.idl_path]).decode("utf8").split("\n") + outputs = [os.path.join(self.output_directory, name) for name in outputs if name] + + # Split output files by extension, + name_dict = {} + for name in outputs: + _, extension = os.path.splitext(name) + name_dict[extension] = name_dict.get(extension, []) + [name] + + if '.kt' in name_dict: + self.formatKotlinFiles(name_dict['.kt']) + def generate(self) -> TargetRunStats: generate_start = time.time() subprocess.check_call(self.command) + self.codeFormat() + generate_end = time.time() return TargetRunStats( diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index ee227cf1cf4c06..e967b0bd007936 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -300,8 +300,43 @@ kotlin_library("onboardingpayload_qr_code_test") { kotlinc_flags = [ "-Xlint:deprecation" ] } +kotlin_library("chipcluster") { + import( + "${chip_root}/src/controller/java/src/chip/devicecontroller/cluster/files.gni") + + output_name = "CHIPClusters.jar" + + deps = [ ":tlv" ] + + sources = [ "src/chip/devicecontroller/cluster/TlvReaderExtension.kt" ] + + sources += structs_sources + sources += eventstructs_sources + + kotlinc_flags = [ "-Xlint:deprecation" ] +} + +kotlin_library("chipcluster_test") { + output_name = "CHIPClustersTest.jar" + + deps = [ + ":chipcluster", + ":tlv", + "${chip_root}/third_party/java_deps:junit-4", + "${chip_root}/third_party/java_deps:truth", + ] + + sources = [ + "tests/chip/devicecontroller/cluster/ChipClusterEventStructTest.kt", + "tests/chip/devicecontroller/cluster/ChipClusterStructTest.kt", + ] + + kotlinc_flags = [ "-Xlint:deprecation" ] +} + group("unit_tests") { deps = [ + ":chipcluster_test", ":json_to_tlv_to_json_test", ":onboardingpayload_manual_code_test", ":onboardingpayload_qr_code_test", @@ -311,10 +346,26 @@ group("unit_tests") { ] } +android_library("chipclusterID") { + output_name = "CHIPClusterID.jar" + + sources = [ + "generated/java/chip/devicecontroller/ClusterIDMapping.java", + "src/chip/devicecontroller/ChipIdLookup.java", + ] + + javac_flags = [ + "-Xlint:deprecation", + "-parameters", # Store infomation about method parameters + ] +} + android_library("java") { output_name = "CHIPController.jar" deps = [ + ":chipcluster", + ":chipclusterID", ":tlv", "${chip_root}/third_party/java_deps:annotation", ] @@ -322,7 +373,6 @@ android_library("java") { data_deps = [ ":jni" ] sources = [ - "generated/java/chip/devicecontroller/ClusterIDMapping.java", "src/chip/devicecontroller/AttestationInfo.java", "src/chip/devicecontroller/AttestationTrustStoreDelegate.java", "src/chip/devicecontroller/CSRInfo.java", @@ -330,7 +380,6 @@ android_library("java") { "src/chip/devicecontroller/ChipCommandType.java", "src/chip/devicecontroller/ChipDeviceController.java", "src/chip/devicecontroller/ChipDeviceControllerException.java", - "src/chip/devicecontroller/ChipIdLookup.java", "src/chip/devicecontroller/ControllerParams.java", "src/chip/devicecontroller/DeviceAttestationDelegate.java", "src/chip/devicecontroller/DiscoveredDevice.java", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt new file mode 100644 index 00000000000000..e926e70d861c20 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt @@ -0,0 +1,115 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class AccessControlClusterAccessControlEntryChangedEvent( + val adminNodeID: Long?, + val adminPasscodeID: Int?, + val changeType: Int, + val latestValue: + chip.devicecontroller.cluster.structs.AccessControlClusterAccessControlEntryStruct?, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("AccessControlClusterAccessControlEntryChangedEvent {\n") + append("\tadminNodeID : $adminNodeID\n") + append("\tadminPasscodeID : $adminPasscodeID\n") + append("\tchangeType : $changeType\n") + append("\tlatestValue : $latestValue\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + if (adminNodeID != null) { + put(ContextSpecificTag(TAG_ADMIN_NODE_I_D), adminNodeID) + } else { + putNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + } + if (adminPasscodeID != null) { + put(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D), adminPasscodeID) + } else { + putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + } + put(ContextSpecificTag(TAG_CHANGE_TYPE), changeType) + if (latestValue != null) { + latestValue.toTlv(ContextSpecificTag(TAG_LATEST_VALUE), this) + } else { + putNull(ContextSpecificTag(TAG_LATEST_VALUE)) + } + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_ADMIN_NODE_I_D = 1 + private const val TAG_ADMIN_PASSCODE_I_D = 2 + private const val TAG_CHANGE_TYPE = 3 + private const val TAG_LATEST_VALUE = 4 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): AccessControlClusterAccessControlEntryChangedEvent { + tlvReader.enterStructure(tag) + val adminNodeID = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + null + } + val adminPasscodeID = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + null + } + val changeType = tlvReader.getInt(ContextSpecificTag(TAG_CHANGE_TYPE)) + val latestValue = + if (!tlvReader.isNull()) { + chip.devicecontroller.cluster.structs.AccessControlClusterAccessControlEntryStruct + .fromTlv(ContextSpecificTag(TAG_LATEST_VALUE), tlvReader) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_LATEST_VALUE)) + null + } + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return AccessControlClusterAccessControlEntryChangedEvent( + adminNodeID, + adminPasscodeID, + changeType, + latestValue, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt new file mode 100644 index 00000000000000..e01b81cec705bb --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt @@ -0,0 +1,115 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class AccessControlClusterAccessControlExtensionChangedEvent( + val adminNodeID: Long?, + val adminPasscodeID: Int?, + val changeType: Int, + val latestValue: + chip.devicecontroller.cluster.structs.AccessControlClusterAccessControlExtensionStruct?, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("AccessControlClusterAccessControlExtensionChangedEvent {\n") + append("\tadminNodeID : $adminNodeID\n") + append("\tadminPasscodeID : $adminPasscodeID\n") + append("\tchangeType : $changeType\n") + append("\tlatestValue : $latestValue\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + if (adminNodeID != null) { + put(ContextSpecificTag(TAG_ADMIN_NODE_I_D), adminNodeID) + } else { + putNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + } + if (adminPasscodeID != null) { + put(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D), adminPasscodeID) + } else { + putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + } + put(ContextSpecificTag(TAG_CHANGE_TYPE), changeType) + if (latestValue != null) { + latestValue.toTlv(ContextSpecificTag(TAG_LATEST_VALUE), this) + } else { + putNull(ContextSpecificTag(TAG_LATEST_VALUE)) + } + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_ADMIN_NODE_I_D = 1 + private const val TAG_ADMIN_PASSCODE_I_D = 2 + private const val TAG_CHANGE_TYPE = 3 + private const val TAG_LATEST_VALUE = 4 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): AccessControlClusterAccessControlExtensionChangedEvent { + tlvReader.enterStructure(tag) + val adminNodeID = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + null + } + val adminPasscodeID = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + null + } + val changeType = tlvReader.getInt(ContextSpecificTag(TAG_CHANGE_TYPE)) + val latestValue = + if (!tlvReader.isNull()) { + chip.devicecontroller.cluster.structs.AccessControlClusterAccessControlExtensionStruct + .fromTlv(ContextSpecificTag(TAG_LATEST_VALUE), tlvReader) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_LATEST_VALUE)) + null + } + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return AccessControlClusterAccessControlExtensionChangedEvent( + adminNodeID, + adminPasscodeID, + changeType, + latestValue, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt new file mode 100644 index 00000000000000..d2e375338f705d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt @@ -0,0 +1,69 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ActionsClusterActionFailedEvent( + val actionID: Int, + val invokeID: Long, + val newState: Int, + val error: Int +) { + override fun toString(): String = buildString { + append("ActionsClusterActionFailedEvent {\n") + append("\tactionID : $actionID\n") + append("\tinvokeID : $invokeID\n") + append("\tnewState : $newState\n") + append("\terror : $error\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ACTION_I_D), actionID) + put(ContextSpecificTag(TAG_INVOKE_I_D), invokeID) + put(ContextSpecificTag(TAG_NEW_STATE), newState) + put(ContextSpecificTag(TAG_ERROR), error) + endStructure() + } + } + + companion object { + private const val TAG_ACTION_I_D = 0 + private const val TAG_INVOKE_I_D = 1 + private const val TAG_NEW_STATE = 2 + private const val TAG_ERROR = 3 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ActionsClusterActionFailedEvent { + tlvReader.enterStructure(tag) + val actionID = tlvReader.getInt(ContextSpecificTag(TAG_ACTION_I_D)) + val invokeID = tlvReader.getLong(ContextSpecificTag(TAG_INVOKE_I_D)) + val newState = tlvReader.getInt(ContextSpecificTag(TAG_NEW_STATE)) + val error = tlvReader.getInt(ContextSpecificTag(TAG_ERROR)) + + tlvReader.exitContainer() + + return ActionsClusterActionFailedEvent(actionID, invokeID, newState, error) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt new file mode 100644 index 00000000000000..05ad68aae272ea --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt @@ -0,0 +1,60 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ActionsClusterStateChangedEvent(val actionID: Int, val invokeID: Long, val newState: Int) { + override fun toString(): String = buildString { + append("ActionsClusterStateChangedEvent {\n") + append("\tactionID : $actionID\n") + append("\tinvokeID : $invokeID\n") + append("\tnewState : $newState\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ACTION_I_D), actionID) + put(ContextSpecificTag(TAG_INVOKE_I_D), invokeID) + put(ContextSpecificTag(TAG_NEW_STATE), newState) + endStructure() + } + } + + companion object { + private const val TAG_ACTION_I_D = 0 + private const val TAG_INVOKE_I_D = 1 + private const val TAG_NEW_STATE = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ActionsClusterStateChangedEvent { + tlvReader.enterStructure(tag) + val actionID = tlvReader.getInt(ContextSpecificTag(TAG_ACTION_I_D)) + val invokeID = tlvReader.getLong(ContextSpecificTag(TAG_INVOKE_I_D)) + val newState = tlvReader.getInt(ContextSpecificTag(TAG_NEW_STATE)) + + tlvReader.exitContainer() + + return ActionsClusterStateChangedEvent(actionID, invokeID, newState) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterLeaveEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterLeaveEvent.kt new file mode 100644 index 00000000000000..962ed26cddb40d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterLeaveEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class BasicInformationClusterLeaveEvent(val fabricIndex: Int) { + override fun toString(): String = buildString { + append("BasicInformationClusterLeaveEvent {\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_FABRIC_INDEX = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): BasicInformationClusterLeaveEvent { + tlvReader.enterStructure(tag) + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return BasicInformationClusterLeaveEvent(fabricIndex) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterReachableChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterReachableChangedEvent.kt new file mode 100644 index 00000000000000..c40211aa617dcc --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterReachableChangedEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class BasicInformationClusterReachableChangedEvent(val reachableNewValue: Boolean) { + override fun toString(): String = buildString { + append("BasicInformationClusterReachableChangedEvent {\n") + append("\treachableNewValue : $reachableNewValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_REACHABLE_NEW_VALUE), reachableNewValue) + endStructure() + } + } + + companion object { + private const val TAG_REACHABLE_NEW_VALUE = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): BasicInformationClusterReachableChangedEvent { + tlvReader.enterStructure(tag) + val reachableNewValue = tlvReader.getBoolean(ContextSpecificTag(TAG_REACHABLE_NEW_VALUE)) + + tlvReader.exitContainer() + + return BasicInformationClusterReachableChangedEvent(reachableNewValue) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterStartUpEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterStartUpEvent.kt new file mode 100644 index 00000000000000..23082666b05cae --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterStartUpEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class BasicInformationClusterStartUpEvent(val softwareVersion: Long) { + override fun toString(): String = buildString { + append("BasicInformationClusterStartUpEvent {\n") + append("\tsoftwareVersion : $softwareVersion\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_SOFTWARE_VERSION), softwareVersion) + endStructure() + } + } + + companion object { + private const val TAG_SOFTWARE_VERSION = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): BasicInformationClusterStartUpEvent { + tlvReader.enterStructure(tag) + val softwareVersion = tlvReader.getLong(ContextSpecificTag(TAG_SOFTWARE_VERSION)) + + tlvReader.exitContainer() + + return BasicInformationClusterStartUpEvent(softwareVersion) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BooleanStateClusterStateChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BooleanStateClusterStateChangeEvent.kt new file mode 100644 index 00000000000000..a0ecfb76141580 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BooleanStateClusterStateChangeEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class BooleanStateClusterStateChangeEvent(val stateValue: Boolean) { + override fun toString(): String = buildString { + append("BooleanStateClusterStateChangeEvent {\n") + append("\tstateValue : $stateValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_STATE_VALUE), stateValue) + endStructure() + } + } + + companion object { + private const val TAG_STATE_VALUE = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): BooleanStateClusterStateChangeEvent { + tlvReader.enterStructure(tag) + val stateValue = tlvReader.getBoolean(ContextSpecificTag(TAG_STATE_VALUE)) + + tlvReader.exitContainer() + + return BooleanStateClusterStateChangeEvent(stateValue) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterReachableChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterReachableChangedEvent.kt new file mode 100644 index 00000000000000..e75b2f7af96f93 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterReachableChangedEvent.kt @@ -0,0 +1,55 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class BridgedDeviceBasicInformationClusterReachableChangedEvent(val reachableNewValue: Boolean) { + override fun toString(): String = buildString { + append("BridgedDeviceBasicInformationClusterReachableChangedEvent {\n") + append("\treachableNewValue : $reachableNewValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_REACHABLE_NEW_VALUE), reachableNewValue) + endStructure() + } + } + + companion object { + private const val TAG_REACHABLE_NEW_VALUE = 0 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): BridgedDeviceBasicInformationClusterReachableChangedEvent { + tlvReader.enterStructure(tag) + val reachableNewValue = tlvReader.getBoolean(ContextSpecificTag(TAG_REACHABLE_NEW_VALUE)) + + tlvReader.exitContainer() + + return BridgedDeviceBasicInformationClusterReachableChangedEvent(reachableNewValue) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterStartUpEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterStartUpEvent.kt new file mode 100644 index 00000000000000..80c60be6847056 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterStartUpEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class BridgedDeviceBasicInformationClusterStartUpEvent(val softwareVersion: Long) { + override fun toString(): String = buildString { + append("BridgedDeviceBasicInformationClusterStartUpEvent {\n") + append("\tsoftwareVersion : $softwareVersion\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_SOFTWARE_VERSION), softwareVersion) + endStructure() + } + } + + companion object { + private const val TAG_SOFTWARE_VERSION = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): BridgedDeviceBasicInformationClusterStartUpEvent { + tlvReader.enterStructure(tag) + val softwareVersion = tlvReader.getLong(ContextSpecificTag(TAG_SOFTWARE_VERSION)) + + tlvReader.exitContainer() + + return BridgedDeviceBasicInformationClusterStartUpEvent(softwareVersion) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DishwasherAlarmClusterNotifyEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DishwasherAlarmClusterNotifyEvent.kt new file mode 100644 index 00000000000000..0b7206788e842a --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DishwasherAlarmClusterNotifyEvent.kt @@ -0,0 +1,69 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class DishwasherAlarmClusterNotifyEvent( + val active: Long, + val inactive: Long, + val state: Long, + val mask: Long +) { + override fun toString(): String = buildString { + append("DishwasherAlarmClusterNotifyEvent {\n") + append("\tactive : $active\n") + append("\tinactive : $inactive\n") + append("\tstate : $state\n") + append("\tmask : $mask\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ACTIVE), active) + put(ContextSpecificTag(TAG_INACTIVE), inactive) + put(ContextSpecificTag(TAG_STATE), state) + put(ContextSpecificTag(TAG_MASK), mask) + endStructure() + } + } + + companion object { + private const val TAG_ACTIVE = 0 + private const val TAG_INACTIVE = 1 + private const val TAG_STATE = 2 + private const val TAG_MASK = 3 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DishwasherAlarmClusterNotifyEvent { + tlvReader.enterStructure(tag) + val active = tlvReader.getLong(ContextSpecificTag(TAG_ACTIVE)) + val inactive = tlvReader.getLong(ContextSpecificTag(TAG_INACTIVE)) + val state = tlvReader.getLong(ContextSpecificTag(TAG_STATE)) + val mask = tlvReader.getLong(ContextSpecificTag(TAG_MASK)) + + tlvReader.exitContainer() + + return DishwasherAlarmClusterNotifyEvent(active, inactive, state, mask) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorLockAlarmEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorLockAlarmEvent.kt new file mode 100644 index 00000000000000..6417fb85009e88 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorLockAlarmEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class DoorLockClusterDoorLockAlarmEvent(val alarmCode: Int) { + override fun toString(): String = buildString { + append("DoorLockClusterDoorLockAlarmEvent {\n") + append("\talarmCode : $alarmCode\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ALARM_CODE), alarmCode) + endStructure() + } + } + + companion object { + private const val TAG_ALARM_CODE = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DoorLockClusterDoorLockAlarmEvent { + tlvReader.enterStructure(tag) + val alarmCode = tlvReader.getInt(ContextSpecificTag(TAG_ALARM_CODE)) + + tlvReader.exitContainer() + + return DoorLockClusterDoorLockAlarmEvent(alarmCode) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorStateChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorStateChangeEvent.kt new file mode 100644 index 00000000000000..d0b6acbe7ea227 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorStateChangeEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class DoorLockClusterDoorStateChangeEvent(val doorState: Int) { + override fun toString(): String = buildString { + append("DoorLockClusterDoorStateChangeEvent {\n") + append("\tdoorState : $doorState\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_DOOR_STATE), doorState) + endStructure() + } + } + + companion object { + private const val TAG_DOOR_STATE = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DoorLockClusterDoorStateChangeEvent { + tlvReader.enterStructure(tag) + val doorState = tlvReader.getInt(ContextSpecificTag(TAG_DOOR_STATE)) + + tlvReader.exitContainer() + + return DoorLockClusterDoorStateChangeEvent(doorState) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationErrorEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationErrorEvent.kt new file mode 100644 index 00000000000000..59e38fa054dd87 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationErrorEvent.kt @@ -0,0 +1,159 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class DoorLockClusterLockOperationErrorEvent( + val lockOperationType: Int, + val operationSource: Int, + val operationError: Int, + val userIndex: Int?, + val fabricIndex: Int?, + val sourceNode: Long?, + val credentials: + Optional>? +) { + override fun toString(): String = buildString { + append("DoorLockClusterLockOperationErrorEvent {\n") + append("\tlockOperationType : $lockOperationType\n") + append("\toperationSource : $operationSource\n") + append("\toperationError : $operationError\n") + append("\tuserIndex : $userIndex\n") + append("\tfabricIndex : $fabricIndex\n") + append("\tsourceNode : $sourceNode\n") + append("\tcredentials : $credentials\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LOCK_OPERATION_TYPE), lockOperationType) + put(ContextSpecificTag(TAG_OPERATION_SOURCE), operationSource) + put(ContextSpecificTag(TAG_OPERATION_ERROR), operationError) + if (userIndex != null) { + put(ContextSpecificTag(TAG_USER_INDEX), userIndex) + } else { + putNull(ContextSpecificTag(TAG_USER_INDEX)) + } + if (fabricIndex != null) { + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + } else { + putNull(ContextSpecificTag(TAG_FABRIC_INDEX)) + } + if (sourceNode != null) { + put(ContextSpecificTag(TAG_SOURCE_NODE), sourceNode) + } else { + putNull(ContextSpecificTag(TAG_SOURCE_NODE)) + } + if (credentials != null) { + if (credentials.isPresent) { + val optcredentials = credentials.get() + startList(ContextSpecificTag(TAG_CREDENTIALS)) + for (item in optcredentials.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + } + } else { + putNull(ContextSpecificTag(TAG_CREDENTIALS)) + } + endStructure() + } + } + + companion object { + private const val TAG_LOCK_OPERATION_TYPE = 0 + private const val TAG_OPERATION_SOURCE = 1 + private const val TAG_OPERATION_ERROR = 2 + private const val TAG_USER_INDEX = 3 + private const val TAG_FABRIC_INDEX = 4 + private const val TAG_SOURCE_NODE = 5 + private const val TAG_CREDENTIALS = 6 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DoorLockClusterLockOperationErrorEvent { + tlvReader.enterStructure(tag) + val lockOperationType = tlvReader.getInt(ContextSpecificTag(TAG_LOCK_OPERATION_TYPE)) + val operationSource = tlvReader.getInt(ContextSpecificTag(TAG_OPERATION_SOURCE)) + val operationError = tlvReader.getInt(ContextSpecificTag(TAG_OPERATION_ERROR)) + val userIndex = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_USER_INDEX)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_USER_INDEX)) + null + } + val fabricIndex = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_FABRIC_INDEX)) + null + } + val sourceNode = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_SOURCE_NODE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_SOURCE_NODE)) + null + } + val credentials = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CREDENTIALS))) { + Optional.of( + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CREDENTIALS)) + while (!tlvReader.isEndOfContainer()) { + this.add( + chip.devicecontroller.cluster.structs.DoorLockClusterCredentialStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_CREDENTIALS)) + null + } + + tlvReader.exitContainer() + + return DoorLockClusterLockOperationErrorEvent( + lockOperationType, + operationSource, + operationError, + userIndex, + fabricIndex, + sourceNode, + credentials + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationEvent.kt new file mode 100644 index 00000000000000..4fbf71082c7adc --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationEvent.kt @@ -0,0 +1,153 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class DoorLockClusterLockOperationEvent( + val lockOperationType: Int, + val operationSource: Int, + val userIndex: Int?, + val fabricIndex: Int?, + val sourceNode: Long?, + val credentials: + Optional>? +) { + override fun toString(): String = buildString { + append("DoorLockClusterLockOperationEvent {\n") + append("\tlockOperationType : $lockOperationType\n") + append("\toperationSource : $operationSource\n") + append("\tuserIndex : $userIndex\n") + append("\tfabricIndex : $fabricIndex\n") + append("\tsourceNode : $sourceNode\n") + append("\tcredentials : $credentials\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LOCK_OPERATION_TYPE), lockOperationType) + put(ContextSpecificTag(TAG_OPERATION_SOURCE), operationSource) + if (userIndex != null) { + put(ContextSpecificTag(TAG_USER_INDEX), userIndex) + } else { + putNull(ContextSpecificTag(TAG_USER_INDEX)) + } + if (fabricIndex != null) { + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + } else { + putNull(ContextSpecificTag(TAG_FABRIC_INDEX)) + } + if (sourceNode != null) { + put(ContextSpecificTag(TAG_SOURCE_NODE), sourceNode) + } else { + putNull(ContextSpecificTag(TAG_SOURCE_NODE)) + } + if (credentials != null) { + if (credentials.isPresent) { + val optcredentials = credentials.get() + startList(ContextSpecificTag(TAG_CREDENTIALS)) + for (item in optcredentials.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + } + } else { + putNull(ContextSpecificTag(TAG_CREDENTIALS)) + } + endStructure() + } + } + + companion object { + private const val TAG_LOCK_OPERATION_TYPE = 0 + private const val TAG_OPERATION_SOURCE = 1 + private const val TAG_USER_INDEX = 2 + private const val TAG_FABRIC_INDEX = 3 + private const val TAG_SOURCE_NODE = 4 + private const val TAG_CREDENTIALS = 5 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DoorLockClusterLockOperationEvent { + tlvReader.enterStructure(tag) + val lockOperationType = tlvReader.getInt(ContextSpecificTag(TAG_LOCK_OPERATION_TYPE)) + val operationSource = tlvReader.getInt(ContextSpecificTag(TAG_OPERATION_SOURCE)) + val userIndex = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_USER_INDEX)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_USER_INDEX)) + null + } + val fabricIndex = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_FABRIC_INDEX)) + null + } + val sourceNode = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_SOURCE_NODE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_SOURCE_NODE)) + null + } + val credentials = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CREDENTIALS))) { + Optional.of( + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CREDENTIALS)) + while (!tlvReader.isEndOfContainer()) { + this.add( + chip.devicecontroller.cluster.structs.DoorLockClusterCredentialStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_CREDENTIALS)) + null + } + + tlvReader.exitContainer() + + return DoorLockClusterLockOperationEvent( + lockOperationType, + operationSource, + userIndex, + fabricIndex, + sourceNode, + credentials + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockUserChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockUserChangeEvent.kt new file mode 100644 index 00000000000000..6fc562b39959ff --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockUserChangeEvent.kt @@ -0,0 +1,132 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class DoorLockClusterLockUserChangeEvent( + val lockDataType: Int, + val dataOperationType: Int, + val operationSource: Int, + val userIndex: Int?, + val fabricIndex: Int?, + val sourceNode: Long?, + val dataIndex: Int? +) { + override fun toString(): String = buildString { + append("DoorLockClusterLockUserChangeEvent {\n") + append("\tlockDataType : $lockDataType\n") + append("\tdataOperationType : $dataOperationType\n") + append("\toperationSource : $operationSource\n") + append("\tuserIndex : $userIndex\n") + append("\tfabricIndex : $fabricIndex\n") + append("\tsourceNode : $sourceNode\n") + append("\tdataIndex : $dataIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LOCK_DATA_TYPE), lockDataType) + put(ContextSpecificTag(TAG_DATA_OPERATION_TYPE), dataOperationType) + put(ContextSpecificTag(TAG_OPERATION_SOURCE), operationSource) + if (userIndex != null) { + put(ContextSpecificTag(TAG_USER_INDEX), userIndex) + } else { + putNull(ContextSpecificTag(TAG_USER_INDEX)) + } + if (fabricIndex != null) { + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + } else { + putNull(ContextSpecificTag(TAG_FABRIC_INDEX)) + } + if (sourceNode != null) { + put(ContextSpecificTag(TAG_SOURCE_NODE), sourceNode) + } else { + putNull(ContextSpecificTag(TAG_SOURCE_NODE)) + } + if (dataIndex != null) { + put(ContextSpecificTag(TAG_DATA_INDEX), dataIndex) + } else { + putNull(ContextSpecificTag(TAG_DATA_INDEX)) + } + endStructure() + } + } + + companion object { + private const val TAG_LOCK_DATA_TYPE = 0 + private const val TAG_DATA_OPERATION_TYPE = 1 + private const val TAG_OPERATION_SOURCE = 2 + private const val TAG_USER_INDEX = 3 + private const val TAG_FABRIC_INDEX = 4 + private const val TAG_SOURCE_NODE = 5 + private const val TAG_DATA_INDEX = 6 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DoorLockClusterLockUserChangeEvent { + tlvReader.enterStructure(tag) + val lockDataType = tlvReader.getInt(ContextSpecificTag(TAG_LOCK_DATA_TYPE)) + val dataOperationType = tlvReader.getInt(ContextSpecificTag(TAG_DATA_OPERATION_TYPE)) + val operationSource = tlvReader.getInt(ContextSpecificTag(TAG_OPERATION_SOURCE)) + val userIndex = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_USER_INDEX)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_USER_INDEX)) + null + } + val fabricIndex = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_FABRIC_INDEX)) + null + } + val sourceNode = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_SOURCE_NODE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_SOURCE_NODE)) + null + } + val dataIndex = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_DATA_INDEX)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DATA_INDEX)) + null + } + + tlvReader.exitContainer() + + return DoorLockClusterLockUserChangeEvent( + lockDataType, + dataOperationType, + operationSource, + userIndex, + fabricIndex, + sourceNode, + dataIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterBootReasonEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterBootReasonEvent.kt new file mode 100644 index 00000000000000..3d743983f1a00f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterBootReasonEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class GeneralDiagnosticsClusterBootReasonEvent(val bootReason: Int) { + override fun toString(): String = buildString { + append("GeneralDiagnosticsClusterBootReasonEvent {\n") + append("\tbootReason : $bootReason\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_BOOT_REASON), bootReason) + endStructure() + } + } + + companion object { + private const val TAG_BOOT_REASON = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): GeneralDiagnosticsClusterBootReasonEvent { + tlvReader.enterStructure(tag) + val bootReason = tlvReader.getInt(ContextSpecificTag(TAG_BOOT_REASON)) + + tlvReader.exitContainer() + + return GeneralDiagnosticsClusterBootReasonEvent(bootReason) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterHardwareFaultChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterHardwareFaultChangeEvent.kt new file mode 100644 index 00000000000000..1287eba322b742 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterHardwareFaultChangeEvent.kt @@ -0,0 +1,82 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class GeneralDiagnosticsClusterHardwareFaultChangeEvent( + val current: List, + val previous: List +) { + override fun toString(): String = buildString { + append("GeneralDiagnosticsClusterHardwareFaultChangeEvent {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): GeneralDiagnosticsClusterHardwareFaultChangeEvent { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return GeneralDiagnosticsClusterHardwareFaultChangeEvent(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterNetworkFaultChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterNetworkFaultChangeEvent.kt new file mode 100644 index 00000000000000..f9fc3cadc8b934 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterNetworkFaultChangeEvent.kt @@ -0,0 +1,82 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class GeneralDiagnosticsClusterNetworkFaultChangeEvent( + val current: List, + val previous: List +) { + override fun toString(): String = buildString { + append("GeneralDiagnosticsClusterNetworkFaultChangeEvent {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): GeneralDiagnosticsClusterNetworkFaultChangeEvent { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return GeneralDiagnosticsClusterNetworkFaultChangeEvent(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterRadioFaultChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterRadioFaultChangeEvent.kt new file mode 100644 index 00000000000000..35daf8dd691bf5 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterRadioFaultChangeEvent.kt @@ -0,0 +1,82 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class GeneralDiagnosticsClusterRadioFaultChangeEvent( + val current: List, + val previous: List +) { + override fun toString(): String = buildString { + append("GeneralDiagnosticsClusterRadioFaultChangeEvent {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): GeneralDiagnosticsClusterRadioFaultChangeEvent { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return GeneralDiagnosticsClusterRadioFaultChangeEvent(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OperationalStateClusterOperationCompletionEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OperationalStateClusterOperationCompletionEvent.kt new file mode 100644 index 00000000000000..092e062784a118 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OperationalStateClusterOperationCompletionEvent.kt @@ -0,0 +1,103 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class OperationalStateClusterOperationCompletionEvent( + val completionErrorCode: Int, + val totalOperationalTime: Optional?, + val pausedTime: Optional? +) { + override fun toString(): String = buildString { + append("OperationalStateClusterOperationCompletionEvent {\n") + append("\tcompletionErrorCode : $completionErrorCode\n") + append("\ttotalOperationalTime : $totalOperationalTime\n") + append("\tpausedTime : $pausedTime\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_COMPLETION_ERROR_CODE), completionErrorCode) + if (totalOperationalTime != null) { + if (totalOperationalTime.isPresent) { + val opttotalOperationalTime = totalOperationalTime.get() + put(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME), opttotalOperationalTime) + } + } else { + putNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)) + } + if (pausedTime != null) { + if (pausedTime.isPresent) { + val optpausedTime = pausedTime.get() + put(ContextSpecificTag(TAG_PAUSED_TIME), optpausedTime) + } + } else { + putNull(ContextSpecificTag(TAG_PAUSED_TIME)) + } + endStructure() + } + } + + companion object { + private const val TAG_COMPLETION_ERROR_CODE = 0 + private const val TAG_TOTAL_OPERATIONAL_TIME = 1 + private const val TAG_PAUSED_TIME = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): OperationalStateClusterOperationCompletionEvent { + tlvReader.enterStructure(tag) + val completionErrorCode = tlvReader.getInt(ContextSpecificTag(TAG_COMPLETION_ERROR_CODE)) + val totalOperationalTime = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)) + null + } + val pausedTime = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PAUSED_TIME))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_PAUSED_TIME))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_PAUSED_TIME)) + null + } + + tlvReader.exitContainer() + + return OperationalStateClusterOperationCompletionEvent( + completionErrorCode, + totalOperationalTime, + pausedTime + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OperationalStateClusterOperationalErrorEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OperationalStateClusterOperationalErrorEvent.kt new file mode 100644 index 00000000000000..b5623a0d701579 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OperationalStateClusterOperationalErrorEvent.kt @@ -0,0 +1,58 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class OperationalStateClusterOperationalErrorEvent( + val errorState: chip.devicecontroller.cluster.structs.OperationalStateClusterErrorStateStruct +) { + override fun toString(): String = buildString { + append("OperationalStateClusterOperationalErrorEvent {\n") + append("\terrorState : $errorState\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + errorState.toTlv(ContextSpecificTag(TAG_ERROR_STATE), this) + endStructure() + } + } + + companion object { + private const val TAG_ERROR_STATE = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): OperationalStateClusterOperationalErrorEvent { + tlvReader.enterStructure(tag) + val errorState = + chip.devicecontroller.cluster.structs.OperationalStateClusterErrorStateStruct.fromTlv( + ContextSpecificTag(TAG_ERROR_STATE), + tlvReader + ) + + tlvReader.exitContainer() + + return OperationalStateClusterOperationalErrorEvent(errorState) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterDownloadErrorEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterDownloadErrorEvent.kt new file mode 100644 index 00000000000000..8a82cbf93c9f1f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterDownloadErrorEvent.kt @@ -0,0 +1,97 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class OtaSoftwareUpdateRequestorClusterDownloadErrorEvent( + val softwareVersion: Long, + val bytesDownloaded: Long, + val progressPercent: Int?, + val platformCode: Long? +) { + override fun toString(): String = buildString { + append("OtaSoftwareUpdateRequestorClusterDownloadErrorEvent {\n") + append("\tsoftwareVersion : $softwareVersion\n") + append("\tbytesDownloaded : $bytesDownloaded\n") + append("\tprogressPercent : $progressPercent\n") + append("\tplatformCode : $platformCode\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_SOFTWARE_VERSION), softwareVersion) + put(ContextSpecificTag(TAG_BYTES_DOWNLOADED), bytesDownloaded) + if (progressPercent != null) { + put(ContextSpecificTag(TAG_PROGRESS_PERCENT), progressPercent) + } else { + putNull(ContextSpecificTag(TAG_PROGRESS_PERCENT)) + } + if (platformCode != null) { + put(ContextSpecificTag(TAG_PLATFORM_CODE), platformCode) + } else { + putNull(ContextSpecificTag(TAG_PLATFORM_CODE)) + } + endStructure() + } + } + + companion object { + private const val TAG_SOFTWARE_VERSION = 0 + private const val TAG_BYTES_DOWNLOADED = 1 + private const val TAG_PROGRESS_PERCENT = 2 + private const val TAG_PLATFORM_CODE = 3 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): OtaSoftwareUpdateRequestorClusterDownloadErrorEvent { + tlvReader.enterStructure(tag) + val softwareVersion = tlvReader.getLong(ContextSpecificTag(TAG_SOFTWARE_VERSION)) + val bytesDownloaded = tlvReader.getLong(ContextSpecificTag(TAG_BYTES_DOWNLOADED)) + val progressPercent = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_PROGRESS_PERCENT)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_PROGRESS_PERCENT)) + null + } + val platformCode = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_PLATFORM_CODE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_PLATFORM_CODE)) + null + } + + tlvReader.exitContainer() + + return OtaSoftwareUpdateRequestorClusterDownloadErrorEvent( + softwareVersion, + bytesDownloaded, + progressPercent, + platformCode + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterStateTransitionEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterStateTransitionEvent.kt new file mode 100644 index 00000000000000..b0b075689fc3be --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterStateTransitionEvent.kt @@ -0,0 +1,87 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class OtaSoftwareUpdateRequestorClusterStateTransitionEvent( + val previousState: Int, + val newState: Int, + val reason: Int, + val targetSoftwareVersion: Long? +) { + override fun toString(): String = buildString { + append("OtaSoftwareUpdateRequestorClusterStateTransitionEvent {\n") + append("\tpreviousState : $previousState\n") + append("\tnewState : $newState\n") + append("\treason : $reason\n") + append("\ttargetSoftwareVersion : $targetSoftwareVersion\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PREVIOUS_STATE), previousState) + put(ContextSpecificTag(TAG_NEW_STATE), newState) + put(ContextSpecificTag(TAG_REASON), reason) + if (targetSoftwareVersion != null) { + put(ContextSpecificTag(TAG_TARGET_SOFTWARE_VERSION), targetSoftwareVersion) + } else { + putNull(ContextSpecificTag(TAG_TARGET_SOFTWARE_VERSION)) + } + endStructure() + } + } + + companion object { + private const val TAG_PREVIOUS_STATE = 0 + private const val TAG_NEW_STATE = 1 + private const val TAG_REASON = 2 + private const val TAG_TARGET_SOFTWARE_VERSION = 3 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): OtaSoftwareUpdateRequestorClusterStateTransitionEvent { + tlvReader.enterStructure(tag) + val previousState = tlvReader.getInt(ContextSpecificTag(TAG_PREVIOUS_STATE)) + val newState = tlvReader.getInt(ContextSpecificTag(TAG_NEW_STATE)) + val reason = tlvReader.getInt(ContextSpecificTag(TAG_REASON)) + val targetSoftwareVersion = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_TARGET_SOFTWARE_VERSION)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TARGET_SOFTWARE_VERSION)) + null + } + + tlvReader.exitContainer() + + return OtaSoftwareUpdateRequestorClusterStateTransitionEvent( + previousState, + newState, + reason, + targetSoftwareVersion + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt new file mode 100644 index 00000000000000..ff1034ace97e31 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt @@ -0,0 +1,62 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class OtaSoftwareUpdateRequestorClusterVersionAppliedEvent( + val softwareVersion: Long, + val productID: Int +) { + override fun toString(): String = buildString { + append("OtaSoftwareUpdateRequestorClusterVersionAppliedEvent {\n") + append("\tsoftwareVersion : $softwareVersion\n") + append("\tproductID : $productID\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_SOFTWARE_VERSION), softwareVersion) + put(ContextSpecificTag(TAG_PRODUCT_I_D), productID) + endStructure() + } + } + + companion object { + private const val TAG_SOFTWARE_VERSION = 0 + private const val TAG_PRODUCT_I_D = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): OtaSoftwareUpdateRequestorClusterVersionAppliedEvent { + tlvReader.enterStructure(tag) + val softwareVersion = tlvReader.getLong(ContextSpecificTag(TAG_SOFTWARE_VERSION)) + val productID = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_I_D)) + + tlvReader.exitContainer() + + return OtaSoftwareUpdateRequestorClusterVersionAppliedEvent(softwareVersion, productID) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatChargeFaultChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatChargeFaultChangeEvent.kt new file mode 100644 index 00000000000000..c3eb0d1e658b56 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatChargeFaultChangeEvent.kt @@ -0,0 +1,79 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class PowerSourceClusterBatChargeFaultChangeEvent(val current: List, val previous: List) { + override fun toString(): String = buildString { + append("PowerSourceClusterBatChargeFaultChangeEvent {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): PowerSourceClusterBatChargeFaultChangeEvent { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return PowerSourceClusterBatChargeFaultChangeEvent(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatFaultChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatFaultChangeEvent.kt new file mode 100644 index 00000000000000..c010184156ecb3 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatFaultChangeEvent.kt @@ -0,0 +1,79 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class PowerSourceClusterBatFaultChangeEvent(val current: List, val previous: List) { + override fun toString(): String = buildString { + append("PowerSourceClusterBatFaultChangeEvent {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): PowerSourceClusterBatFaultChangeEvent { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return PowerSourceClusterBatFaultChangeEvent(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterWiredFaultChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterWiredFaultChangeEvent.kt new file mode 100644 index 00000000000000..8a06b36fba61d0 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterWiredFaultChangeEvent.kt @@ -0,0 +1,79 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class PowerSourceClusterWiredFaultChangeEvent(val current: List, val previous: List) { + override fun toString(): String = buildString { + append("PowerSourceClusterWiredFaultChangeEvent {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): PowerSourceClusterWiredFaultChangeEvent { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return PowerSourceClusterWiredFaultChangeEvent(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RefrigeratorAlarmClusterNotifyEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RefrigeratorAlarmClusterNotifyEvent.kt new file mode 100644 index 00000000000000..c116f16ac73229 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RefrigeratorAlarmClusterNotifyEvent.kt @@ -0,0 +1,69 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class RefrigeratorAlarmClusterNotifyEvent( + val active: Long, + val inactive: Long, + val state: Long, + val mask: Long +) { + override fun toString(): String = buildString { + append("RefrigeratorAlarmClusterNotifyEvent {\n") + append("\tactive : $active\n") + append("\tinactive : $inactive\n") + append("\tstate : $state\n") + append("\tmask : $mask\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ACTIVE), active) + put(ContextSpecificTag(TAG_INACTIVE), inactive) + put(ContextSpecificTag(TAG_STATE), state) + put(ContextSpecificTag(TAG_MASK), mask) + endStructure() + } + } + + companion object { + private const val TAG_ACTIVE = 0 + private const val TAG_INACTIVE = 1 + private const val TAG_STATE = 2 + private const val TAG_MASK = 3 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): RefrigeratorAlarmClusterNotifyEvent { + tlvReader.enterStructure(tag) + val active = tlvReader.getLong(ContextSpecificTag(TAG_ACTIVE)) + val inactive = tlvReader.getLong(ContextSpecificTag(TAG_INACTIVE)) + val state = tlvReader.getLong(ContextSpecificTag(TAG_STATE)) + val mask = tlvReader.getLong(ContextSpecificTag(TAG_MASK)) + + tlvReader.exitContainer() + + return RefrigeratorAlarmClusterNotifyEvent(active, inactive, state, mask) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RvcOperationalStateClusterOperationCompletionEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RvcOperationalStateClusterOperationCompletionEvent.kt new file mode 100644 index 00000000000000..c6afaa9750adf8 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RvcOperationalStateClusterOperationCompletionEvent.kt @@ -0,0 +1,106 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class RvcOperationalStateClusterOperationCompletionEvent( + val completionErrorCode: Int, + val totalOperationalTime: Optional?, + val pausedTime: Optional? +) { + override fun toString(): String = buildString { + append("RvcOperationalStateClusterOperationCompletionEvent {\n") + append("\tcompletionErrorCode : $completionErrorCode\n") + append("\ttotalOperationalTime : $totalOperationalTime\n") + append("\tpausedTime : $pausedTime\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_COMPLETION_ERROR_CODE), completionErrorCode) + if (totalOperationalTime != null) { + if (totalOperationalTime.isPresent) { + val opttotalOperationalTime = totalOperationalTime.get() + put(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME), opttotalOperationalTime) + } + } else { + putNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)) + } + if (pausedTime != null) { + if (pausedTime.isPresent) { + val optpausedTime = pausedTime.get() + put(ContextSpecificTag(TAG_PAUSED_TIME), optpausedTime) + } + } else { + putNull(ContextSpecificTag(TAG_PAUSED_TIME)) + } + endStructure() + } + } + + companion object { + private const val TAG_COMPLETION_ERROR_CODE = 0 + private const val TAG_TOTAL_OPERATIONAL_TIME = 1 + private const val TAG_PAUSED_TIME = 2 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): RvcOperationalStateClusterOperationCompletionEvent { + tlvReader.enterStructure(tag) + val completionErrorCode = tlvReader.getInt(ContextSpecificTag(TAG_COMPLETION_ERROR_CODE)) + val totalOperationalTime = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)) + null + } + val pausedTime = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PAUSED_TIME))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_PAUSED_TIME))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_PAUSED_TIME)) + null + } + + tlvReader.exitContainer() + + return RvcOperationalStateClusterOperationCompletionEvent( + completionErrorCode, + totalOperationalTime, + pausedTime + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RvcOperationalStateClusterOperationalErrorEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RvcOperationalStateClusterOperationalErrorEvent.kt new file mode 100644 index 00000000000000..bf6fed9817f60f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RvcOperationalStateClusterOperationalErrorEvent.kt @@ -0,0 +1,58 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class RvcOperationalStateClusterOperationalErrorEvent( + val errorState: chip.devicecontroller.cluster.structs.RvcOperationalStateClusterErrorStateStruct +) { + override fun toString(): String = buildString { + append("RvcOperationalStateClusterOperationalErrorEvent {\n") + append("\terrorState : $errorState\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + errorState.toTlv(ContextSpecificTag(TAG_ERROR_STATE), this) + endStructure() + } + } + + companion object { + private const val TAG_ERROR_STATE = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): RvcOperationalStateClusterOperationalErrorEvent { + tlvReader.enterStructure(tag) + val errorState = + chip.devicecontroller.cluster.structs.RvcOperationalStateClusterErrorStateStruct.fromTlv( + ContextSpecificTag(TAG_ERROR_STATE), + tlvReader + ) + + tlvReader.exitContainer() + + return RvcOperationalStateClusterOperationalErrorEvent(errorState) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterCOAlarmEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterCOAlarmEvent.kt new file mode 100644 index 00000000000000..2bc948e2a667b1 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterCOAlarmEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SmokeCoAlarmClusterCOAlarmEvent(val alarmSeverityLevel: Int) { + override fun toString(): String = buildString { + append("SmokeCoAlarmClusterCOAlarmEvent {\n") + append("\talarmSeverityLevel : $alarmSeverityLevel\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL), alarmSeverityLevel) + endStructure() + } + } + + companion object { + private const val TAG_ALARM_SEVERITY_LEVEL = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SmokeCoAlarmClusterCOAlarmEvent { + tlvReader.enterStructure(tag) + val alarmSeverityLevel = tlvReader.getInt(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL)) + + tlvReader.exitContainer() + + return SmokeCoAlarmClusterCOAlarmEvent(alarmSeverityLevel) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterInterconnectCOAlarmEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterInterconnectCOAlarmEvent.kt new file mode 100644 index 00000000000000..19223606c4685d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterInterconnectCOAlarmEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SmokeCoAlarmClusterInterconnectCOAlarmEvent(val alarmSeverityLevel: Int) { + override fun toString(): String = buildString { + append("SmokeCoAlarmClusterInterconnectCOAlarmEvent {\n") + append("\talarmSeverityLevel : $alarmSeverityLevel\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL), alarmSeverityLevel) + endStructure() + } + } + + companion object { + private const val TAG_ALARM_SEVERITY_LEVEL = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SmokeCoAlarmClusterInterconnectCOAlarmEvent { + tlvReader.enterStructure(tag) + val alarmSeverityLevel = tlvReader.getInt(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL)) + + tlvReader.exitContainer() + + return SmokeCoAlarmClusterInterconnectCOAlarmEvent(alarmSeverityLevel) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterInterconnectSmokeAlarmEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterInterconnectSmokeAlarmEvent.kt new file mode 100644 index 00000000000000..38e2fe872915f7 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterInterconnectSmokeAlarmEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SmokeCoAlarmClusterInterconnectSmokeAlarmEvent(val alarmSeverityLevel: Int) { + override fun toString(): String = buildString { + append("SmokeCoAlarmClusterInterconnectSmokeAlarmEvent {\n") + append("\talarmSeverityLevel : $alarmSeverityLevel\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL), alarmSeverityLevel) + endStructure() + } + } + + companion object { + private const val TAG_ALARM_SEVERITY_LEVEL = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SmokeCoAlarmClusterInterconnectSmokeAlarmEvent { + tlvReader.enterStructure(tag) + val alarmSeverityLevel = tlvReader.getInt(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL)) + + tlvReader.exitContainer() + + return SmokeCoAlarmClusterInterconnectSmokeAlarmEvent(alarmSeverityLevel) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterLowBatteryEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterLowBatteryEvent.kt new file mode 100644 index 00000000000000..ce2d9ad47341d0 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterLowBatteryEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SmokeCoAlarmClusterLowBatteryEvent(val alarmSeverityLevel: Int) { + override fun toString(): String = buildString { + append("SmokeCoAlarmClusterLowBatteryEvent {\n") + append("\talarmSeverityLevel : $alarmSeverityLevel\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL), alarmSeverityLevel) + endStructure() + } + } + + companion object { + private const val TAG_ALARM_SEVERITY_LEVEL = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SmokeCoAlarmClusterLowBatteryEvent { + tlvReader.enterStructure(tag) + val alarmSeverityLevel = tlvReader.getInt(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL)) + + tlvReader.exitContainer() + + return SmokeCoAlarmClusterLowBatteryEvent(alarmSeverityLevel) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterSmokeAlarmEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterSmokeAlarmEvent.kt new file mode 100644 index 00000000000000..324a5d4461a225 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterSmokeAlarmEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SmokeCoAlarmClusterSmokeAlarmEvent(val alarmSeverityLevel: Int) { + override fun toString(): String = buildString { + append("SmokeCoAlarmClusterSmokeAlarmEvent {\n") + append("\talarmSeverityLevel : $alarmSeverityLevel\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL), alarmSeverityLevel) + endStructure() + } + } + + companion object { + private const val TAG_ALARM_SEVERITY_LEVEL = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SmokeCoAlarmClusterSmokeAlarmEvent { + tlvReader.enterStructure(tag) + val alarmSeverityLevel = tlvReader.getInt(ContextSpecificTag(TAG_ALARM_SEVERITY_LEVEL)) + + tlvReader.exitContainer() + + return SmokeCoAlarmClusterSmokeAlarmEvent(alarmSeverityLevel) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SoftwareDiagnosticsClusterSoftwareFaultEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SoftwareDiagnosticsClusterSoftwareFaultEvent.kt new file mode 100644 index 00000000000000..50b455842e538f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SoftwareDiagnosticsClusterSoftwareFaultEvent.kt @@ -0,0 +1,81 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class SoftwareDiagnosticsClusterSoftwareFaultEvent( + val id: Long, + val name: Optional, + val faultRecording: Optional +) { + override fun toString(): String = buildString { + append("SoftwareDiagnosticsClusterSoftwareFaultEvent {\n") + append("\tid : $id\n") + append("\tname : $name\n") + append("\tfaultRecording : $faultRecording\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ID), id) + if (name.isPresent) { + val optname = name.get() + put(ContextSpecificTag(TAG_NAME), optname) + } + if (faultRecording.isPresent) { + val optfaultRecording = faultRecording.get() + put(ContextSpecificTag(TAG_FAULT_RECORDING), optfaultRecording) + } + endStructure() + } + } + + companion object { + private const val TAG_ID = 0 + private const val TAG_NAME = 1 + private const val TAG_FAULT_RECORDING = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SoftwareDiagnosticsClusterSoftwareFaultEvent { + tlvReader.enterStructure(tag) + val id = tlvReader.getLong(ContextSpecificTag(TAG_ID)) + val name = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_NAME))) + } else { + Optional.empty() + } + val faultRecording = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_FAULT_RECORDING))) { + Optional.of(tlvReader.getByteArray(ContextSpecificTag(TAG_FAULT_RECORDING))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return SoftwareDiagnosticsClusterSoftwareFaultEvent(id, name, faultRecording) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterInitialPressEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterInitialPressEvent.kt new file mode 100644 index 00000000000000..893412c1f25322 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterInitialPressEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SwitchClusterInitialPressEvent(val newPosition: Int) { + override fun toString(): String = buildString { + append("SwitchClusterInitialPressEvent {\n") + append("\tnewPosition : $newPosition\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_NEW_POSITION), newPosition) + endStructure() + } + } + + companion object { + private const val TAG_NEW_POSITION = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SwitchClusterInitialPressEvent { + tlvReader.enterStructure(tag) + val newPosition = tlvReader.getInt(ContextSpecificTag(TAG_NEW_POSITION)) + + tlvReader.exitContainer() + + return SwitchClusterInitialPressEvent(newPosition) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterLongPressEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterLongPressEvent.kt new file mode 100644 index 00000000000000..3fa420f46ddec3 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterLongPressEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SwitchClusterLongPressEvent(val newPosition: Int) { + override fun toString(): String = buildString { + append("SwitchClusterLongPressEvent {\n") + append("\tnewPosition : $newPosition\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_NEW_POSITION), newPosition) + endStructure() + } + } + + companion object { + private const val TAG_NEW_POSITION = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SwitchClusterLongPressEvent { + tlvReader.enterStructure(tag) + val newPosition = tlvReader.getInt(ContextSpecificTag(TAG_NEW_POSITION)) + + tlvReader.exitContainer() + + return SwitchClusterLongPressEvent(newPosition) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterLongReleaseEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterLongReleaseEvent.kt new file mode 100644 index 00000000000000..eb90698fc735ab --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterLongReleaseEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SwitchClusterLongReleaseEvent(val previousPosition: Int) { + override fun toString(): String = buildString { + append("SwitchClusterLongReleaseEvent {\n") + append("\tpreviousPosition : $previousPosition\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PREVIOUS_POSITION), previousPosition) + endStructure() + } + } + + companion object { + private const val TAG_PREVIOUS_POSITION = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SwitchClusterLongReleaseEvent { + tlvReader.enterStructure(tag) + val previousPosition = tlvReader.getInt(ContextSpecificTag(TAG_PREVIOUS_POSITION)) + + tlvReader.exitContainer() + + return SwitchClusterLongReleaseEvent(previousPosition) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterMultiPressCompleteEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterMultiPressCompleteEvent.kt new file mode 100644 index 00000000000000..81141e17424fbb --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterMultiPressCompleteEvent.kt @@ -0,0 +1,60 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SwitchClusterMultiPressCompleteEvent( + val previousPosition: Int, + val totalNumberOfPressesCounted: Int +) { + override fun toString(): String = buildString { + append("SwitchClusterMultiPressCompleteEvent {\n") + append("\tpreviousPosition : $previousPosition\n") + append("\ttotalNumberOfPressesCounted : $totalNumberOfPressesCounted\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PREVIOUS_POSITION), previousPosition) + put(ContextSpecificTag(TAG_TOTAL_NUMBER_OF_PRESSES_COUNTED), totalNumberOfPressesCounted) + endStructure() + } + } + + companion object { + private const val TAG_PREVIOUS_POSITION = 0 + private const val TAG_TOTAL_NUMBER_OF_PRESSES_COUNTED = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SwitchClusterMultiPressCompleteEvent { + tlvReader.enterStructure(tag) + val previousPosition = tlvReader.getInt(ContextSpecificTag(TAG_PREVIOUS_POSITION)) + val totalNumberOfPressesCounted = + tlvReader.getInt(ContextSpecificTag(TAG_TOTAL_NUMBER_OF_PRESSES_COUNTED)) + + tlvReader.exitContainer() + + return SwitchClusterMultiPressCompleteEvent(previousPosition, totalNumberOfPressesCounted) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterMultiPressOngoingEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterMultiPressOngoingEvent.kt new file mode 100644 index 00000000000000..11fab26fdfce8e --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterMultiPressOngoingEvent.kt @@ -0,0 +1,60 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SwitchClusterMultiPressOngoingEvent( + val newPosition: Int, + val currentNumberOfPressesCounted: Int +) { + override fun toString(): String = buildString { + append("SwitchClusterMultiPressOngoingEvent {\n") + append("\tnewPosition : $newPosition\n") + append("\tcurrentNumberOfPressesCounted : $currentNumberOfPressesCounted\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_NEW_POSITION), newPosition) + put(ContextSpecificTag(TAG_CURRENT_NUMBER_OF_PRESSES_COUNTED), currentNumberOfPressesCounted) + endStructure() + } + } + + companion object { + private const val TAG_NEW_POSITION = 0 + private const val TAG_CURRENT_NUMBER_OF_PRESSES_COUNTED = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SwitchClusterMultiPressOngoingEvent { + tlvReader.enterStructure(tag) + val newPosition = tlvReader.getInt(ContextSpecificTag(TAG_NEW_POSITION)) + val currentNumberOfPressesCounted = + tlvReader.getInt(ContextSpecificTag(TAG_CURRENT_NUMBER_OF_PRESSES_COUNTED)) + + tlvReader.exitContainer() + + return SwitchClusterMultiPressOngoingEvent(newPosition, currentNumberOfPressesCounted) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterShortReleaseEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterShortReleaseEvent.kt new file mode 100644 index 00000000000000..0eeb9e2841fd7c --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterShortReleaseEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SwitchClusterShortReleaseEvent(val previousPosition: Int) { + override fun toString(): String = buildString { + append("SwitchClusterShortReleaseEvent {\n") + append("\tpreviousPosition : $previousPosition\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PREVIOUS_POSITION), previousPosition) + endStructure() + } + } + + companion object { + private const val TAG_PREVIOUS_POSITION = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SwitchClusterShortReleaseEvent { + tlvReader.enterStructure(tag) + val previousPosition = tlvReader.getInt(ContextSpecificTag(TAG_PREVIOUS_POSITION)) + + tlvReader.exitContainer() + + return SwitchClusterShortReleaseEvent(previousPosition) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterSwitchLatchedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterSwitchLatchedEvent.kt new file mode 100644 index 00000000000000..2b921b37ac6c2b --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterSwitchLatchedEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class SwitchClusterSwitchLatchedEvent(val newPosition: Int) { + override fun toString(): String = buildString { + append("SwitchClusterSwitchLatchedEvent {\n") + append("\tnewPosition : $newPosition\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_NEW_POSITION), newPosition) + endStructure() + } + } + + companion object { + private const val TAG_NEW_POSITION = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SwitchClusterSwitchLatchedEvent { + tlvReader.enterStructure(tag) + val newPosition = tlvReader.getInt(ContextSpecificTag(TAG_NEW_POSITION)) + + tlvReader.exitContainer() + + return SwitchClusterSwitchLatchedEvent(newPosition) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterConnectionStatusEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterConnectionStatusEvent.kt new file mode 100644 index 00000000000000..ffdc72b1e54c89 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterConnectionStatusEvent.kt @@ -0,0 +1,55 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ThreadNetworkDiagnosticsClusterConnectionStatusEvent(val connectionStatus: Int) { + override fun toString(): String = buildString { + append("ThreadNetworkDiagnosticsClusterConnectionStatusEvent {\n") + append("\tconnectionStatus : $connectionStatus\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_CONNECTION_STATUS), connectionStatus) + endStructure() + } + } + + companion object { + private const val TAG_CONNECTION_STATUS = 0 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): ThreadNetworkDiagnosticsClusterConnectionStatusEvent { + tlvReader.enterStructure(tag) + val connectionStatus = tlvReader.getInt(ContextSpecificTag(TAG_CONNECTION_STATUS)) + + tlvReader.exitContainer() + + return ThreadNetworkDiagnosticsClusterConnectionStatusEvent(connectionStatus) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent.kt new file mode 100644 index 00000000000000..f9110c39fa1d40 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent.kt @@ -0,0 +1,85 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent( + val current: List, + val previous: List +) { + override fun toString(): String = buildString { + append("ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt new file mode 100644 index 00000000000000..53090f750b4e06 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class TimeSynchronizationClusterDSTStatusEvent(val DSTOffsetActive: Boolean) { + override fun toString(): String = buildString { + append("TimeSynchronizationClusterDSTStatusEvent {\n") + append("\tDSTOffsetActive : $DSTOffsetActive\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_D_S_T_OFFSET_ACTIVE), DSTOffsetActive) + endStructure() + } + } + + companion object { + private const val TAG_D_S_T_OFFSET_ACTIVE = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): TimeSynchronizationClusterDSTStatusEvent { + tlvReader.enterStructure(tag) + val DSTOffsetActive = tlvReader.getBoolean(ContextSpecificTag(TAG_D_S_T_OFFSET_ACTIVE)) + + tlvReader.exitContainer() + + return TimeSynchronizationClusterDSTStatusEvent(DSTOffsetActive) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterTimeZoneStatusEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterTimeZoneStatusEvent.kt new file mode 100644 index 00000000000000..452e9d902c4767 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterTimeZoneStatusEvent.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 chip.devicecontroller.cluster.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class TimeSynchronizationClusterTimeZoneStatusEvent(val offset: Long, val name: Optional) { + override fun toString(): String = buildString { + append("TimeSynchronizationClusterTimeZoneStatusEvent {\n") + append("\toffset : $offset\n") + append("\tname : $name\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_OFFSET), offset) + if (name.isPresent) { + val optname = name.get() + put(ContextSpecificTag(TAG_NAME), optname) + } + endStructure() + } + } + + companion object { + private const val TAG_OFFSET = 0 + private const val TAG_NAME = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): TimeSynchronizationClusterTimeZoneStatusEvent { + tlvReader.enterStructure(tag) + val offset = tlvReader.getLong(ContextSpecificTag(TAG_OFFSET)) + val name = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_NAME))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return TimeSynchronizationClusterTimeZoneStatusEvent(offset, name) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestEventEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestEventEvent.kt new file mode 100644 index 00000000000000..8c2e410ab80f6d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestEventEvent.kt @@ -0,0 +1,111 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class UnitTestingClusterTestEventEvent( + val arg1: Int, + val arg2: Int, + val arg3: Boolean, + val arg4: chip.devicecontroller.cluster.structs.UnitTestingClusterSimpleStruct, + val arg5: List, + val arg6: List +) { + override fun toString(): String = buildString { + append("UnitTestingClusterTestEventEvent {\n") + append("\targ1 : $arg1\n") + append("\targ2 : $arg2\n") + append("\targ3 : $arg3\n") + append("\targ4 : $arg4\n") + append("\targ5 : $arg5\n") + append("\targ6 : $arg6\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ARG1), arg1) + put(ContextSpecificTag(TAG_ARG2), arg2) + put(ContextSpecificTag(TAG_ARG3), arg3) + arg4.toTlv(ContextSpecificTag(TAG_ARG4), this) + startList(ContextSpecificTag(TAG_ARG5)) + for (item in arg5.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + startList(ContextSpecificTag(TAG_ARG6)) + for (item in arg6.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_ARG1 = 1 + private const val TAG_ARG2 = 2 + private const val TAG_ARG3 = 3 + private const val TAG_ARG4 = 4 + private const val TAG_ARG5 = 5 + private const val TAG_ARG6 = 6 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UnitTestingClusterTestEventEvent { + tlvReader.enterStructure(tag) + val arg1 = tlvReader.getInt(ContextSpecificTag(TAG_ARG1)) + val arg2 = tlvReader.getInt(ContextSpecificTag(TAG_ARG2)) + val arg3 = tlvReader.getBoolean(ContextSpecificTag(TAG_ARG3)) + val arg4 = + chip.devicecontroller.cluster.structs.UnitTestingClusterSimpleStruct.fromTlv( + ContextSpecificTag(TAG_ARG4), + tlvReader + ) + val arg5 = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_ARG5)) + while (!tlvReader.isEndOfContainer()) { + this.add( + chip.devicecontroller.cluster.structs.UnitTestingClusterSimpleStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + val arg6 = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_ARG6)) + while (!tlvReader.isEndOfContainer()) { + this.add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return UnitTestingClusterTestEventEvent(arg1, arg2, arg3, arg4, arg5, arg6) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestFabricScopedEventEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestFabricScopedEventEvent.kt new file mode 100644 index 00000000000000..d746c65d5ea1f1 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestFabricScopedEventEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class UnitTestingClusterTestFabricScopedEventEvent(val fabricIndex: Int) { + override fun toString(): String = buildString { + append("UnitTestingClusterTestFabricScopedEventEvent {\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UnitTestingClusterTestFabricScopedEventEvent { + tlvReader.enterStructure(tag) + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return UnitTestingClusterTestFabricScopedEventEvent(fabricIndex) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterAssociationFailureEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterAssociationFailureEvent.kt new file mode 100644 index 00000000000000..087484ef1bfa7b --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterAssociationFailureEvent.kt @@ -0,0 +1,62 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class WiFiNetworkDiagnosticsClusterAssociationFailureEvent( + val associationFailure: Int, + val status: Int +) { + override fun toString(): String = buildString { + append("WiFiNetworkDiagnosticsClusterAssociationFailureEvent {\n") + append("\tassociationFailure : $associationFailure\n") + append("\tstatus : $status\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ASSOCIATION_FAILURE), associationFailure) + put(ContextSpecificTag(TAG_STATUS), status) + endStructure() + } + } + + companion object { + private const val TAG_ASSOCIATION_FAILURE = 0 + private const val TAG_STATUS = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): WiFiNetworkDiagnosticsClusterAssociationFailureEvent { + tlvReader.enterStructure(tag) + val associationFailure = tlvReader.getInt(ContextSpecificTag(TAG_ASSOCIATION_FAILURE)) + val status = tlvReader.getInt(ContextSpecificTag(TAG_STATUS)) + + tlvReader.exitContainer() + + return WiFiNetworkDiagnosticsClusterAssociationFailureEvent(associationFailure, status) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterConnectionStatusEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterConnectionStatusEvent.kt new file mode 100644 index 00000000000000..3599597c99b152 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterConnectionStatusEvent.kt @@ -0,0 +1,55 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class WiFiNetworkDiagnosticsClusterConnectionStatusEvent(val connectionStatus: Int) { + override fun toString(): String = buildString { + append("WiFiNetworkDiagnosticsClusterConnectionStatusEvent {\n") + append("\tconnectionStatus : $connectionStatus\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_CONNECTION_STATUS), connectionStatus) + endStructure() + } + } + + companion object { + private const val TAG_CONNECTION_STATUS = 0 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): WiFiNetworkDiagnosticsClusterConnectionStatusEvent { + tlvReader.enterStructure(tag) + val connectionStatus = tlvReader.getInt(ContextSpecificTag(TAG_CONNECTION_STATUS)) + + tlvReader.exitContainer() + + return WiFiNetworkDiagnosticsClusterConnectionStatusEvent(connectionStatus) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterDisconnectionEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterDisconnectionEvent.kt new file mode 100644 index 00000000000000..6d54ae4f2bfdcd --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterDisconnectionEvent.kt @@ -0,0 +1,52 @@ +/* + * + * 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.eventstructs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class WiFiNetworkDiagnosticsClusterDisconnectionEvent(val reasonCode: Int) { + override fun toString(): String = buildString { + append("WiFiNetworkDiagnosticsClusterDisconnectionEvent {\n") + append("\treasonCode : $reasonCode\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_REASON_CODE), reasonCode) + endStructure() + } + } + + companion object { + private const val TAG_REASON_CODE = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): WiFiNetworkDiagnosticsClusterDisconnectionEvent { + tlvReader.enterStructure(tag) + val reasonCode = tlvReader.getInt(ContextSpecificTag(TAG_REASON_CODE)) + + tlvReader.exitContainer() + + return WiFiNetworkDiagnosticsClusterDisconnectionEvent(reasonCode) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlEntryStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlEntryStruct.kt new file mode 100644 index 00000000000000..6daac4451c1833 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlEntryStruct.kt @@ -0,0 +1,121 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class AccessControlClusterAccessControlEntryStruct( + val privilege: Int, + val authMode: Int, + val subjects: List?, + val targets: List?, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("AccessControlClusterAccessControlEntryStruct {\n") + append("\tprivilege : $privilege\n") + append("\tauthMode : $authMode\n") + append("\tsubjects : $subjects\n") + append("\ttargets : $targets\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRIVILEGE), privilege) + put(ContextSpecificTag(TAG_AUTH_MODE), authMode) + if (subjects != null) { + startList(ContextSpecificTag(TAG_SUBJECTS)) + for (item in subjects.iterator()) { + put(AnonymousTag, item) + } + endList() + } else { + putNull(ContextSpecificTag(TAG_SUBJECTS)) + } + if (targets != null) { + startList(ContextSpecificTag(TAG_TARGETS)) + for (item in targets.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + } else { + putNull(ContextSpecificTag(TAG_TARGETS)) + } + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_PRIVILEGE = 1 + private const val TAG_AUTH_MODE = 2 + private const val TAG_SUBJECTS = 3 + private const val TAG_TARGETS = 4 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): AccessControlClusterAccessControlEntryStruct { + tlvReader.enterStructure(tag) + val privilege = tlvReader.getInt(ContextSpecificTag(TAG_PRIVILEGE)) + val authMode = tlvReader.getInt(ContextSpecificTag(TAG_AUTH_MODE)) + val subjects = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_SUBJECTS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getLong(AnonymousTag)) + } + tlvReader.exitContainer() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_SUBJECTS)) + null + } + val targets = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_TARGETS)) + while (!tlvReader.isEndOfContainer()) { + add(AccessControlClusterAccessControlTargetStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_TARGETS)) + null + } + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return AccessControlClusterAccessControlEntryStruct( + privilege, + authMode, + subjects, + targets, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlExtensionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlExtensionStruct.kt new file mode 100644 index 00000000000000..4a1d95221d816c --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlExtensionStruct.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class AccessControlClusterAccessControlExtensionStruct(val data: ByteArray, val fabricIndex: Int) { + override fun toString(): String = buildString { + append("AccessControlClusterAccessControlExtensionStruct {\n") + append("\tdata : $data\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_DATA), data) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_DATA = 1 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): AccessControlClusterAccessControlExtensionStruct { + tlvReader.enterStructure(tag) + val data = tlvReader.getByteArray(ContextSpecificTag(TAG_DATA)) + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return AccessControlClusterAccessControlExtensionStruct(data, fabricIndex) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlTargetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlTargetStruct.kt new file mode 100644 index 00000000000000..e721aa3fefe91d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlTargetStruct.kt @@ -0,0 +1,94 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class AccessControlClusterAccessControlTargetStruct( + val cluster: Long?, + val endpoint: Int?, + val deviceType: Long? +) { + override fun toString(): String = buildString { + append("AccessControlClusterAccessControlTargetStruct {\n") + append("\tcluster : $cluster\n") + append("\tendpoint : $endpoint\n") + append("\tdeviceType : $deviceType\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + if (cluster != null) { + put(ContextSpecificTag(TAG_CLUSTER), cluster) + } else { + putNull(ContextSpecificTag(TAG_CLUSTER)) + } + if (endpoint != null) { + put(ContextSpecificTag(TAG_ENDPOINT), endpoint) + } else { + putNull(ContextSpecificTag(TAG_ENDPOINT)) + } + if (deviceType != null) { + put(ContextSpecificTag(TAG_DEVICE_TYPE), deviceType) + } else { + putNull(ContextSpecificTag(TAG_DEVICE_TYPE)) + } + endStructure() + } + } + + companion object { + private const val TAG_CLUSTER = 0 + private const val TAG_ENDPOINT = 1 + private const val TAG_DEVICE_TYPE = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): AccessControlClusterAccessControlTargetStruct { + tlvReader.enterStructure(tag) + val cluster = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_CLUSTER)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_CLUSTER)) + null + } + val endpoint = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_ENDPOINT)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ENDPOINT)) + null + } + val deviceType = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_DEVICE_TYPE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_DEVICE_TYPE)) + null + } + + tlvReader.exitContainer() + + return AccessControlClusterAccessControlTargetStruct(cluster, endpoint, deviceType) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterActionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterActionStruct.kt new file mode 100644 index 00000000000000..2ed7a3f08152be --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterActionStruct.kt @@ -0,0 +1,86 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ActionsClusterActionStruct( + val actionID: Int, + val name: String, + val type: Int, + val endpointListID: Int, + val supportedCommands: Int, + val state: Int +) { + override fun toString(): String = buildString { + append("ActionsClusterActionStruct {\n") + append("\tactionID : $actionID\n") + append("\tname : $name\n") + append("\ttype : $type\n") + append("\tendpointListID : $endpointListID\n") + append("\tsupportedCommands : $supportedCommands\n") + append("\tstate : $state\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ACTION_I_D), actionID) + put(ContextSpecificTag(TAG_NAME), name) + put(ContextSpecificTag(TAG_TYPE), type) + put(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D), endpointListID) + put(ContextSpecificTag(TAG_SUPPORTED_COMMANDS), supportedCommands) + put(ContextSpecificTag(TAG_STATE), state) + endStructure() + } + } + + companion object { + private const val TAG_ACTION_I_D = 0 + private const val TAG_NAME = 1 + private const val TAG_TYPE = 2 + private const val TAG_ENDPOINT_LIST_I_D = 3 + private const val TAG_SUPPORTED_COMMANDS = 4 + private const val TAG_STATE = 5 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ActionsClusterActionStruct { + tlvReader.enterStructure(tag) + val actionID = tlvReader.getInt(ContextSpecificTag(TAG_ACTION_I_D)) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + val type = tlvReader.getInt(ContextSpecificTag(TAG_TYPE)) + val endpointListID = tlvReader.getInt(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D)) + val supportedCommands = tlvReader.getInt(ContextSpecificTag(TAG_SUPPORTED_COMMANDS)) + val state = tlvReader.getInt(ContextSpecificTag(TAG_STATE)) + + tlvReader.exitContainer() + + return ActionsClusterActionStruct( + actionID, + name, + type, + endpointListID, + supportedCommands, + state + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterEndpointListStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterEndpointListStruct.kt new file mode 100644 index 00000000000000..b714e693156957 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterEndpointListStruct.kt @@ -0,0 +1,81 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ActionsClusterEndpointListStruct( + val endpointListID: Int, + val name: String, + val type: Int, + val endpoints: List +) { + override fun toString(): String = buildString { + append("ActionsClusterEndpointListStruct {\n") + append("\tendpointListID : $endpointListID\n") + append("\tname : $name\n") + append("\ttype : $type\n") + append("\tendpoints : $endpoints\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D), endpointListID) + put(ContextSpecificTag(TAG_NAME), name) + put(ContextSpecificTag(TAG_TYPE), type) + startList(ContextSpecificTag(TAG_ENDPOINTS)) + for (item in endpoints.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_ENDPOINT_LIST_I_D = 0 + private const val TAG_NAME = 1 + private const val TAG_TYPE = 2 + private const val TAG_ENDPOINTS = 3 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ActionsClusterEndpointListStruct { + tlvReader.enterStructure(tag) + val endpointListID = tlvReader.getInt(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D)) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + val type = tlvReader.getInt(ContextSpecificTag(TAG_TYPE)) + val endpoints = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_ENDPOINTS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ActionsClusterEndpointListStruct(endpointListID, name, type, endpoints) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActivatedCarbonFilterMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActivatedCarbonFilterMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..68a44d37dfff0f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActivatedCarbonFilterMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ActivatedCarbonFilterMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("ActivatedCarbonFilterMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): ActivatedCarbonFilterMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return ActivatedCarbonFilterMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt new file mode 100644 index 00000000000000..21649a8ecc73df --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt @@ -0,0 +1,59 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ApplicationBasicClusterApplicationStruct( + val catalogVendorID: Int, + val applicationID: String +) { + override fun toString(): String = buildString { + append("ApplicationBasicClusterApplicationStruct {\n") + append("\tcatalogVendorID : $catalogVendorID\n") + append("\tapplicationID : $applicationID\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D), catalogVendorID) + put(ContextSpecificTag(TAG_APPLICATION_I_D), applicationID) + endStructure() + } + } + + companion object { + private const val TAG_CATALOG_VENDOR_I_D = 0 + private const val TAG_APPLICATION_I_D = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ApplicationBasicClusterApplicationStruct { + tlvReader.enterStructure(tag) + val catalogVendorID = tlvReader.getInt(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D)) + val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_I_D)) + + tlvReader.exitContainer() + + return ApplicationBasicClusterApplicationStruct(catalogVendorID, applicationID) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationEPStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationEPStruct.kt new file mode 100644 index 00000000000000..f710204737cb52 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationEPStruct.kt @@ -0,0 +1,72 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class ApplicationLauncherClusterApplicationEPStruct( + val application: ApplicationLauncherClusterApplicationStruct, + val endpoint: Optional +) { + override fun toString(): String = buildString { + append("ApplicationLauncherClusterApplicationEPStruct {\n") + append("\tapplication : $application\n") + append("\tendpoint : $endpoint\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + application.toTlv(ContextSpecificTag(TAG_APPLICATION), this) + if (endpoint.isPresent) { + val optendpoint = endpoint.get() + put(ContextSpecificTag(TAG_ENDPOINT), optendpoint) + } + endStructure() + } + } + + companion object { + private const val TAG_APPLICATION = 0 + private const val TAG_ENDPOINT = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ApplicationLauncherClusterApplicationEPStruct { + tlvReader.enterStructure(tag) + val application = + ApplicationLauncherClusterApplicationStruct.fromTlv( + ContextSpecificTag(TAG_APPLICATION), + tlvReader + ) + val endpoint = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENDPOINT))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_ENDPOINT))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ApplicationLauncherClusterApplicationEPStruct(application, endpoint) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt new file mode 100644 index 00000000000000..68e78e31084c04 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt @@ -0,0 +1,59 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ApplicationLauncherClusterApplicationStruct( + val catalogVendorID: Int, + val applicationID: String +) { + override fun toString(): String = buildString { + append("ApplicationLauncherClusterApplicationStruct {\n") + append("\tcatalogVendorID : $catalogVendorID\n") + append("\tapplicationID : $applicationID\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D), catalogVendorID) + put(ContextSpecificTag(TAG_APPLICATION_I_D), applicationID) + endStructure() + } + } + + companion object { + private const val TAG_CATALOG_VENDOR_I_D = 0 + private const val TAG_APPLICATION_I_D = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ApplicationLauncherClusterApplicationStruct { + tlvReader.enterStructure(tag) + val catalogVendorID = tlvReader.getInt(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D)) + val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_I_D)) + + tlvReader.exitContainer() + + return ApplicationLauncherClusterApplicationStruct(catalogVendorID, applicationID) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AudioOutputClusterOutputInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AudioOutputClusterOutputInfoStruct.kt new file mode 100644 index 00000000000000..aef8596f19a83c --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AudioOutputClusterOutputInfoStruct.kt @@ -0,0 +1,60 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class AudioOutputClusterOutputInfoStruct(val index: Int, val outputType: Int, val name: String) { + override fun toString(): String = buildString { + append("AudioOutputClusterOutputInfoStruct {\n") + append("\tindex : $index\n") + append("\toutputType : $outputType\n") + append("\tname : $name\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_INDEX), index) + put(ContextSpecificTag(TAG_OUTPUT_TYPE), outputType) + put(ContextSpecificTag(TAG_NAME), name) + endStructure() + } + } + + companion object { + private const val TAG_INDEX = 0 + private const val TAG_OUTPUT_TYPE = 1 + private const val TAG_NAME = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): AudioOutputClusterOutputInfoStruct { + tlvReader.enterStructure(tag) + val index = tlvReader.getInt(ContextSpecificTag(TAG_INDEX)) + val outputType = tlvReader.getInt(ContextSpecificTag(TAG_OUTPUT_TYPE)) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + + tlvReader.exitContainer() + + return AudioOutputClusterOutputInfoStruct(index, outputType, name) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BasicInformationClusterCapabilityMinimaStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BasicInformationClusterCapabilityMinimaStruct.kt new file mode 100644 index 00000000000000..e4f323b6321541 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BasicInformationClusterCapabilityMinimaStruct.kt @@ -0,0 +1,63 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class BasicInformationClusterCapabilityMinimaStruct( + val caseSessionsPerFabric: Int, + val subscriptionsPerFabric: Int +) { + override fun toString(): String = buildString { + append("BasicInformationClusterCapabilityMinimaStruct {\n") + append("\tcaseSessionsPerFabric : $caseSessionsPerFabric\n") + append("\tsubscriptionsPerFabric : $subscriptionsPerFabric\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_CASE_SESSIONS_PER_FABRIC), caseSessionsPerFabric) + put(ContextSpecificTag(TAG_SUBSCRIPTIONS_PER_FABRIC), subscriptionsPerFabric) + endStructure() + } + } + + companion object { + private const val TAG_CASE_SESSIONS_PER_FABRIC = 0 + private const val TAG_SUBSCRIPTIONS_PER_FABRIC = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): BasicInformationClusterCapabilityMinimaStruct { + tlvReader.enterStructure(tag) + val caseSessionsPerFabric = tlvReader.getInt(ContextSpecificTag(TAG_CASE_SESSIONS_PER_FABRIC)) + val subscriptionsPerFabric = + tlvReader.getInt(ContextSpecificTag(TAG_SUBSCRIPTIONS_PER_FABRIC)) + + tlvReader.exitContainer() + + return BasicInformationClusterCapabilityMinimaStruct( + caseSessionsPerFabric, + subscriptionsPerFabric + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BasicInformationClusterProductAppearanceStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BasicInformationClusterProductAppearanceStruct.kt new file mode 100644 index 00000000000000..3678494c7b90fb --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BasicInformationClusterProductAppearanceStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class BasicInformationClusterProductAppearanceStruct(val finish: Int, val primaryColor: Int?) { + override fun toString(): String = buildString { + append("BasicInformationClusterProductAppearanceStruct {\n") + append("\tfinish : $finish\n") + append("\tprimaryColor : $primaryColor\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_FINISH), finish) + if (primaryColor != null) { + put(ContextSpecificTag(TAG_PRIMARY_COLOR), primaryColor) + } else { + putNull(ContextSpecificTag(TAG_PRIMARY_COLOR)) + } + endStructure() + } + } + + companion object { + private const val TAG_FINISH = 0 + private const val TAG_PRIMARY_COLOR = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): BasicInformationClusterProductAppearanceStruct { + tlvReader.enterStructure(tag) + val finish = tlvReader.getInt(ContextSpecificTag(TAG_FINISH)) + val primaryColor = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_PRIMARY_COLOR)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_PRIMARY_COLOR)) + null + } + + tlvReader.exitContainer() + + return BasicInformationClusterProductAppearanceStruct(finish, primaryColor) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BindingClusterTargetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BindingClusterTargetStruct.kt new file mode 100644 index 00000000000000..8ab0146b8e95f3 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BindingClusterTargetStruct.kt @@ -0,0 +1,107 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class BindingClusterTargetStruct( + val node: Optional, + val group: Optional, + val endpoint: Optional, + val cluster: Optional, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("BindingClusterTargetStruct {\n") + append("\tnode : $node\n") + append("\tgroup : $group\n") + append("\tendpoint : $endpoint\n") + append("\tcluster : $cluster\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + if (node.isPresent) { + val optnode = node.get() + put(ContextSpecificTag(TAG_NODE), optnode) + } + if (group.isPresent) { + val optgroup = group.get() + put(ContextSpecificTag(TAG_GROUP), optgroup) + } + if (endpoint.isPresent) { + val optendpoint = endpoint.get() + put(ContextSpecificTag(TAG_ENDPOINT), optendpoint) + } + if (cluster.isPresent) { + val optcluster = cluster.get() + put(ContextSpecificTag(TAG_CLUSTER), optcluster) + } + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_NODE = 1 + private const val TAG_GROUP = 2 + private const val TAG_ENDPOINT = 3 + private const val TAG_CLUSTER = 4 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): BindingClusterTargetStruct { + tlvReader.enterStructure(tag) + val node = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NODE))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_NODE))) + } else { + Optional.empty() + } + val group = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_GROUP))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_GROUP))) + } else { + Optional.empty() + } + val endpoint = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENDPOINT))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_ENDPOINT))) + } else { + Optional.empty() + } + val cluster = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CLUSTER))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_CLUSTER))) + } else { + Optional.empty() + } + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return BindingClusterTargetStruct(node, group, endpoint, cluster, fabricIndex) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BridgedDeviceBasicInformationClusterProductAppearanceStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BridgedDeviceBasicInformationClusterProductAppearanceStruct.kt new file mode 100644 index 00000000000000..d1426bc0828631 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BridgedDeviceBasicInformationClusterProductAppearanceStruct.kt @@ -0,0 +1,72 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class BridgedDeviceBasicInformationClusterProductAppearanceStruct( + val finish: Int, + val primaryColor: Int? +) { + override fun toString(): String = buildString { + append("BridgedDeviceBasicInformationClusterProductAppearanceStruct {\n") + append("\tfinish : $finish\n") + append("\tprimaryColor : $primaryColor\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_FINISH), finish) + if (primaryColor != null) { + put(ContextSpecificTag(TAG_PRIMARY_COLOR), primaryColor) + } else { + putNull(ContextSpecificTag(TAG_PRIMARY_COLOR)) + } + endStructure() + } + } + + companion object { + private const val TAG_FINISH = 0 + private const val TAG_PRIMARY_COLOR = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): BridgedDeviceBasicInformationClusterProductAppearanceStruct { + tlvReader.enterStructure(tag) + val finish = tlvReader.getInt(ContextSpecificTag(TAG_FINISH)) + val primaryColor = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_PRIMARY_COLOR)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_PRIMARY_COLOR)) + null + } + + tlvReader.exitContainer() + + return BridgedDeviceBasicInformationClusterProductAppearanceStruct(finish, primaryColor) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CeramicFilterMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CeramicFilterMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..391f4d7ed01f40 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CeramicFilterMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class CeramicFilterMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("CeramicFilterMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): CeramicFilterMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return CeramicFilterMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterChannelInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterChannelInfoStruct.kt new file mode 100644 index 00000000000000..9d10bf6f24e5fa --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterChannelInfoStruct.kt @@ -0,0 +1,105 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class ChannelClusterChannelInfoStruct( + val majorNumber: Int, + val minorNumber: Int, + val name: Optional, + val callSign: Optional, + val affiliateCallSign: Optional +) { + override fun toString(): String = buildString { + append("ChannelClusterChannelInfoStruct {\n") + append("\tmajorNumber : $majorNumber\n") + append("\tminorNumber : $minorNumber\n") + append("\tname : $name\n") + append("\tcallSign : $callSign\n") + append("\taffiliateCallSign : $affiliateCallSign\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_MAJOR_NUMBER), majorNumber) + put(ContextSpecificTag(TAG_MINOR_NUMBER), minorNumber) + if (name.isPresent) { + val optname = name.get() + put(ContextSpecificTag(TAG_NAME), optname) + } + if (callSign.isPresent) { + val optcallSign = callSign.get() + put(ContextSpecificTag(TAG_CALL_SIGN), optcallSign) + } + if (affiliateCallSign.isPresent) { + val optaffiliateCallSign = affiliateCallSign.get() + put(ContextSpecificTag(TAG_AFFILIATE_CALL_SIGN), optaffiliateCallSign) + } + endStructure() + } + } + + companion object { + private const val TAG_MAJOR_NUMBER = 0 + private const val TAG_MINOR_NUMBER = 1 + private const val TAG_NAME = 2 + private const val TAG_CALL_SIGN = 3 + private const val TAG_AFFILIATE_CALL_SIGN = 4 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ChannelClusterChannelInfoStruct { + tlvReader.enterStructure(tag) + val majorNumber = tlvReader.getInt(ContextSpecificTag(TAG_MAJOR_NUMBER)) + val minorNumber = tlvReader.getInt(ContextSpecificTag(TAG_MINOR_NUMBER)) + val name = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_NAME))) + } else { + Optional.empty() + } + val callSign = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_CALL_SIGN))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_CALL_SIGN))) + } else { + Optional.empty() + } + val affiliateCallSign = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_AFFILIATE_CALL_SIGN))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_AFFILIATE_CALL_SIGN))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ChannelClusterChannelInfoStruct( + majorNumber, + minorNumber, + name, + callSign, + affiliateCallSign + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterLineupInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterLineupInfoStruct.kt new file mode 100644 index 00000000000000..edc8f9157db120 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterLineupInfoStruct.kt @@ -0,0 +1,86 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class ChannelClusterLineupInfoStruct( + val operatorName: String, + val lineupName: Optional, + val postalCode: Optional, + val lineupInfoType: Int +) { + override fun toString(): String = buildString { + append("ChannelClusterLineupInfoStruct {\n") + append("\toperatorName : $operatorName\n") + append("\tlineupName : $lineupName\n") + append("\tpostalCode : $postalCode\n") + append("\tlineupInfoType : $lineupInfoType\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_OPERATOR_NAME), operatorName) + if (lineupName.isPresent) { + val optlineupName = lineupName.get() + put(ContextSpecificTag(TAG_LINEUP_NAME), optlineupName) + } + if (postalCode.isPresent) { + val optpostalCode = postalCode.get() + put(ContextSpecificTag(TAG_POSTAL_CODE), optpostalCode) + } + put(ContextSpecificTag(TAG_LINEUP_INFO_TYPE), lineupInfoType) + endStructure() + } + } + + companion object { + private const val TAG_OPERATOR_NAME = 0 + private const val TAG_LINEUP_NAME = 1 + private const val TAG_POSTAL_CODE = 2 + private const val TAG_LINEUP_INFO_TYPE = 3 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ChannelClusterLineupInfoStruct { + tlvReader.enterStructure(tag) + val operatorName = tlvReader.getString(ContextSpecificTag(TAG_OPERATOR_NAME)) + val lineupName = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_LINEUP_NAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_LINEUP_NAME))) + } else { + Optional.empty() + } + val postalCode = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_POSTAL_CODE))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_POSTAL_CODE))) + } else { + Optional.empty() + } + val lineupInfoType = tlvReader.getInt(ContextSpecificTag(TAG_LINEUP_INFO_TYPE)) + + tlvReader.exitContainer() + + return ChannelClusterLineupInfoStruct(operatorName, lineupName, postalCode, lineupInfoType) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterAdditionalInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterAdditionalInfoStruct.kt new file mode 100644 index 00000000000000..0e1ebee9f97df2 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterAdditionalInfoStruct.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ContentLauncherClusterAdditionalInfoStruct(val name: String, val value: String) { + override fun toString(): String = buildString { + append("ContentLauncherClusterAdditionalInfoStruct {\n") + append("\tname : $name\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_NAME), name) + put(ContextSpecificTag(TAG_VALUE), value) + endStructure() + } + } + + companion object { + private const val TAG_NAME = 0 + private const val TAG_VALUE = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ContentLauncherClusterAdditionalInfoStruct { + tlvReader.enterStructure(tag) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + val value = tlvReader.getString(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return ContentLauncherClusterAdditionalInfoStruct(name, value) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterBrandingInformationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterBrandingInformationStruct.kt new file mode 100644 index 00000000000000..5f4719e9c00ef8 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterBrandingInformationStruct.kt @@ -0,0 +1,152 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class ContentLauncherClusterBrandingInformationStruct( + val providerName: String, + val background: Optional, + val logo: Optional, + val progressBar: Optional, + val splash: Optional, + val waterMark: Optional +) { + override fun toString(): String = buildString { + append("ContentLauncherClusterBrandingInformationStruct {\n") + append("\tproviderName : $providerName\n") + append("\tbackground : $background\n") + append("\tlogo : $logo\n") + append("\tprogressBar : $progressBar\n") + append("\tsplash : $splash\n") + append("\twaterMark : $waterMark\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PROVIDER_NAME), providerName) + if (background.isPresent) { + val optbackground = background.get() + optbackground.toTlv(ContextSpecificTag(TAG_BACKGROUND), this) + } + if (logo.isPresent) { + val optlogo = logo.get() + optlogo.toTlv(ContextSpecificTag(TAG_LOGO), this) + } + if (progressBar.isPresent) { + val optprogressBar = progressBar.get() + optprogressBar.toTlv(ContextSpecificTag(TAG_PROGRESS_BAR), this) + } + if (splash.isPresent) { + val optsplash = splash.get() + optsplash.toTlv(ContextSpecificTag(TAG_SPLASH), this) + } + if (waterMark.isPresent) { + val optwaterMark = waterMark.get() + optwaterMark.toTlv(ContextSpecificTag(TAG_WATER_MARK), this) + } + endStructure() + } + } + + companion object { + private const val TAG_PROVIDER_NAME = 0 + private const val TAG_BACKGROUND = 1 + private const val TAG_LOGO = 2 + private const val TAG_PROGRESS_BAR = 3 + private const val TAG_SPLASH = 4 + private const val TAG_WATER_MARK = 5 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ContentLauncherClusterBrandingInformationStruct { + tlvReader.enterStructure(tag) + val providerName = tlvReader.getString(ContextSpecificTag(TAG_PROVIDER_NAME)) + val background = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_BACKGROUND))) { + Optional.of( + ContentLauncherClusterStyleInformationStruct.fromTlv( + ContextSpecificTag(TAG_BACKGROUND), + tlvReader + ) + ) + } else { + Optional.empty() + } + val logo = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_LOGO))) { + Optional.of( + ContentLauncherClusterStyleInformationStruct.fromTlv( + ContextSpecificTag(TAG_LOGO), + tlvReader + ) + ) + } else { + Optional.empty() + } + val progressBar = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PROGRESS_BAR))) { + Optional.of( + ContentLauncherClusterStyleInformationStruct.fromTlv( + ContextSpecificTag(TAG_PROGRESS_BAR), + tlvReader + ) + ) + } else { + Optional.empty() + } + val splash = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_SPLASH))) { + Optional.of( + ContentLauncherClusterStyleInformationStruct.fromTlv( + ContextSpecificTag(TAG_SPLASH), + tlvReader + ) + ) + } else { + Optional.empty() + } + val waterMark = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_WATER_MARK))) { + Optional.of( + ContentLauncherClusterStyleInformationStruct.fromTlv( + ContextSpecificTag(TAG_WATER_MARK), + tlvReader + ) + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ContentLauncherClusterBrandingInformationStruct( + providerName, + background, + logo, + progressBar, + splash, + waterMark + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterContentSearchStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterContentSearchStruct.kt new file mode 100644 index 00000000000000..9457b03907a4fb --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterContentSearchStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ContentLauncherClusterContentSearchStruct( + val parameterList: List +) { + override fun toString(): String = buildString { + append("ContentLauncherClusterContentSearchStruct {\n") + append("\tparameterList : $parameterList\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_PARAMETER_LIST)) + for (item in parameterList.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_PARAMETER_LIST = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ContentLauncherClusterContentSearchStruct { + tlvReader.enterStructure(tag) + val parameterList = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PARAMETER_LIST)) + while (!tlvReader.isEndOfContainer()) { + add(ContentLauncherClusterParameterStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ContentLauncherClusterContentSearchStruct(parameterList) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterDimensionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterDimensionStruct.kt new file mode 100644 index 00000000000000..a38245918bb476 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterDimensionStruct.kt @@ -0,0 +1,64 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ContentLauncherClusterDimensionStruct( + val width: Double, + val height: Double, + val metric: Int +) { + override fun toString(): String = buildString { + append("ContentLauncherClusterDimensionStruct {\n") + append("\twidth : $width\n") + append("\theight : $height\n") + append("\tmetric : $metric\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_WIDTH), width) + put(ContextSpecificTag(TAG_HEIGHT), height) + put(ContextSpecificTag(TAG_METRIC), metric) + endStructure() + } + } + + companion object { + private const val TAG_WIDTH = 0 + private const val TAG_HEIGHT = 1 + private const val TAG_METRIC = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ContentLauncherClusterDimensionStruct { + tlvReader.enterStructure(tag) + val width = tlvReader.getDouble(ContextSpecificTag(TAG_WIDTH)) + val height = tlvReader.getDouble(ContextSpecificTag(TAG_HEIGHT)) + val metric = tlvReader.getInt(ContextSpecificTag(TAG_METRIC)) + + tlvReader.exitContainer() + + return ContentLauncherClusterDimensionStruct(width, height, metric) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt new file mode 100644 index 00000000000000..caf0f99848c93c --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt @@ -0,0 +1,86 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class ContentLauncherClusterParameterStruct( + val type: Int, + val value: String, + val externalIDList: Optional> +) { + override fun toString(): String = buildString { + append("ContentLauncherClusterParameterStruct {\n") + append("\ttype : $type\n") + append("\tvalue : $value\n") + append("\texternalIDList : $externalIDList\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_TYPE), type) + put(ContextSpecificTag(TAG_VALUE), value) + if (externalIDList.isPresent) { + val optexternalIDList = externalIDList.get() + startList(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + for (item in optexternalIDList.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + } + endStructure() + } + } + + companion object { + private const val TAG_TYPE = 0 + private const val TAG_VALUE = 1 + private const val TAG_EXTERNAL_I_D_LIST = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ContentLauncherClusterParameterStruct { + tlvReader.enterStructure(tag) + val type = tlvReader.getInt(ContextSpecificTag(TAG_TYPE)) + val value = tlvReader.getString(ContextSpecificTag(TAG_VALUE)) + val externalIDList = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST))) { + Optional.of( + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + while (!tlvReader.isEndOfContainer()) { + add(ContentLauncherClusterAdditionalInfoStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ContentLauncherClusterParameterStruct(type, value, externalIDList) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt new file mode 100644 index 00000000000000..d5e686bbb5ac45 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt @@ -0,0 +1,91 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class ContentLauncherClusterStyleInformationStruct( + val imageURL: Optional, + val color: Optional, + val size: Optional +) { + override fun toString(): String = buildString { + append("ContentLauncherClusterStyleInformationStruct {\n") + append("\timageURL : $imageURL\n") + append("\tcolor : $color\n") + append("\tsize : $size\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + if (imageURL.isPresent) { + val optimageURL = imageURL.get() + put(ContextSpecificTag(TAG_IMAGE_U_R_L), optimageURL) + } + if (color.isPresent) { + val optcolor = color.get() + put(ContextSpecificTag(TAG_COLOR), optcolor) + } + if (size.isPresent) { + val optsize = size.get() + optsize.toTlv(ContextSpecificTag(TAG_SIZE), this) + } + endStructure() + } + } + + companion object { + private const val TAG_IMAGE_U_R_L = 0 + private const val TAG_COLOR = 1 + private const val TAG_SIZE = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ContentLauncherClusterStyleInformationStruct { + tlvReader.enterStructure(tag) + val imageURL = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_IMAGE_U_R_L))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_IMAGE_U_R_L))) + } else { + Optional.empty() + } + val color = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_COLOR))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_COLOR))) + } else { + Optional.empty() + } + val size = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_SIZE))) { + Optional.of( + ContentLauncherClusterDimensionStruct.fromTlv(ContextSpecificTag(TAG_SIZE), tlvReader) + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ContentLauncherClusterStyleInformationStruct(imageURL, color, size) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterDeviceTypeStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterDeviceTypeStruct.kt new file mode 100644 index 00000000000000..75fed36957e726 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterDeviceTypeStruct.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class DescriptorClusterDeviceTypeStruct(val deviceType: Long, val revision: Int) { + override fun toString(): String = buildString { + append("DescriptorClusterDeviceTypeStruct {\n") + append("\tdeviceType : $deviceType\n") + append("\trevision : $revision\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_DEVICE_TYPE), deviceType) + put(ContextSpecificTag(TAG_REVISION), revision) + endStructure() + } + } + + companion object { + private const val TAG_DEVICE_TYPE = 0 + private const val TAG_REVISION = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DescriptorClusterDeviceTypeStruct { + tlvReader.enterStructure(tag) + val deviceType = tlvReader.getLong(ContextSpecificTag(TAG_DEVICE_TYPE)) + val revision = tlvReader.getInt(ContextSpecificTag(TAG_REVISION)) + + tlvReader.exitContainer() + + return DescriptorClusterDeviceTypeStruct(deviceType, revision) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterSemanticTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterSemanticTagStruct.kt new file mode 100644 index 00000000000000..abde881ccffcea --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterSemanticTagStruct.kt @@ -0,0 +1,97 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class DescriptorClusterSemanticTagStruct( + val mfgCode: Int?, + val namespaceID: Int, + val tag: Int, + val label: Optional? +) { + override fun toString(): String = buildString { + append("DescriptorClusterSemanticTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tnamespaceID : $namespaceID\n") + append("\ttag : $tag\n") + append("\tlabel : $label\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + if (mfgCode != null) { + put(ContextSpecificTag(TAG_MFG_CODE), mfgCode) + } else { + putNull(ContextSpecificTag(TAG_MFG_CODE)) + } + put(ContextSpecificTag(TAG_NAMESPACE_I_D), namespaceID) + put(ContextSpecificTag(TAG_TAG), tag) + if (label != null) { + if (label.isPresent) { + val optlabel = label.get() + put(ContextSpecificTag(TAG_LABEL), optlabel) + } + } else { + putNull(ContextSpecificTag(TAG_LABEL)) + } + endStructure() + } + } + + companion object { + private const val TAG_MFG_CODE = 0 + private const val TAG_NAMESPACE_I_D = 1 + private const val TAG_TAG = 2 + private const val TAG_LABEL = 3 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DescriptorClusterSemanticTagStruct { + tlvReader.enterStructure(tag) + val mfgCode = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_MFG_CODE)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_MFG_CODE)) + null + } + val namespaceID = tlvReader.getInt(ContextSpecificTag(TAG_NAMESPACE_I_D)) + val tag = tlvReader.getInt(ContextSpecificTag(TAG_TAG)) + val label = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_LABEL))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_LABEL))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_LABEL)) + null + } + + tlvReader.exitContainer() + + return DescriptorClusterSemanticTagStruct(mfgCode, namespaceID, tag, label) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt new file mode 100644 index 00000000000000..423d6a554672ce --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeOptionStruct.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 chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class DishwasherModeClusterModeOptionStruct( + val label: String, + val mode: Int, + val modeTags: List +) { + override fun toString(): String = buildString { + append("DishwasherModeClusterModeOptionStruct {\n") + append("\tlabel : $label\n") + append("\tmode : $mode\n") + append("\tmodeTags : $modeTags\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_MODE), mode) + startList(ContextSpecificTag(TAG_MODE_TAGS)) + for (item in modeTags.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_MODE = 1 + private const val TAG_MODE_TAGS = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DishwasherModeClusterModeOptionStruct { + tlvReader.enterStructure(tag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val mode = tlvReader.getInt(ContextSpecificTag(TAG_MODE)) + val modeTags = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_MODE_TAGS)) + while (!tlvReader.isEndOfContainer()) { + add(DishwasherModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return DishwasherModeClusterModeOptionStruct(label, mode, modeTags) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeTagStruct.kt new file mode 100644 index 00000000000000..33881f4ac00c8d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeTagStruct.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 chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class DishwasherModeClusterModeTagStruct(val mfgCode: Optional, val value: Int) { + override fun toString(): String = buildString { + append("DishwasherModeClusterModeTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + 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(tag: Tag, tlvReader: TlvReader): DishwasherModeClusterModeTagStruct { + tlvReader.enterStructure(tag) + val mfgCode = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_MFG_CODE))) + } else { + Optional.empty() + } + val value = tlvReader.getInt(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return DishwasherModeClusterModeTagStruct(mfgCode, value) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DoorLockClusterCredentialStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DoorLockClusterCredentialStruct.kt new file mode 100644 index 00000000000000..da3a551267eb09 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DoorLockClusterCredentialStruct.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class DoorLockClusterCredentialStruct(val credentialType: Int, val credentialIndex: Int) { + override fun toString(): String = buildString { + append("DoorLockClusterCredentialStruct {\n") + append("\tcredentialType : $credentialType\n") + append("\tcredentialIndex : $credentialIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_CREDENTIAL_TYPE), credentialType) + put(ContextSpecificTag(TAG_CREDENTIAL_INDEX), credentialIndex) + endStructure() + } + } + + companion object { + private const val TAG_CREDENTIAL_TYPE = 0 + private const val TAG_CREDENTIAL_INDEX = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): DoorLockClusterCredentialStruct { + tlvReader.enterStructure(tag) + val credentialType = tlvReader.getInt(ContextSpecificTag(TAG_CREDENTIAL_TYPE)) + val credentialIndex = tlvReader.getInt(ContextSpecificTag(TAG_CREDENTIAL_INDEX)) + + tlvReader.exitContainer() + + return DoorLockClusterCredentialStruct(credentialType, credentialIndex) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectrostaticFilterMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectrostaticFilterMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..4997a33f64aebd --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectrostaticFilterMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ElectrostaticFilterMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("ElectrostaticFilterMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): ElectrostaticFilterMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return ElectrostaticFilterMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FixedLabelClusterLabelStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FixedLabelClusterLabelStruct.kt new file mode 100644 index 00000000000000..09292f726d9467 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FixedLabelClusterLabelStruct.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class FixedLabelClusterLabelStruct(val label: String, val value: String) { + override fun toString(): String = buildString { + append("FixedLabelClusterLabelStruct {\n") + append("\tlabel : $label\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_VALUE), value) + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_VALUE = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): FixedLabelClusterLabelStruct { + tlvReader.enterStructure(tag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val value = tlvReader.getString(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return FixedLabelClusterLabelStruct(label, value) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FuelTankMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FuelTankMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..1df5be4e9e2320 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FuelTankMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,63 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class FuelTankMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("FuelTankMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): FuelTankMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return FuelTankMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GeneralCommissioningClusterBasicCommissioningInfo.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GeneralCommissioningClusterBasicCommissioningInfo.kt new file mode 100644 index 00000000000000..60d10b41112a9d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GeneralCommissioningClusterBasicCommissioningInfo.kt @@ -0,0 +1,64 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class GeneralCommissioningClusterBasicCommissioningInfo( + val failSafeExpiryLengthSeconds: Int, + val maxCumulativeFailsafeSeconds: Int +) { + override fun toString(): String = buildString { + append("GeneralCommissioningClusterBasicCommissioningInfo {\n") + append("\tfailSafeExpiryLengthSeconds : $failSafeExpiryLengthSeconds\n") + append("\tmaxCumulativeFailsafeSeconds : $maxCumulativeFailsafeSeconds\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_FAIL_SAFE_EXPIRY_LENGTH_SECONDS), failSafeExpiryLengthSeconds) + put(ContextSpecificTag(TAG_MAX_CUMULATIVE_FAILSAFE_SECONDS), maxCumulativeFailsafeSeconds) + endStructure() + } + } + + companion object { + private const val TAG_FAIL_SAFE_EXPIRY_LENGTH_SECONDS = 0 + private const val TAG_MAX_CUMULATIVE_FAILSAFE_SECONDS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): GeneralCommissioningClusterBasicCommissioningInfo { + tlvReader.enterStructure(tag) + val failSafeExpiryLengthSeconds = + tlvReader.getInt(ContextSpecificTag(TAG_FAIL_SAFE_EXPIRY_LENGTH_SECONDS)) + val maxCumulativeFailsafeSeconds = + tlvReader.getInt(ContextSpecificTag(TAG_MAX_CUMULATIVE_FAILSAFE_SECONDS)) + + tlvReader.exitContainer() + + return GeneralCommissioningClusterBasicCommissioningInfo( + failSafeExpiryLengthSeconds, + maxCumulativeFailsafeSeconds + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GeneralDiagnosticsClusterNetworkInterface.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GeneralDiagnosticsClusterNetworkInterface.kt new file mode 100644 index 00000000000000..d4ff313520e65e --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GeneralDiagnosticsClusterNetworkInterface.kt @@ -0,0 +1,147 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class GeneralDiagnosticsClusterNetworkInterface( + val name: String, + val isOperational: Boolean, + val offPremiseServicesReachableIPv4: Boolean?, + val offPremiseServicesReachableIPv6: Boolean?, + val hardwareAddress: ByteArray, + val IPv4Addresses: List, + val IPv6Addresses: List, + val type: Int +) { + override fun toString(): String = buildString { + append("GeneralDiagnosticsClusterNetworkInterface {\n") + append("\tname : $name\n") + append("\tisOperational : $isOperational\n") + append("\toffPremiseServicesReachableIPv4 : $offPremiseServicesReachableIPv4\n") + append("\toffPremiseServicesReachableIPv6 : $offPremiseServicesReachableIPv6\n") + append("\thardwareAddress : $hardwareAddress\n") + append("\tIPv4Addresses : $IPv4Addresses\n") + append("\tIPv6Addresses : $IPv6Addresses\n") + append("\ttype : $type\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_NAME), name) + put(ContextSpecificTag(TAG_IS_OPERATIONAL), isOperational) + if (offPremiseServicesReachableIPv4 != null) { + put( + ContextSpecificTag(TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV4), + offPremiseServicesReachableIPv4 + ) + } else { + putNull(ContextSpecificTag(TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV4)) + } + if (offPremiseServicesReachableIPv6 != null) { + put( + ContextSpecificTag(TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV6), + offPremiseServicesReachableIPv6 + ) + } else { + putNull(ContextSpecificTag(TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV6)) + } + put(ContextSpecificTag(TAG_HARDWARE_ADDRESS), hardwareAddress) + startList(ContextSpecificTag(TAG_I_PV4_ADDRESSES)) + for (item in IPv4Addresses.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_I_PV6_ADDRESSES)) + for (item in IPv6Addresses.iterator()) { + put(AnonymousTag, item) + } + endList() + put(ContextSpecificTag(TAG_TYPE), type) + endStructure() + } + } + + companion object { + private const val TAG_NAME = 0 + private const val TAG_IS_OPERATIONAL = 1 + private const val TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV4 = 2 + private const val TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV6 = 3 + private const val TAG_HARDWARE_ADDRESS = 4 + private const val TAG_I_PV4_ADDRESSES = 5 + private const val TAG_I_PV6_ADDRESSES = 6 + private const val TAG_TYPE = 7 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): GeneralDiagnosticsClusterNetworkInterface { + tlvReader.enterStructure(tag) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + val isOperational = tlvReader.getBoolean(ContextSpecificTag(TAG_IS_OPERATIONAL)) + val offPremiseServicesReachableIPv4 = + if (!tlvReader.isNull()) { + tlvReader.getBoolean(ContextSpecificTag(TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV4)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV4)) + null + } + val offPremiseServicesReachableIPv6 = + if (!tlvReader.isNull()) { + tlvReader.getBoolean(ContextSpecificTag(TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV6)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_OFF_PREMISE_SERVICES_REACHABLE_I_PV6)) + null + } + val hardwareAddress = tlvReader.getByteArray(ContextSpecificTag(TAG_HARDWARE_ADDRESS)) + val IPv4Addresses = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_I_PV4_ADDRESSES)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getByteArray(AnonymousTag)) + } + tlvReader.exitContainer() + } + val IPv6Addresses = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_I_PV6_ADDRESSES)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getByteArray(AnonymousTag)) + } + tlvReader.exitContainer() + } + val type = tlvReader.getInt(ContextSpecificTag(TAG_TYPE)) + + tlvReader.exitContainer() + + return GeneralDiagnosticsClusterNetworkInterface( + name, + isOperational, + offPremiseServicesReachableIPv4, + offPremiseServicesReachableIPv6, + hardwareAddress, + IPv4Addresses, + IPv6Addresses, + type + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupInfoMapStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupInfoMapStruct.kt new file mode 100644 index 00000000000000..6038b55d345b75 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupInfoMapStruct.kt @@ -0,0 +1,90 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class GroupKeyManagementClusterGroupInfoMapStruct( + val groupId: Int, + val endpoints: List, + val groupName: Optional, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("GroupKeyManagementClusterGroupInfoMapStruct {\n") + append("\tgroupId : $groupId\n") + append("\tendpoints : $endpoints\n") + append("\tgroupName : $groupName\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_GROUP_ID), groupId) + startList(ContextSpecificTag(TAG_ENDPOINTS)) + for (item in endpoints.iterator()) { + put(AnonymousTag, item) + } + endList() + if (groupName.isPresent) { + val optgroupName = groupName.get() + put(ContextSpecificTag(TAG_GROUP_NAME), optgroupName) + } + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_GROUP_ID = 1 + private const val TAG_ENDPOINTS = 2 + private const val TAG_GROUP_NAME = 3 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): GroupKeyManagementClusterGroupInfoMapStruct { + tlvReader.enterStructure(tag) + val groupId = tlvReader.getInt(ContextSpecificTag(TAG_GROUP_ID)) + val endpoints = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_ENDPOINTS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val groupName = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_GROUP_NAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_GROUP_NAME))) + } else { + Optional.empty() + } + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return GroupKeyManagementClusterGroupInfoMapStruct(groupId, endpoints, groupName, fabricIndex) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt new file mode 100644 index 00000000000000..d565d70233abc2 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt @@ -0,0 +1,64 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class GroupKeyManagementClusterGroupKeyMapStruct( + val groupId: Int, + val groupKeySetID: Int, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("GroupKeyManagementClusterGroupKeyMapStruct {\n") + append("\tgroupId : $groupId\n") + append("\tgroupKeySetID : $groupKeySetID\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_GROUP_ID), groupId) + put(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D), groupKeySetID) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_GROUP_ID = 1 + private const val TAG_GROUP_KEY_SET_I_D = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): GroupKeyManagementClusterGroupKeyMapStruct { + tlvReader.enterStructure(tag) + val groupId = tlvReader.getInt(ContextSpecificTag(TAG_GROUP_ID)) + val groupKeySetID = tlvReader.getInt(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D)) + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return GroupKeyManagementClusterGroupKeyMapStruct(groupId, groupKeySetID, fabricIndex) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt new file mode 100644 index 00000000000000..418b6037ae46c9 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt @@ -0,0 +1,159 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class GroupKeyManagementClusterGroupKeySetStruct( + val groupKeySetID: Int, + val groupKeySecurityPolicy: Int, + val epochKey0: ByteArray?, + val epochStartTime0: Long?, + val epochKey1: ByteArray?, + val epochStartTime1: Long?, + val epochKey2: ByteArray?, + val epochStartTime2: Long? +) { + override fun toString(): String = buildString { + append("GroupKeyManagementClusterGroupKeySetStruct {\n") + append("\tgroupKeySetID : $groupKeySetID\n") + append("\tgroupKeySecurityPolicy : $groupKeySecurityPolicy\n") + append("\tepochKey0 : $epochKey0\n") + append("\tepochStartTime0 : $epochStartTime0\n") + append("\tepochKey1 : $epochKey1\n") + append("\tepochStartTime1 : $epochStartTime1\n") + append("\tepochKey2 : $epochKey2\n") + append("\tepochStartTime2 : $epochStartTime2\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D), groupKeySetID) + put(ContextSpecificTag(TAG_GROUP_KEY_SECURITY_POLICY), groupKeySecurityPolicy) + if (epochKey0 != null) { + put(ContextSpecificTag(TAG_EPOCH_KEY0), epochKey0) + } else { + putNull(ContextSpecificTag(TAG_EPOCH_KEY0)) + } + if (epochStartTime0 != null) { + put(ContextSpecificTag(TAG_EPOCH_START_TIME0), epochStartTime0) + } else { + putNull(ContextSpecificTag(TAG_EPOCH_START_TIME0)) + } + if (epochKey1 != null) { + put(ContextSpecificTag(TAG_EPOCH_KEY1), epochKey1) + } else { + putNull(ContextSpecificTag(TAG_EPOCH_KEY1)) + } + if (epochStartTime1 != null) { + put(ContextSpecificTag(TAG_EPOCH_START_TIME1), epochStartTime1) + } else { + putNull(ContextSpecificTag(TAG_EPOCH_START_TIME1)) + } + if (epochKey2 != null) { + put(ContextSpecificTag(TAG_EPOCH_KEY2), epochKey2) + } else { + putNull(ContextSpecificTag(TAG_EPOCH_KEY2)) + } + if (epochStartTime2 != null) { + put(ContextSpecificTag(TAG_EPOCH_START_TIME2), epochStartTime2) + } else { + putNull(ContextSpecificTag(TAG_EPOCH_START_TIME2)) + } + endStructure() + } + } + + companion object { + private const val TAG_GROUP_KEY_SET_I_D = 0 + private const val TAG_GROUP_KEY_SECURITY_POLICY = 1 + private const val TAG_EPOCH_KEY0 = 2 + private const val TAG_EPOCH_START_TIME0 = 3 + private const val TAG_EPOCH_KEY1 = 4 + private const val TAG_EPOCH_START_TIME1 = 5 + private const val TAG_EPOCH_KEY2 = 6 + private const val TAG_EPOCH_START_TIME2 = 7 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): GroupKeyManagementClusterGroupKeySetStruct { + tlvReader.enterStructure(tag) + val groupKeySetID = tlvReader.getInt(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D)) + val groupKeySecurityPolicy = + tlvReader.getInt(ContextSpecificTag(TAG_GROUP_KEY_SECURITY_POLICY)) + val epochKey0 = + if (!tlvReader.isNull()) { + tlvReader.getByteArray(ContextSpecificTag(TAG_EPOCH_KEY0)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EPOCH_KEY0)) + null + } + val epochStartTime0 = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_EPOCH_START_TIME0)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EPOCH_START_TIME0)) + null + } + val epochKey1 = + if (!tlvReader.isNull()) { + tlvReader.getByteArray(ContextSpecificTag(TAG_EPOCH_KEY1)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EPOCH_KEY1)) + null + } + val epochStartTime1 = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_EPOCH_START_TIME1)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EPOCH_START_TIME1)) + null + } + val epochKey2 = + if (!tlvReader.isNull()) { + tlvReader.getByteArray(ContextSpecificTag(TAG_EPOCH_KEY2)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EPOCH_KEY2)) + null + } + val epochStartTime2 = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_EPOCH_START_TIME2)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EPOCH_START_TIME2)) + null + } + + tlvReader.exitContainer() + + return GroupKeyManagementClusterGroupKeySetStruct( + groupKeySetID, + groupKeySecurityPolicy, + epochKey0, + epochStartTime0, + epochKey1, + epochStartTime1, + epochKey2, + epochStartTime2 + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/HepaFilterMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/HepaFilterMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..a86ba8db2dee0a --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/HepaFilterMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class HepaFilterMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("HepaFilterMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): HepaFilterMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return HepaFilterMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt new file mode 100644 index 00000000000000..d380689bed016f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt @@ -0,0 +1,74 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class IcdManagementClusterMonitoringRegistrationStruct( + val checkInNodeID: Long, + val monitoredSubject: Long, + val key: ByteArray, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("IcdManagementClusterMonitoringRegistrationStruct {\n") + append("\tcheckInNodeID : $checkInNodeID\n") + append("\tmonitoredSubject : $monitoredSubject\n") + append("\tkey : $key\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_CHECK_IN_NODE_I_D), checkInNodeID) + put(ContextSpecificTag(TAG_MONITORED_SUBJECT), monitoredSubject) + put(ContextSpecificTag(TAG_KEY), key) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_CHECK_IN_NODE_I_D = 1 + private const val TAG_MONITORED_SUBJECT = 2 + private const val TAG_KEY = 3 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): IcdManagementClusterMonitoringRegistrationStruct { + tlvReader.enterStructure(tag) + val checkInNodeID = tlvReader.getLong(ContextSpecificTag(TAG_CHECK_IN_NODE_I_D)) + val monitoredSubject = tlvReader.getLong(ContextSpecificTag(TAG_MONITORED_SUBJECT)) + val key = tlvReader.getByteArray(ContextSpecificTag(TAG_KEY)) + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return IcdManagementClusterMonitoringRegistrationStruct( + checkInNodeID, + monitoredSubject, + key, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/InkCartridgeMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/InkCartridgeMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..114ffa845ce245 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/InkCartridgeMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class InkCartridgeMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("InkCartridgeMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): InkCartridgeMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return InkCartridgeMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IonizingFilterMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IonizingFilterMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..d90f06e6504f06 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IonizingFilterMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class IonizingFilterMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("IonizingFilterMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): IonizingFilterMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return IonizingFilterMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/LaundryWasherModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/LaundryWasherModeClusterModeOptionStruct.kt new file mode 100644 index 00000000000000..eeab9e95eb7cce --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/LaundryWasherModeClusterModeOptionStruct.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 chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class LaundryWasherModeClusterModeOptionStruct( + val label: String, + val mode: Int, + val modeTags: List +) { + override fun toString(): String = buildString { + append("LaundryWasherModeClusterModeOptionStruct {\n") + append("\tlabel : $label\n") + append("\tmode : $mode\n") + append("\tmodeTags : $modeTags\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_MODE), mode) + startList(ContextSpecificTag(TAG_MODE_TAGS)) + for (item in modeTags.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_MODE = 1 + private const val TAG_MODE_TAGS = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): LaundryWasherModeClusterModeOptionStruct { + tlvReader.enterStructure(tag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val mode = tlvReader.getInt(ContextSpecificTag(TAG_MODE)) + val modeTags = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_MODE_TAGS)) + while (!tlvReader.isEndOfContainer()) { + add(LaundryWasherModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return LaundryWasherModeClusterModeOptionStruct(label, mode, modeTags) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/LaundryWasherModeClusterModeTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/LaundryWasherModeClusterModeTagStruct.kt new file mode 100644 index 00000000000000..eed09912c26a9c --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/LaundryWasherModeClusterModeTagStruct.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 chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class LaundryWasherModeClusterModeTagStruct(val mfgCode: Optional, val value: Int) { + override fun toString(): String = buildString { + append("LaundryWasherModeClusterModeTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + 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(tag: Tag, tlvReader: TlvReader): LaundryWasherModeClusterModeTagStruct { + tlvReader.enterStructure(tag) + val mfgCode = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_MFG_CODE))) + } else { + Optional.empty() + } + val value = tlvReader.getInt(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return LaundryWasherModeClusterModeTagStruct(mfgCode, value) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MediaInputClusterInputInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MediaInputClusterInputInfoStruct.kt new file mode 100644 index 00000000000000..514c05d19f6fdf --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MediaInputClusterInputInfoStruct.kt @@ -0,0 +1,69 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class MediaInputClusterInputInfoStruct( + val index: Int, + val inputType: Int, + val name: String, + val description: String +) { + override fun toString(): String = buildString { + append("MediaInputClusterInputInfoStruct {\n") + append("\tindex : $index\n") + append("\tinputType : $inputType\n") + append("\tname : $name\n") + append("\tdescription : $description\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_INDEX), index) + put(ContextSpecificTag(TAG_INPUT_TYPE), inputType) + put(ContextSpecificTag(TAG_NAME), name) + put(ContextSpecificTag(TAG_DESCRIPTION), description) + endStructure() + } + } + + companion object { + private const val TAG_INDEX = 0 + private const val TAG_INPUT_TYPE = 1 + private const val TAG_NAME = 2 + private const val TAG_DESCRIPTION = 3 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): MediaInputClusterInputInfoStruct { + tlvReader.enterStructure(tag) + val index = tlvReader.getInt(ContextSpecificTag(TAG_INDEX)) + val inputType = tlvReader.getInt(ContextSpecificTag(TAG_INPUT_TYPE)) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + val description = tlvReader.getString(ContextSpecificTag(TAG_DESCRIPTION)) + + tlvReader.exitContainer() + + return MediaInputClusterInputInfoStruct(index, inputType, name, description) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MediaPlaybackClusterPlaybackPositionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MediaPlaybackClusterPlaybackPositionStruct.kt new file mode 100644 index 00000000000000..d452d083a73112 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MediaPlaybackClusterPlaybackPositionStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class MediaPlaybackClusterPlaybackPositionStruct(val updatedAt: Long, val position: Long?) { + override fun toString(): String = buildString { + append("MediaPlaybackClusterPlaybackPositionStruct {\n") + append("\tupdatedAt : $updatedAt\n") + append("\tposition : $position\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_UPDATED_AT), updatedAt) + if (position != null) { + put(ContextSpecificTag(TAG_POSITION), position) + } else { + putNull(ContextSpecificTag(TAG_POSITION)) + } + endStructure() + } + } + + companion object { + private const val TAG_UPDATED_AT = 0 + private const val TAG_POSITION = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): MediaPlaybackClusterPlaybackPositionStruct { + tlvReader.enterStructure(tag) + val updatedAt = tlvReader.getLong(ContextSpecificTag(TAG_UPDATED_AT)) + val position = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_POSITION)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_POSITION)) + null + } + + tlvReader.exitContainer() + + return MediaPlaybackClusterPlaybackPositionStruct(updatedAt, position) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ModeSelectClusterModeOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ModeSelectClusterModeOptionStruct.kt new file mode 100644 index 00000000000000..ac95817519112f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ModeSelectClusterModeOptionStruct.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 chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ModeSelectClusterModeOptionStruct( + val label: String, + val mode: Int, + val semanticTags: List +) { + override fun toString(): String = buildString { + append("ModeSelectClusterModeOptionStruct {\n") + append("\tlabel : $label\n") + append("\tmode : $mode\n") + append("\tsemanticTags : $semanticTags\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_MODE), mode) + startList(ContextSpecificTag(TAG_SEMANTIC_TAGS)) + for (item in semanticTags.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_MODE = 1 + private const val TAG_SEMANTIC_TAGS = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ModeSelectClusterModeOptionStruct { + tlvReader.enterStructure(tag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val mode = tlvReader.getInt(ContextSpecificTag(TAG_MODE)) + val semanticTags = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_SEMANTIC_TAGS)) + while (!tlvReader.isEndOfContainer()) { + add(ModeSelectClusterSemanticTagStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ModeSelectClusterModeOptionStruct(label, mode, semanticTags) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ModeSelectClusterSemanticTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ModeSelectClusterSemanticTagStruct.kt new file mode 100644 index 00000000000000..04c893671659d3 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ModeSelectClusterSemanticTagStruct.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ModeSelectClusterSemanticTagStruct(val mfgCode: Int, val value: Int) { + override fun toString(): String = buildString { + append("ModeSelectClusterSemanticTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_MFG_CODE), mfgCode) + put(ContextSpecificTag(TAG_VALUE), value) + endStructure() + } + } + + companion object { + private const val TAG_MFG_CODE = 0 + private const val TAG_VALUE = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ModeSelectClusterSemanticTagStruct { + tlvReader.enterStructure(tag) + val mfgCode = tlvReader.getInt(ContextSpecificTag(TAG_MFG_CODE)) + val value = tlvReader.getInt(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return ModeSelectClusterSemanticTagStruct(mfgCode, value) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt new file mode 100644 index 00000000000000..8b942f2a492dd1 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt @@ -0,0 +1,59 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class NetworkCommissioningClusterNetworkInfoStruct( + val networkID: ByteArray, + val connected: Boolean +) { + override fun toString(): String = buildString { + append("NetworkCommissioningClusterNetworkInfoStruct {\n") + append("\tnetworkID : $networkID\n") + append("\tconnected : $connected\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_NETWORK_I_D), networkID) + put(ContextSpecificTag(TAG_CONNECTED), connected) + endStructure() + } + } + + companion object { + private const val TAG_NETWORK_I_D = 0 + private const val TAG_CONNECTED = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): NetworkCommissioningClusterNetworkInfoStruct { + tlvReader.enterStructure(tag) + val networkID = tlvReader.getByteArray(ContextSpecificTag(TAG_NETWORK_I_D)) + val connected = tlvReader.getBoolean(ContextSpecificTag(TAG_CONNECTED)) + + tlvReader.exitContainer() + + return NetworkCommissioningClusterNetworkInfoStruct(networkID, connected) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterThreadInterfaceScanResultStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterThreadInterfaceScanResultStruct.kt new file mode 100644 index 00000000000000..76593b32131477 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterThreadInterfaceScanResultStruct.kt @@ -0,0 +1,101 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class NetworkCommissioningClusterThreadInterfaceScanResultStruct( + val panId: Int, + val extendedPanId: Long, + val networkName: String, + val channel: Int, + val version: Int, + val extendedAddress: ByteArray, + val rssi: Int, + val lqi: Int +) { + override fun toString(): String = buildString { + append("NetworkCommissioningClusterThreadInterfaceScanResultStruct {\n") + append("\tpanId : $panId\n") + append("\textendedPanId : $extendedPanId\n") + append("\tnetworkName : $networkName\n") + append("\tchannel : $channel\n") + append("\tversion : $version\n") + append("\textendedAddress : $extendedAddress\n") + append("\trssi : $rssi\n") + append("\tlqi : $lqi\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PAN_ID), panId) + put(ContextSpecificTag(TAG_EXTENDED_PAN_ID), extendedPanId) + put(ContextSpecificTag(TAG_NETWORK_NAME), networkName) + put(ContextSpecificTag(TAG_CHANNEL), channel) + put(ContextSpecificTag(TAG_VERSION), version) + put(ContextSpecificTag(TAG_EXTENDED_ADDRESS), extendedAddress) + put(ContextSpecificTag(TAG_RSSI), rssi) + put(ContextSpecificTag(TAG_LQI), lqi) + endStructure() + } + } + + companion object { + private const val TAG_PAN_ID = 0 + private const val TAG_EXTENDED_PAN_ID = 1 + private const val TAG_NETWORK_NAME = 2 + private const val TAG_CHANNEL = 3 + private const val TAG_VERSION = 4 + private const val TAG_EXTENDED_ADDRESS = 5 + private const val TAG_RSSI = 6 + private const val TAG_LQI = 7 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): NetworkCommissioningClusterThreadInterfaceScanResultStruct { + tlvReader.enterStructure(tag) + val panId = tlvReader.getInt(ContextSpecificTag(TAG_PAN_ID)) + val extendedPanId = tlvReader.getLong(ContextSpecificTag(TAG_EXTENDED_PAN_ID)) + val networkName = tlvReader.getString(ContextSpecificTag(TAG_NETWORK_NAME)) + val channel = tlvReader.getInt(ContextSpecificTag(TAG_CHANNEL)) + val version = tlvReader.getInt(ContextSpecificTag(TAG_VERSION)) + val extendedAddress = tlvReader.getByteArray(ContextSpecificTag(TAG_EXTENDED_ADDRESS)) + val rssi = tlvReader.getInt(ContextSpecificTag(TAG_RSSI)) + val lqi = tlvReader.getInt(ContextSpecificTag(TAG_LQI)) + + tlvReader.exitContainer() + + return NetworkCommissioningClusterThreadInterfaceScanResultStruct( + panId, + extendedPanId, + networkName, + channel, + version, + extendedAddress, + rssi, + lqi + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterWiFiInterfaceScanResultStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterWiFiInterfaceScanResultStruct.kt new file mode 100644 index 00000000000000..d2cf4bcf5b7cb0 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterWiFiInterfaceScanResultStruct.kt @@ -0,0 +1,89 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class NetworkCommissioningClusterWiFiInterfaceScanResultStruct( + val security: Int, + val ssid: ByteArray, + val bssid: ByteArray, + val channel: Int, + val wiFiBand: Int, + val rssi: Int +) { + override fun toString(): String = buildString { + append("NetworkCommissioningClusterWiFiInterfaceScanResultStruct {\n") + append("\tsecurity : $security\n") + append("\tssid : $ssid\n") + append("\tbssid : $bssid\n") + append("\tchannel : $channel\n") + append("\twiFiBand : $wiFiBand\n") + append("\trssi : $rssi\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_SECURITY), security) + put(ContextSpecificTag(TAG_SSID), ssid) + put(ContextSpecificTag(TAG_BSSID), bssid) + put(ContextSpecificTag(TAG_CHANNEL), channel) + put(ContextSpecificTag(TAG_WI_FI_BAND), wiFiBand) + put(ContextSpecificTag(TAG_RSSI), rssi) + endStructure() + } + } + + companion object { + private const val TAG_SECURITY = 0 + private const val TAG_SSID = 1 + private const val TAG_BSSID = 2 + private const val TAG_CHANNEL = 3 + private const val TAG_WI_FI_BAND = 4 + private const val TAG_RSSI = 5 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): NetworkCommissioningClusterWiFiInterfaceScanResultStruct { + tlvReader.enterStructure(tag) + val security = tlvReader.getInt(ContextSpecificTag(TAG_SECURITY)) + val ssid = tlvReader.getByteArray(ContextSpecificTag(TAG_SSID)) + val bssid = tlvReader.getByteArray(ContextSpecificTag(TAG_BSSID)) + val channel = tlvReader.getInt(ContextSpecificTag(TAG_CHANNEL)) + val wiFiBand = tlvReader.getInt(ContextSpecificTag(TAG_WI_FI_BAND)) + val rssi = tlvReader.getInt(ContextSpecificTag(TAG_RSSI)) + + tlvReader.exitContainer() + + return NetworkCommissioningClusterWiFiInterfaceScanResultStruct( + security, + ssid, + bssid, + channel, + wiFiBand, + rssi + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt new file mode 100644 index 00000000000000..8264e9fa5ee545 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt @@ -0,0 +1,89 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class OperationalCredentialsClusterFabricDescriptorStruct( + val rootPublicKey: ByteArray, + val vendorID: Int, + val fabricID: Long, + val nodeID: Long, + val label: String, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("OperationalCredentialsClusterFabricDescriptorStruct {\n") + append("\trootPublicKey : $rootPublicKey\n") + append("\tvendorID : $vendorID\n") + append("\tfabricID : $fabricID\n") + append("\tnodeID : $nodeID\n") + append("\tlabel : $label\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY), rootPublicKey) + put(ContextSpecificTag(TAG_VENDOR_I_D), vendorID) + put(ContextSpecificTag(TAG_FABRIC_I_D), fabricID) + put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_ROOT_PUBLIC_KEY = 1 + private const val TAG_VENDOR_I_D = 2 + private const val TAG_FABRIC_I_D = 3 + private const val TAG_NODE_I_D = 4 + private const val TAG_LABEL = 5 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): OperationalCredentialsClusterFabricDescriptorStruct { + tlvReader.enterStructure(tag) + val rootPublicKey = tlvReader.getByteArray(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY)) + val vendorID = tlvReader.getInt(ContextSpecificTag(TAG_VENDOR_I_D)) + val fabricID = tlvReader.getLong(ContextSpecificTag(TAG_FABRIC_I_D)) + val nodeID = tlvReader.getLong(ContextSpecificTag(TAG_NODE_I_D)) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return OperationalCredentialsClusterFabricDescriptorStruct( + rootPublicKey, + vendorID, + fabricID, + nodeID, + label, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterNOCStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterNOCStruct.kt new file mode 100644 index 00000000000000..a05f388d1a5e06 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterNOCStruct.kt @@ -0,0 +1,74 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class OperationalCredentialsClusterNOCStruct( + val noc: ByteArray, + val icac: ByteArray?, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("OperationalCredentialsClusterNOCStruct {\n") + append("\tnoc : $noc\n") + append("\ticac : $icac\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_NOC), noc) + if (icac != null) { + put(ContextSpecificTag(TAG_ICAC), icac) + } else { + putNull(ContextSpecificTag(TAG_ICAC)) + } + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_NOC = 1 + private const val TAG_ICAC = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): OperationalCredentialsClusterNOCStruct { + tlvReader.enterStructure(tag) + val noc = tlvReader.getByteArray(ContextSpecificTag(TAG_NOC)) + val icac = + if (!tlvReader.isNull()) { + tlvReader.getByteArray(ContextSpecificTag(TAG_ICAC)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_ICAC)) + null + } + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return OperationalCredentialsClusterNOCStruct(noc, icac, fabricIndex) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterErrorStateStruct.kt new file mode 100644 index 00000000000000..cdbccac37fe63f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterErrorStateStruct.kt @@ -0,0 +1,85 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class OperationalStateClusterErrorStateStruct( + val errorStateID: Int, + val errorStateLabel: Optional, + val errorStateDetails: Optional +) { + override fun toString(): String = buildString { + append("OperationalStateClusterErrorStateStruct {\n") + append("\terrorStateID : $errorStateID\n") + append("\terrorStateLabel : $errorStateLabel\n") + append("\terrorStateDetails : $errorStateDetails\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) + if (errorStateLabel.isPresent) { + val opterrorStateLabel = errorStateLabel.get() + put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) + } + if (errorStateDetails.isPresent) { + val opterrorStateDetails = errorStateDetails.get() + put(ContextSpecificTag(TAG_ERROR_STATE_DETAILS), opterrorStateDetails) + } + endStructure() + } + } + + companion object { + private const val TAG_ERROR_STATE_I_D = 0 + private const val TAG_ERROR_STATE_LABEL = 1 + private const val TAG_ERROR_STATE_DETAILS = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): OperationalStateClusterErrorStateStruct { + tlvReader.enterStructure(tag) + val errorStateID = tlvReader.getInt(ContextSpecificTag(TAG_ERROR_STATE_I_D)) + val errorStateLabel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) + } else { + Optional.empty() + } + val errorStateDetails = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_DETAILS))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_DETAILS))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return OperationalStateClusterErrorStateStruct( + errorStateID, + errorStateLabel, + errorStateDetails + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt new file mode 100644 index 00000000000000..1c55ac8f8927c4 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt @@ -0,0 +1,71 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class OperationalStateClusterOperationalStateStruct( + val operationalStateID: Int, + val operationalStateLabel: Optional +) { + override fun toString(): String = buildString { + append("OperationalStateClusterOperationalStateStruct {\n") + append("\toperationalStateID : $operationalStateID\n") + append("\toperationalStateLabel : $operationalStateLabel\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) + if (operationalStateLabel.isPresent) { + val optoperationalStateLabel = operationalStateLabel.get() + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) + } + endStructure() + } + } + + companion object { + private const val TAG_OPERATIONAL_STATE_I_D = 0 + private const val TAG_OPERATIONAL_STATE_LABEL = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): OperationalStateClusterOperationalStateStruct { + tlvReader.enterStructure(tag) + val operationalStateID = tlvReader.getInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) + val operationalStateLabel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return OperationalStateClusterOperationalStateStruct( + operationalStateID, + operationalStateLabel + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt new file mode 100644 index 00000000000000..17f95d897b258b --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt @@ -0,0 +1,68 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class OtaSoftwareUpdateRequestorClusterProviderLocation( + val providerNodeID: Long, + val endpoint: Int, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("OtaSoftwareUpdateRequestorClusterProviderLocation {\n") + append("\tproviderNodeID : $providerNodeID\n") + append("\tendpoint : $endpoint\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PROVIDER_NODE_I_D), providerNodeID) + put(ContextSpecificTag(TAG_ENDPOINT), endpoint) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_PROVIDER_NODE_I_D = 1 + private const val TAG_ENDPOINT = 2 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): OtaSoftwareUpdateRequestorClusterProviderLocation { + tlvReader.enterStructure(tag) + val providerNodeID = tlvReader.getLong(ContextSpecificTag(TAG_PROVIDER_NODE_I_D)) + val endpoint = tlvReader.getInt(ContextSpecificTag(TAG_ENDPOINT)) + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return OtaSoftwareUpdateRequestorClusterProviderLocation( + providerNodeID, + endpoint, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OzoneFilterMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OzoneFilterMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..52318157e94dc5 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OzoneFilterMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class OzoneFilterMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("OzoneFilterMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): OzoneFilterMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return OzoneFilterMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterBatChargeFaultChangeType.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterBatChargeFaultChangeType.kt new file mode 100644 index 00000000000000..6172f21498fdb0 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterBatChargeFaultChangeType.kt @@ -0,0 +1,79 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class PowerSourceClusterBatChargeFaultChangeType(val current: List, val previous: List) { + override fun toString(): String = buildString { + append("PowerSourceClusterBatChargeFaultChangeType {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): PowerSourceClusterBatChargeFaultChangeType { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return PowerSourceClusterBatChargeFaultChangeType(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterBatFaultChangeType.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterBatFaultChangeType.kt new file mode 100644 index 00000000000000..6ef4a63074b8a2 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterBatFaultChangeType.kt @@ -0,0 +1,79 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class PowerSourceClusterBatFaultChangeType(val current: List, val previous: List) { + override fun toString(): String = buildString { + append("PowerSourceClusterBatFaultChangeType {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): PowerSourceClusterBatFaultChangeType { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return PowerSourceClusterBatFaultChangeType(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterWiredFaultChangeType.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterWiredFaultChangeType.kt new file mode 100644 index 00000000000000..86cdc01f28fd41 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterWiredFaultChangeType.kt @@ -0,0 +1,79 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class PowerSourceClusterWiredFaultChangeType(val current: List, val previous: List) { + override fun toString(): String = buildString { + append("PowerSourceClusterWiredFaultChangeType {\n") + append("\tcurrent : $current\n") + append("\tprevious : $previous\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_CURRENT)) + for (item in current.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_PREVIOUS)) + for (item in previous.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CURRENT = 0 + private const val TAG_PREVIOUS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): PowerSourceClusterWiredFaultChangeType { + tlvReader.enterStructure(tag) + val current = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_CURRENT)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val previous = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_PREVIOUS)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return PowerSourceClusterWiredFaultChangeType(current, previous) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct.kt new file mode 100644 index 00000000000000..6632b9581bb508 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct.kt @@ -0,0 +1,88 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class RefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct( + val label: String, + val mode: Int, + val modeTags: List +) { + override fun toString(): String = buildString { + append("RefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct {\n") + append("\tlabel : $label\n") + append("\tmode : $mode\n") + append("\tmodeTags : $modeTags\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_MODE), mode) + startList(ContextSpecificTag(TAG_MODE_TAGS)) + for (item in modeTags.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_MODE = 1 + private const val TAG_MODE_TAGS = 2 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): RefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct { + tlvReader.enterStructure(tag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val mode = tlvReader.getInt(ContextSpecificTag(TAG_MODE)) + val modeTags = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_MODE_TAGS)) + while (!tlvReader.isEndOfContainer()) { + add( + RefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return RefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct( + label, + mode, + modeTags + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct.kt new file mode 100644 index 00000000000000..9f806c52fa6fa2 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct.kt @@ -0,0 +1,71 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class RefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct( + val mfgCode: Optional, + val value: Int +) { + override fun toString(): String = buildString { + append("RefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + 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( + tag: Tag, + tlvReader: TlvReader + ): RefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct { + tlvReader.enterStructure(tag) + val mfgCode = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_MFG_CODE))) + } else { + Optional.empty() + } + val value = tlvReader.getInt(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return RefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct(mfgCode, value) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcCleanModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcCleanModeClusterModeOptionStruct.kt new file mode 100644 index 00000000000000..e3f33a1b7dcac5 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcCleanModeClusterModeOptionStruct.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 chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class RvcCleanModeClusterModeOptionStruct( + val label: String, + val mode: Int, + val modeTags: List +) { + override fun toString(): String = buildString { + append("RvcCleanModeClusterModeOptionStruct {\n") + append("\tlabel : $label\n") + append("\tmode : $mode\n") + append("\tmodeTags : $modeTags\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_MODE), mode) + startList(ContextSpecificTag(TAG_MODE_TAGS)) + for (item in modeTags.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_MODE = 1 + private const val TAG_MODE_TAGS = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): RvcCleanModeClusterModeOptionStruct { + tlvReader.enterStructure(tag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val mode = tlvReader.getInt(ContextSpecificTag(TAG_MODE)) + val modeTags = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_MODE_TAGS)) + while (!tlvReader.isEndOfContainer()) { + add(RvcCleanModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return RvcCleanModeClusterModeOptionStruct(label, mode, modeTags) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcCleanModeClusterModeTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcCleanModeClusterModeTagStruct.kt new file mode 100644 index 00000000000000..bc7eb7ed818b41 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcCleanModeClusterModeTagStruct.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 chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class RvcCleanModeClusterModeTagStruct(val mfgCode: Optional, val value: Int) { + override fun toString(): String = buildString { + append("RvcCleanModeClusterModeTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + 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(tag: Tag, tlvReader: TlvReader): RvcCleanModeClusterModeTagStruct { + tlvReader.enterStructure(tag) + val mfgCode = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_MFG_CODE))) + } else { + Optional.empty() + } + val value = tlvReader.getInt(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return RvcCleanModeClusterModeTagStruct(mfgCode, value) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt new file mode 100644 index 00000000000000..f6b9b8b14456f0 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt @@ -0,0 +1,85 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class RvcOperationalStateClusterErrorStateStruct( + val errorStateID: Int, + val errorStateLabel: Optional, + val errorStateDetails: Optional +) { + override fun toString(): String = buildString { + append("RvcOperationalStateClusterErrorStateStruct {\n") + append("\terrorStateID : $errorStateID\n") + append("\terrorStateLabel : $errorStateLabel\n") + append("\terrorStateDetails : $errorStateDetails\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) + if (errorStateLabel.isPresent) { + val opterrorStateLabel = errorStateLabel.get() + put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) + } + if (errorStateDetails.isPresent) { + val opterrorStateDetails = errorStateDetails.get() + put(ContextSpecificTag(TAG_ERROR_STATE_DETAILS), opterrorStateDetails) + } + endStructure() + } + } + + companion object { + private const val TAG_ERROR_STATE_I_D = 0 + private const val TAG_ERROR_STATE_LABEL = 1 + private const val TAG_ERROR_STATE_DETAILS = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): RvcOperationalStateClusterErrorStateStruct { + tlvReader.enterStructure(tag) + val errorStateID = tlvReader.getInt(ContextSpecificTag(TAG_ERROR_STATE_I_D)) + val errorStateLabel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) + } else { + Optional.empty() + } + val errorStateDetails = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_DETAILS))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_DETAILS))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return RvcOperationalStateClusterErrorStateStruct( + errorStateID, + errorStateLabel, + errorStateDetails + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt new file mode 100644 index 00000000000000..66f2796d71439f --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt @@ -0,0 +1,71 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class RvcOperationalStateClusterOperationalStateStruct( + val operationalStateID: Int, + val operationalStateLabel: Optional +) { + override fun toString(): String = buildString { + append("RvcOperationalStateClusterOperationalStateStruct {\n") + append("\toperationalStateID : $operationalStateID\n") + append("\toperationalStateLabel : $operationalStateLabel\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) + if (operationalStateLabel.isPresent) { + val optoperationalStateLabel = operationalStateLabel.get() + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) + } + endStructure() + } + } + + companion object { + private const val TAG_OPERATIONAL_STATE_I_D = 0 + private const val TAG_OPERATIONAL_STATE_LABEL = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): RvcOperationalStateClusterOperationalStateStruct { + tlvReader.enterStructure(tag) + val operationalStateID = tlvReader.getInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) + val operationalStateLabel = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return RvcOperationalStateClusterOperationalStateStruct( + operationalStateID, + operationalStateLabel + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeOptionStruct.kt new file mode 100644 index 00000000000000..64b272df8e62c2 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeOptionStruct.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 chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class RvcRunModeClusterModeOptionStruct( + val label: String, + val mode: Int, + val modeTags: List +) { + override fun toString(): String = buildString { + append("RvcRunModeClusterModeOptionStruct {\n") + append("\tlabel : $label\n") + append("\tmode : $mode\n") + append("\tmodeTags : $modeTags\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_MODE), mode) + startList(ContextSpecificTag(TAG_MODE_TAGS)) + for (item in modeTags.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_MODE = 1 + private const val TAG_MODE_TAGS = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): RvcRunModeClusterModeOptionStruct { + tlvReader.enterStructure(tag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val mode = tlvReader.getInt(ContextSpecificTag(TAG_MODE)) + val modeTags = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_MODE_TAGS)) + while (!tlvReader.isEndOfContainer()) { + add(RvcRunModeClusterModeTagStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return RvcRunModeClusterModeOptionStruct(label, mode, modeTags) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeTagStruct.kt new file mode 100644 index 00000000000000..3ad4e9aee5ba6d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeTagStruct.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 chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class RvcRunModeClusterModeTagStruct(val mfgCode: Optional, val value: Int) { + override fun toString(): String = buildString { + append("RvcRunModeClusterModeTagStruct {\n") + append("\tmfgCode : $mfgCode\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + 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(tag: Tag, tlvReader: TlvReader): RvcRunModeClusterModeTagStruct { + tlvReader.enterStructure(tag) + val mfgCode = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MFG_CODE))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_MFG_CODE))) + } else { + Optional.empty() + } + val value = tlvReader.getInt(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return RvcRunModeClusterModeTagStruct(mfgCode, value) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterAttributeValuePair.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterAttributeValuePair.kt new file mode 100644 index 00000000000000..213d87b9137cf5 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterAttributeValuePair.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ScenesClusterAttributeValuePair(val attributeID: Long, val attributeValue: Long) { + override fun toString(): String = buildString { + append("ScenesClusterAttributeValuePair {\n") + append("\tattributeID : $attributeID\n") + append("\tattributeValue : $attributeValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + put(ContextSpecificTag(TAG_ATTRIBUTE_VALUE), attributeValue) + endStructure() + } + } + + companion object { + private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_ATTRIBUTE_VALUE = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ScenesClusterAttributeValuePair { + tlvReader.enterStructure(tag) + val attributeID = tlvReader.getLong(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val attributeValue = tlvReader.getLong(ContextSpecificTag(TAG_ATTRIBUTE_VALUE)) + + tlvReader.exitContainer() + + return ScenesClusterAttributeValuePair(attributeID, attributeValue) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterExtensionFieldSet.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterExtensionFieldSet.kt new file mode 100644 index 00000000000000..edc04a2084e2fd --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterExtensionFieldSet.kt @@ -0,0 +1,71 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ScenesClusterExtensionFieldSet( + val clusterID: Long, + val attributeValueList: List +) { + override fun toString(): String = buildString { + append("ScenesClusterExtensionFieldSet {\n") + append("\tclusterID : $clusterID\n") + append("\tattributeValueList : $attributeValueList\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_CLUSTER_I_D), clusterID) + startList(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) + for (item in attributeValueList.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_CLUSTER_I_D = 0 + private const val TAG_ATTRIBUTE_VALUE_LIST = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ScenesClusterExtensionFieldSet { + tlvReader.enterStructure(tag) + val clusterID = tlvReader.getLong(ContextSpecificTag(TAG_CLUSTER_I_D)) + val attributeValueList = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) + while (!tlvReader.isEndOfContainer()) { + add(ScenesClusterAttributeValuePair.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ScenesClusterExtensionFieldSet(clusterID, attributeValueList) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt new file mode 100644 index 00000000000000..5359b9a4b70a2a --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt @@ -0,0 +1,113 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class SoftwareDiagnosticsClusterThreadMetricsStruct( + val id: Long, + val name: Optional, + val stackFreeCurrent: Optional, + val stackFreeMinimum: Optional, + val stackSize: Optional +) { + override fun toString(): String = buildString { + append("SoftwareDiagnosticsClusterThreadMetricsStruct {\n") + append("\tid : $id\n") + append("\tname : $name\n") + append("\tstackFreeCurrent : $stackFreeCurrent\n") + append("\tstackFreeMinimum : $stackFreeMinimum\n") + append("\tstackSize : $stackSize\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ID), id) + if (name.isPresent) { + val optname = name.get() + put(ContextSpecificTag(TAG_NAME), optname) + } + if (stackFreeCurrent.isPresent) { + val optstackFreeCurrent = stackFreeCurrent.get() + put(ContextSpecificTag(TAG_STACK_FREE_CURRENT), optstackFreeCurrent) + } + if (stackFreeMinimum.isPresent) { + val optstackFreeMinimum = stackFreeMinimum.get() + put(ContextSpecificTag(TAG_STACK_FREE_MINIMUM), optstackFreeMinimum) + } + if (stackSize.isPresent) { + val optstackSize = stackSize.get() + put(ContextSpecificTag(TAG_STACK_SIZE), optstackSize) + } + endStructure() + } + } + + companion object { + private const val TAG_ID = 0 + private const val TAG_NAME = 1 + private const val TAG_STACK_FREE_CURRENT = 2 + private const val TAG_STACK_FREE_MINIMUM = 3 + private const val TAG_STACK_SIZE = 4 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): SoftwareDiagnosticsClusterThreadMetricsStruct { + tlvReader.enterStructure(tag) + val id = tlvReader.getLong(ContextSpecificTag(TAG_ID)) + val name = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_NAME))) + } else { + Optional.empty() + } + val stackFreeCurrent = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_STACK_FREE_CURRENT))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_STACK_FREE_CURRENT))) + } else { + Optional.empty() + } + val stackFreeMinimum = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_STACK_FREE_MINIMUM))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_STACK_FREE_MINIMUM))) + } else { + Optional.empty() + } + val stackSize = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_STACK_SIZE))) { + Optional.of(tlvReader.getLong(ContextSpecificTag(TAG_STACK_SIZE))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return SoftwareDiagnosticsClusterThreadMetricsStruct( + id, + name, + stackFreeCurrent, + stackFreeMinimum, + stackSize + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt new file mode 100644 index 00000000000000..403134993beaed --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class TargetNavigatorClusterTargetInfoStruct(val identifier: Int, val name: String) { + override fun toString(): String = buildString { + append("TargetNavigatorClusterTargetInfoStruct {\n") + append("\tidentifier : $identifier\n") + append("\tname : $name\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_IDENTIFIER), identifier) + put(ContextSpecificTag(TAG_NAME), name) + endStructure() + } + } + + companion object { + private const val TAG_IDENTIFIER = 0 + private const val TAG_NAME = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): TargetNavigatorClusterTargetInfoStruct { + tlvReader.enterStructure(tag) + val identifier = tlvReader.getInt(ContextSpecificTag(TAG_IDENTIFIER)) + val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) + + tlvReader.exitContainer() + + return TargetNavigatorClusterTargetInfoStruct(identifier, name) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterThermostatScheduleTransition.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterThermostatScheduleTransition.kt new file mode 100644 index 00000000000000..cb432fb1e976b4 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterThermostatScheduleTransition.kt @@ -0,0 +1,88 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ThermostatClusterThermostatScheduleTransition( + val transitionTime: Int, + val heatSetpoint: Int?, + val coolSetpoint: Int? +) { + override fun toString(): String = buildString { + append("ThermostatClusterThermostatScheduleTransition {\n") + append("\ttransitionTime : $transitionTime\n") + append("\theatSetpoint : $heatSetpoint\n") + append("\tcoolSetpoint : $coolSetpoint\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_TRANSITION_TIME), transitionTime) + if (heatSetpoint != null) { + put(ContextSpecificTag(TAG_HEAT_SETPOINT), heatSetpoint) + } else { + putNull(ContextSpecificTag(TAG_HEAT_SETPOINT)) + } + if (coolSetpoint != null) { + put(ContextSpecificTag(TAG_COOL_SETPOINT), coolSetpoint) + } else { + putNull(ContextSpecificTag(TAG_COOL_SETPOINT)) + } + endStructure() + } + } + + companion object { + private const val TAG_TRANSITION_TIME = 0 + private const val TAG_HEAT_SETPOINT = 1 + private const val TAG_COOL_SETPOINT = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ThermostatClusterThermostatScheduleTransition { + tlvReader.enterStructure(tag) + val transitionTime = tlvReader.getInt(ContextSpecificTag(TAG_TRANSITION_TIME)) + val heatSetpoint = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_HEAT_SETPOINT)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_HEAT_SETPOINT)) + null + } + val coolSetpoint = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_COOL_SETPOINT)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_COOL_SETPOINT)) + null + } + + tlvReader.exitContainer() + + return ThermostatClusterThermostatScheduleTransition( + transitionTime, + heatSetpoint, + coolSetpoint + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterNeighborTableStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterNeighborTableStruct.kt new file mode 100644 index 00000000000000..4a7066df5d7f25 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterNeighborTableStruct.kt @@ -0,0 +1,157 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ThreadNetworkDiagnosticsClusterNeighborTableStruct( + val extAddress: Long, + val age: Long, + val rloc16: Int, + val linkFrameCounter: Long, + val mleFrameCounter: Long, + val lqi: Int, + val averageRssi: Int?, + val lastRssi: Int?, + val frameErrorRate: Int, + val messageErrorRate: Int, + val rxOnWhenIdle: Boolean, + val fullThreadDevice: Boolean, + val fullNetworkData: Boolean, + val isChild: Boolean +) { + override fun toString(): String = buildString { + append("ThreadNetworkDiagnosticsClusterNeighborTableStruct {\n") + append("\textAddress : $extAddress\n") + append("\tage : $age\n") + append("\trloc16 : $rloc16\n") + append("\tlinkFrameCounter : $linkFrameCounter\n") + append("\tmleFrameCounter : $mleFrameCounter\n") + append("\tlqi : $lqi\n") + append("\taverageRssi : $averageRssi\n") + append("\tlastRssi : $lastRssi\n") + append("\tframeErrorRate : $frameErrorRate\n") + append("\tmessageErrorRate : $messageErrorRate\n") + append("\trxOnWhenIdle : $rxOnWhenIdle\n") + append("\tfullThreadDevice : $fullThreadDevice\n") + append("\tfullNetworkData : $fullNetworkData\n") + append("\tisChild : $isChild\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_EXT_ADDRESS), extAddress) + put(ContextSpecificTag(TAG_AGE), age) + put(ContextSpecificTag(TAG_RLOC16), rloc16) + put(ContextSpecificTag(TAG_LINK_FRAME_COUNTER), linkFrameCounter) + put(ContextSpecificTag(TAG_MLE_FRAME_COUNTER), mleFrameCounter) + put(ContextSpecificTag(TAG_LQI), lqi) + if (averageRssi != null) { + put(ContextSpecificTag(TAG_AVERAGE_RSSI), averageRssi) + } else { + putNull(ContextSpecificTag(TAG_AVERAGE_RSSI)) + } + if (lastRssi != null) { + put(ContextSpecificTag(TAG_LAST_RSSI), lastRssi) + } else { + putNull(ContextSpecificTag(TAG_LAST_RSSI)) + } + put(ContextSpecificTag(TAG_FRAME_ERROR_RATE), frameErrorRate) + put(ContextSpecificTag(TAG_MESSAGE_ERROR_RATE), messageErrorRate) + put(ContextSpecificTag(TAG_RX_ON_WHEN_IDLE), rxOnWhenIdle) + put(ContextSpecificTag(TAG_FULL_THREAD_DEVICE), fullThreadDevice) + put(ContextSpecificTag(TAG_FULL_NETWORK_DATA), fullNetworkData) + put(ContextSpecificTag(TAG_IS_CHILD), isChild) + endStructure() + } + } + + companion object { + private const val TAG_EXT_ADDRESS = 0 + private const val TAG_AGE = 1 + private const val TAG_RLOC16 = 2 + private const val TAG_LINK_FRAME_COUNTER = 3 + private const val TAG_MLE_FRAME_COUNTER = 4 + private const val TAG_LQI = 5 + private const val TAG_AVERAGE_RSSI = 6 + private const val TAG_LAST_RSSI = 7 + private const val TAG_FRAME_ERROR_RATE = 8 + private const val TAG_MESSAGE_ERROR_RATE = 9 + private const val TAG_RX_ON_WHEN_IDLE = 10 + private const val TAG_FULL_THREAD_DEVICE = 11 + private const val TAG_FULL_NETWORK_DATA = 12 + private const val TAG_IS_CHILD = 13 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): ThreadNetworkDiagnosticsClusterNeighborTableStruct { + tlvReader.enterStructure(tag) + val extAddress = tlvReader.getLong(ContextSpecificTag(TAG_EXT_ADDRESS)) + val age = tlvReader.getLong(ContextSpecificTag(TAG_AGE)) + val rloc16 = tlvReader.getInt(ContextSpecificTag(TAG_RLOC16)) + val linkFrameCounter = tlvReader.getLong(ContextSpecificTag(TAG_LINK_FRAME_COUNTER)) + val mleFrameCounter = tlvReader.getLong(ContextSpecificTag(TAG_MLE_FRAME_COUNTER)) + val lqi = tlvReader.getInt(ContextSpecificTag(TAG_LQI)) + val averageRssi = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_AVERAGE_RSSI)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_AVERAGE_RSSI)) + null + } + val lastRssi = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_LAST_RSSI)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_LAST_RSSI)) + null + } + val frameErrorRate = tlvReader.getInt(ContextSpecificTag(TAG_FRAME_ERROR_RATE)) + val messageErrorRate = tlvReader.getInt(ContextSpecificTag(TAG_MESSAGE_ERROR_RATE)) + val rxOnWhenIdle = tlvReader.getBoolean(ContextSpecificTag(TAG_RX_ON_WHEN_IDLE)) + val fullThreadDevice = tlvReader.getBoolean(ContextSpecificTag(TAG_FULL_THREAD_DEVICE)) + val fullNetworkData = tlvReader.getBoolean(ContextSpecificTag(TAG_FULL_NETWORK_DATA)) + val isChild = tlvReader.getBoolean(ContextSpecificTag(TAG_IS_CHILD)) + + tlvReader.exitContainer() + + return ThreadNetworkDiagnosticsClusterNeighborTableStruct( + extAddress, + age, + rloc16, + linkFrameCounter, + mleFrameCounter, + lqi, + averageRssi, + lastRssi, + frameErrorRate, + messageErrorRate, + rxOnWhenIdle, + fullThreadDevice, + fullNetworkData, + isChild + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterOperationalDatasetComponents.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterOperationalDatasetComponents.kt new file mode 100644 index 00000000000000..f9764369891073 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterOperationalDatasetComponents.kt @@ -0,0 +1,130 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ThreadNetworkDiagnosticsClusterOperationalDatasetComponents( + val activeTimestampPresent: Boolean, + val pendingTimestampPresent: Boolean, + val masterKeyPresent: Boolean, + val networkNamePresent: Boolean, + val extendedPanIdPresent: Boolean, + val meshLocalPrefixPresent: Boolean, + val delayPresent: Boolean, + val panIdPresent: Boolean, + val channelPresent: Boolean, + val pskcPresent: Boolean, + val securityPolicyPresent: Boolean, + val channelMaskPresent: Boolean +) { + override fun toString(): String = buildString { + append("ThreadNetworkDiagnosticsClusterOperationalDatasetComponents {\n") + append("\tactiveTimestampPresent : $activeTimestampPresent\n") + append("\tpendingTimestampPresent : $pendingTimestampPresent\n") + append("\tmasterKeyPresent : $masterKeyPresent\n") + append("\tnetworkNamePresent : $networkNamePresent\n") + append("\textendedPanIdPresent : $extendedPanIdPresent\n") + append("\tmeshLocalPrefixPresent : $meshLocalPrefixPresent\n") + append("\tdelayPresent : $delayPresent\n") + append("\tpanIdPresent : $panIdPresent\n") + append("\tchannelPresent : $channelPresent\n") + append("\tpskcPresent : $pskcPresent\n") + append("\tsecurityPolicyPresent : $securityPolicyPresent\n") + append("\tchannelMaskPresent : $channelMaskPresent\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP_PRESENT), activeTimestampPresent) + put(ContextSpecificTag(TAG_PENDING_TIMESTAMP_PRESENT), pendingTimestampPresent) + put(ContextSpecificTag(TAG_MASTER_KEY_PRESENT), masterKeyPresent) + put(ContextSpecificTag(TAG_NETWORK_NAME_PRESENT), networkNamePresent) + put(ContextSpecificTag(TAG_EXTENDED_PAN_ID_PRESENT), extendedPanIdPresent) + put(ContextSpecificTag(TAG_MESH_LOCAL_PREFIX_PRESENT), meshLocalPrefixPresent) + put(ContextSpecificTag(TAG_DELAY_PRESENT), delayPresent) + put(ContextSpecificTag(TAG_PAN_ID_PRESENT), panIdPresent) + put(ContextSpecificTag(TAG_CHANNEL_PRESENT), channelPresent) + put(ContextSpecificTag(TAG_PSKC_PRESENT), pskcPresent) + put(ContextSpecificTag(TAG_SECURITY_POLICY_PRESENT), securityPolicyPresent) + put(ContextSpecificTag(TAG_CHANNEL_MASK_PRESENT), channelMaskPresent) + endStructure() + } + } + + companion object { + private const val TAG_ACTIVE_TIMESTAMP_PRESENT = 0 + private const val TAG_PENDING_TIMESTAMP_PRESENT = 1 + private const val TAG_MASTER_KEY_PRESENT = 2 + private const val TAG_NETWORK_NAME_PRESENT = 3 + private const val TAG_EXTENDED_PAN_ID_PRESENT = 4 + private const val TAG_MESH_LOCAL_PREFIX_PRESENT = 5 + private const val TAG_DELAY_PRESENT = 6 + private const val TAG_PAN_ID_PRESENT = 7 + private const val TAG_CHANNEL_PRESENT = 8 + private const val TAG_PSKC_PRESENT = 9 + private const val TAG_SECURITY_POLICY_PRESENT = 10 + private const val TAG_CHANNEL_MASK_PRESENT = 11 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): ThreadNetworkDiagnosticsClusterOperationalDatasetComponents { + tlvReader.enterStructure(tag) + val activeTimestampPresent = + tlvReader.getBoolean(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP_PRESENT)) + val pendingTimestampPresent = + tlvReader.getBoolean(ContextSpecificTag(TAG_PENDING_TIMESTAMP_PRESENT)) + val masterKeyPresent = tlvReader.getBoolean(ContextSpecificTag(TAG_MASTER_KEY_PRESENT)) + val networkNamePresent = tlvReader.getBoolean(ContextSpecificTag(TAG_NETWORK_NAME_PRESENT)) + val extendedPanIdPresent = + tlvReader.getBoolean(ContextSpecificTag(TAG_EXTENDED_PAN_ID_PRESENT)) + val meshLocalPrefixPresent = + tlvReader.getBoolean(ContextSpecificTag(TAG_MESH_LOCAL_PREFIX_PRESENT)) + val delayPresent = tlvReader.getBoolean(ContextSpecificTag(TAG_DELAY_PRESENT)) + val panIdPresent = tlvReader.getBoolean(ContextSpecificTag(TAG_PAN_ID_PRESENT)) + val channelPresent = tlvReader.getBoolean(ContextSpecificTag(TAG_CHANNEL_PRESENT)) + val pskcPresent = tlvReader.getBoolean(ContextSpecificTag(TAG_PSKC_PRESENT)) + val securityPolicyPresent = + tlvReader.getBoolean(ContextSpecificTag(TAG_SECURITY_POLICY_PRESENT)) + val channelMaskPresent = tlvReader.getBoolean(ContextSpecificTag(TAG_CHANNEL_MASK_PRESENT)) + + tlvReader.exitContainer() + + return ThreadNetworkDiagnosticsClusterOperationalDatasetComponents( + activeTimestampPresent, + pendingTimestampPresent, + masterKeyPresent, + networkNamePresent, + extendedPanIdPresent, + meshLocalPrefixPresent, + delayPresent, + panIdPresent, + channelPresent, + pskcPresent, + securityPolicyPresent, + channelMaskPresent + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt new file mode 100644 index 00000000000000..8a7c423f84e6ad --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt @@ -0,0 +1,110 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ThreadNetworkDiagnosticsClusterRouteTableStruct( + val extAddress: Long, + val rloc16: Int, + val routerId: Int, + val nextHop: Int, + val pathCost: Int, + val LQIIn: Int, + val LQIOut: Int, + val age: Int, + val allocated: Boolean, + val linkEstablished: Boolean +) { + override fun toString(): String = buildString { + append("ThreadNetworkDiagnosticsClusterRouteTableStruct {\n") + append("\textAddress : $extAddress\n") + append("\trloc16 : $rloc16\n") + append("\trouterId : $routerId\n") + append("\tnextHop : $nextHop\n") + append("\tpathCost : $pathCost\n") + append("\tLQIIn : $LQIIn\n") + append("\tLQIOut : $LQIOut\n") + append("\tage : $age\n") + append("\tallocated : $allocated\n") + append("\tlinkEstablished : $linkEstablished\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_EXT_ADDRESS), extAddress) + put(ContextSpecificTag(TAG_RLOC16), rloc16) + put(ContextSpecificTag(TAG_ROUTER_ID), routerId) + put(ContextSpecificTag(TAG_NEXT_HOP), nextHop) + put(ContextSpecificTag(TAG_PATH_COST), pathCost) + put(ContextSpecificTag(TAG_L_Q_I_IN), LQIIn) + put(ContextSpecificTag(TAG_L_Q_I_OUT), LQIOut) + put(ContextSpecificTag(TAG_AGE), age) + put(ContextSpecificTag(TAG_ALLOCATED), allocated) + put(ContextSpecificTag(TAG_LINK_ESTABLISHED), linkEstablished) + endStructure() + } + } + + companion object { + private const val TAG_EXT_ADDRESS = 0 + private const val TAG_RLOC16 = 1 + private const val TAG_ROUTER_ID = 2 + private const val TAG_NEXT_HOP = 3 + private const val TAG_PATH_COST = 4 + private const val TAG_L_Q_I_IN = 5 + private const val TAG_L_Q_I_OUT = 6 + private const val TAG_AGE = 7 + private const val TAG_ALLOCATED = 8 + private const val TAG_LINK_ESTABLISHED = 9 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ThreadNetworkDiagnosticsClusterRouteTableStruct { + tlvReader.enterStructure(tag) + val extAddress = tlvReader.getLong(ContextSpecificTag(TAG_EXT_ADDRESS)) + val rloc16 = tlvReader.getInt(ContextSpecificTag(TAG_RLOC16)) + val routerId = tlvReader.getInt(ContextSpecificTag(TAG_ROUTER_ID)) + val nextHop = tlvReader.getInt(ContextSpecificTag(TAG_NEXT_HOP)) + val pathCost = tlvReader.getInt(ContextSpecificTag(TAG_PATH_COST)) + val LQIIn = tlvReader.getInt(ContextSpecificTag(TAG_L_Q_I_IN)) + val LQIOut = tlvReader.getInt(ContextSpecificTag(TAG_L_Q_I_OUT)) + val age = tlvReader.getInt(ContextSpecificTag(TAG_AGE)) + val allocated = tlvReader.getBoolean(ContextSpecificTag(TAG_ALLOCATED)) + val linkEstablished = tlvReader.getBoolean(ContextSpecificTag(TAG_LINK_ESTABLISHED)) + + tlvReader.exitContainer() + + return ThreadNetworkDiagnosticsClusterRouteTableStruct( + extAddress, + rloc16, + routerId, + nextHop, + pathCost, + LQIIn, + LQIOut, + age, + allocated, + linkEstablished + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterSecurityPolicy.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterSecurityPolicy.kt new file mode 100644 index 00000000000000..1474db405b9d43 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterSecurityPolicy.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ThreadNetworkDiagnosticsClusterSecurityPolicy(val rotationTime: Int, val flags: Int) { + override fun toString(): String = buildString { + append("ThreadNetworkDiagnosticsClusterSecurityPolicy {\n") + append("\trotationTime : $rotationTime\n") + append("\tflags : $flags\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_ROTATION_TIME), rotationTime) + put(ContextSpecificTag(TAG_FLAGS), flags) + endStructure() + } + } + + companion object { + private const val TAG_ROTATION_TIME = 0 + private const val TAG_FLAGS = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): ThreadNetworkDiagnosticsClusterSecurityPolicy { + tlvReader.enterStructure(tag) + val rotationTime = tlvReader.getInt(ContextSpecificTag(TAG_ROTATION_TIME)) + val flags = tlvReader.getInt(ContextSpecificTag(TAG_FLAGS)) + + tlvReader.exitContainer() + + return ThreadNetworkDiagnosticsClusterSecurityPolicy(rotationTime, flags) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterDSTOffsetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterDSTOffsetStruct.kt new file mode 100644 index 00000000000000..d770d7a2ac8e03 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterDSTOffsetStruct.kt @@ -0,0 +1,74 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class TimeSynchronizationClusterDSTOffsetStruct( + val offset: Long, + val validStarting: Long, + val validUntil: Long? +) { + override fun toString(): String = buildString { + append("TimeSynchronizationClusterDSTOffsetStruct {\n") + append("\toffset : $offset\n") + append("\tvalidStarting : $validStarting\n") + append("\tvalidUntil : $validUntil\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_OFFSET), offset) + put(ContextSpecificTag(TAG_VALID_STARTING), validStarting) + if (validUntil != null) { + put(ContextSpecificTag(TAG_VALID_UNTIL), validUntil) + } else { + putNull(ContextSpecificTag(TAG_VALID_UNTIL)) + } + endStructure() + } + } + + companion object { + private const val TAG_OFFSET = 0 + private const val TAG_VALID_STARTING = 1 + private const val TAG_VALID_UNTIL = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): TimeSynchronizationClusterDSTOffsetStruct { + tlvReader.enterStructure(tag) + val offset = tlvReader.getLong(ContextSpecificTag(TAG_OFFSET)) + val validStarting = tlvReader.getLong(ContextSpecificTag(TAG_VALID_STARTING)) + val validUntil = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_VALID_UNTIL)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_VALID_UNTIL)) + null + } + + tlvReader.exitContainer() + + return TimeSynchronizationClusterDSTOffsetStruct(offset, validStarting, validUntil) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt new file mode 100644 index 00000000000000..7a2e95c671517a --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt @@ -0,0 +1,62 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct( + val nodeID: Long, + val endpoint: Int +) { + override fun toString(): String = buildString { + append("TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct {\n") + append("\tnodeID : $nodeID\n") + append("\tendpoint : $endpoint\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_ENDPOINT), endpoint) + endStructure() + } + } + + companion object { + private const val TAG_NODE_I_D = 0 + private const val TAG_ENDPOINT = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct { + tlvReader.enterStructure(tag) + val nodeID = tlvReader.getLong(ContextSpecificTag(TAG_NODE_I_D)) + val endpoint = tlvReader.getInt(ContextSpecificTag(TAG_ENDPOINT)) + + tlvReader.exitContainer() + + return TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct(nodeID, endpoint) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTimeZoneStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTimeZoneStruct.kt new file mode 100644 index 00000000000000..8a256fd7edfefe --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTimeZoneStruct.kt @@ -0,0 +1,73 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class TimeSynchronizationClusterTimeZoneStruct( + val offset: Long, + val validAt: Long, + val name: Optional +) { + override fun toString(): String = buildString { + append("TimeSynchronizationClusterTimeZoneStruct {\n") + append("\toffset : $offset\n") + append("\tvalidAt : $validAt\n") + append("\tname : $name\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_OFFSET), offset) + put(ContextSpecificTag(TAG_VALID_AT), validAt) + if (name.isPresent) { + val optname = name.get() + put(ContextSpecificTag(TAG_NAME), optname) + } + endStructure() + } + } + + companion object { + private const val TAG_OFFSET = 0 + private const val TAG_VALID_AT = 1 + private const val TAG_NAME = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): TimeSynchronizationClusterTimeZoneStruct { + tlvReader.enterStructure(tag) + val offset = tlvReader.getLong(ContextSpecificTag(TAG_OFFSET)) + val validAt = tlvReader.getLong(ContextSpecificTag(TAG_VALID_AT)) + val name = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NAME))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_NAME))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return TimeSynchronizationClusterTimeZoneStruct(offset, validAt, name) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt new file mode 100644 index 00000000000000..db50619ad5da53 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt @@ -0,0 +1,64 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class TimeSynchronizationClusterTrustedTimeSourceStruct( + val fabricIndex: Int, + val nodeID: Long, + val endpoint: Int +) { + override fun toString(): String = buildString { + append("TimeSynchronizationClusterTrustedTimeSourceStruct {\n") + append("\tfabricIndex : $fabricIndex\n") + append("\tnodeID : $nodeID\n") + append("\tendpoint : $endpoint\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_ENDPOINT), endpoint) + endStructure() + } + } + + companion object { + private const val TAG_FABRIC_INDEX = 0 + private const val TAG_NODE_I_D = 1 + private const val TAG_ENDPOINT = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): TimeSynchronizationClusterTrustedTimeSourceStruct { + tlvReader.enterStructure(tag) + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + val nodeID = tlvReader.getLong(ContextSpecificTag(TAG_NODE_I_D)) + val endpoint = tlvReader.getInt(ContextSpecificTag(TAG_ENDPOINT)) + + tlvReader.exitContainer() + + return TimeSynchronizationClusterTrustedTimeSourceStruct(fabricIndex, nodeID, endpoint) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TonerCartridgeMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TonerCartridgeMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..3633524a987a8c --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TonerCartridgeMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class TonerCartridgeMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("TonerCartridgeMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): TonerCartridgeMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return TonerCartridgeMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterDoubleNestedStructList.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterDoubleNestedStructList.kt new file mode 100644 index 00000000000000..bd34e9f5a90c49 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterDoubleNestedStructList.kt @@ -0,0 +1,64 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class UnitTestingClusterDoubleNestedStructList(val a: List) { + override fun toString(): String = buildString { + append("UnitTestingClusterDoubleNestedStructList {\n") + append("\ta : $a\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + startList(ContextSpecificTag(TAG_A)) + for (item in a.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_A = 0 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UnitTestingClusterDoubleNestedStructList { + tlvReader.enterStructure(tag) + val a = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_A)) + while (!tlvReader.isEndOfContainer()) { + add(UnitTestingClusterNestedStructList.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return UnitTestingClusterDoubleNestedStructList(a) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStruct.kt new file mode 100644 index 00000000000000..7ca3b0b29aab01 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStruct.kt @@ -0,0 +1,64 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class UnitTestingClusterNestedStruct( + val a: Int, + val b: Boolean, + val c: UnitTestingClusterSimpleStruct +) { + override fun toString(): String = buildString { + append("UnitTestingClusterNestedStruct {\n") + append("\ta : $a\n") + append("\tb : $b\n") + append("\tc : $c\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_A), a) + put(ContextSpecificTag(TAG_B), b) + c.toTlv(ContextSpecificTag(TAG_C), this) + endStructure() + } + } + + companion object { + private const val TAG_A = 0 + private const val TAG_B = 1 + private const val TAG_C = 2 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UnitTestingClusterNestedStruct { + tlvReader.enterStructure(tag) + val a = tlvReader.getInt(ContextSpecificTag(TAG_A)) + val b = tlvReader.getBoolean(ContextSpecificTag(TAG_B)) + val c = UnitTestingClusterSimpleStruct.fromTlv(ContextSpecificTag(TAG_C), tlvReader) + + tlvReader.exitContainer() + + return UnitTestingClusterNestedStruct(a, b, c) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStructList.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStructList.kt new file mode 100644 index 00000000000000..b954fe0ec9879b --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStructList.kt @@ -0,0 +1,129 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class UnitTestingClusterNestedStructList( + val a: Int, + val b: Boolean, + val c: UnitTestingClusterSimpleStruct, + val d: List, + val e: List, + val f: List, + val g: List +) { + override fun toString(): String = buildString { + append("UnitTestingClusterNestedStructList {\n") + append("\ta : $a\n") + append("\tb : $b\n") + append("\tc : $c\n") + append("\td : $d\n") + append("\te : $e\n") + append("\tf : $f\n") + append("\tg : $g\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_A), a) + put(ContextSpecificTag(TAG_B), b) + c.toTlv(ContextSpecificTag(TAG_C), this) + startList(ContextSpecificTag(TAG_D)) + for (item in d.iterator()) { + item.toTlv(AnonymousTag, this) + } + endList() + startList(ContextSpecificTag(TAG_E)) + for (item in e.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_F)) + for (item in f.iterator()) { + put(AnonymousTag, item) + } + endList() + startList(ContextSpecificTag(TAG_G)) + for (item in g.iterator()) { + put(AnonymousTag, item) + } + endList() + endStructure() + } + } + + companion object { + private const val TAG_A = 0 + private const val TAG_B = 1 + private const val TAG_C = 2 + private const val TAG_D = 3 + private const val TAG_E = 4 + private const val TAG_F = 5 + private const val TAG_G = 6 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UnitTestingClusterNestedStructList { + tlvReader.enterStructure(tag) + val a = tlvReader.getInt(ContextSpecificTag(TAG_A)) + val b = tlvReader.getBoolean(ContextSpecificTag(TAG_B)) + val c = UnitTestingClusterSimpleStruct.fromTlv(ContextSpecificTag(TAG_C), tlvReader) + val d = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_D)) + while (!tlvReader.isEndOfContainer()) { + add(UnitTestingClusterSimpleStruct.fromTlv(AnonymousTag, tlvReader)) + } + tlvReader.exitContainer() + } + val e = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_E)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getLong(AnonymousTag)) + } + tlvReader.exitContainer() + } + val f = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_F)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getByteArray(AnonymousTag)) + } + tlvReader.exitContainer() + } + val g = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_G)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return UnitTestingClusterNestedStructList(a, b, c, d, e, f, g) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNullablesAndOptionalsStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNullablesAndOptionalsStruct.kt new file mode 100644 index 00000000000000..08a4b642e69d45 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNullablesAndOptionalsStruct.kt @@ -0,0 +1,308 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class UnitTestingClusterNullablesAndOptionalsStruct( + val nullableInt: Int?, + val optionalInt: Optional, + val nullableOptionalInt: Optional?, + val nullableString: String?, + val optionalString: Optional, + val nullableOptionalString: Optional?, + val nullableStruct: UnitTestingClusterSimpleStruct?, + val optionalStruct: Optional, + val nullableOptionalStruct: Optional?, + val nullableList: List?, + val optionalList: Optional>, + val nullableOptionalList: Optional>? +) { + override fun toString(): String = buildString { + append("UnitTestingClusterNullablesAndOptionalsStruct {\n") + append("\tnullableInt : $nullableInt\n") + append("\toptionalInt : $optionalInt\n") + append("\tnullableOptionalInt : $nullableOptionalInt\n") + append("\tnullableString : $nullableString\n") + append("\toptionalString : $optionalString\n") + append("\tnullableOptionalString : $nullableOptionalString\n") + append("\tnullableStruct : $nullableStruct\n") + append("\toptionalStruct : $optionalStruct\n") + append("\tnullableOptionalStruct : $nullableOptionalStruct\n") + append("\tnullableList : $nullableList\n") + append("\toptionalList : $optionalList\n") + append("\tnullableOptionalList : $nullableOptionalList\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + if (nullableInt != null) { + put(ContextSpecificTag(TAG_NULLABLE_INT), nullableInt) + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_INT)) + } + if (optionalInt.isPresent) { + val optoptionalInt = optionalInt.get() + put(ContextSpecificTag(TAG_OPTIONAL_INT), optoptionalInt) + } + if (nullableOptionalInt != null) { + if (nullableOptionalInt.isPresent) { + val optnullableOptionalInt = nullableOptionalInt.get() + put(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_INT), optnullableOptionalInt) + } + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_INT)) + } + if (nullableString != null) { + put(ContextSpecificTag(TAG_NULLABLE_STRING), nullableString) + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_STRING)) + } + if (optionalString.isPresent) { + val optoptionalString = optionalString.get() + put(ContextSpecificTag(TAG_OPTIONAL_STRING), optoptionalString) + } + if (nullableOptionalString != null) { + if (nullableOptionalString.isPresent) { + val optnullableOptionalString = nullableOptionalString.get() + put(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRING), optnullableOptionalString) + } + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRING)) + } + if (nullableStruct != null) { + nullableStruct.toTlv(ContextSpecificTag(TAG_NULLABLE_STRUCT), this) + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_STRUCT)) + } + if (optionalStruct.isPresent) { + val optoptionalStruct = optionalStruct.get() + optoptionalStruct.toTlv(ContextSpecificTag(TAG_OPTIONAL_STRUCT), this) + } + if (nullableOptionalStruct != null) { + if (nullableOptionalStruct.isPresent) { + val optnullableOptionalStruct = nullableOptionalStruct.get() + optnullableOptionalStruct.toTlv(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRUCT), this) + } + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRUCT)) + } + if (nullableList != null) { + startList(ContextSpecificTag(TAG_NULLABLE_LIST)) + for (item in nullableList.iterator()) { + put(AnonymousTag, item) + } + endList() + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_LIST)) + } + if (optionalList.isPresent) { + val optoptionalList = optionalList.get() + startList(ContextSpecificTag(TAG_OPTIONAL_LIST)) + for (item in optoptionalList.iterator()) { + put(AnonymousTag, item) + } + endList() + } + if (nullableOptionalList != null) { + if (nullableOptionalList.isPresent) { + val optnullableOptionalList = nullableOptionalList.get() + startList(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_LIST)) + for (item in optnullableOptionalList.iterator()) { + put(AnonymousTag, item) + } + endList() + } + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_LIST)) + } + endStructure() + } + } + + companion object { + private const val TAG_NULLABLE_INT = 0 + private const val TAG_OPTIONAL_INT = 1 + private const val TAG_NULLABLE_OPTIONAL_INT = 2 + private const val TAG_NULLABLE_STRING = 3 + private const val TAG_OPTIONAL_STRING = 4 + private const val TAG_NULLABLE_OPTIONAL_STRING = 5 + private const val TAG_NULLABLE_STRUCT = 6 + private const val TAG_OPTIONAL_STRUCT = 7 + private const val TAG_NULLABLE_OPTIONAL_STRUCT = 8 + private const val TAG_NULLABLE_LIST = 9 + private const val TAG_OPTIONAL_LIST = 10 + private const val TAG_NULLABLE_OPTIONAL_LIST = 11 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UnitTestingClusterNullablesAndOptionalsStruct { + tlvReader.enterStructure(tag) + val nullableInt = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_NULLABLE_INT)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_INT)) + null + } + val optionalInt = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPTIONAL_INT))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_OPTIONAL_INT))) + } else { + Optional.empty() + } + val nullableOptionalInt = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_INT))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_INT))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_INT)) + null + } + val nullableString = + if (!tlvReader.isNull()) { + tlvReader.getString(ContextSpecificTag(TAG_NULLABLE_STRING)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_STRING)) + null + } + val optionalString = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPTIONAL_STRING))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPTIONAL_STRING))) + } else { + Optional.empty() + } + val nullableOptionalString = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRING))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRING))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRING)) + null + } + val nullableStruct = + if (!tlvReader.isNull()) { + UnitTestingClusterSimpleStruct.fromTlv(ContextSpecificTag(TAG_NULLABLE_STRUCT), tlvReader) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_STRUCT)) + null + } + val optionalStruct = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPTIONAL_STRUCT))) { + Optional.of( + UnitTestingClusterSimpleStruct.fromTlv( + ContextSpecificTag(TAG_OPTIONAL_STRUCT), + tlvReader + ) + ) + } else { + Optional.empty() + } + val nullableOptionalStruct = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRUCT))) { + Optional.of( + UnitTestingClusterSimpleStruct.fromTlv( + ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRUCT), + tlvReader + ) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_STRUCT)) + null + } + val nullableList = + if (!tlvReader.isNull()) { + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_NULLABLE_LIST)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_LIST)) + null + } + val optionalList = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPTIONAL_LIST))) { + Optional.of( + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_OPTIONAL_LIST)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + ) + } else { + Optional.empty() + } + val nullableOptionalList = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_LIST))) { + Optional.of( + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_LIST)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_LIST)) + null + } + + tlvReader.exitContainer() + + return UnitTestingClusterNullablesAndOptionalsStruct( + nullableInt, + optionalInt, + nullableOptionalInt, + nullableString, + optionalString, + nullableOptionalString, + nullableStruct, + optionalStruct, + nullableOptionalStruct, + nullableList, + optionalList, + nullableOptionalList + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterSimpleStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterSimpleStruct.kt new file mode 100644 index 00000000000000..26bf18a07ed214 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterSimpleStruct.kt @@ -0,0 +1,89 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class UnitTestingClusterSimpleStruct( + val a: Int, + val b: Boolean, + val c: Int, + val d: ByteArray, + val e: String, + val f: Int, + val g: Float, + val h: Double +) { + override fun toString(): String = buildString { + append("UnitTestingClusterSimpleStruct {\n") + append("\ta : $a\n") + append("\tb : $b\n") + append("\tc : $c\n") + append("\td : $d\n") + append("\te : $e\n") + append("\tf : $f\n") + append("\tg : $g\n") + append("\th : $h\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_A), a) + put(ContextSpecificTag(TAG_B), b) + put(ContextSpecificTag(TAG_C), c) + put(ContextSpecificTag(TAG_D), d) + put(ContextSpecificTag(TAG_E), e) + put(ContextSpecificTag(TAG_F), f) + put(ContextSpecificTag(TAG_G), g) + put(ContextSpecificTag(TAG_H), h) + endStructure() + } + } + + companion object { + private const val TAG_A = 0 + private const val TAG_B = 1 + private const val TAG_C = 2 + private const val TAG_D = 3 + private const val TAG_E = 4 + private const val TAG_F = 5 + private const val TAG_G = 6 + private const val TAG_H = 7 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UnitTestingClusterSimpleStruct { + tlvReader.enterStructure(tag) + val a = tlvReader.getInt(ContextSpecificTag(TAG_A)) + val b = tlvReader.getBoolean(ContextSpecificTag(TAG_B)) + val c = tlvReader.getInt(ContextSpecificTag(TAG_C)) + val d = tlvReader.getByteArray(ContextSpecificTag(TAG_D)) + val e = tlvReader.getString(ContextSpecificTag(TAG_E)) + val f = tlvReader.getInt(ContextSpecificTag(TAG_F)) + val g = tlvReader.getFloat(ContextSpecificTag(TAG_G)) + val h = tlvReader.getDouble(ContextSpecificTag(TAG_H)) + + tlvReader.exitContainer() + + return UnitTestingClusterSimpleStruct(a, b, c, d, e, f, g, h) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestFabricScoped.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestFabricScoped.kt new file mode 100644 index 00000000000000..6b7273f3172d5d --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestFabricScoped.kt @@ -0,0 +1,161 @@ +/* + * + * 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 chip.tlv.AnonymousTag +import chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional + +class UnitTestingClusterTestFabricScoped( + val fabricSensitiveInt8u: Int, + val optionalFabricSensitiveInt8u: Optional, + val nullableFabricSensitiveInt8u: Int?, + val nullableOptionalFabricSensitiveInt8u: Optional?, + val fabricSensitiveCharString: String, + val fabricSensitiveStruct: UnitTestingClusterSimpleStruct, + val fabricSensitiveInt8uList: List, + val fabricIndex: Int +) { + override fun toString(): String = buildString { + append("UnitTestingClusterTestFabricScoped {\n") + append("\tfabricSensitiveInt8u : $fabricSensitiveInt8u\n") + append("\toptionalFabricSensitiveInt8u : $optionalFabricSensitiveInt8u\n") + append("\tnullableFabricSensitiveInt8u : $nullableFabricSensitiveInt8u\n") + append("\tnullableOptionalFabricSensitiveInt8u : $nullableOptionalFabricSensitiveInt8u\n") + append("\tfabricSensitiveCharString : $fabricSensitiveCharString\n") + append("\tfabricSensitiveStruct : $fabricSensitiveStruct\n") + append("\tfabricSensitiveInt8uList : $fabricSensitiveInt8uList\n") + append("\tfabricIndex : $fabricIndex\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_FABRIC_SENSITIVE_INT8U), fabricSensitiveInt8u) + if (optionalFabricSensitiveInt8u.isPresent) { + val optoptionalFabricSensitiveInt8u = optionalFabricSensitiveInt8u.get() + put( + ContextSpecificTag(TAG_OPTIONAL_FABRIC_SENSITIVE_INT8U), + optoptionalFabricSensitiveInt8u + ) + } + if (nullableFabricSensitiveInt8u != null) { + put(ContextSpecificTag(TAG_NULLABLE_FABRIC_SENSITIVE_INT8U), nullableFabricSensitiveInt8u) + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_FABRIC_SENSITIVE_INT8U)) + } + if (nullableOptionalFabricSensitiveInt8u != null) { + if (nullableOptionalFabricSensitiveInt8u.isPresent) { + val optnullableOptionalFabricSensitiveInt8u = nullableOptionalFabricSensitiveInt8u.get() + put( + ContextSpecificTag(TAG_NULLABLE_OPTIONAL_FABRIC_SENSITIVE_INT8U), + optnullableOptionalFabricSensitiveInt8u + ) + } + } else { + putNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_FABRIC_SENSITIVE_INT8U)) + } + put(ContextSpecificTag(TAG_FABRIC_SENSITIVE_CHAR_STRING), fabricSensitiveCharString) + fabricSensitiveStruct.toTlv(ContextSpecificTag(TAG_FABRIC_SENSITIVE_STRUCT), this) + startList(ContextSpecificTag(TAG_FABRIC_SENSITIVE_INT8U_LIST)) + for (item in fabricSensitiveInt8uList.iterator()) { + put(AnonymousTag, item) + } + endList() + put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) + endStructure() + } + } + + companion object { + private const val TAG_FABRIC_SENSITIVE_INT8U = 1 + private const val TAG_OPTIONAL_FABRIC_SENSITIVE_INT8U = 2 + private const val TAG_NULLABLE_FABRIC_SENSITIVE_INT8U = 3 + private const val TAG_NULLABLE_OPTIONAL_FABRIC_SENSITIVE_INT8U = 4 + private const val TAG_FABRIC_SENSITIVE_CHAR_STRING = 5 + private const val TAG_FABRIC_SENSITIVE_STRUCT = 6 + private const val TAG_FABRIC_SENSITIVE_INT8U_LIST = 7 + private const val TAG_FABRIC_INDEX = 254 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UnitTestingClusterTestFabricScoped { + tlvReader.enterStructure(tag) + val fabricSensitiveInt8u = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_SENSITIVE_INT8U)) + val optionalFabricSensitiveInt8u = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPTIONAL_FABRIC_SENSITIVE_INT8U))) { + Optional.of(tlvReader.getInt(ContextSpecificTag(TAG_OPTIONAL_FABRIC_SENSITIVE_INT8U))) + } else { + Optional.empty() + } + val nullableFabricSensitiveInt8u = + if (!tlvReader.isNull()) { + tlvReader.getInt(ContextSpecificTag(TAG_NULLABLE_FABRIC_SENSITIVE_INT8U)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_FABRIC_SENSITIVE_INT8U)) + null + } + val nullableOptionalFabricSensitiveInt8u = + if (!tlvReader.isNull()) { + if ( + tlvReader.isNextTag(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_FABRIC_SENSITIVE_INT8U)) + ) { + Optional.of( + tlvReader.getInt(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_FABRIC_SENSITIVE_INT8U)) + ) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_NULLABLE_OPTIONAL_FABRIC_SENSITIVE_INT8U)) + null + } + val fabricSensitiveCharString = + tlvReader.getString(ContextSpecificTag(TAG_FABRIC_SENSITIVE_CHAR_STRING)) + val fabricSensitiveStruct = + UnitTestingClusterSimpleStruct.fromTlv( + ContextSpecificTag(TAG_FABRIC_SENSITIVE_STRUCT), + tlvReader + ) + val fabricSensitiveInt8uList = + buildList { + tlvReader.enterList(ContextSpecificTag(TAG_FABRIC_SENSITIVE_INT8U_LIST)) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + val fabricIndex = tlvReader.getInt(ContextSpecificTag(TAG_FABRIC_INDEX)) + + tlvReader.exitContainer() + + return UnitTestingClusterTestFabricScoped( + fabricSensitiveInt8u, + optionalFabricSensitiveInt8u, + nullableFabricSensitiveInt8u, + nullableOptionalFabricSensitiveInt8u, + fabricSensitiveCharString, + fabricSensitiveStruct, + fabricSensitiveInt8uList, + fabricIndex + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestListStructOctet.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestListStructOctet.kt new file mode 100644 index 00000000000000..6c5df4cb224166 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestListStructOctet.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class UnitTestingClusterTestListStructOctet(val member1: Long, val member2: ByteArray) { + override fun toString(): String = buildString { + append("UnitTestingClusterTestListStructOctet {\n") + append("\tmember1 : $member1\n") + append("\tmember2 : $member2\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_MEMBER1), member1) + put(ContextSpecificTag(TAG_MEMBER2), member2) + endStructure() + } + } + + companion object { + private const val TAG_MEMBER1 = 0 + private const val TAG_MEMBER2 = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UnitTestingClusterTestListStructOctet { + tlvReader.enterStructure(tag) + val member1 = tlvReader.getLong(ContextSpecificTag(TAG_MEMBER1)) + val member2 = tlvReader.getByteArray(ContextSpecificTag(TAG_MEMBER2)) + + tlvReader.exitContainer() + + return UnitTestingClusterTestListStructOctet(member1, member2) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UserLabelClusterLabelStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UserLabelClusterLabelStruct.kt new file mode 100644 index 00000000000000..d90396f2a010ea --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UserLabelClusterLabelStruct.kt @@ -0,0 +1,56 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class UserLabelClusterLabelStruct(val label: String, val value: String) { + override fun toString(): String = buildString { + append("UserLabelClusterLabelStruct {\n") + append("\tlabel : $label\n") + append("\tvalue : $value\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_LABEL), label) + put(ContextSpecificTag(TAG_VALUE), value) + endStructure() + } + } + + companion object { + private const val TAG_LABEL = 0 + private const val TAG_VALUE = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UserLabelClusterLabelStruct { + tlvReader.enterStructure(tag) + val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) + val value = tlvReader.getString(ContextSpecificTag(TAG_VALUE)) + + tlvReader.exitContainer() + + return UserLabelClusterLabelStruct(label, value) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UvFilterMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UvFilterMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..c8f3fbfd0085f7 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UvFilterMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,63 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class UvFilterMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("UvFilterMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv(tag: Tag, tlvReader: TlvReader): UvFilterMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return UvFilterMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterTankMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterTankMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..0d0eadde9869da --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterTankMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class WaterTankMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("WaterTankMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): WaterTankMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return WaterTankMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZeoliteFilterMonitoringClusterReplacementProductStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZeoliteFilterMonitoringClusterReplacementProductStruct.kt new file mode 100644 index 00000000000000..a76eb3c119b24b --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZeoliteFilterMonitoringClusterReplacementProductStruct.kt @@ -0,0 +1,66 @@ +/* + * + * 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 chip.tlv.ContextSpecificTag +import chip.tlv.Tag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter + +class ZeoliteFilterMonitoringClusterReplacementProductStruct( + val productIdentifierType: Int, + val productIdentifierValue: String +) { + override fun toString(): String = buildString { + append("ZeoliteFilterMonitoringClusterReplacementProductStruct {\n") + append("\tproductIdentifierType : $productIdentifierType\n") + append("\tproductIdentifierValue : $productIdentifierValue\n") + append("}\n") + } + + fun toTlv(tag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tag) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE), productIdentifierType) + put(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE), productIdentifierValue) + endStructure() + } + } + + companion object { + private const val TAG_PRODUCT_IDENTIFIER_TYPE = 0 + private const val TAG_PRODUCT_IDENTIFIER_VALUE = 1 + + fun fromTlv( + tag: Tag, + tlvReader: TlvReader + ): ZeoliteFilterMonitoringClusterReplacementProductStruct { + tlvReader.enterStructure(tag) + val productIdentifierType = tlvReader.getInt(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_TYPE)) + val productIdentifierValue = + tlvReader.getString(ContextSpecificTag(TAG_PRODUCT_IDENTIFIER_VALUE)) + + tlvReader.exitContainer() + + return ZeoliteFilterMonitoringClusterReplacementProductStruct( + productIdentifierType, + productIdentifierValue + ) + } + } +} diff --git a/src/controller/java/src/chip/devicecontroller/cluster/TlvReaderExtension.kt b/src/controller/java/src/chip/devicecontroller/cluster/TlvReaderExtension.kt new file mode 100644 index 00000000000000..7f97fb3be1563f --- /dev/null +++ b/src/controller/java/src/chip/devicecontroller/cluster/TlvReaderExtension.kt @@ -0,0 +1,44 @@ +/* + * + * 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 + +import chip.tlv.NullValue +import chip.tlv.Tag +import chip.tlv.TlvReader + +fun TlvReader.getBoolean(tag: Tag): Boolean { + return getBool(tag) +} + +fun TlvReader.getString(tag: Tag): String { + return getUtf8String(tag) +} + +fun TlvReader.getByteArray(tag: Tag): ByteArray { + return getByteString(tag) +} + +fun TlvReader.isNull(): Boolean { + val value = peekElement().value + return (value is NullValue) +} + +fun TlvReader.isNextTag(tag: Tag): Boolean { + val nextTag = peekElement().tag + return (nextTag == tag) +} diff --git a/src/controller/java/src/chip/devicecontroller/cluster/files.gni b/src/controller/java/src/chip/devicecontroller/cluster/files.gni new file mode 100644 index 00000000000000..c03d2afad86d59 --- /dev/null +++ b/src/controller/java/src/chip/devicecontroller/cluster/files.gni @@ -0,0 +1,151 @@ +import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") + +structs_sources = [ + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlEntryStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlExtensionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AccessControlClusterAccessControlTargetStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterActionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterEndpointListStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActivatedCarbonFilterMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationEPStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/AudioOutputClusterOutputInfoStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BasicInformationClusterCapabilityMinimaStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BasicInformationClusterProductAppearanceStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BindingClusterTargetStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/BridgedDeviceBasicInformationClusterProductAppearanceStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/CeramicFilterMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterChannelInfoStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterLineupInfoStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterAdditionalInfoStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterBrandingInformationStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterContentSearchStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterDimensionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterDeviceTypeStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DishwasherModeClusterModeTagStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DoorLockClusterCredentialStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectrostaticFilterMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FixedLabelClusterLabelStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/FuelTankMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GeneralCommissioningClusterBasicCommissioningInfo.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GeneralDiagnosticsClusterNetworkInterface.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupInfoMapStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/HepaFilterMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/InkCartridgeMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IonizingFilterMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/LaundryWasherModeClusterModeOptionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/LaundryWasherModeClusterModeTagStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MediaInputClusterInputInfoStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MediaPlaybackClusterPlaybackPositionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ModeSelectClusterModeOptionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ModeSelectClusterSemanticTagStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterThreadInterfaceScanResultStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterWiFiInterfaceScanResultStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterNOCStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterErrorStateStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OzoneFilterMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterBatChargeFaultChangeType.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterBatFaultChangeType.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/PowerSourceClusterWiredFaultChangeType.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RefrigeratorAndTemperatureControlledCabinetModeClusterModeOptionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RefrigeratorAndTemperatureControlledCabinetModeClusterModeTagStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcCleanModeClusterModeOptionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcCleanModeClusterModeTagStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeOptionStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcRunModeClusterModeTagStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterAttributeValuePair.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesClusterExtensionFieldSet.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterThermostatScheduleTransition.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterNeighborTableStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterOperationalDatasetComponents.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterSecurityPolicy.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterDSTOffsetStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTimeZoneStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TonerCartridgeMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterDoubleNestedStructList.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNestedStructList.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterNullablesAndOptionalsStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterSimpleStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestFabricScoped.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UnitTestingClusterTestListStructOctet.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UserLabelClusterLabelStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/UvFilterMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/WaterTankMonitoringClusterReplacementProductStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZeoliteFilterMonitoringClusterReplacementProductStruct.kt", +] + +eventstructs_sources = [ + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterLeaveEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterReachableChangedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BasicInformationClusterStartUpEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BooleanStateClusterStateChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterReachableChangedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/BridgedDeviceBasicInformationClusterStartUpEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DishwasherAlarmClusterNotifyEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorLockAlarmEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterDoorStateChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationErrorEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockUserChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterBootReasonEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterHardwareFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterNetworkFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/GeneralDiagnosticsClusterRadioFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OperationalStateClusterOperationCompletionEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OperationalStateClusterOperationalErrorEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterDownloadErrorEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterStateTransitionEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatChargeFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterBatFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/PowerSourceClusterWiredFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RefrigeratorAlarmClusterNotifyEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RvcOperationalStateClusterOperationCompletionEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/RvcOperationalStateClusterOperationalErrorEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterCOAlarmEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterInterconnectCOAlarmEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterInterconnectSmokeAlarmEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterLowBatteryEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SmokeCoAlarmClusterSmokeAlarmEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SoftwareDiagnosticsClusterSoftwareFaultEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterInitialPressEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterLongPressEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterLongReleaseEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterMultiPressCompleteEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterMultiPressOngoingEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterShortReleaseEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SwitchClusterSwitchLatchedEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterConnectionStatusEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterTimeZoneStatusEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestEventEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/UnitTestingClusterTestFabricScopedEventEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterAssociationFailureEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterConnectionStatusEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/WiFiNetworkDiagnosticsClusterDisconnectionEvent.kt", +] diff --git a/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterEventStructTest.kt b/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterEventStructTest.kt new file mode 100644 index 00000000000000..a0b83d5dafbff5 --- /dev/null +++ b/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterEventStructTest.kt @@ -0,0 +1,82 @@ +/* + * + * 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 + +import chip.devicecontroller.cluster.eventstructs.UnitTestingClusterTestEventEvent +import chip.devicecontroller.cluster.eventstructs.UnitTestingClusterTestFabricScopedEventEvent +import chip.devicecontroller.cluster.structs.UnitTestingClusterSimpleStruct +import chip.tlv.AnonymousTag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import org.junit.Test + +class ChipClusterEventStructTest { + @Test + fun testEventEventTlvTest() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val simpleStruct2 = + UnitTestingClusterSimpleStruct(8, false, 9, byteArrayOf(0x02, 0x03), "test2", 4, 5.6f, 7.8) + val struct = + UnitTestingClusterTestEventEvent( + 1, + 2, + true, + simpleStruct, + listOf(simpleStruct, simpleStruct2), + listOf(3, 4, 5) + ) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = UnitTestingClusterTestEventEvent.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + fun testFabricScopedEventEventTest() { + val struct = UnitTestingClusterTestFabricScopedEventEvent(1) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = + UnitTestingClusterTestFabricScopedEventEvent.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } +} diff --git a/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterStructTest.kt b/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterStructTest.kt new file mode 100644 index 00000000000000..1e5923f41eac9e --- /dev/null +++ b/src/controller/java/tests/chip/devicecontroller/cluster/ChipClusterStructTest.kt @@ -0,0 +1,395 @@ +/* + * + * 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 + +import chip.devicecontroller.cluster.structs.UnitTestingClusterDoubleNestedStructList +import chip.devicecontroller.cluster.structs.UnitTestingClusterNestedStructList +import chip.devicecontroller.cluster.structs.UnitTestingClusterNullablesAndOptionalsStruct +import chip.devicecontroller.cluster.structs.UnitTestingClusterSimpleStruct +import chip.devicecontroller.cluster.structs.UnitTestingClusterTestFabricScoped +import chip.devicecontroller.cluster.structs.UnitTestingClusterTestListStructOctet +import chip.tlv.AnonymousTag +import chip.tlv.TlvReader +import chip.tlv.TlvWriter +import java.util.Optional +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.JUnit4 + +@RunWith(JUnit4::class) +class ChipClusterStructTest { + @Test + fun doubleNestedStructTlvTest() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val simpleStruct2 = + UnitTestingClusterSimpleStruct(8, false, 9, byteArrayOf(0x02, 0x03), "test2", 4, 5.6f, 7.8) + val nestedStructList = + UnitTestingClusterNestedStructList( + 1, + true, + simpleStruct, + listOf(simpleStruct, simpleStruct2), + listOf(1L, 2L), + listOf(byteArrayOf(0x02, 0x03), byteArrayOf(0x03, 0x04)), + listOf(1, 2) + ) + val nestedStructList2 = + UnitTestingClusterNestedStructList( + 2, + false, + simpleStruct2, + listOf(simpleStruct2, simpleStruct), + listOf(3L, 4L), + listOf(byteArrayOf(0x04, 0x05), byteArrayOf(0x06, 0x07)), + listOf(3, 4, 5) + ) + val testStruct = + UnitTestingClusterDoubleNestedStructList(listOf(nestedStructList, nestedStructList2)) + + val tlvWriter = TlvWriter() + testStruct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareTestStruct = + UnitTestingClusterDoubleNestedStructList.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareTestStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + fun nullablesAndOptionalsStructTlvTest1() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val struct = + UnitTestingClusterNullablesAndOptionalsStruct( + 1, + Optional.of(2), + Optional.of(3), + "test4", + Optional.of("test5"), + Optional.of("test6"), + simpleStruct, + Optional.of(simpleStruct), + Optional.of(simpleStruct), + listOf(1, 2, 3), + Optional.of(listOf(4, 5, 6)), + Optional.of(listOf(7, 8, 9)) + ) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = + UnitTestingClusterNullablesAndOptionalsStruct.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + // Optional Check - 1 + fun nullablesAndOptionalsStructTlvTest2() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val struct = + UnitTestingClusterNullablesAndOptionalsStruct( + 1, + Optional.empty(), + Optional.empty(), + "test4", + Optional.of("test5"), + Optional.of("test6"), + simpleStruct, + Optional.empty(), + Optional.empty(), + listOf(1, 2, 3), + Optional.of(listOf(4, 5, 6)), + Optional.of(listOf(7, 8, 9)) + ) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = + UnitTestingClusterNullablesAndOptionalsStruct.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + // Optional Check - 2 + fun nullablesAndOptionalsStructTlvTest3() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val struct = + UnitTestingClusterNullablesAndOptionalsStruct( + 1, + Optional.of(2), + Optional.of(3), + "test4", + Optional.empty(), + Optional.empty(), + simpleStruct, + Optional.of(simpleStruct), + Optional.of(simpleStruct), + listOf(1, 2, 3), + Optional.empty(), + Optional.empty() + ) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = + UnitTestingClusterNullablesAndOptionalsStruct.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + // Nullable check - 1 + fun nullablesAndOptionalsStructTlvTest4() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val struct = + UnitTestingClusterNullablesAndOptionalsStruct( + 1, + Optional.empty(), + null, + null, + Optional.of("test5"), + Optional.of("test6"), + simpleStruct, + Optional.empty(), + null, + null, + Optional.of(listOf(4, 5, 6)), + Optional.of(listOf(7, 8, 9)) + ) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = + UnitTestingClusterNullablesAndOptionalsStruct.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + // Nullable check - 2 + fun nullablesAndOptionalsStructTlvTest5() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val struct = + UnitTestingClusterNullablesAndOptionalsStruct( + null, + Optional.of(2), + Optional.of(3), + "test4", + Optional.empty(), + null, + null, + Optional.of(simpleStruct), + Optional.of(simpleStruct), + listOf(1, 2, 3), + Optional.empty(), + null + ) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = + UnitTestingClusterNullablesAndOptionalsStruct.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + fun testFabricScopedTlvTest1() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val struct = + UnitTestingClusterTestFabricScoped( + 1, + Optional.of(2), + 3, + Optional.of(4), + "test1", + simpleStruct, + listOf(1, 2, 3), + 4 + ) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = UnitTestingClusterTestFabricScoped.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + fun testFabricScopedTlvTest2() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val struct = + UnitTestingClusterTestFabricScoped( + 1, + Optional.empty(), + 3, + null, + "test1", + simpleStruct, + listOf(1, 2, 3), + 4 + ) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = UnitTestingClusterTestFabricScoped.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + fun testFabricScopedTlvTest3() { + val simpleStruct = + UnitTestingClusterSimpleStruct(1, true, 2, byteArrayOf(0x00, 0x01), "test", 3, 4.5f, 6.7) + val struct = + UnitTestingClusterTestFabricScoped( + 1, + Optional.of(2), + null, + Optional.empty(), + "test1", + simpleStruct, + listOf(1, 2, 3), + 4 + ) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = UnitTestingClusterTestFabricScoped.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } + + @Test + fun testListStructOctetTlvTest() { + val struct = UnitTestingClusterTestListStructOctet(1L, byteArrayOf(0x01, 0x02, 0x03)) + + val tlvWriter = TlvWriter() + struct.toTlv(AnonymousTag, tlvWriter) + + // to TLV ByteArray + val tlv = tlvWriter.getEncoded() + + // Reparse to Struct + val tlvReader = TlvReader(tlv) + val compareStruct = UnitTestingClusterTestListStructOctet.fromTlv(AnonymousTag, tlvReader) + + // For comparing, struct to re-generate to tlv bytearray + val compareTlvWriter = TlvWriter() + compareStruct.toTlv(AnonymousTag, compareTlvWriter) + + assert(compareTlvWriter.getEncoded().contentEquals(tlvWriter.getEncoded())) + } +}