Skip to content

Commit

Permalink
Generated using ./scripts/tools/zap_regen_all.py
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarcosb committed Nov 6, 2024
1 parent f12c7d8 commit 41feb3d
Show file tree
Hide file tree
Showing 10 changed files with 3,119 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 matter.tlv.ContextSpecificTag
import matter.tlv.Tag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class TlsClientManagementClusterEndpointProvisionedEvent(val endpointID: UInt) {
override fun toString(): String = buildString {
append("TlsClientManagementClusterEndpointProvisionedEvent {\n")
append("\tendpointID : $endpointID\n")
append("}\n")
}

fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
tlvWriter.apply {
startStructure(tlvTag)
put(ContextSpecificTag(TAG_ENDPOINT_ID), endpointID)
endStructure()
}
}

companion object {
private const val TAG_ENDPOINT_ID = 0

fun fromTlv(
tlvTag: Tag,
tlvReader: TlvReader,
): TlsClientManagementClusterEndpointProvisionedEvent {
tlvReader.enterStructure(tlvTag)
val endpointID = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT_ID))

tlvReader.exitContainer()

return TlsClientManagementClusterEndpointProvisionedEvent(endpointID)
}
}
}
Original file line number Diff line number Diff line change
@@ -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 matter.tlv.ContextSpecificTag
import matter.tlv.Tag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class TlsCertificateManagementClusterTLSCertStruct(val caid: UInt, val certificate: ByteArray) {
override fun toString(): String = buildString {
append("TlsCertificateManagementClusterTLSCertStruct {\n")
append("\tcaid : $caid\n")
append("\tcertificate : $certificate\n")
append("}\n")
}

fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
tlvWriter.apply {
startStructure(tlvTag)
put(ContextSpecificTag(TAG_CAID), caid)
put(ContextSpecificTag(TAG_CERTIFICATE), certificate)
endStructure()
}
}

companion object {
private const val TAG_CAID = 0
private const val TAG_CERTIFICATE = 1

fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): TlsCertificateManagementClusterTLSCertStruct {
tlvReader.enterStructure(tlvTag)
val caid = tlvReader.getUInt(ContextSpecificTag(TAG_CAID))
val certificate = tlvReader.getByteArray(ContextSpecificTag(TAG_CERTIFICATE))

tlvReader.exitContainer()

return TlsCertificateManagementClusterTLSCertStruct(caid, certificate)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package chip.devicecontroller.cluster.structs

import chip.devicecontroller.cluster.*
import matter.tlv.AnonymousTag
import matter.tlv.ContextSpecificTag
import matter.tlv.Tag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class TlsCertificateManagementClusterTLSClientCertificateDetailStruct(
val ccdid: UInt,
val clientCertificate: ByteArray,
val intermediateCerts: List<ByteArray>,
) {
override fun toString(): String = buildString {
append("TlsCertificateManagementClusterTLSClientCertificateDetailStruct {\n")
append("\tccdid : $ccdid\n")
append("\tclientCertificate : $clientCertificate\n")
append("\tintermediateCerts : $intermediateCerts\n")
append("}\n")
}

fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
tlvWriter.apply {
startStructure(tlvTag)
put(ContextSpecificTag(TAG_CCDID), ccdid)
put(ContextSpecificTag(TAG_CLIENT_CERTIFICATE), clientCertificate)
startArray(ContextSpecificTag(TAG_INTERMEDIATE_CERTS))
for (item in intermediateCerts.iterator()) {
put(AnonymousTag, item)
}
endArray()
endStructure()
}
}

companion object {
private const val TAG_CCDID = 0
private const val TAG_CLIENT_CERTIFICATE = 1
private const val TAG_INTERMEDIATE_CERTS = 2

fun fromTlv(
tlvTag: Tag,
tlvReader: TlvReader,
): TlsCertificateManagementClusterTLSClientCertificateDetailStruct {
tlvReader.enterStructure(tlvTag)
val ccdid = tlvReader.getUInt(ContextSpecificTag(TAG_CCDID))
val clientCertificate = tlvReader.getByteArray(ContextSpecificTag(TAG_CLIENT_CERTIFICATE))
val intermediateCerts =
buildList<ByteArray> {
tlvReader.enterArray(ContextSpecificTag(TAG_INTERMEDIATE_CERTS))
while (!tlvReader.isEndOfContainer()) {
add(tlvReader.getByteArray(AnonymousTag))
}
tlvReader.exitContainer()
}

tlvReader.exitContainer()

return TlsCertificateManagementClusterTLSClientCertificateDetailStruct(
ccdid,
clientCertificate,
intermediateCerts,
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
*
* 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 java.util.Optional
import matter.tlv.ContextSpecificTag
import matter.tlv.Tag
import matter.tlv.TlvReader
import matter.tlv.TlvWriter

class TlsClientManagementClusterTLSEndpointStruct(
val endpointID: UInt,
val hostname: ByteArray,
val port: UInt,
val caid: UInt,
val ccdid: Optional<UInt>?,
val status: UInt,
) {
override fun toString(): String = buildString {
append("TlsClientManagementClusterTLSEndpointStruct {\n")
append("\tendpointID : $endpointID\n")
append("\thostname : $hostname\n")
append("\tport : $port\n")
append("\tcaid : $caid\n")
append("\tccdid : $ccdid\n")
append("\tstatus : $status\n")
append("}\n")
}

fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
tlvWriter.apply {
startStructure(tlvTag)
put(ContextSpecificTag(TAG_ENDPOINT_ID), endpointID)
put(ContextSpecificTag(TAG_HOSTNAME), hostname)
put(ContextSpecificTag(TAG_PORT), port)
put(ContextSpecificTag(TAG_CAID), caid)
if (ccdid != null) {
if (ccdid.isPresent) {
val optccdid = ccdid.get()
put(ContextSpecificTag(TAG_CCDID), optccdid)
}
} else {
putNull(ContextSpecificTag(TAG_CCDID))
}
put(ContextSpecificTag(TAG_STATUS), status)
endStructure()
}
}

companion object {
private const val TAG_ENDPOINT_ID = 0
private const val TAG_HOSTNAME = 1
private const val TAG_PORT = 2
private const val TAG_CAID = 3
private const val TAG_CCDID = 4
private const val TAG_STATUS = 5

fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): TlsClientManagementClusterTLSEndpointStruct {
tlvReader.enterStructure(tlvTag)
val endpointID = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT_ID))
val hostname = tlvReader.getByteArray(ContextSpecificTag(TAG_HOSTNAME))
val port = tlvReader.getUInt(ContextSpecificTag(TAG_PORT))
val caid = tlvReader.getUInt(ContextSpecificTag(TAG_CAID))
val ccdid =
if (!tlvReader.isNull()) {
if (tlvReader.isNextTag(ContextSpecificTag(TAG_CCDID))) {
Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_CCDID)))
} else {
Optional.empty()
}
} else {
tlvReader.getNull(ContextSpecificTag(TAG_CCDID))
null
}
val status = tlvReader.getUInt(ContextSpecificTag(TAG_STATUS))

tlvReader.exitContainer()

return TlsClientManagementClusterTLSEndpointStruct(
endpointID,
hostname,
port,
caid,
ccdid,
status,
)
}
}
}
Loading

0 comments on commit 41feb3d

Please sign in to comment.