From 57a787cf5f71113ca1eb835a6dbd837050ae1bd7 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 12 Dec 2023 10:14:14 -0500 Subject: [PATCH] Remove files that are not to be generated anymore --- .../SampleMeiClusterPingedEvent.kt | 56 --- ...statClusterThermostatScheduleTransition.kt | 88 ---- .../SampleMeiClusterPingedEvent.kt | 56 --- .../ElectricalEnergyMeasurementCluster.kt | 472 ------------------ 4 files changed, 672 deletions(-) delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SampleMeiClusterPingedEvent.kt delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterThermostatScheduleTransition.kt delete mode 100644 src/controller/java/generated/java/matter/controller/cluster/eventstructs/SampleMeiClusterPingedEvent.kt delete mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SampleMeiClusterPingedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SampleMeiClusterPingedEvent.kt deleted file mode 100644 index 6f61ec256f2d5b..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/SampleMeiClusterPingedEvent.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * 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 SampleMeiClusterPingedEvent(val arg1: UInt, val fabricIndex: UInt) { - override fun toString(): String = buildString { - append("SampleMeiClusterPingedEvent {\n") - append("\targ1 : $arg1\n") - append("\tfabricIndex : $fabricIndex\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_ARG1), arg1) - put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) - endStructure() - } - } - - companion object { - private const val TAG_ARG1 = 1 - private const val TAG_FABRIC_INDEX = 254 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): SampleMeiClusterPingedEvent { - tlvReader.enterStructure(tlvTag) - val arg1 = tlvReader.getUInt(ContextSpecificTag(TAG_ARG1)) - val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) - - tlvReader.exitContainer() - - return SampleMeiClusterPingedEvent(arg1, fabricIndex) - } - } -} 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 deleted file mode 100644 index 385f331a718700..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterThermostatScheduleTransition.kt +++ /dev/null @@ -1,88 +0,0 @@ -/* - * - * 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 ThermostatClusterThermostatScheduleTransition( - val transitionTime: UInt, - 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(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - 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(tlvTag: Tag, tlvReader: TlvReader): ThermostatClusterThermostatScheduleTransition { - tlvReader.enterStructure(tlvTag) - val transitionTime = tlvReader.getUInt(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/matter/controller/cluster/eventstructs/SampleMeiClusterPingedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/SampleMeiClusterPingedEvent.kt deleted file mode 100644 index a85446c9824cc6..00000000000000 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/SampleMeiClusterPingedEvent.kt +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package matter.devicecontroller.cluster.eventstructs - -import matter.devicecontroller.cluster.* -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class SampleMeiClusterPingedEvent(val arg1: UByte, val fabricIndex: UByte) { - override fun toString(): String = buildString { - append("SampleMeiClusterPingedEvent {\n") - append("\targ1 : $arg1\n") - append("\tfabricIndex : $fabricIndex\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_ARG1), arg1) - put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) - endStructure() - } - } - - companion object { - private const val TAG_ARG1 = 1 - private const val TAG_FABRIC_INDEX = 254 - - fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): SampleMeiClusterPingedEvent { - tlvReader.enterStructure(tlvTag) - val arg1 = tlvReader.getUByte(ContextSpecificTag(TAG_ARG1)) - val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) - - tlvReader.exitContainer() - - return SampleMeiClusterPingedEvent(arg1, fabricIndex) - } - } -} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt deleted file mode 100644 index d9c3677d557c85..00000000000000 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt +++ /dev/null @@ -1,472 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package matter.devicecontroller.cluster.clusters - -import java.util.logging.Level -import java.util.logging.Logger -import matter.controller.* -import matter.controller.model.AttributePath -import matter.devicecontroller.cluster.structs.* -import matter.tlv.AnonymousTag -import matter.tlv.TlvReader - -class ElectricalEnergyMeasurementCluster( - private val controller: MatterController, - private val endpointId: UShort -) { - class AccuracyAttribute(val value: ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct) - - class CumulativeEnergyImportedAttribute( - val value: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? - ) - - class CumulativeEnergyExportedAttribute( - val value: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? - ) - - class PeriodicEnergyImportedAttribute( - val value: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? - ) - - class PeriodicEnergyExportedAttribute( - val value: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? - ) - - class GeneratedCommandListAttribute(val value: List) - - class AcceptedCommandListAttribute(val value: List) - - class EventListAttribute(val value: List) - - class AttributeListAttribute(val value: List) - - suspend fun readAccuracyAttribute(): AccuracyAttribute { - val ATTRIBUTE_ID: UInt = 0u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Accuracy attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct = - ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.fromTlv(AnonymousTag, tlvReader) - - return AccuracyAttribute(decodedValue) - } - - suspend fun readCumulativeEnergyImportedAttribute(): CumulativeEnergyImportedAttribute { - val ATTRIBUTE_ID: UInt = 1u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Cumulativeenergyimported attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.fromTlv(AnonymousTag, tlvReader) - } else { - null - } - } else { - tlvReader.getNull(AnonymousTag) - null - } - - return CumulativeEnergyImportedAttribute(decodedValue) - } - - suspend fun readCumulativeEnergyExportedAttribute(): CumulativeEnergyExportedAttribute { - val ATTRIBUTE_ID: UInt = 2u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Cumulativeenergyexported attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.fromTlv(AnonymousTag, tlvReader) - } else { - null - } - } else { - tlvReader.getNull(AnonymousTag) - null - } - - return CumulativeEnergyExportedAttribute(decodedValue) - } - - suspend fun readPeriodicEnergyImportedAttribute(): PeriodicEnergyImportedAttribute { - val ATTRIBUTE_ID: UInt = 3u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Periodicenergyimported attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.fromTlv(AnonymousTag, tlvReader) - } else { - null - } - } else { - tlvReader.getNull(AnonymousTag) - null - } - - return PeriodicEnergyImportedAttribute(decodedValue) - } - - suspend fun readPeriodicEnergyExportedAttribute(): PeriodicEnergyExportedAttribute { - val ATTRIBUTE_ID: UInt = 4u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Periodicenergyexported attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: ElectricalEnergyMeasurementClusterEnergyMeasurementStruct? = - if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(AnonymousTag)) { - ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.fromTlv(AnonymousTag, tlvReader) - } else { - null - } - } else { - tlvReader.getNull(AnonymousTag) - null - } - - return PeriodicEnergyExportedAttribute(decodedValue) - } - - suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { - val ATTRIBUTE_ID: UInt = 65528u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Generatedcommandlist attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(tlvReader.getUInt(AnonymousTag)) - } - tlvReader.exitContainer() - } - - return GeneratedCommandListAttribute(decodedValue) - } - - suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { - val ATTRIBUTE_ID: UInt = 65529u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Acceptedcommandlist attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(tlvReader.getUInt(AnonymousTag)) - } - tlvReader.exitContainer() - } - - return AcceptedCommandListAttribute(decodedValue) - } - - suspend fun readEventListAttribute(): EventListAttribute { - val ATTRIBUTE_ID: UInt = 65530u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Eventlist attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(tlvReader.getUInt(AnonymousTag)) - } - tlvReader.exitContainer() - } - - return EventListAttribute(decodedValue) - } - - suspend fun readAttributeListAttribute(): AttributeListAttribute { - val ATTRIBUTE_ID: UInt = 65531u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Attributelist attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: List = - buildList { - tlvReader.enterArray(AnonymousTag) - while (!tlvReader.isEndOfContainer()) { - add(tlvReader.getUInt(AnonymousTag)) - } - tlvReader.exitContainer() - } - - return AttributeListAttribute(decodedValue) - } - - suspend fun readFeatureMapAttribute(): UInt { - val ATTRIBUTE_ID: UInt = 65532u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Featuremap attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) - - return decodedValue - } - - suspend fun readClusterRevisionAttribute(): UShort { - val ATTRIBUTE_ID: UInt = 65533u - - val attributePath = - AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) - - val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) - - val response = controller.read(readRequest) - - if (response.successes.isEmpty()) { - logger.log(Level.WARNING, "Read command failed") - throw IllegalStateException("Read command failed with failures: ${response.failures}") - } - - logger.log(Level.FINE, "Read command succeeded") - - val attributeData = - response.successes.filterIsInstance().firstOrNull { - it.path.attributeId == ATTRIBUTE_ID - } - - requireNotNull(attributeData) { "Clusterrevision attribute not found in response" } - - // Decode the TLV data into the appropriate type - val tlvReader = TlvReader(attributeData.data) - val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) - - return decodedValue - } - - companion object { - private val logger = Logger.getLogger(ElectricalEnergyMeasurementCluster::class.java.name) - const val CLUSTER_ID: UInt = 145u - } -}