From 1117944121668a93d1c61f60c197020e887463fb Mon Sep 17 00:00:00 2001 From: David Rempel <63119829+drempelg@users.noreply.github.com> Date: Mon, 11 Dec 2023 12:09:29 -0800 Subject: [PATCH] Feature/electrical energy measurement (#30389) * Added the xml for the electrical energy measurement cluster * Added convienience functions for sending events * Fixed weird whitespace * ran codegen * Add license server * Remove chip namespace prefix because we are in the chip namespace already * Restyle and use CHIP_ERROR_FORMAT * Fix header as well * Restyle * Some changes from epoch_s to systime_ms * Update the cluster to the latest version from the SPEC PR * Zap regen * Remove files that are not generated anymore by our xmls * Mark struct type attributes as needing attributeAccessInterfaceAttributes * Ran zap_convert_all.py * zaq regen after zap convert * make all clusters compile * Fix domain * Do not use PRIu64 * Fix esp32 compilation - add server cluster directory * Start adding an attribute encoding interface - for now we write nulls * Start adding some storage capability for the energy bits * Also add attribute access interface for accuracy * Also reserve space for dynamic endpoints. Note that accuracy setting is still missing * Make reporting work when accuracy is changed * Fix featuremap default * XML updates based on review * Zap regen all * Update some copyrights * Undo submodule change * fix test --------- Co-authored-by: Andrei Litvin Co-authored-by: Andrei Litvin --- docs/clusters.md | 1 + .../air-purifier-common/air-purifier-app.zap | 3 +- .../air-quality-sensor-app.zap | 3 +- .../all-clusters-app.matter | 95 ++ .../all-clusters-common/all-clusters-app.zap | 221 +++- .../esp32/main/CMakeLists.txt | 3 +- .../all-clusters-minimal-app.zap | 3 +- .../bridge-app/bridge-common/bridge-app.zap | 3 +- ...noip_rootnode_dimmablelight_bCwGYSDpoe.zap | 3 +- ...r_humiditysensor_thermostat_56de3d5f45.zap | 3 +- .../rootnode_airqualitysensor_e63187f6c9.zap | 3 +- .../rootnode_basicvideoplayer_0ff86e943b.zap | 3 +- ...tnode_colortemperaturelight_hbUnzYVeyn.zap | 3 +- .../rootnode_contactsensor_lFAGG1bfRO.zap | 3 +- .../rootnode_dimmablelight_bCwGYSDpoe.zap | 3 +- .../rootnode_dishwasher_cc105034fe.zap | 3 +- .../devices/rootnode_doorlock_aNKYAreMXE.zap | 3 +- ...rootnode_extendedcolorlight_8lcaaYJVAa.zap | 3 +- .../chef/devices/rootnode_fan_7N2TobIlOX.zap | 3 +- .../rootnode_flowsensor_1zVxHedlaV.zap | 3 +- .../rootnode_genericswitch_9866e35d0b.zap | 3 +- ...rootnode_heatingcoolingunit_ncdGai1E5a.zap | 3 +- .../rootnode_humiditysensor_Xyj4gda6Hb.zap | 3 +- .../rootnode_laundrywasher_fb10d238c8.zap | 3 +- .../rootnode_lightsensor_lZQycTFcJK.zap | 3 +- .../rootnode_occupancysensor_iHyVgifZuo.zap | 3 +- .../rootnode_onofflight_bbs1b7IaOV.zap | 3 +- .../devices/rootnode_onofflight_samplemei.zap | 3 +- .../rootnode_onofflightswitch_FsPlMr090Q.zap | 3 +- .../rootnode_onoffpluginunit_Wtf8ss5EBY.zap | 3 +- .../rootnode_pressuresensor_s0qC9wLH4k.zap | 3 +- .../chef/devices/rootnode_pump_5f904818cc.zap | 3 +- .../chef/devices/rootnode_pump_a811bb33a0.zap | 3 +- ...emperaturecontrolledcabinet_ffdb696680.zap | 3 +- ...otnode_roboticvacuumcleaner_1807ff0c49.zap | 3 +- ...rootnode_roomairconditioner_9cf3607804.zap | 3 +- .../rootnode_smokecoalarm_686fe0dcb8.zap | 3 +- .../devices/rootnode_speaker_RpzeXdimqA.zap | 3 +- .../rootnode_temperaturesensor_Qy1zkNW7c3.zap | 3 +- .../rootnode_thermostat_bm3fb8dhYi.zap | 3 +- .../rootnode_windowcovering_RLCxaGi9Yx.zap | 3 +- examples/chef/devices/template.zap | 3 +- .../contact-sensor-app.zap | 3 +- .../dishwasher-common/dishwasher-app.zap | 3 +- .../light-switch-common/light-switch-app.zap | 3 +- .../data_model/lighting-app-ethernet.zap | 3 +- .../data_model/lighting-app-thread.zap | 3 +- .../data_model/lighting-app-wifi.zap | 3 +- .../lighting-common/lighting-app.zap | 3 +- .../lighting-app/nxp/zap/lighting-on-off.zap | 3 +- examples/lighting-app/qpg/zap/light.zap | 3 +- .../silabs/data_model/lighting-thread-app.zap | 3 +- .../silabs/data_model/lighting-wifi-app.zap | 3 +- .../lit-icd-common/lit-icd-server-app.zap | 3 +- examples/lock-app/lock-common/lock-app.zap | 3 +- examples/lock-app/nxp/zap/lock-app.zap | 3 +- examples/lock-app/qpg/zap/lock.zap | 3 +- .../log-source-common/log-source-app.zap | 3 +- .../network-manager-app.zap | 256 ++-- .../ota-provider-common/ota-provider-app.zap | 3 +- .../ota-requestor-app.zap | 3 +- .../placeholder/linux/apps/app1/config.zap | 3 +- .../placeholder/linux/apps/app2/config.zap | 3 +- examples/pump-app/pump-common/pump-app.zap | 3 +- .../silabs/data_model/pump-thread-app.zap | 3 +- .../silabs/data_model/pump-wifi-app.zap | 3 +- .../pump-controller-app.zap | 3 +- .../refrigerator-common/refrigerator-app.zap | 3 +- examples/rvc-app/rvc-common/rvc-app.zap | 3 +- .../smoke-co-alarm-app.zap | 3 +- .../temperature-measurement.zap | 3 +- .../nxp/zap/thermostat_matter_thread.zap | 3 +- .../nxp/zap/thermostat_matter_wifi.zap | 3 +- .../thermostat-common/thermostat.zap | 3 +- .../tv-casting-common/tv-casting-app.zap | 3 +- .../virtual-device-app.zap | 3 +- examples/window-app/common/window-app.zap | 3 +- .../zap/tests/inputs/all-clusters-app.zap | 3 +- .../tools/zap/tests/inputs/lighting-app.zap | 3 +- .../electrical-energy-measurement-server.cpp | 208 ++++ .../electrical-energy-measurement-server.h | 40 + src/app/zap-templates/zcl/data-model/all.xml | 1 + .../electrical-energy-measurement-cluster.xml | 107 ++ .../zcl/zcl-with-test-extensions.json | 10 +- src/app/zap-templates/zcl/zcl.json | 10 +- src/app/zap_cluster_list.json | 4 + .../data_model/controller-clusters.matter | 79 ++ .../chip/devicecontroller/ChipClusters.java | 337 ++++++ .../devicecontroller/ChipEventStructs.java | 122 ++ .../chip/devicecontroller/ChipStructs.java | 363 ++++++ .../devicecontroller/ClusterIDMapping.java | 110 ++ .../devicecontroller/ClusterInfoMapping.java | 198 ++++ .../devicecontroller/ClusterReadMapping.java | 71 ++ .../devicecontroller/ClusterWriteMapping.java | 2 + ...entClusterCumulativeEnergyMeasuredEvent.kt | 96 ++ ...ementClusterPeriodicEnergyMeasuredEvent.kt | 96 ++ .../chip/devicecontroller/cluster/files.gni | 5 + ...trolClusterScopedLoadControlEventStruct.kt | 144 --- ...asurementClusterEnergyMeasurementStruct.kt | 116 ++ ...ntClusterMeasurementAccuracyRangeStruct.kt | 150 +++ ...urementClusterMeasurementAccuracyStruct.kt | 100 ++ .../ElectricalEnergyMeasurementCluster.kt | 165 +++ ...entClusterCumulativeEnergyMeasuredEvent.kt | 96 ++ ...ementClusterPeriodicEnergyMeasuredEvent.kt | 96 ++ .../matter/devicecontroller/cluster/files.gni | 6 + ...trolClusterScopedLoadControlEventStruct.kt | 144 --- ...asurementClusterEnergyMeasurementStruct.kt | 116 ++ ...ntClusterMeasurementAccuracyRangeStruct.kt | 150 +++ ...urementClusterMeasurementAccuracyStruct.kt | 100 ++ .../CHIPAttributeTLVValueDecoder.cpp | 804 +++++++++++++ .../java/zap-generated/CHIPClientCallbacks.h | 8 + .../CHIPEventTLVValueDecoder.cpp | 574 +++++++++ .../java/zap-generated/CHIPReadCallbacks.cpp | 290 +++++ .../python/chip/clusters/CHIPClusters.py | 76 ++ .../python/chip/clusters/Objects.py | 348 ++++++ .../MTRAttributeSpecifiedCheck.mm | 45 + .../MTRAttributeTLVValueDecoder.mm | 222 ++++ .../CHIP/zap-generated/MTRBaseClusters.h | 116 ++ .../CHIP/zap-generated/MTRBaseClusters.mm | 400 +++++++ .../CHIP/zap-generated/MTRClusterConstants.h | 18 + .../CHIP/zap-generated/MTRClusters.h | 46 + .../CHIP/zap-generated/MTRClusters.mm | 59 + .../zap-generated/MTRCommandTimedCheck.mm | 12 + .../zap-generated/MTREventTLVValueDecoder.mm | 159 +++ .../CHIP/zap-generated/MTRStructsObjc.h | 42 + .../CHIP/zap-generated/MTRStructsObjc.mm | 186 +++ .../zap-generated/attributes/Accessors.cpp | 68 ++ .../zap-generated/attributes/Accessors.h | 16 + .../app-common/zap-generated/callback.h | 84 ++ .../zap-generated/cluster-enums-check.h | 26 + .../app-common/zap-generated/cluster-enums.h | 37 + .../zap-generated/cluster-objects.cpp | 306 +++++ .../zap-generated/cluster-objects.h | 316 +++++ .../app-common/zap-generated/ids/Attributes.h | 50 + .../app-common/zap-generated/ids/Clusters.h | 3 + .../app-common/zap-generated/ids/Events.h | 14 + .../app-common/zap-generated/print-cluster.h | 9 + .../zap-generated/cluster/Commands.h | 115 ++ .../cluster/ComplexArgumentParser.cpp | 195 ++++ .../cluster/ComplexArgumentParser.h | 18 + .../cluster/logging/DataModelLogger.cpp | 307 +++++ .../cluster/logging/DataModelLogger.h | 18 + .../zap-generated/cluster/Commands.h | 1025 +++++++++++++++++ 143 files changed, 9558 insertions(+), 494 deletions(-) create mode 100644 src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp create mode 100644 src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h create mode 100644 src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt delete mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt create mode 100644 src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt create mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt create mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt create mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt delete mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt create mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt create mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt create mode 100644 src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt diff --git a/docs/clusters.md b/docs/clusters.md index a3c4b13dee7271..8d1d29a84d2e87 100644 --- a/docs/clusters.md +++ b/docs/clusters.md @@ -77,6 +77,7 @@ Generally regenerate using one of: | 114 | 0x72 | ActivatedCarbonFilterMonitoring | | 128 | 0x80 | BooleanSensorConfiguration | | 129 | 0x81 | ValveConfigurationAndControl | +| 145 | 0x91 | ElectricalEnergyMeasurement | | 150 | 0x96 | DemandResponseLoadControl | | 152 | 0x98 | DeviceEnergyManagement | | 153 | 0x99 | EnergyEvse | diff --git a/examples/air-purifier-app/air-purifier-common/air-purifier-app.zap b/examples/air-purifier-app/air-purifier-common/air-purifier-app.zap index 9e6fd096b39361..987813f08a1cee 100644 --- a/examples/air-purifier-app/air-purifier-common/air-purifier-app.zap +++ b/examples/air-purifier-app/air-purifier-common/air-purifier-app.zap @@ -7583,5 +7583,6 @@ "endpointId": 4, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap index 52d2ddfccc18f1..383705d04183cf 100644 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/air-quality-sensor-app.zap @@ -6063,5 +6063,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index f405eed37f7c9c..d6345f8867dddd 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -3638,6 +3638,85 @@ cluster ActivatedCarbonFilterMonitoring = 114 { command ResetCondition(): DefaultSuccess = 0; } +/** This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. */ +provisional cluster ElectricalEnergyMeasurement = 145 { + revision 1; + + enum MeasurementTypeEnum : enum16 { + kUnspecified = 0; + kVoltage = 1; + kActiveCurrent = 2; + kReactiveCurrent = 3; + kApparentCurrent = 4; + kActivePower = 5; + kReactivePower = 6; + kApparentPower = 7; + kRMSVoltage = 8; + kRMSCurrent = 9; + kRMSPower = 10; + kFrequency = 11; + kPowerFactor = 12; + kNeutralCurrent = 13; + kElectricalEnergy = 14; + } + + bitmap Feature : bitmap32 { + kImportedEnergy = 0x1; + kExportedEnergy = 0x2; + kCumulativeEnergy = 0x4; + kPeriodicEnergy = 0x8; + } + + struct MeasurementAccuracyRangeStruct { + int64s rangeMin = 0; + int64s rangeMax = 1; + optional percent100ths percentMax = 2; + optional percent100ths percentMin = 3; + optional percent100ths percentTypical = 4; + optional int64u fixedMax = 5; + optional int64u fixedMin = 6; + optional int64u fixedTypical = 7; + } + + struct MeasurementAccuracyStruct { + MeasurementTypeEnum measurementType = 0; + boolean measured = 1; + int64s minMeasuredValue = 2; + int64s maxMeasuredValue = 3; + MeasurementAccuracyRangeStruct accuracyRanges[] = 4; + } + + struct EnergyMeasurementStruct { + int64s energy = 0; + optional epoch_s startTimestamp = 1; + optional epoch_s endTimestamp = 2; + optional systime_ms startSystime = 3; + optional systime_ms endSystime = 4; + } + + info event CumulativeEnergyMeasured = 0 { + optional EnergyMeasurementStruct energyImported = 0; + optional EnergyMeasurementStruct energyExported = 1; + } + + info event PeriodicEnergyMeasured = 1 { + optional EnergyMeasurementStruct energyImported = 0; + optional EnergyMeasurementStruct energyExported = 1; + } + + readonly attribute MeasurementAccuracyStruct accuracy = 0; + readonly attribute optional nullable EnergyMeasurementStruct cumulativeEnergyImported = 1; + readonly attribute optional nullable EnergyMeasurementStruct cumulativeEnergyExported = 2; + readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyImported = 3; + readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyExported = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** Provides an interface for controlling and adjusting automatic window coverings. */ cluster WindowCovering = 258 { revision 5; @@ -7046,6 +7125,22 @@ endpoint 1 { handle command ResetCondition; } + server cluster ElectricalEnergyMeasurement { + emits event CumulativeEnergyMeasured; + emits event PeriodicEnergyMeasured; + callback attribute accuracy; + callback attribute cumulativeEnergyImported; + callback attribute cumulativeEnergyExported; + callback attribute periodicEnergyImported; + callback attribute periodicEnergyExported; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0x000F; + ram attribute clusterRevision default = 1; + } + server cluster WindowCovering { ram attribute type default = 0x08; ram attribute physicalClosedLimitLift default = 0xFFFF; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 9d8216013aa144..2a331d5674f0e4 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -11524,6 +11524,225 @@ } ] }, + { + "name": "Electrical Energy Measurement", + "code": 145, + "mfgCode": null, + "define": "ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "Measured", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Accuracy", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "MeasurementAccuracyStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CumulativeEnergyImported", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "EnergyMeasurementStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CumulativeEnergyExported", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "EnergyMeasurementStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PeriodicEnergyImported", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "EnergyMeasurementStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PeriodicEnergyExported", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "EnergyMeasurementStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x000F", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "CumulativeEnergyMeasured", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "PeriodicEnergyMeasured", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, { "name": "Window Covering", "code": 258, @@ -21742,4 +21961,4 @@ } ], "log": [] -} \ No newline at end of file +} diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 2687ad0da28539..1be7ef7cd6c842 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -84,8 +84,9 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/temperature-control-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/time-synchronization-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/dishwasher-alarm-server" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-energy-measurement-server" ) diff --git a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap index f8242628a7b01e..2ca83ff224c938 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap +++ b/examples/all-clusters-minimal-app/all-clusters-common/all-clusters-minimal-app.zap @@ -12252,5 +12252,6 @@ "endpointId": 65534, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/bridge-app/bridge-common/bridge-app.zap b/examples/bridge-app/bridge-common/bridge-app.zap index 0412a216ba7872..daeb971c0c9b48 100644 --- a/examples/bridge-app/bridge-common/bridge-app.zap +++ b/examples/bridge-app/bridge-common/bridge-app.zap @@ -5753,5 +5753,6 @@ "endpointId": 2, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap index 44e06c856968f8..9eae9ed03bec5c 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap @@ -4827,5 +4827,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.zap b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.zap index ddf9888809e6e9..029e03b3d6c8db 100644 --- a/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.zap +++ b/examples/chef/devices/rootnode_airpurifier_airqualitysensor_temperaturesensor_humiditysensor_thermostat_56de3d5f45.zap @@ -7876,5 +7876,6 @@ "endpointId": 5, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.zap b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.zap index 7eb4f3081dc3d2..1225a520c5e2c2 100644 --- a/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.zap +++ b/examples/chef/devices/rootnode_airqualitysensor_e63187f6c9.zap @@ -6070,5 +6070,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } diff --git a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.zap b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.zap index 272db06ab28ad4..9876380437e15b 100644 --- a/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.zap +++ b/examples/chef/devices/rootnode_basicvideoplayer_0ff86e943b.zap @@ -3970,5 +3970,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap index 709b2d3d338aba..863849c072ec8f 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap @@ -3950,5 +3950,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap index 7b5a4b49f9810a..58b836ccf50f53 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap @@ -3132,5 +3132,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap index 6ccf72e82c653b..c8330dd1701340 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap @@ -3564,5 +3564,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap b/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap index 5bc8fb68715b8c..b43f3c763799ff 100644 --- a/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap +++ b/examples/chef/devices/rootnode_dishwasher_cc105034fe.zap @@ -3565,5 +3565,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap index 96c60ff5453cd3..91b44423822875 100644 --- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap +++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap @@ -3461,5 +3461,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap index edd39619401e94..1a8fa80a5068ab 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap @@ -4054,5 +4054,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap b/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap index f3b01c60689739..c73eb2c7d43b2d 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap @@ -3275,5 +3275,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap index 5fe9927c1a14ea..dbb444c612924f 100644 --- a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap +++ b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap @@ -3034,5 +3034,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.zap b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.zap index d4f54512a7f13e..d4801ef3d48ab4 100644 --- a/examples/chef/devices/rootnode_genericswitch_9866e35d0b.zap +++ b/examples/chef/devices/rootnode_genericswitch_9866e35d0b.zap @@ -2438,5 +2438,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap index 139e739d9f8411..d796e78dcc17be 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap @@ -3639,5 +3639,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap index d93a61ea027e91..fd1801e7f923d0 100644 --- a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap +++ b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap @@ -3034,5 +3034,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap index 6b3b2859bc5f03..d9cd3825701630 100644 --- a/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap +++ b/examples/chef/devices/rootnode_laundrywasher_fb10d238c8.zap @@ -3401,5 +3401,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap index c01e3ca021db05..ffe1e4e9881e6f 100644 --- a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap +++ b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap @@ -3002,5 +3002,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap index 550bd5b467de59..01ee3e4be73b33 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap @@ -3018,5 +3018,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap index e39bd754aadf0c..5387f929b2e5d5 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap @@ -3474,5 +3474,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_onofflight_samplemei.zap b/examples/chef/devices/rootnode_onofflight_samplemei.zap index 473df045095cdc..958c902905add3 100644 --- a/examples/chef/devices/rootnode_onofflight_samplemei.zap +++ b/examples/chef/devices/rootnode_onofflight_samplemei.zap @@ -3606,5 +3606,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap index 4172207e164fe8..330377146f46f4 100644 --- a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap +++ b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap @@ -3194,5 +3194,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap index 7dcde4698b9da4..09eb11f7af077e 100644 --- a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap +++ b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap @@ -3222,5 +3222,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap index d8a968333633c6..feeee30e560046 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap @@ -3044,5 +3044,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_pump_5f904818cc.zap b/examples/chef/devices/rootnode_pump_5f904818cc.zap index b8909b097aaaa0..7ad53ca3281b52 100644 --- a/examples/chef/devices/rootnode_pump_5f904818cc.zap +++ b/examples/chef/devices/rootnode_pump_5f904818cc.zap @@ -3577,5 +3577,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_pump_a811bb33a0.zap b/examples/chef/devices/rootnode_pump_a811bb33a0.zap index e41fb9daa1c1aa..23b03e5b5b9b45 100644 --- a/examples/chef/devices/rootnode_pump_a811bb33a0.zap +++ b/examples/chef/devices/rootnode_pump_a811bb33a0.zap @@ -3035,5 +3035,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap index 7aa39d37307947..eec3ee7aa0e156 100644 --- a/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap +++ b/examples/chef/devices/rootnode_refrigerator_temperaturecontrolledcabinet_temperaturecontrolledcabinet_ffdb696680.zap @@ -3825,5 +3825,6 @@ "endpointId": 3, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap index 636f37076589eb..8c2a294fa04525 100644 --- a/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap +++ b/examples/chef/devices/rootnode_roboticvacuumcleaner_1807ff0c49.zap @@ -3083,5 +3083,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.zap b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.zap index 2feee5a947ccf4..074ad1dde59509 100644 --- a/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.zap +++ b/examples/chef/devices/rootnode_roomairconditioner_9cf3607804.zap @@ -3180,5 +3180,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.zap b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.zap index 5659783ce4ece8..3f0152a6202989 100644 --- a/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.zap +++ b/examples/chef/devices/rootnode_smokecoalarm_686fe0dcb8.zap @@ -3117,5 +3117,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap index b6cd32c5f5895d..edcfb8493a67c2 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap @@ -3206,5 +3206,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap index b35d366285e564..1a8083d15c19dd 100644 --- a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap +++ b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap @@ -3018,5 +3018,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap index a63173975d4c2b..29f186daa70076 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap @@ -3849,5 +3849,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap index b91dfc2b141d36..3a9b598f1435ae 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap @@ -3510,5 +3510,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/template.zap b/examples/chef/devices/template.zap index a67dae0c0fcec5..c53936a568b663 100644 --- a/examples/chef/devices/template.zap +++ b/examples/chef/devices/template.zap @@ -2724,5 +2724,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap index 748e5b6f9bbc0a..b37968d2d15978 100644 --- a/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap +++ b/examples/contact-sensor-app/contact-sensor-common/contact-sensor-app.zap @@ -4746,5 +4746,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap b/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap index 09ad0865018b8c..35bc463cd88416 100644 --- a/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap +++ b/examples/dishwasher-app/dishwasher-common/dishwasher-app.zap @@ -3943,5 +3943,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.zap b/examples/light-switch-app/light-switch-common/light-switch-app.zap index 478ce07cc7cb2d..354ba583cf0b41 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.zap +++ b/examples/light-switch-app/light-switch-common/light-switch-app.zap @@ -5880,5 +5880,6 @@ "endpointId": 2, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.zap b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.zap index 8e9a98042f426b..fcc53e79e4e132 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.zap +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-ethernet.zap @@ -4325,5 +4325,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.zap b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.zap index f9491931a681af..88ba4b99a2bcb2 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.zap +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-thread.zap @@ -5301,5 +5301,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap index 31780199b9dace..2a827b20850429 100644 --- a/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap +++ b/examples/lighting-app/bouffalolab/data_model/lighting-app-wifi.zap @@ -4508,5 +4508,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lighting-app/lighting-common/lighting-app.zap b/examples/lighting-app/lighting-common/lighting-app.zap index 66c0be9b94b739..854b16014cd6bf 100644 --- a/examples/lighting-app/lighting-common/lighting-app.zap +++ b/examples/lighting-app/lighting-common/lighting-app.zap @@ -5960,5 +5960,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lighting-app/nxp/zap/lighting-on-off.zap b/examples/lighting-app/nxp/zap/lighting-on-off.zap index 5be21734eee409..77fdb80b52a574 100644 --- a/examples/lighting-app/nxp/zap/lighting-on-off.zap +++ b/examples/lighting-app/nxp/zap/lighting-on-off.zap @@ -3994,5 +3994,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lighting-app/qpg/zap/light.zap b/examples/lighting-app/qpg/zap/light.zap index 2c881ce56c2e37..87e3bbcec961b4 100644 --- a/examples/lighting-app/qpg/zap/light.zap +++ b/examples/lighting-app/qpg/zap/light.zap @@ -5979,5 +5979,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap index 23c507509ea418..eb00551c566457 100644 --- a/examples/lighting-app/silabs/data_model/lighting-thread-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-thread-app.zap @@ -5932,5 +5932,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap index 768952dac2e36f..c5f5ddec752665 100644 --- a/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap +++ b/examples/lighting-app/silabs/data_model/lighting-wifi-app.zap @@ -5076,5 +5076,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap index 8c4b29e926b2c7..52301cf0d9540e 100644 --- a/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap +++ b/examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap @@ -3628,5 +3628,6 @@ "endpointId": 0, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lock-app/lock-common/lock-app.zap b/examples/lock-app/lock-common/lock-app.zap index ef58c8006cb198..05016f2b4025af 100644 --- a/examples/lock-app/lock-common/lock-app.zap +++ b/examples/lock-app/lock-common/lock-app.zap @@ -6414,5 +6414,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lock-app/nxp/zap/lock-app.zap b/examples/lock-app/nxp/zap/lock-app.zap index bdb78c5307b26c..cc5c7a3bb3e194 100644 --- a/examples/lock-app/nxp/zap/lock-app.zap +++ b/examples/lock-app/nxp/zap/lock-app.zap @@ -3457,5 +3457,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/lock-app/qpg/zap/lock.zap b/examples/lock-app/qpg/zap/lock.zap index d0489afe5c9b4b..07fc1197ddea91 100644 --- a/examples/lock-app/qpg/zap/lock.zap +++ b/examples/lock-app/qpg/zap/lock.zap @@ -5242,5 +5242,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/log-source-app/log-source-common/log-source-app.zap b/examples/log-source-app/log-source-common/log-source-app.zap index c486ee0070fea2..ac87b6dc41d924 100644 --- a/examples/log-source-app/log-source-common/log-source-app.zap +++ b/examples/log-source-app/log-source-common/log-source-app.zap @@ -737,5 +737,6 @@ "endpointId": 0, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/network-manager-app/network-manager-common/network-manager-app.zap b/examples/network-manager-app/network-manager-common/network-manager-app.zap index c6e8a0de50659d..3cac811850b8fc 100644 --- a/examples/network-manager-app/network-manager-common/network-manager-app.zap +++ b/examples/network-manager-app/network-manager-common/network-manager-app.zap @@ -170,7 +170,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -186,7 +186,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -202,7 +202,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -218,7 +218,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -234,7 +234,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -250,7 +250,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -266,7 +266,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -298,7 +298,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -324,7 +324,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -340,7 +340,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -356,7 +356,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "4", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -372,7 +372,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -388,7 +388,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -404,7 +404,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -420,7 +420,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -436,7 +436,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -468,7 +468,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -510,7 +510,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "10", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -526,7 +526,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -542,7 +542,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -558,7 +558,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -574,7 +574,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -606,7 +606,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "XX", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -622,7 +622,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -638,7 +638,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -654,7 +654,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -670,7 +670,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -686,7 +686,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "20210614123456ZZ", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -702,7 +702,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -718,7 +718,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -734,7 +734,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -750,7 +750,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -798,7 +798,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -814,7 +814,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -830,7 +830,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -846,7 +846,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -862,7 +862,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -878,7 +878,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -894,7 +894,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1041,7 +1041,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1057,7 +1057,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1073,7 +1073,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1089,7 +1089,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1105,7 +1105,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1121,7 +1121,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1137,7 +1137,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1211,7 +1211,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1291,7 +1291,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1307,7 +1307,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1323,7 +1323,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1407,7 +1407,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1423,7 +1423,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1439,7 +1439,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000000000000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1455,7 +1455,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x00000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1471,7 +1471,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1487,7 +1487,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1503,7 +1503,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1519,7 +1519,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1551,7 +1551,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1567,7 +1567,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1583,7 +1583,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1671,7 +1671,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1687,7 +1687,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1703,7 +1703,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1719,7 +1719,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1735,7 +1735,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000000000000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1751,7 +1751,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1767,7 +1767,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1783,7 +1783,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1799,7 +1799,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1815,7 +1815,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1831,7 +1831,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1847,7 +1847,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1863,7 +1863,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1879,7 +1879,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1895,7 +1895,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1911,7 +1911,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1927,7 +1927,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1943,7 +1943,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1959,7 +1959,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1975,7 +1975,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1991,7 +1991,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2059,7 +2059,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2075,7 +2075,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2091,7 +2091,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2107,7 +2107,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2123,7 +2123,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2139,7 +2139,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x00000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2155,7 +2155,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x00000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2171,7 +2171,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x00000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2187,7 +2187,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x00000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2203,7 +2203,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x00000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2219,7 +2219,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x00000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2235,7 +2235,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000000000000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2251,7 +2251,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x0000000000000000", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2342,7 +2342,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2358,7 +2358,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2374,7 +2374,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2450,7 +2450,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2466,7 +2466,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2482,7 +2482,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2498,7 +2498,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2514,7 +2514,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2530,7 +2530,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2686,7 +2686,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2702,7 +2702,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2718,7 +2718,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2734,7 +2734,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2750,7 +2750,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2766,7 +2766,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2782,7 +2782,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2798,7 +2798,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2814,7 +2814,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2922,7 +2922,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2938,7 +2938,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2954,7 +2954,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2970,7 +2970,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -2986,7 +2986,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3002,7 +3002,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3057,7 +3057,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3073,7 +3073,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3089,7 +3089,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3105,7 +3105,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3121,7 +3121,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3137,7 +3137,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3153,7 +3153,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3169,7 +3169,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3201,7 +3201,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap b/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap index 23becbb30ac9ed..3b5c806ab10d61 100644 --- a/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap +++ b/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap @@ -2315,5 +2315,6 @@ "endpointId": 0, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap index 37fb1e55071267..6665f50cd92c8b 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap @@ -3472,5 +3472,6 @@ "endpointId": 65534, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/placeholder/linux/apps/app1/config.zap b/examples/placeholder/linux/apps/app1/config.zap index 11f85e323bcf83..b7e4e02d1370cd 100644 --- a/examples/placeholder/linux/apps/app1/config.zap +++ b/examples/placeholder/linux/apps/app1/config.zap @@ -15141,5 +15141,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/placeholder/linux/apps/app2/config.zap b/examples/placeholder/linux/apps/app2/config.zap index 85b3958dde6f7e..c821c18390ea66 100644 --- a/examples/placeholder/linux/apps/app2/config.zap +++ b/examples/placeholder/linux/apps/app2/config.zap @@ -14933,5 +14933,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/pump-app/pump-common/pump-app.zap b/examples/pump-app/pump-common/pump-app.zap index 47060615ba022a..ace68aa46200d8 100644 --- a/examples/pump-app/pump-common/pump-app.zap +++ b/examples/pump-app/pump-common/pump-app.zap @@ -4654,5 +4654,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/pump-app/silabs/data_model/pump-thread-app.zap b/examples/pump-app/silabs/data_model/pump-thread-app.zap index 1759c693e901d0..3c2f4cb9bf9959 100644 --- a/examples/pump-app/silabs/data_model/pump-thread-app.zap +++ b/examples/pump-app/silabs/data_model/pump-thread-app.zap @@ -4654,5 +4654,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/pump-app/silabs/data_model/pump-wifi-app.zap b/examples/pump-app/silabs/data_model/pump-wifi-app.zap index 1759c693e901d0..3c2f4cb9bf9959 100644 --- a/examples/pump-app/silabs/data_model/pump-wifi-app.zap +++ b/examples/pump-app/silabs/data_model/pump-wifi-app.zap @@ -4654,5 +4654,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap index c62ef5889939b5..bba15f087cfdc6 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.zap @@ -3480,5 +3480,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap b/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap index 2efab5f43b384c..b3da40044c69b3 100644 --- a/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap +++ b/examples/refrigerator-app/refrigerator-common/refrigerator-app.zap @@ -3757,5 +3757,6 @@ "endpointId": 3, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/rvc-app/rvc-common/rvc-app.zap b/examples/rvc-app/rvc-common/rvc-app.zap index 9ab708e1bf0446..9f4f43bc793e3a 100644 --- a/examples/rvc-app/rvc-common/rvc-app.zap +++ b/examples/rvc-app/rvc-common/rvc-app.zap @@ -2823,5 +2823,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.zap b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.zap index e81864a5181d20..e80abb2729557a 100644 --- a/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.zap +++ b/examples/smoke-co-alarm-app/smoke-co-alarm-common/smoke-co-alarm-app.zap @@ -4881,5 +4881,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap index 9803e8d34ec36a..924ca2e2ccc48d 100644 --- a/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap +++ b/examples/temperature-measurement-app/temperature-measurement-common/temperature-measurement.zap @@ -3225,5 +3225,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/thermostat/nxp/zap/thermostat_matter_thread.zap b/examples/thermostat/nxp/zap/thermostat_matter_thread.zap index d5927370f28635..52062d89c75a08 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_thread.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_thread.zap @@ -4918,5 +4918,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap index a4b725903ac7a1..035d087d09cab1 100644 --- a/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap +++ b/examples/thermostat/nxp/zap/thermostat_matter_wifi.zap @@ -4060,5 +4060,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/thermostat/thermostat-common/thermostat.zap b/examples/thermostat/thermostat-common/thermostat.zap index 51d93649dce726..c5aebe739ad24b 100644 --- a/examples/thermostat/thermostat-common/thermostat.zap +++ b/examples/thermostat/thermostat-common/thermostat.zap @@ -5091,5 +5091,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap index e2df7549c77b07..abe20a454df785 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.zap @@ -4414,5 +4414,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap index ef2d710c43ba78..c386e4c4becfe7 100644 --- a/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap +++ b/examples/virtual-device-app/virtual-device-common/virtual-device-app.zap @@ -6106,5 +6106,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/window-app/common/window-app.zap b/examples/window-app/common/window-app.zap index 58156ec9db2319..2a8bb37fe4ee4c 100644 --- a/examples/window-app/common/window-app.zap +++ b/examples/window-app/common/window-app.zap @@ -7105,5 +7105,6 @@ "endpointId": 2, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index c62d16a6db7703..65cf99d5b0f510 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -16797,5 +16797,6 @@ "endpointId": 65534, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/scripts/tools/zap/tests/inputs/lighting-app.zap b/scripts/tools/zap/tests/inputs/lighting-app.zap index 0a3f56f8d981bc..58db6ff25f5d15 100644 --- a/scripts/tools/zap/tests/inputs/lighting-app.zap +++ b/scripts/tools/zap/tests/inputs/lighting-app.zap @@ -5742,5 +5742,6 @@ "endpointId": 1, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp new file mode 100644 index 00000000000000..fcc75ef319d60c --- /dev/null +++ b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.cpp @@ -0,0 +1,208 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * 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. + */ +#include "electrical-energy-measurement-server.h" + +#include + +#include +#include +#include +#include + +using chip::Protocols::InteractionModel::Status; + +namespace { + +using namespace chip; +using namespace chip::app::Clusters::ElectricalEnergyMeasurement; +using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Attributes; +using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Structs; + +struct MeasurementData +{ + MeasurementAccuracyStruct::Type measurementAccuracy; + Optional cumulativeImported; + Optional cumulativeExported; + Optional periodicImported; + Optional periodicExported; +}; + +MeasurementData + gMeasurements[EMBER_AF_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; + +MeasurementData * MeasurementDataForEndpoint(EndpointId endpointId) +{ + auto index = emberAfGetClusterServerEndpointIndex(endpointId, app::Clusters::ElectricalEnergyMeasurement::Id, + EMBER_AF_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT); + + if (index == kEmberInvalidEndpointIndex) + { + return nullptr; + } + + if (index >= EMBER_AF_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT) + { + ChipLogError(NotSpecified, "Internal error: invalid/unexpected energy measurement index."); + return nullptr; + } + return &gMeasurements[index]; +} + +class ElectricalEnergyMeasurementAttrAccess : public app::AttributeAccessInterface +{ +public: + ElectricalEnergyMeasurementAttrAccess() : + app::AttributeAccessInterface(Optional::Missing(), app::Clusters::ElectricalEnergyMeasurement::Id) + {} + + CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override; +}; + +CHIP_ERROR ElectricalEnergyMeasurementAttrAccess::Read(const app::ConcreteReadAttributePath & aPath, + app::AttributeValueEncoder & aEncoder) +{ + VerifyOrDie(aPath.mClusterId == app::Clusters::ElectricalEnergyMeasurement::Id); + + MeasurementData * data = MeasurementDataForEndpoint(aPath.mEndpointId); + + switch (aPath.mAttributeId) + { + case Accuracy::Id: + if (data == nullptr) + { + return CHIP_ERROR_NOT_FOUND; + } + return aEncoder.Encode(data->measurementAccuracy); + case CumulativeEnergyImported::Id: + if ((data == nullptr) || !data->cumulativeImported.HasValue()) + { + return aEncoder.EncodeNull(); + } + return aEncoder.Encode(data->cumulativeImported.Value()); + case CumulativeEnergyExported::Id: + if ((data == nullptr) || !data->cumulativeExported.HasValue()) + { + return aEncoder.EncodeNull(); + } + return aEncoder.Encode(data->cumulativeExported.Value()); + case PeriodicEnergyImported::Id: + if ((data == nullptr) || !data->periodicImported.HasValue()) + { + return aEncoder.EncodeNull(); + } + return aEncoder.Encode(data->periodicImported.Value()); + case PeriodicEnergyExported::Id: + if ((data == nullptr) || !data->periodicExported.HasValue()) + { + return aEncoder.EncodeNull(); + } + return aEncoder.Encode(data->periodicExported.Value()); + } + + return CHIP_NO_ERROR; +} + +ElectricalEnergyMeasurementAttrAccess gAttrAccess; + +} // namespace + +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalEnergyMeasurement { + +CHIP_ERROR SetMeasurementAccuracy(EndpointId endpointId, const MeasurementAccuracyStruct::Type & accuracy) +{ + + MeasurementData * data = MeasurementDataForEndpoint(endpointId); + VerifyOrReturnError(data != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + data->measurementAccuracy = accuracy; + + MatterReportingAttributeChangeCallback(endpointId, ElectricalEnergyMeasurement::Id, Accuracy::Id); + + return CHIP_NO_ERROR; +} + +bool NotifyCumulativeEnergyMeasured(EndpointId endpointId, const Optional & energyImported, + const Optional & energyExported) +{ + MeasurementData * data = MeasurementDataForEndpoint(endpointId); + if (data != nullptr) + { + data->cumulativeImported = energyImported; + data->cumulativeExported = energyExported; + } + + Events::CumulativeEnergyMeasured::Type event; + + event.energyImported = energyImported; + event.energyExported = energyExported; + + EventNumber eventNumber; + CHIP_ERROR error = app::LogEvent(event, endpointId, eventNumber); + + if (CHIP_NO_ERROR != error) + { + ChipLogError(Zcl, "[NotifyCumulativeEnergyMeasured] Unable to send event: %" CHIP_ERROR_FORMAT " [endpointId=%d]", + error.Format(), endpointId); + return false; + } + ChipLogProgress(Zcl, "[NotifyCumulativeEnergyMeasured] Sent event [endpointId=%d,eventNumber=%lu]", endpointId, + static_cast(eventNumber)); + return true; +} + +bool NotifyPeriodicEnergyMeasured(EndpointId endpointId, const Optional & energyImported, + const Optional & energyExported) +{ + MeasurementData * data = MeasurementDataForEndpoint(endpointId); + if (data != nullptr) + { + data->periodicImported = energyImported; + data->periodicExported = energyExported; + } + + Events::PeriodicEnergyMeasured::Type event; + + event.energyImported = energyImported; + event.energyExported = energyExported; + + EventNumber eventNumber; + CHIP_ERROR error = app::LogEvent(event, endpointId, eventNumber); + + if (CHIP_NO_ERROR != error) + { + ChipLogError(Zcl, "[NotifyPeriodicEnergyMeasured] Unable to send event: %" CHIP_ERROR_FORMAT " [endpointId=%d]", + error.Format(), endpointId); + return false; + } + ChipLogProgress(Zcl, "[NotifyPeriodicEnergyMeasured] Sent event [endpointId=%d,eventNumber=%lu]", endpointId, + static_cast(eventNumber)); + return true; +} + +} // namespace ElectricalEnergyMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip + +void MatterElectricalEnergyMeasurementPluginServerInitCallback() +{ + registerAttributeAccessOverride(&gAttrAccess); +} diff --git a/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h new file mode 100644 index 00000000000000..8647b9bde0b750 --- /dev/null +++ b/src/app/clusters/electrical-energy-measurement-server/electrical-energy-measurement-server.h @@ -0,0 +1,40 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * 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. + */ +#pragma once + +#include + +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalEnergyMeasurement { + +bool NotifyCumulativeEnergyMeasured(EndpointId endpointId, const Optional & energyImported, + const Optional & energyExported); + +bool NotifyPeriodicEnergyMeasured(EndpointId endpointId, const Optional & energyImported, + const Optional & energyExported); + +CHIP_ERROR SetMeasurementAccuracy(EndpointId endpointId, const Structs::MeasurementAccuracyStruct::Type & accuracy); + +} // namespace ElectricalEnergyMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml index cef3f6053ccf89..3556c0309206e7 100644 --- a/src/app/zap-templates/zcl/data-model/all.xml +++ b/src/app/zap-templates/zcl/data-model/all.xml @@ -31,6 +31,7 @@ + diff --git a/src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml new file mode 100644 index 00000000000000..6271b56d235a61 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Electrical Energy Measurement + Measurement & Sensing + This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. + 0x0091 + ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER + true + true + + + Accuracy + CumulativeEnergyImported + CumulativeEnergyExported + PeriodicEnergyImported + PeriodicEnergyExported + + + This event SHALL be generated when the server takes a snapshot of the cumulative energy imported by the server, exported from the server of both. + + + + + + This event SHALL be generated when the server reaches the end of a reporting period for imported energy, exported energy, or both. + + + + + + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index c1c33570d71a5c..1bab6d709d05df 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -45,6 +45,7 @@ "microwave-oven-mode-cluster.xml", "microwave-oven-control-cluster.xml", "door-lock-cluster.xml", + "electrical-energy-measurement-cluster.xml", "electrical-measurement-cluster.xml", "energy-evse-cluster.xml", "ethernet-network-diagnostics-cluster.xml", @@ -545,7 +546,14 @@ "LevelValue", "FeatureMap" ], - "Air Quality": ["AirQuality", "FeatureMap"] + "Air Quality": ["AirQuality", "FeatureMap"], + "Electrical Energy Measurement": [ + "Accuracy", + "CumulativeEnergyImported", + "CumulativeEnergyExported", + "PeriodicEnergyImported", + "PeriodicEnergyExported" + ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index e000e0fc738163..257222de56ad40 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -42,6 +42,7 @@ "dishwasher-mode-cluster.xml", "microwave-oven-mode-cluster.xml", "door-lock-cluster.xml", + "electrical-energy-measurement-cluster.xml", "drlc-cluster.xml", "electrical-measurement-cluster.xml", "energy-evse-cluster.xml", @@ -543,7 +544,14 @@ "LevelValue", "FeatureMap" ], - "Air Quality": ["AirQuality", "FeatureMap"] + "Air Quality": ["AirQuality", "FeatureMap"], + "Electrical Energy Measurement": [ + "Accuracy", + "CumulativeEnergyImported", + "CumulativeEnergyExported", + "PeriodicEnergyImported", + "PeriodicEnergyExported" + ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 31c8515cd98666..cdd92f9698b1e8 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -35,6 +35,7 @@ "DISHWASHER_MODE_CLUSTER": [], "MICROWAVE_OVEN_MODE_CLUSTER": [], "DOOR_LOCK_CLUSTER": [], + "ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER": [], "ELECTRICAL_MEASUREMENT_CLUSTER": [], "ENERGY_EVSE_CLUSTER": [], "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [], @@ -170,6 +171,9 @@ "DISHWASHER_MODE_CLUSTER": ["mode-base-server"], "MICROWAVE_OVEN_MODE_CLUSTER": ["mode-base-server"], "DOOR_LOCK_CLUSTER": ["door-lock-server"], + "ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER": [ + "electrical-energy-measurement-server" + ], "ELECTRICAL_MEASUREMENT_CLUSTER": [], "ENERGY_EVSE_CLUSTER": ["energy-evse-server"], "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [ diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 3602cad6d8899a..2d1909cb0ee41b 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4107,6 +4107,85 @@ provisional cluster ValveConfigurationAndControl = 129 { command SetLevel(SetLevelRequest): DefaultSuccess = 2; } +/** This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. */ +provisional cluster ElectricalEnergyMeasurement = 145 { + revision 1; + + enum MeasurementTypeEnum : enum16 { + kUnspecified = 0; + kVoltage = 1; + kActiveCurrent = 2; + kReactiveCurrent = 3; + kApparentCurrent = 4; + kActivePower = 5; + kReactivePower = 6; + kApparentPower = 7; + kRMSVoltage = 8; + kRMSCurrent = 9; + kRMSPower = 10; + kFrequency = 11; + kPowerFactor = 12; + kNeutralCurrent = 13; + kElectricalEnergy = 14; + } + + bitmap Feature : bitmap32 { + kImportedEnergy = 0x1; + kExportedEnergy = 0x2; + kCumulativeEnergy = 0x4; + kPeriodicEnergy = 0x8; + } + + struct MeasurementAccuracyRangeStruct { + int64s rangeMin = 0; + int64s rangeMax = 1; + optional percent100ths percentMax = 2; + optional percent100ths percentMin = 3; + optional percent100ths percentTypical = 4; + optional int64u fixedMax = 5; + optional int64u fixedMin = 6; + optional int64u fixedTypical = 7; + } + + struct MeasurementAccuracyStruct { + MeasurementTypeEnum measurementType = 0; + boolean measured = 1; + int64s minMeasuredValue = 2; + int64s maxMeasuredValue = 3; + MeasurementAccuracyRangeStruct accuracyRanges[] = 4; + } + + struct EnergyMeasurementStruct { + int64s energy = 0; + optional epoch_s startTimestamp = 1; + optional epoch_s endTimestamp = 2; + optional systime_ms startSystime = 3; + optional systime_ms endSystime = 4; + } + + info event CumulativeEnergyMeasured = 0 { + optional EnergyMeasurementStruct energyImported = 0; + optional EnergyMeasurementStruct energyExported = 1; + } + + info event PeriodicEnergyMeasured = 1 { + optional EnergyMeasurementStruct energyImported = 0; + optional EnergyMeasurementStruct energyExported = 1; + } + + readonly attribute MeasurementAccuracyStruct accuracy = 0; + readonly attribute optional nullable EnergyMeasurementStruct cumulativeEnergyImported = 1; + readonly attribute optional nullable EnergyMeasurementStruct cumulativeEnergyExported = 2; + readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyImported = 3; + readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyExported = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + /** This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. */ provisional cluster DemandResponseLoadControl = 150 { revision 4; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 1eed51794fad6f..b571ac051e3f2b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -28311,6 +28311,343 @@ public void onSuccess(byte[] tlv) { } } + public static class ElectricalEnergyMeasurementCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 145L; + + private static final long ACCURACY_ATTRIBUTE_ID = 0L; + private static final long CUMULATIVE_ENERGY_IMPORTED_ATTRIBUTE_ID = 1L; + private static final long CUMULATIVE_ENERGY_EXPORTED_ATTRIBUTE_ID = 2L; + private static final long PERIODIC_ENERGY_IMPORTED_ATTRIBUTE_ID = 3L; + private static final long PERIODIC_ENERGY_EXPORTED_ATTRIBUTE_ID = 4L; + private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; + private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; + private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; + private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L; + private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L; + private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L; + + public ElectricalEnergyMeasurementCluster(long devicePtr, int endpointId) { + super(devicePtr, endpointId, CLUSTER_ID); + } + + @Override + @Deprecated + public long initWithDevice(long devicePtr, int endpointId) { + return 0L; + } + + public interface AccuracyAttributeCallback extends BaseAttributeCallback { + void onSuccess(ChipStructs.ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct value); + } + + public interface CumulativeEnergyImportedAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value); + } + + public interface CumulativeEnergyExportedAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value); + } + + public interface PeriodicEnergyImportedAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value); + } + + public interface PeriodicEnergyExportedAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value); + } + + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface EventListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface AttributeListAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public void readAccuracyAttribute( + AccuracyAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCURACY_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + ChipStructs.ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCURACY_ATTRIBUTE_ID, true); + } + + public void subscribeAccuracyAttribute( + AccuracyAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCURACY_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + ChipStructs.ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, ACCURACY_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readCumulativeEnergyImportedAttribute( + CumulativeEnergyImportedAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CUMULATIVE_ENERGY_IMPORTED_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CUMULATIVE_ENERGY_IMPORTED_ATTRIBUTE_ID, true); + } + + public void subscribeCumulativeEnergyImportedAttribute( + CumulativeEnergyImportedAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CUMULATIVE_ENERGY_IMPORTED_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, CUMULATIVE_ENERGY_IMPORTED_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readCumulativeEnergyExportedAttribute( + CumulativeEnergyExportedAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CUMULATIVE_ENERGY_EXPORTED_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CUMULATIVE_ENERGY_EXPORTED_ATTRIBUTE_ID, true); + } + + public void subscribeCumulativeEnergyExportedAttribute( + CumulativeEnergyExportedAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CUMULATIVE_ENERGY_EXPORTED_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, CUMULATIVE_ENERGY_EXPORTED_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readPeriodicEnergyImportedAttribute( + PeriodicEnergyImportedAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PERIODIC_ENERGY_IMPORTED_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PERIODIC_ENERGY_IMPORTED_ATTRIBUTE_ID, true); + } + + public void subscribePeriodicEnergyImportedAttribute( + PeriodicEnergyImportedAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PERIODIC_ENERGY_IMPORTED_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, PERIODIC_ENERGY_IMPORTED_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readPeriodicEnergyExportedAttribute( + PeriodicEnergyExportedAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PERIODIC_ENERGY_EXPORTED_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, PERIODIC_ENERGY_EXPORTED_ATTRIBUTE_ID, true); + } + + public void subscribePeriodicEnergyExportedAttribute( + PeriodicEnergyExportedAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PERIODIC_ENERGY_EXPORTED_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, PERIODIC_ENERGY_EXPORTED_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeGeneratedCommandListAttribute( + GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAcceptedCommandListAttribute( + AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readEventListAttribute( + EventListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, EVENT_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeEventListAttribute( + EventListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readAttributeListAttribute( + AttributeListAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true); + } + + public void subscribeAttributeListAttribute( + AttributeListAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFeatureMapAttribute( + LongAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FEATURE_MAP_ATTRIBUTE_ID, true); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readClusterRevisionAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, true); + } + + public void subscribeClusterRevisionAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); + } + } + public static class DemandResponseLoadControlCluster extends BaseChipCluster { public static final long CLUSTER_ID = 150L; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index 256d205a09e8df..5f9984935302be 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -3060,6 +3060,128 @@ public String toString() { return output.toString(); } } +public static class ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent { + public Optional energyImported; + public Optional energyExported; + private static final long ENERGY_IMPORTED_ID = 0L; + private static final long ENERGY_EXPORTED_ID = 1L; + + public ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent( + Optional energyImported, + Optional energyExported + ) { + this.energyImported = energyImported; + this.energyExported = energyExported; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ENERGY_IMPORTED_ID, energyImported.map((nonOptionalenergyImported) -> nonOptionalenergyImported.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(ENERGY_EXPORTED_ID, energyExported.map((nonOptionalenergyExported) -> nonOptionalenergyExported.encodeTlv()).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional energyImported = Optional.empty(); + Optional energyExported = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ENERGY_IMPORTED_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + energyImported = Optional.of(ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == ENERGY_EXPORTED_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + energyExported = Optional.of(ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.decodeTlv(castingValue)); + } + } + } + return new ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent( + energyImported, + energyExported + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent {\n"); + output.append("\tenergyImported: "); + output.append(energyImported); + output.append("\n"); + output.append("\tenergyExported: "); + output.append(energyExported); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent { + public Optional energyImported; + public Optional energyExported; + private static final long ENERGY_IMPORTED_ID = 0L; + private static final long ENERGY_EXPORTED_ID = 1L; + + public ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent( + Optional energyImported, + Optional energyExported + ) { + this.energyImported = energyImported; + this.energyExported = energyExported; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ENERGY_IMPORTED_ID, energyImported.map((nonOptionalenergyImported) -> nonOptionalenergyImported.encodeTlv()).orElse(new EmptyType()))); + values.add(new StructElement(ENERGY_EXPORTED_ID, energyExported.map((nonOptionalenergyExported) -> nonOptionalenergyExported.encodeTlv()).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Optional energyImported = Optional.empty(); + Optional energyExported = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ENERGY_IMPORTED_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + energyImported = Optional.of(ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.decodeTlv(castingValue)); + } + } else if (element.contextTagNum() == ENERGY_EXPORTED_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Struct) { + StructType castingValue = element.value(StructType.class); + energyExported = Optional.of(ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.decodeTlv(castingValue)); + } + } + } + return new ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent( + energyImported, + energyExported + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent {\n"); + output.append("\tenergyImported: "); + output.append(energyImported); + output.append("\n"); + output.append("\tenergyExported: "); + output.append(energyExported); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent { public byte[] eventID; public @Nullable Integer transitionIndex; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index ba1b077bbf57b2..0237b3fc989cd2 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -5428,6 +5428,369 @@ public String toString() { return output.toString(); } } +public static class ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct { + public Long rangeMin; + public Long rangeMax; + public Optional percentMax; + public Optional percentMin; + public Optional percentTypical; + public Optional fixedMax; + public Optional fixedMin; + public Optional fixedTypical; + private static final long RANGE_MIN_ID = 0L; + private static final long RANGE_MAX_ID = 1L; + private static final long PERCENT_MAX_ID = 2L; + private static final long PERCENT_MIN_ID = 3L; + private static final long PERCENT_TYPICAL_ID = 4L; + private static final long FIXED_MAX_ID = 5L; + private static final long FIXED_MIN_ID = 6L; + private static final long FIXED_TYPICAL_ID = 7L; + + public ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct( + Long rangeMin, + Long rangeMax, + Optional percentMax, + Optional percentMin, + Optional percentTypical, + Optional fixedMax, + Optional fixedMin, + Optional fixedTypical + ) { + this.rangeMin = rangeMin; + this.rangeMax = rangeMax; + this.percentMax = percentMax; + this.percentMin = percentMin; + this.percentTypical = percentTypical; + this.fixedMax = fixedMax; + this.fixedMin = fixedMin; + this.fixedTypical = fixedTypical; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(RANGE_MIN_ID, new IntType(rangeMin))); + values.add(new StructElement(RANGE_MAX_ID, new IntType(rangeMax))); + values.add(new StructElement(PERCENT_MAX_ID, percentMax.map((nonOptionalpercentMax) -> new UIntType(nonOptionalpercentMax)).orElse(new EmptyType()))); + values.add(new StructElement(PERCENT_MIN_ID, percentMin.map((nonOptionalpercentMin) -> new UIntType(nonOptionalpercentMin)).orElse(new EmptyType()))); + values.add(new StructElement(PERCENT_TYPICAL_ID, percentTypical.map((nonOptionalpercentTypical) -> new UIntType(nonOptionalpercentTypical)).orElse(new EmptyType()))); + values.add(new StructElement(FIXED_MAX_ID, fixedMax.map((nonOptionalfixedMax) -> new UIntType(nonOptionalfixedMax)).orElse(new EmptyType()))); + values.add(new StructElement(FIXED_MIN_ID, fixedMin.map((nonOptionalfixedMin) -> new UIntType(nonOptionalfixedMin)).orElse(new EmptyType()))); + values.add(new StructElement(FIXED_TYPICAL_ID, fixedTypical.map((nonOptionalfixedTypical) -> new UIntType(nonOptionalfixedTypical)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long rangeMin = null; + Long rangeMax = null; + Optional percentMax = Optional.empty(); + Optional percentMin = Optional.empty(); + Optional percentTypical = Optional.empty(); + Optional fixedMax = Optional.empty(); + Optional fixedMin = Optional.empty(); + Optional fixedTypical = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == RANGE_MIN_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + rangeMin = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == RANGE_MAX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + rangeMax = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == PERCENT_MAX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + percentMax = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == PERCENT_MIN_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + percentMin = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == PERCENT_TYPICAL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + percentTypical = Optional.of(castingValue.value(Integer.class)); + } + } else if (element.contextTagNum() == FIXED_MAX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fixedMax = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == FIXED_MIN_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fixedMin = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == FIXED_TYPICAL_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + fixedTypical = Optional.of(castingValue.value(Long.class)); + } + } + } + return new ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct( + rangeMin, + rangeMax, + percentMax, + percentMin, + percentTypical, + fixedMax, + fixedMin, + fixedTypical + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct {\n"); + output.append("\trangeMin: "); + output.append(rangeMin); + output.append("\n"); + output.append("\trangeMax: "); + output.append(rangeMax); + output.append("\n"); + output.append("\tpercentMax: "); + output.append(percentMax); + output.append("\n"); + output.append("\tpercentMin: "); + output.append(percentMin); + output.append("\n"); + output.append("\tpercentTypical: "); + output.append(percentTypical); + output.append("\n"); + output.append("\tfixedMax: "); + output.append(fixedMax); + output.append("\n"); + output.append("\tfixedMin: "); + output.append(fixedMin); + output.append("\n"); + output.append("\tfixedTypical: "); + output.append(fixedTypical); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct { + public Integer measurementType; + public Boolean measured; + public Long minMeasuredValue; + public Long maxMeasuredValue; + public ArrayList accuracyRanges; + private static final long MEASUREMENT_TYPE_ID = 0L; + private static final long MEASURED_ID = 1L; + private static final long MIN_MEASURED_VALUE_ID = 2L; + private static final long MAX_MEASURED_VALUE_ID = 3L; + private static final long ACCURACY_RANGES_ID = 4L; + + public ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct( + Integer measurementType, + Boolean measured, + Long minMeasuredValue, + Long maxMeasuredValue, + ArrayList accuracyRanges + ) { + this.measurementType = measurementType; + this.measured = measured; + this.minMeasuredValue = minMeasuredValue; + this.maxMeasuredValue = maxMeasuredValue; + this.accuracyRanges = accuracyRanges; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(MEASUREMENT_TYPE_ID, new UIntType(measurementType))); + values.add(new StructElement(MEASURED_ID, new BooleanType(measured))); + values.add(new StructElement(MIN_MEASURED_VALUE_ID, new IntType(minMeasuredValue))); + values.add(new StructElement(MAX_MEASURED_VALUE_ID, new IntType(maxMeasuredValue))); + values.add(new StructElement(ACCURACY_RANGES_ID, ArrayType.generateArrayType(accuracyRanges, (elementaccuracyRanges) -> elementaccuracyRanges.encodeTlv()))); + + return new StructType(values); + } + + public static ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer measurementType = null; + Boolean measured = null; + Long minMeasuredValue = null; + Long maxMeasuredValue = null; + ArrayList accuracyRanges = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == MEASUREMENT_TYPE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + measurementType = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == MEASURED_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Boolean) { + BooleanType castingValue = element.value(BooleanType.class); + measured = castingValue.value(Boolean.class); + } + } else if (element.contextTagNum() == MIN_MEASURED_VALUE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + minMeasuredValue = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == MAX_MEASURED_VALUE_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + maxMeasuredValue = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == ACCURACY_RANGES_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + accuracyRanges = castingValue.map((elementcastingValue) -> ChipStructs.ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.decodeTlv(elementcastingValue)); + } + } + } + return new ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct( + measurementType, + measured, + minMeasuredValue, + maxMeasuredValue, + accuracyRanges + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct {\n"); + output.append("\tmeasurementType: "); + output.append(measurementType); + output.append("\n"); + output.append("\tmeasured: "); + output.append(measured); + output.append("\n"); + output.append("\tminMeasuredValue: "); + output.append(minMeasuredValue); + output.append("\n"); + output.append("\tmaxMeasuredValue: "); + output.append(maxMeasuredValue); + output.append("\n"); + output.append("\taccuracyRanges: "); + output.append(accuracyRanges); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ElectricalEnergyMeasurementClusterEnergyMeasurementStruct { + public Long energy; + public Optional startTimestamp; + public Optional endTimestamp; + public Optional startSystime; + public Optional endSystime; + private static final long ENERGY_ID = 0L; + private static final long START_TIMESTAMP_ID = 1L; + private static final long END_TIMESTAMP_ID = 2L; + private static final long START_SYSTIME_ID = 3L; + private static final long END_SYSTIME_ID = 4L; + + public ElectricalEnergyMeasurementClusterEnergyMeasurementStruct( + Long energy, + Optional startTimestamp, + Optional endTimestamp, + Optional startSystime, + Optional endSystime + ) { + this.energy = energy; + this.startTimestamp = startTimestamp; + this.endTimestamp = endTimestamp; + this.startSystime = startSystime; + this.endSystime = endSystime; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ENERGY_ID, new IntType(energy))); + values.add(new StructElement(START_TIMESTAMP_ID, startTimestamp.map((nonOptionalstartTimestamp) -> new UIntType(nonOptionalstartTimestamp)).orElse(new EmptyType()))); + values.add(new StructElement(END_TIMESTAMP_ID, endTimestamp.map((nonOptionalendTimestamp) -> new UIntType(nonOptionalendTimestamp)).orElse(new EmptyType()))); + values.add(new StructElement(START_SYSTIME_ID, startSystime.map((nonOptionalstartSystime) -> new UIntType(nonOptionalstartSystime)).orElse(new EmptyType()))); + values.add(new StructElement(END_SYSTIME_ID, endSystime.map((nonOptionalendSystime) -> new UIntType(nonOptionalendSystime)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ElectricalEnergyMeasurementClusterEnergyMeasurementStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Long energy = null; + Optional startTimestamp = Optional.empty(); + Optional endTimestamp = Optional.empty(); + Optional startSystime = Optional.empty(); + Optional endSystime = Optional.empty(); + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ENERGY_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + energy = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == START_TIMESTAMP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + startTimestamp = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == END_TIMESTAMP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + endTimestamp = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == START_SYSTIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + startSystime = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == END_SYSTIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + endSystime = Optional.of(castingValue.value(Long.class)); + } + } + } + return new ElectricalEnergyMeasurementClusterEnergyMeasurementStruct( + energy, + startTimestamp, + endTimestamp, + startSystime, + endSystime + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalEnergyMeasurementClusterEnergyMeasurementStruct {\n"); + output.append("\tenergy: "); + output.append(energy); + output.append("\n"); + output.append("\tstartTimestamp: "); + output.append(startTimestamp); + output.append("\n"); + output.append("\tendTimestamp: "); + output.append(endTimestamp); + output.append("\n"); + output.append("\tstartSystime: "); + output.append(startSystime); + output.append("\n"); + output.append("\tendSystime: "); + output.append(endSystime); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class DemandResponseLoadControlClusterHeatingSourceControlStruct { public Integer heatingSource; private static final long HEATING_SOURCE_ID = 0L; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 96f0183b3dadf3..0762d4168da6f5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java @@ -223,6 +223,9 @@ public static BaseCluster getCluster(long clusterId) { if (clusterId == ValveConfigurationAndControl.ID) { return new ValveConfigurationAndControl(); } + if (clusterId == ElectricalEnergyMeasurement.ID) { + return new ElectricalEnergyMeasurement(); + } if (clusterId == DemandResponseLoadControl.ID) { return new DemandResponseLoadControl(); } @@ -9038,6 +9041,113 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class ElectricalEnergyMeasurement implements BaseCluster { + public static final long ID = 145L; + public long getID() { + return ID; + } + + public enum Attribute { + Accuracy(0L), + CumulativeEnergyImported(1L), + CumulativeEnergyExported(2L), + PeriodicEnergyImported(3L), + PeriodicEnergyExported(4L), + GeneratedCommandList(65528L), + AcceptedCommandList(65529L), + EventList(65530L), + AttributeList(65531L), + FeatureMap(65532L), + ClusterRevision(65533L),; + private final long id; + Attribute(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Attribute value(long id) throws NoSuchFieldError { + for (Attribute attribute : Attribute.values()) { + if (attribute.getID() == id) { + return attribute; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Event { + CumulativeEnergyMeasured(0L), + PeriodicEnergyMeasured(1L),; + private final long id; + Event(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Event value(long id) throws NoSuchFieldError { + for (Event event : Event.values()) { + if (event.getID() == id) { + return event; + } + } + throw new NoSuchFieldError(); + } + } + + public enum Command {; + private final long id; + Command(long id) { + this.id = id; + } + + public long getID() { + return id; + } + + public static Command value(long id) throws NoSuchFieldError { + for (Command command : Command.values()) { + if (command.getID() == id) { + return command; + } + } + throw new NoSuchFieldError(); + } + }@Override + public String getAttributeName(long id) throws NoSuchFieldError { + return Attribute.value(id).toString(); + } + + @Override + public String getEventName(long id) throws NoSuchFieldError { + return Event.value(id).toString(); + } + + @Override + public String getCommandName(long id) throws NoSuchFieldError { + return Command.value(id).toString(); + } + + @Override + public long getAttributeID(String name) throws IllegalArgumentException { + return Attribute.valueOf(name).getID(); + } + + @Override + public long getEventID(String name) throws IllegalArgumentException { + return Event.valueOf(name).getID(); + } + + @Override + public long getCommandID(String name) throws IllegalArgumentException { + return Command.valueOf(name).getID(); + } + } public static class DemandResponseLoadControl implements BaseCluster { public static final long ID = 150L; public long getID() { diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index db477f41ca12bd..27b051c993d5f5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -10008,6 +10008,195 @@ public void onError(Exception ex) { } } + public static class DelegatedElectricalEnergyMeasurementClusterAccuracyAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.AccuracyAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(ChipStructs.ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalEnergyMeasurementClusterCumulativeEnergyImportedAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.CumulativeEnergyImportedAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalEnergyMeasurementClusterCumulativeEnergyExportedAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.CumulativeEnergyExportedAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalEnergyMeasurementClusterPeriodicEnergyImportedAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.PeriodicEnergyImportedAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalEnergyMeasurementClusterPeriodicEnergyExportedAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.PeriodicEnergyExportedAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalEnergyMeasurementClusterGeneratedCommandListAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalEnergyMeasurementClusterAcceptedCommandListAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalEnergyMeasurementClusterEventListAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.EventListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalEnergyMeasurementClusterAttributeListAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.AttributeListAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(List valueList) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List"); + responseValues.put(commandResponseInfo, valueList); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + public static class DelegatedDemandResponseLoadControlClusterLoadControlProgramsAttributeCallback implements ChipClusters.DemandResponseLoadControlCluster.LoadControlProgramsAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -19302,6 +19491,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.ValveConfigurationAndControlCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("valveConfigurationAndControl", valveConfigurationAndControlClusterInfo); + ClusterInfo electricalEnergyMeasurementClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.ElectricalEnergyMeasurementCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("electricalEnergyMeasurement", electricalEnergyMeasurementClusterInfo); + ClusterInfo demandResponseLoadControlClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.DemandResponseLoadControlCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("demandResponseLoadControl", demandResponseLoadControlClusterInfo); @@ -19555,6 +19748,7 @@ public void combineCommand(Map destination, Map> getCommandMap() { commandMap.put("valveConfigurationAndControl", valveConfigurationAndControlClusterInteractionInfoMap); + Map electricalEnergyMeasurementClusterInteractionInfoMap = new LinkedHashMap<>(); + + commandMap.put("electricalEnergyMeasurement", electricalEnergyMeasurementClusterInteractionInfoMap); + Map demandResponseLoadControlClusterInteractionInfoMap = new LinkedHashMap<>(); Map demandResponseLoadControlregisterLoadControlProgramRequestCommandParams = new LinkedHashMap(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 2ac1dab0489c80..fecf9c31d761ee 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -8931,6 +8931,76 @@ private static Map readValveConfigurationAndControlInte return result; } + private static Map readElectricalEnergyMeasurementInteractionInfo() { + Map result = new LinkedHashMap<>();Map readElectricalEnergyMeasurementGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalEnergyMeasurementGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalEnergyMeasurementCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.ElectricalEnergyMeasurementCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalEnergyMeasurementClusterGeneratedCommandListAttributeCallback(), + readElectricalEnergyMeasurementGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readElectricalEnergyMeasurementGeneratedCommandListAttributeInteractionInfo); + Map readElectricalEnergyMeasurementAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalEnergyMeasurementAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalEnergyMeasurementCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.ElectricalEnergyMeasurementCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalEnergyMeasurementClusterAcceptedCommandListAttributeCallback(), + readElectricalEnergyMeasurementAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readElectricalEnergyMeasurementAcceptedCommandListAttributeInteractionInfo); + Map readElectricalEnergyMeasurementEventListCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalEnergyMeasurementEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalEnergyMeasurementCluster) cluster).readEventListAttribute( + (ChipClusters.ElectricalEnergyMeasurementCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalEnergyMeasurementClusterEventListAttributeCallback(), + readElectricalEnergyMeasurementEventListCommandParams + ); + result.put("readEventListAttribute", readElectricalEnergyMeasurementEventListAttributeInteractionInfo); + Map readElectricalEnergyMeasurementAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalEnergyMeasurementAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalEnergyMeasurementCluster) cluster).readAttributeListAttribute( + (ChipClusters.ElectricalEnergyMeasurementCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalEnergyMeasurementClusterAttributeListAttributeCallback(), + readElectricalEnergyMeasurementAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readElectricalEnergyMeasurementAttributeListAttributeInteractionInfo); + Map readElectricalEnergyMeasurementFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalEnergyMeasurementFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalEnergyMeasurementCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readElectricalEnergyMeasurementFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readElectricalEnergyMeasurementFeatureMapAttributeInteractionInfo); + Map readElectricalEnergyMeasurementClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalEnergyMeasurementClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalEnergyMeasurementCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readElectricalEnergyMeasurementClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readElectricalEnergyMeasurementClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readDemandResponseLoadControlInteractionInfo() { Map result = new LinkedHashMap<>();Map readDemandResponseLoadControlLoadControlProgramsCommandParams = new LinkedHashMap(); InteractionInfo readDemandResponseLoadControlLoadControlProgramsAttributeInteractionInfo = new InteractionInfo( @@ -19392,6 +19462,7 @@ public Map> getReadAttributeMap() { put("activatedCarbonFilterMonitoring", readActivatedCarbonFilterMonitoringInteractionInfo()); put("booleanSensorConfiguration", readBooleanSensorConfigurationInteractionInfo()); put("valveConfigurationAndControl", readValveConfigurationAndControlInteractionInfo()); + put("electricalEnergyMeasurement", readElectricalEnergyMeasurementInteractionInfo()); put("demandResponseLoadControl", readDemandResponseLoadControlInteractionInfo()); put("deviceEnergyManagement", readDeviceEnergyManagementInteractionInfo()); put("energyEvse", readEnergyEvseInteractionInfo()); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index c0e34bf7f9d89b..5c6174336ce03a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -1278,6 +1278,8 @@ public Map> getWriteAttributeMap() { ); writeValveConfigurationAndControlInteractionInfo.put("writeOpenLevelAttribute", writeValveConfigurationAndControlOpenLevelAttributeInteractionInfo); writeAttributeMap.put("valveConfigurationAndControl", writeValveConfigurationAndControlInteractionInfo); + Map writeElectricalEnergyMeasurementInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("electricalEnergyMeasurement", writeElectricalEnergyMeasurementInteractionInfo); Map writeDemandResponseLoadControlInteractionInfo = new LinkedHashMap<>(); Map writeDemandResponseLoadControlDefaultRandomStartCommandParams = new LinkedHashMap(); CommandParameterInfo demandResponseLoadControldefaultRandomStartCommandParameterInfo = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt new file mode 100644 index 00000000000000..8e0a4253bbc183 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt @@ -0,0 +1,96 @@ +/* + * + * 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 java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent( + val energyImported: + Optional< + chip.devicecontroller.cluster.structs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + >, + val energyExported: + Optional< + chip.devicecontroller.cluster.structs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + > +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent {\n") + append("\tenergyImported : $energyImported\n") + append("\tenergyExported : $energyExported\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (energyImported.isPresent) { + val optenergyImported = energyImported.get() + optenergyImported.toTlv(ContextSpecificTag(TAG_ENERGY_IMPORTED), this) + } + if (energyExported.isPresent) { + val optenergyExported = energyExported.get() + optenergyExported.toTlv(ContextSpecificTag(TAG_ENERGY_EXPORTED), this) + } + endStructure() + } + } + + companion object { + private const val TAG_ENERGY_IMPORTED = 0 + private const val TAG_ENERGY_EXPORTED = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent { + tlvReader.enterStructure(tlvTag) + val energyImported = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_IMPORTED))) { + Optional.of( + chip.devicecontroller.cluster.structs + .ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + .fromTlv(ContextSpecificTag(TAG_ENERGY_IMPORTED), tlvReader) + ) + } else { + Optional.empty() + } + val energyExported = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_EXPORTED))) { + Optional.of( + chip.devicecontroller.cluster.structs + .ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + .fromTlv(ContextSpecificTag(TAG_ENERGY_EXPORTED), tlvReader) + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent( + energyImported, + energyExported + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt new file mode 100644 index 00000000000000..a2ffd06d482dc8 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt @@ -0,0 +1,96 @@ +/* + * + * 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 java.util.Optional +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent( + val energyImported: + Optional< + chip.devicecontroller.cluster.structs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + >, + val energyExported: + Optional< + chip.devicecontroller.cluster.structs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + > +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent {\n") + append("\tenergyImported : $energyImported\n") + append("\tenergyExported : $energyExported\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (energyImported.isPresent) { + val optenergyImported = energyImported.get() + optenergyImported.toTlv(ContextSpecificTag(TAG_ENERGY_IMPORTED), this) + } + if (energyExported.isPresent) { + val optenergyExported = energyExported.get() + optenergyExported.toTlv(ContextSpecificTag(TAG_ENERGY_EXPORTED), this) + } + endStructure() + } + } + + companion object { + private const val TAG_ENERGY_IMPORTED = 0 + private const val TAG_ENERGY_EXPORTED = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent { + tlvReader.enterStructure(tlvTag) + val energyImported = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_IMPORTED))) { + Optional.of( + chip.devicecontroller.cluster.structs + .ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + .fromTlv(ContextSpecificTag(TAG_ENERGY_IMPORTED), tlvReader) + ) + } else { + Optional.empty() + } + val energyExported = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_EXPORTED))) { + Optional.of( + chip.devicecontroller.cluster.structs + .ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + .fromTlv(ContextSpecificTag(TAG_ENERGY_EXPORTED), tlvReader) + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent( + energyImported, + energyExported + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni index a7049a39a43861..f4242b257d9ce1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -53,6 +53,9 @@ structs_sources = [ "${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/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.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/GeneralCommissioningClusterBasicCommissioningInfo.kt", @@ -140,6 +143,8 @@ eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationEvent.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/DoorLockClusterLockUserChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt", diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt deleted file mode 100644 index 6a02cd2f755090..00000000000000 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt +++ /dev/null @@ -1,144 +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.AnonymousTag -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class DemandResponseLoadControlClusterScopedLoadControlEventStruct( - val eventID: ByteArray, - val programControl: ByteArray, - val control: UInt, - val deviceClass: ULong, - val enrollmentGroup: UInt?, - val criticality: UInt, - val startTime: ULong?, - val transitions: List, - val fabricIndex: UInt -) { - override fun toString(): String = buildString { - append("DemandResponseLoadControlClusterScopedLoadControlEventStruct {\n") - append("\teventID : $eventID\n") - append("\tprogramControl : $programControl\n") - append("\tcontrol : $control\n") - append("\tdeviceClass : $deviceClass\n") - append("\tenrollmentGroup : $enrollmentGroup\n") - append("\tcriticality : $criticality\n") - append("\tstartTime : $startTime\n") - append("\ttransitions : $transitions\n") - append("\tfabricIndex : $fabricIndex\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_EVENT_I_D), eventID) - put(ContextSpecificTag(TAG_PROGRAM_CONTROL), programControl) - put(ContextSpecificTag(TAG_CONTROL), control) - put(ContextSpecificTag(TAG_DEVICE_CLASS), deviceClass) - if (enrollmentGroup != null) { - put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), enrollmentGroup) - } else { - putNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) - } - put(ContextSpecificTag(TAG_CRITICALITY), criticality) - if (startTime != null) { - put(ContextSpecificTag(TAG_START_TIME), startTime) - } else { - putNull(ContextSpecificTag(TAG_START_TIME)) - } - startArray(ContextSpecificTag(TAG_TRANSITIONS)) - for (item in transitions.iterator()) { - item.toTlv(AnonymousTag, this) - } - endArray() - put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) - endStructure() - } - } - - companion object { - private const val TAG_EVENT_I_D = 0 - private const val TAG_PROGRAM_CONTROL = 1 - private const val TAG_CONTROL = 2 - private const val TAG_DEVICE_CLASS = 3 - private const val TAG_ENROLLMENT_GROUP = 4 - private const val TAG_CRITICALITY = 5 - private const val TAG_START_TIME = 6 - private const val TAG_TRANSITIONS = 7 - private const val TAG_FABRIC_INDEX = 254 - - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader - ): DemandResponseLoadControlClusterScopedLoadControlEventStruct { - tlvReader.enterStructure(tlvTag) - val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) - val programControl = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_CONTROL)) - val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) - val deviceClass = tlvReader.getULong(ContextSpecificTag(TAG_DEVICE_CLASS)) - val enrollmentGroup = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) - null - } - val criticality = tlvReader.getUInt(ContextSpecificTag(TAG_CRITICALITY)) - val startTime = - if (!tlvReader.isNull()) { - tlvReader.getULong(ContextSpecificTag(TAG_START_TIME)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_START_TIME)) - null - } - val transitions = - buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_TRANSITIONS)) - while (!tlvReader.isEndOfContainer()) { - add( - DemandResponseLoadControlClusterLoadControlEventTransitionStruct.fromTlv( - AnonymousTag, - tlvReader - ) - ) - } - tlvReader.exitContainer() - } - val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) - - tlvReader.exitContainer() - - return DemandResponseLoadControlClusterScopedLoadControlEventStruct( - eventID, - programControl, - control, - deviceClass, - enrollmentGroup, - criticality, - startTime, - transitions, - fabricIndex - ) - } - } -} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt new file mode 100644 index 00000000000000..bbce3fc7d16ff7 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt @@ -0,0 +1,116 @@ +/* + * + * 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 ElectricalEnergyMeasurementClusterEnergyMeasurementStruct( + val energy: Long, + val startTimestamp: Optional, + val endTimestamp: Optional, + val startSystime: Optional, + val endSystime: Optional +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterEnergyMeasurementStruct {\n") + append("\tenergy : $energy\n") + append("\tstartTimestamp : $startTimestamp\n") + append("\tendTimestamp : $endTimestamp\n") + append("\tstartSystime : $startSystime\n") + append("\tendSystime : $endSystime\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ENERGY), energy) + if (startTimestamp.isPresent) { + val optstartTimestamp = startTimestamp.get() + put(ContextSpecificTag(TAG_START_TIMESTAMP), optstartTimestamp) + } + if (endTimestamp.isPresent) { + val optendTimestamp = endTimestamp.get() + put(ContextSpecificTag(TAG_END_TIMESTAMP), optendTimestamp) + } + if (startSystime.isPresent) { + val optstartSystime = startSystime.get() + put(ContextSpecificTag(TAG_START_SYSTIME), optstartSystime) + } + if (endSystime.isPresent) { + val optendSystime = endSystime.get() + put(ContextSpecificTag(TAG_END_SYSTIME), optendSystime) + } + endStructure() + } + } + + companion object { + private const val TAG_ENERGY = 0 + private const val TAG_START_TIMESTAMP = 1 + private const val TAG_END_TIMESTAMP = 2 + private const val TAG_START_SYSTIME = 3 + private const val TAG_END_SYSTIME = 4 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterEnergyMeasurementStruct { + tlvReader.enterStructure(tlvTag) + val energy = tlvReader.getLong(ContextSpecificTag(TAG_ENERGY)) + val startTimestamp = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_START_TIMESTAMP))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_START_TIMESTAMP))) + } else { + Optional.empty() + } + val endTimestamp = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_END_TIMESTAMP))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_END_TIMESTAMP))) + } else { + Optional.empty() + } + val startSystime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_START_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_START_SYSTIME))) + } else { + Optional.empty() + } + val endSystime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_END_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_END_SYSTIME))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterEnergyMeasurementStruct( + energy, + startTimestamp, + endTimestamp, + startSystime, + endSystime + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt new file mode 100644 index 00000000000000..8ce0529f9cd457 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt @@ -0,0 +1,150 @@ +/* + * + * 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 ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct( + val rangeMin: Long, + val rangeMax: Long, + val percentMax: Optional, + val percentMin: Optional, + val percentTypical: Optional, + val fixedMax: Optional, + val fixedMin: Optional, + val fixedTypical: Optional +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct {\n") + append("\trangeMin : $rangeMin\n") + append("\trangeMax : $rangeMax\n") + append("\tpercentMax : $percentMax\n") + append("\tpercentMin : $percentMin\n") + append("\tpercentTypical : $percentTypical\n") + append("\tfixedMax : $fixedMax\n") + append("\tfixedMin : $fixedMin\n") + append("\tfixedTypical : $fixedTypical\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_RANGE_MIN), rangeMin) + put(ContextSpecificTag(TAG_RANGE_MAX), rangeMax) + if (percentMax.isPresent) { + val optpercentMax = percentMax.get() + put(ContextSpecificTag(TAG_PERCENT_MAX), optpercentMax) + } + if (percentMin.isPresent) { + val optpercentMin = percentMin.get() + put(ContextSpecificTag(TAG_PERCENT_MIN), optpercentMin) + } + if (percentTypical.isPresent) { + val optpercentTypical = percentTypical.get() + put(ContextSpecificTag(TAG_PERCENT_TYPICAL), optpercentTypical) + } + if (fixedMax.isPresent) { + val optfixedMax = fixedMax.get() + put(ContextSpecificTag(TAG_FIXED_MAX), optfixedMax) + } + if (fixedMin.isPresent) { + val optfixedMin = fixedMin.get() + put(ContextSpecificTag(TAG_FIXED_MIN), optfixedMin) + } + if (fixedTypical.isPresent) { + val optfixedTypical = fixedTypical.get() + put(ContextSpecificTag(TAG_FIXED_TYPICAL), optfixedTypical) + } + endStructure() + } + } + + companion object { + private const val TAG_RANGE_MIN = 0 + private const val TAG_RANGE_MAX = 1 + private const val TAG_PERCENT_MAX = 2 + private const val TAG_PERCENT_MIN = 3 + private const val TAG_PERCENT_TYPICAL = 4 + private const val TAG_FIXED_MAX = 5 + private const val TAG_FIXED_MIN = 6 + private const val TAG_FIXED_TYPICAL = 7 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct { + tlvReader.enterStructure(tlvTag) + val rangeMin = tlvReader.getLong(ContextSpecificTag(TAG_RANGE_MIN)) + val rangeMax = tlvReader.getLong(ContextSpecificTag(TAG_RANGE_MAX)) + val percentMax = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PERCENT_MAX))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_PERCENT_MAX))) + } else { + Optional.empty() + } + val percentMin = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PERCENT_MIN))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_PERCENT_MIN))) + } else { + Optional.empty() + } + val percentTypical = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PERCENT_TYPICAL))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_PERCENT_TYPICAL))) + } else { + Optional.empty() + } + val fixedMax = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_FIXED_MAX))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_FIXED_MAX))) + } else { + Optional.empty() + } + val fixedMin = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_FIXED_MIN))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_FIXED_MIN))) + } else { + Optional.empty() + } + val fixedTypical = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_FIXED_TYPICAL))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_FIXED_TYPICAL))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct( + rangeMin, + rangeMax, + percentMax, + percentMin, + percentTypical, + fixedMax, + fixedMin, + fixedTypical + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt new file mode 100644 index 00000000000000..3c33b23cb9e505 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt @@ -0,0 +1,100 @@ +/* + * + * 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 ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct( + val measurementType: UInt, + val measured: Boolean, + val minMeasuredValue: Long, + val maxMeasuredValue: Long, + val accuracyRanges: List +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct {\n") + append("\tmeasurementType : $measurementType\n") + append("\tmeasured : $measured\n") + append("\tminMeasuredValue : $minMeasuredValue\n") + append("\tmaxMeasuredValue : $maxMeasuredValue\n") + append("\taccuracyRanges : $accuracyRanges\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_MEASUREMENT_TYPE), measurementType) + put(ContextSpecificTag(TAG_MEASURED), measured) + put(ContextSpecificTag(TAG_MIN_MEASURED_VALUE), minMeasuredValue) + put(ContextSpecificTag(TAG_MAX_MEASURED_VALUE), maxMeasuredValue) + startArray(ContextSpecificTag(TAG_ACCURACY_RANGES)) + for (item in accuracyRanges.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_MEASUREMENT_TYPE = 0 + private const val TAG_MEASURED = 1 + private const val TAG_MIN_MEASURED_VALUE = 2 + private const val TAG_MAX_MEASURED_VALUE = 3 + private const val TAG_ACCURACY_RANGES = 4 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct { + tlvReader.enterStructure(tlvTag) + val measurementType = tlvReader.getUInt(ContextSpecificTag(TAG_MEASUREMENT_TYPE)) + val measured = tlvReader.getBoolean(ContextSpecificTag(TAG_MEASURED)) + val minMeasuredValue = tlvReader.getLong(ContextSpecificTag(TAG_MIN_MEASURED_VALUE)) + val maxMeasuredValue = tlvReader.getLong(ContextSpecificTag(TAG_MAX_MEASURED_VALUE)) + val accuracyRanges = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_ACCURACY_RANGES)) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct( + measurementType, + measured, + minMeasuredValue, + maxMeasuredValue, + accuracyRanges + ) + } + } +} 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 new file mode 100644 index 00000000000000..c51f3bf35e1d55 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt @@ -0,0 +1,165 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package matter.devicecontroller.cluster.clusters + +import matter.controller.MatterController +import matter.devicecontroller.cluster.structs.* + +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 { + // Implementation needs to be added here + } + + suspend fun subscribeAccuracyAttribute(minInterval: Int, maxInterval: Int): AccuracyAttribute { + // Implementation needs to be added here + } + + suspend fun readCumulativeEnergyImportedAttribute(): CumulativeEnergyImportedAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeCumulativeEnergyImportedAttribute( + minInterval: Int, + maxInterval: Int + ): CumulativeEnergyImportedAttribute { + // Implementation needs to be added here + } + + suspend fun readCumulativeEnergyExportedAttribute(): CumulativeEnergyExportedAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeCumulativeEnergyExportedAttribute( + minInterval: Int, + maxInterval: Int + ): CumulativeEnergyExportedAttribute { + // Implementation needs to be added here + } + + suspend fun readPeriodicEnergyImportedAttribute(): PeriodicEnergyImportedAttribute { + // Implementation needs to be added here + } + + suspend fun subscribePeriodicEnergyImportedAttribute( + minInterval: Int, + maxInterval: Int + ): PeriodicEnergyImportedAttribute { + // Implementation needs to be added here + } + + suspend fun readPeriodicEnergyExportedAttribute(): PeriodicEnergyExportedAttribute { + // Implementation needs to be added here + } + + suspend fun subscribePeriodicEnergyExportedAttribute( + minInterval: Int, + maxInterval: Int + ): PeriodicEnergyExportedAttribute { + // Implementation needs to be added here + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): GeneratedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): AcceptedCommandListAttribute { + // Implementation needs to be added here + } + + suspend fun readEventListAttribute(): EventListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeEventListAttribute(minInterval: Int, maxInterval: Int): EventListAttribute { + // Implementation needs to be added here + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + // Implementation needs to be added here + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int + ): AttributeListAttribute { + // Implementation needs to be added here + } + + suspend fun readFeatureMapAttribute(): UInt { + // Implementation needs to be added here + } + + suspend fun subscribeFeatureMapAttribute(minInterval: Int, maxInterval: Int): UInt { + // Implementation needs to be added here + } + + suspend fun readClusterRevisionAttribute(): UShort { + // Implementation needs to be added here + } + + suspend fun subscribeClusterRevisionAttribute(minInterval: Int, maxInterval: Int): UShort { + // Implementation needs to be added here + } + + companion object { + const val CLUSTER_ID: UInt = 145u + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt new file mode 100644 index 00000000000000..e103a1fe9f8ba0 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt @@ -0,0 +1,96 @@ +/* + * + * 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 java.util.Optional +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent( + val energyImported: + Optional< + matter.devicecontroller.cluster.structs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + >, + val energyExported: + Optional< + matter.devicecontroller.cluster.structs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + > +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent {\n") + append("\tenergyImported : $energyImported\n") + append("\tenergyExported : $energyExported\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (energyImported.isPresent) { + val optenergyImported = energyImported.get() + optenergyImported.toTlv(ContextSpecificTag(TAG_ENERGY_IMPORTED), this) + } + if (energyExported.isPresent) { + val optenergyExported = energyExported.get() + optenergyExported.toTlv(ContextSpecificTag(TAG_ENERGY_EXPORTED), this) + } + endStructure() + } + } + + companion object { + private const val TAG_ENERGY_IMPORTED = 0 + private const val TAG_ENERGY_EXPORTED = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent { + tlvReader.enterStructure(tlvTag) + val energyImported = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_IMPORTED))) { + Optional.of( + matter.devicecontroller.cluster.structs + .ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + .fromTlv(ContextSpecificTag(TAG_ENERGY_IMPORTED), tlvReader) + ) + } else { + Optional.empty() + } + val energyExported = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_EXPORTED))) { + Optional.of( + matter.devicecontroller.cluster.structs + .ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + .fromTlv(ContextSpecificTag(TAG_ENERGY_EXPORTED), tlvReader) + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent( + energyImported, + energyExported + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt new file mode 100644 index 00000000000000..c28176f591cc50 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt @@ -0,0 +1,96 @@ +/* + * + * 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 java.util.Optional +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent( + val energyImported: + Optional< + matter.devicecontroller.cluster.structs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + >, + val energyExported: + Optional< + matter.devicecontroller.cluster.structs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + > +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent {\n") + append("\tenergyImported : $energyImported\n") + append("\tenergyExported : $energyExported\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (energyImported.isPresent) { + val optenergyImported = energyImported.get() + optenergyImported.toTlv(ContextSpecificTag(TAG_ENERGY_IMPORTED), this) + } + if (energyExported.isPresent) { + val optenergyExported = energyExported.get() + optenergyExported.toTlv(ContextSpecificTag(TAG_ENERGY_EXPORTED), this) + } + endStructure() + } + } + + companion object { + private const val TAG_ENERGY_IMPORTED = 0 + private const val TAG_ENERGY_EXPORTED = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent { + tlvReader.enterStructure(tlvTag) + val energyImported = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_IMPORTED))) { + Optional.of( + matter.devicecontroller.cluster.structs + .ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + .fromTlv(ContextSpecificTag(TAG_ENERGY_IMPORTED), tlvReader) + ) + } else { + Optional.empty() + } + val energyExported = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_ENERGY_EXPORTED))) { + Optional.of( + matter.devicecontroller.cluster.structs + .ElectricalEnergyMeasurementClusterEnergyMeasurementStruct + .fromTlv(ContextSpecificTag(TAG_ENERGY_EXPORTED), tlvReader) + ) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent( + energyImported, + energyExported + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni index bbcafb5fbff65a..d13dca88a95532 100644 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/files.gni @@ -53,6 +53,9 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DishwasherModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DoorLockClusterCredentialStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/FixedLabelClusterLabelStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/GeneralCommissioningClusterBasicCommissioningInfo.kt", @@ -140,6 +143,8 @@ matter_eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DoorLockClusterLockOperationErrorEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/DoorLockClusterLockUserChangeEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt", @@ -223,6 +228,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DishwasherAlarmCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DishwasherModeCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/DoorLockCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/ElectricalMeasurementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EnergyEvseCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/devicecontroller/cluster/clusters/EthernetNetworkDiagnosticsCluster.kt", diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt deleted file mode 100644 index f9ea556026897f..00000000000000 --- a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/DemandResponseLoadControlClusterScopedLoadControlEventStruct.kt +++ /dev/null @@ -1,144 +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.structs - -import matter.devicecontroller.cluster.* -import matter.tlv.AnonymousTag -import matter.tlv.ContextSpecificTag -import matter.tlv.Tag -import matter.tlv.TlvReader -import matter.tlv.TlvWriter - -class DemandResponseLoadControlClusterScopedLoadControlEventStruct( - val eventID: ByteArray, - val programControl: ByteArray, - val control: UInt, - val deviceClass: ULong, - val enrollmentGroup: UByte?, - val criticality: UInt, - val startTime: UInt?, - val transitions: List, - val fabricIndex: UByte -) { - override fun toString(): String = buildString { - append("DemandResponseLoadControlClusterScopedLoadControlEventStruct {\n") - append("\teventID : $eventID\n") - append("\tprogramControl : $programControl\n") - append("\tcontrol : $control\n") - append("\tdeviceClass : $deviceClass\n") - append("\tenrollmentGroup : $enrollmentGroup\n") - append("\tcriticality : $criticality\n") - append("\tstartTime : $startTime\n") - append("\ttransitions : $transitions\n") - append("\tfabricIndex : $fabricIndex\n") - append("}\n") - } - - fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { - tlvWriter.apply { - startStructure(tlvTag) - put(ContextSpecificTag(TAG_EVENT_I_D), eventID) - put(ContextSpecificTag(TAG_PROGRAM_CONTROL), programControl) - put(ContextSpecificTag(TAG_CONTROL), control) - put(ContextSpecificTag(TAG_DEVICE_CLASS), deviceClass) - if (enrollmentGroup != null) { - put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), enrollmentGroup) - } else { - putNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) - } - put(ContextSpecificTag(TAG_CRITICALITY), criticality) - if (startTime != null) { - put(ContextSpecificTag(TAG_START_TIME), startTime) - } else { - putNull(ContextSpecificTag(TAG_START_TIME)) - } - startArray(ContextSpecificTag(TAG_TRANSITIONS)) - for (item in transitions.iterator()) { - item.toTlv(AnonymousTag, this) - } - endArray() - put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) - endStructure() - } - } - - companion object { - private const val TAG_EVENT_I_D = 0 - private const val TAG_PROGRAM_CONTROL = 1 - private const val TAG_CONTROL = 2 - private const val TAG_DEVICE_CLASS = 3 - private const val TAG_ENROLLMENT_GROUP = 4 - private const val TAG_CRITICALITY = 5 - private const val TAG_START_TIME = 6 - private const val TAG_TRANSITIONS = 7 - private const val TAG_FABRIC_INDEX = 254 - - fun fromTlv( - tlvTag: Tag, - tlvReader: TlvReader - ): DemandResponseLoadControlClusterScopedLoadControlEventStruct { - tlvReader.enterStructure(tlvTag) - val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) - val programControl = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_CONTROL)) - val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) - val deviceClass = tlvReader.getULong(ContextSpecificTag(TAG_DEVICE_CLASS)) - val enrollmentGroup = - if (!tlvReader.isNull()) { - tlvReader.getUByte(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_ENROLLMENT_GROUP)) - null - } - val criticality = tlvReader.getUInt(ContextSpecificTag(TAG_CRITICALITY)) - val startTime = - if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_START_TIME)) - } else { - tlvReader.getNull(ContextSpecificTag(TAG_START_TIME)) - null - } - val transitions = - buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_TRANSITIONS)) - while (!tlvReader.isEndOfContainer()) { - add( - DemandResponseLoadControlClusterLoadControlEventTransitionStruct.fromTlv( - AnonymousTag, - tlvReader - ) - ) - } - tlvReader.exitContainer() - } - val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) - - tlvReader.exitContainer() - - return DemandResponseLoadControlClusterScopedLoadControlEventStruct( - eventID, - programControl, - control, - deviceClass, - enrollmentGroup, - criticality, - startTime, - transitions, - fabricIndex - ) - } - } -} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt new file mode 100644 index 00000000000000..7c0e06cdada0e9 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt @@ -0,0 +1,116 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.devicecontroller.cluster.structs + +import java.util.Optional +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalEnergyMeasurementClusterEnergyMeasurementStruct( + val energy: Long, + val startTimestamp: Optional, + val endTimestamp: Optional, + val startSystime: Optional, + val endSystime: Optional +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterEnergyMeasurementStruct {\n") + append("\tenergy : $energy\n") + append("\tstartTimestamp : $startTimestamp\n") + append("\tendTimestamp : $endTimestamp\n") + append("\tstartSystime : $startSystime\n") + append("\tendSystime : $endSystime\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ENERGY), energy) + if (startTimestamp.isPresent) { + val optstartTimestamp = startTimestamp.get() + put(ContextSpecificTag(TAG_START_TIMESTAMP), optstartTimestamp) + } + if (endTimestamp.isPresent) { + val optendTimestamp = endTimestamp.get() + put(ContextSpecificTag(TAG_END_TIMESTAMP), optendTimestamp) + } + if (startSystime.isPresent) { + val optstartSystime = startSystime.get() + put(ContextSpecificTag(TAG_START_SYSTIME), optstartSystime) + } + if (endSystime.isPresent) { + val optendSystime = endSystime.get() + put(ContextSpecificTag(TAG_END_SYSTIME), optendSystime) + } + endStructure() + } + } + + companion object { + private const val TAG_ENERGY = 0 + private const val TAG_START_TIMESTAMP = 1 + private const val TAG_END_TIMESTAMP = 2 + private const val TAG_START_SYSTIME = 3 + private const val TAG_END_SYSTIME = 4 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterEnergyMeasurementStruct { + tlvReader.enterStructure(tlvTag) + val energy = tlvReader.getLong(ContextSpecificTag(TAG_ENERGY)) + val startTimestamp = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_START_TIMESTAMP))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_START_TIMESTAMP))) + } else { + Optional.empty() + } + val endTimestamp = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_END_TIMESTAMP))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_END_TIMESTAMP))) + } else { + Optional.empty() + } + val startSystime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_START_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_START_SYSTIME))) + } else { + Optional.empty() + } + val endSystime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_END_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_END_SYSTIME))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterEnergyMeasurementStruct( + energy, + startTimestamp, + endTimestamp, + startSystime, + endSystime + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt new file mode 100644 index 00000000000000..f97a3db40175da --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt @@ -0,0 +1,150 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.devicecontroller.cluster.structs + +import java.util.Optional +import matter.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct( + val rangeMin: Long, + val rangeMax: Long, + val percentMax: Optional, + val percentMin: Optional, + val percentTypical: Optional, + val fixedMax: Optional, + val fixedMin: Optional, + val fixedTypical: Optional +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct {\n") + append("\trangeMin : $rangeMin\n") + append("\trangeMax : $rangeMax\n") + append("\tpercentMax : $percentMax\n") + append("\tpercentMin : $percentMin\n") + append("\tpercentTypical : $percentTypical\n") + append("\tfixedMax : $fixedMax\n") + append("\tfixedMin : $fixedMin\n") + append("\tfixedTypical : $fixedTypical\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_RANGE_MIN), rangeMin) + put(ContextSpecificTag(TAG_RANGE_MAX), rangeMax) + if (percentMax.isPresent) { + val optpercentMax = percentMax.get() + put(ContextSpecificTag(TAG_PERCENT_MAX), optpercentMax) + } + if (percentMin.isPresent) { + val optpercentMin = percentMin.get() + put(ContextSpecificTag(TAG_PERCENT_MIN), optpercentMin) + } + if (percentTypical.isPresent) { + val optpercentTypical = percentTypical.get() + put(ContextSpecificTag(TAG_PERCENT_TYPICAL), optpercentTypical) + } + if (fixedMax.isPresent) { + val optfixedMax = fixedMax.get() + put(ContextSpecificTag(TAG_FIXED_MAX), optfixedMax) + } + if (fixedMin.isPresent) { + val optfixedMin = fixedMin.get() + put(ContextSpecificTag(TAG_FIXED_MIN), optfixedMin) + } + if (fixedTypical.isPresent) { + val optfixedTypical = fixedTypical.get() + put(ContextSpecificTag(TAG_FIXED_TYPICAL), optfixedTypical) + } + endStructure() + } + } + + companion object { + private const val TAG_RANGE_MIN = 0 + private const val TAG_RANGE_MAX = 1 + private const val TAG_PERCENT_MAX = 2 + private const val TAG_PERCENT_MIN = 3 + private const val TAG_PERCENT_TYPICAL = 4 + private const val TAG_FIXED_MAX = 5 + private const val TAG_FIXED_MIN = 6 + private const val TAG_FIXED_TYPICAL = 7 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct { + tlvReader.enterStructure(tlvTag) + val rangeMin = tlvReader.getLong(ContextSpecificTag(TAG_RANGE_MIN)) + val rangeMax = tlvReader.getLong(ContextSpecificTag(TAG_RANGE_MAX)) + val percentMax = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PERCENT_MAX))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_PERCENT_MAX))) + } else { + Optional.empty() + } + val percentMin = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PERCENT_MIN))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_PERCENT_MIN))) + } else { + Optional.empty() + } + val percentTypical = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_PERCENT_TYPICAL))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_PERCENT_TYPICAL))) + } else { + Optional.empty() + } + val fixedMax = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_FIXED_MAX))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_FIXED_MAX))) + } else { + Optional.empty() + } + val fixedMin = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_FIXED_MIN))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_FIXED_MIN))) + } else { + Optional.empty() + } + val fixedTypical = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_FIXED_TYPICAL))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_FIXED_TYPICAL))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct( + rangeMin, + rangeMax, + percentMax, + percentMin, + percentTypical, + fixedMax, + fixedMin, + fixedTypical + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt new file mode 100644 index 00000000000000..6fa6a4b048c2a2 --- /dev/null +++ b/src/controller/java/generated/java/matter/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt @@ -0,0 +1,100 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.devicecontroller.cluster.structs + +import matter.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct( + val measurementType: UInt, + val measured: Boolean, + val minMeasuredValue: Long, + val maxMeasuredValue: Long, + val accuracyRanges: List +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct {\n") + append("\tmeasurementType : $measurementType\n") + append("\tmeasured : $measured\n") + append("\tminMeasuredValue : $minMeasuredValue\n") + append("\tmaxMeasuredValue : $maxMeasuredValue\n") + append("\taccuracyRanges : $accuracyRanges\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_MEASUREMENT_TYPE), measurementType) + put(ContextSpecificTag(TAG_MEASURED), measured) + put(ContextSpecificTag(TAG_MIN_MEASURED_VALUE), minMeasuredValue) + put(ContextSpecificTag(TAG_MAX_MEASURED_VALUE), maxMeasuredValue) + startArray(ContextSpecificTag(TAG_ACCURACY_RANGES)) + for (item in accuracyRanges.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_MEASUREMENT_TYPE = 0 + private const val TAG_MEASURED = 1 + private const val TAG_MIN_MEASURED_VALUE = 2 + private const val TAG_MAX_MEASURED_VALUE = 3 + private const val TAG_ACCURACY_RANGES = 4 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct { + tlvReader.enterStructure(tlvTag) + val measurementType = tlvReader.getUInt(ContextSpecificTag(TAG_MEASUREMENT_TYPE)) + val measured = tlvReader.getBoolean(ContextSpecificTag(TAG_MEASURED)) + val minMeasuredValue = tlvReader.getLong(ContextSpecificTag(TAG_MIN_MEASURED_VALUE)) + val maxMeasuredValue = tlvReader.getLong(ContextSpecificTag(TAG_MAX_MEASURED_VALUE)) + val accuracyRanges = + buildList { + tlvReader.enterArray(ContextSpecificTag(TAG_ACCURACY_RANGES)) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct( + measurementType, + measured, + minMeasuredValue, + maxMeasuredValue, + accuracyRanges + ) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index aee716ee76a3f3..e87c3ea5961c68 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -19345,6 +19345,810 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::ElectricalEnergyMeasurement::Id: { + using namespace app::Clusters::ElectricalEnergyMeasurement; + switch (aPath.mAttributeId) + { + case Attributes::Accuracy::Id: { + using TypeInfo = Attributes::Accuracy::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + jobject value_measurementType; + std::string value_measurementTypeClassName = "java/lang/Integer"; + std::string value_measurementTypeCtorSignature = "(I)V"; + jint jnivalue_measurementType = static_cast(cppValue.measurementType); + chip::JniReferences::GetInstance().CreateBoxedObject(value_measurementTypeClassName.c_str(), + value_measurementTypeCtorSignature.c_str(), + jnivalue_measurementType, value_measurementType); + jobject value_measured; + std::string value_measuredClassName = "java/lang/Boolean"; + std::string value_measuredCtorSignature = "(Z)V"; + jboolean jnivalue_measured = static_cast(cppValue.measured); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_measuredClassName.c_str(), value_measuredCtorSignature.c_str(), jnivalue_measured, value_measured); + jobject value_minMeasuredValue; + std::string value_minMeasuredValueClassName = "java/lang/Long"; + std::string value_minMeasuredValueCtorSignature = "(J)V"; + jlong jnivalue_minMeasuredValue = static_cast(cppValue.minMeasuredValue); + chip::JniReferences::GetInstance().CreateBoxedObject(value_minMeasuredValueClassName.c_str(), + value_minMeasuredValueCtorSignature.c_str(), + jnivalue_minMeasuredValue, value_minMeasuredValue); + jobject value_maxMeasuredValue; + std::string value_maxMeasuredValueClassName = "java/lang/Long"; + std::string value_maxMeasuredValueCtorSignature = "(J)V"; + jlong jnivalue_maxMeasuredValue = static_cast(cppValue.maxMeasuredValue); + chip::JniReferences::GetInstance().CreateBoxedObject(value_maxMeasuredValueClassName.c_str(), + value_maxMeasuredValueCtorSignature.c_str(), + jnivalue_maxMeasuredValue, value_maxMeasuredValue); + jobject value_accuracyRanges; + chip::JniReferences::GetInstance().CreateArrayList(value_accuracyRanges); + + auto iter_value_accuracyRanges_1 = cppValue.accuracyRanges.begin(); + while (iter_value_accuracyRanges_1.Next()) + { + auto & entry_1 = iter_value_accuracyRanges_1.GetValue(); + jobject newElement_1; + jobject newElement_1_rangeMin; + std::string newElement_1_rangeMinClassName = "java/lang/Long"; + std::string newElement_1_rangeMinCtorSignature = "(J)V"; + jlong jninewElement_1_rangeMin = static_cast(entry_1.rangeMin); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_rangeMinClassName.c_str(), + newElement_1_rangeMinCtorSignature.c_str(), + jninewElement_1_rangeMin, newElement_1_rangeMin); + jobject newElement_1_rangeMax; + std::string newElement_1_rangeMaxClassName = "java/lang/Long"; + std::string newElement_1_rangeMaxCtorSignature = "(J)V"; + jlong jninewElement_1_rangeMax = static_cast(entry_1.rangeMax); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_rangeMaxClassName.c_str(), + newElement_1_rangeMaxCtorSignature.c_str(), + jninewElement_1_rangeMax, newElement_1_rangeMax); + jobject newElement_1_percentMax; + if (!entry_1.percentMax.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_percentMax); + } + else + { + jobject newElement_1_percentMaxInsideOptional; + std::string newElement_1_percentMaxInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_1_percentMaxInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_1_percentMaxInsideOptional = static_cast(entry_1.percentMax.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_percentMaxInsideOptionalClassName.c_str(), + newElement_1_percentMaxInsideOptionalCtorSignature.c_str(), jninewElement_1_percentMaxInsideOptional, + newElement_1_percentMaxInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_percentMaxInsideOptional, + newElement_1_percentMax); + } + jobject newElement_1_percentMin; + if (!entry_1.percentMin.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_percentMin); + } + else + { + jobject newElement_1_percentMinInsideOptional; + std::string newElement_1_percentMinInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_1_percentMinInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_1_percentMinInsideOptional = static_cast(entry_1.percentMin.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_percentMinInsideOptionalClassName.c_str(), + newElement_1_percentMinInsideOptionalCtorSignature.c_str(), jninewElement_1_percentMinInsideOptional, + newElement_1_percentMinInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_percentMinInsideOptional, + newElement_1_percentMin); + } + jobject newElement_1_percentTypical; + if (!entry_1.percentTypical.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_percentTypical); + } + else + { + jobject newElement_1_percentTypicalInsideOptional; + std::string newElement_1_percentTypicalInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_1_percentTypicalInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_1_percentTypicalInsideOptional = static_cast(entry_1.percentTypical.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_percentTypicalInsideOptionalClassName.c_str(), + newElement_1_percentTypicalInsideOptionalCtorSignature.c_str(), + jninewElement_1_percentTypicalInsideOptional, newElement_1_percentTypicalInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_percentTypicalInsideOptional, + newElement_1_percentTypical); + } + jobject newElement_1_fixedMax; + if (!entry_1.fixedMax.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_fixedMax); + } + else + { + jobject newElement_1_fixedMaxInsideOptional; + std::string newElement_1_fixedMaxInsideOptionalClassName = "java/lang/Long"; + std::string newElement_1_fixedMaxInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_1_fixedMaxInsideOptional = static_cast(entry_1.fixedMax.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_fixedMaxInsideOptionalClassName.c_str(), + newElement_1_fixedMaxInsideOptionalCtorSignature.c_str(), jninewElement_1_fixedMaxInsideOptional, + newElement_1_fixedMaxInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_fixedMaxInsideOptional, newElement_1_fixedMax); + } + jobject newElement_1_fixedMin; + if (!entry_1.fixedMin.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_fixedMin); + } + else + { + jobject newElement_1_fixedMinInsideOptional; + std::string newElement_1_fixedMinInsideOptionalClassName = "java/lang/Long"; + std::string newElement_1_fixedMinInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_1_fixedMinInsideOptional = static_cast(entry_1.fixedMin.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_fixedMinInsideOptionalClassName.c_str(), + newElement_1_fixedMinInsideOptionalCtorSignature.c_str(), jninewElement_1_fixedMinInsideOptional, + newElement_1_fixedMinInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_fixedMinInsideOptional, newElement_1_fixedMin); + } + jobject newElement_1_fixedTypical; + if (!entry_1.fixedTypical.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_fixedTypical); + } + else + { + jobject newElement_1_fixedTypicalInsideOptional; + std::string newElement_1_fixedTypicalInsideOptionalClassName = "java/lang/Long"; + std::string newElement_1_fixedTypicalInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_1_fixedTypicalInsideOptional = static_cast(entry_1.fixedTypical.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_fixedTypicalInsideOptionalClassName.c_str(), + newElement_1_fixedTypicalInsideOptionalCtorSignature.c_str(), jninewElement_1_fixedTypicalInsideOptional, + newElement_1_fixedTypicalInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_1_fixedTypicalInsideOptional, + newElement_1_fixedTypical); + } + + jclass measurementAccuracyRangeStructStructClass_2; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct", + measurementAccuracyRangeStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct"); + return nullptr; + } + jmethodID measurementAccuracyRangeStructStructCtor_2 = + env->GetMethodID(measurementAccuracyRangeStructStructClass_2, "", + "(Ljava/lang/Long;Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/" + "Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (measurementAccuracyRangeStructStructCtor_2 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct constructor"); + return nullptr; + } + + newElement_1 = env->NewObject( + measurementAccuracyRangeStructStructClass_2, measurementAccuracyRangeStructStructCtor_2, newElement_1_rangeMin, + newElement_1_rangeMax, newElement_1_percentMax, newElement_1_percentMin, newElement_1_percentTypical, + newElement_1_fixedMax, newElement_1_fixedMin, newElement_1_fixedTypical); + chip::JniReferences::GetInstance().AddToList(value_accuracyRanges, newElement_1); + } + + jclass measurementAccuracyStructStructClass_0; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct", + measurementAccuracyStructStructClass_0); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct"); + return nullptr; + } + jmethodID measurementAccuracyStructStructCtor_0 = + env->GetMethodID(measurementAccuracyStructStructClass_0, "", + "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Long;Ljava/lang/Long;Ljava/util/ArrayList;)V"); + if (measurementAccuracyStructStructCtor_0 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct constructor"); + return nullptr; + } + + value = + env->NewObject(measurementAccuracyStructStructClass_0, measurementAccuracyStructStructCtor_0, value_measurementType, + value_measured, value_minMeasuredValue, value_maxMeasuredValue, value_accuracyRanges); + return value; + } + case Attributes::CumulativeEnergyImported::Id: { + using TypeInfo = Attributes::CumulativeEnergyImported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_energy; + std::string value_energyClassName = "java/lang/Long"; + std::string value_energyCtorSignature = "(J)V"; + jlong jnivalue_energy = static_cast(cppValue.Value().energy); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyClassName.c_str(), value_energyCtorSignature.c_str(), jnivalue_energy, value_energy); + jobject value_startTimestamp; + if (!cppValue.Value().startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_startTimestamp); + } + else + { + jobject value_startTimestampInsideOptional; + std::string value_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_startTimestampInsideOptional = static_cast(cppValue.Value().startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startTimestampInsideOptionalClassName.c_str(), + value_startTimestampInsideOptionalCtorSignature.c_str(), jnivalue_startTimestampInsideOptional, + value_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_startTimestampInsideOptional, value_startTimestamp); + } + jobject value_endTimestamp; + if (!cppValue.Value().endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_endTimestamp); + } + else + { + jobject value_endTimestampInsideOptional; + std::string value_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_endTimestampInsideOptional = static_cast(cppValue.Value().endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endTimestampInsideOptionalClassName.c_str(), value_endTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_endTimestampInsideOptional, value_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_endTimestampInsideOptional, value_endTimestamp); + } + jobject value_startSystime; + if (!cppValue.Value().startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_startSystime); + } + else + { + jobject value_startSystimeInsideOptional; + std::string value_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_startSystimeInsideOptional = static_cast(cppValue.Value().startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startSystimeInsideOptionalClassName.c_str(), value_startSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_startSystimeInsideOptional, value_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_startSystimeInsideOptional, value_startSystime); + } + jobject value_endSystime; + if (!cppValue.Value().endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_endSystime); + } + else + { + jobject value_endSystimeInsideOptional; + std::string value_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_endSystimeInsideOptional = static_cast(cppValue.Value().endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endSystimeInsideOptionalClassName.c_str(), value_endSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_endSystimeInsideOptional, value_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_endSystimeInsideOptional, value_endSystime); + } + + jclass energyMeasurementStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct", + energyMeasurementStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + return nullptr; + } + jmethodID energyMeasurementStructStructCtor_1 = env->GetMethodID( + energyMeasurementStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (energyMeasurementStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct constructor"); + return nullptr; + } + + value = env->NewObject(energyMeasurementStructStructClass_1, energyMeasurementStructStructCtor_1, value_energy, + value_startTimestamp, value_endTimestamp, value_startSystime, value_endSystime); + } + return value; + } + case Attributes::CumulativeEnergyExported::Id: { + using TypeInfo = Attributes::CumulativeEnergyExported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_energy; + std::string value_energyClassName = "java/lang/Long"; + std::string value_energyCtorSignature = "(J)V"; + jlong jnivalue_energy = static_cast(cppValue.Value().energy); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyClassName.c_str(), value_energyCtorSignature.c_str(), jnivalue_energy, value_energy); + jobject value_startTimestamp; + if (!cppValue.Value().startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_startTimestamp); + } + else + { + jobject value_startTimestampInsideOptional; + std::string value_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_startTimestampInsideOptional = static_cast(cppValue.Value().startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startTimestampInsideOptionalClassName.c_str(), + value_startTimestampInsideOptionalCtorSignature.c_str(), jnivalue_startTimestampInsideOptional, + value_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_startTimestampInsideOptional, value_startTimestamp); + } + jobject value_endTimestamp; + if (!cppValue.Value().endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_endTimestamp); + } + else + { + jobject value_endTimestampInsideOptional; + std::string value_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_endTimestampInsideOptional = static_cast(cppValue.Value().endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endTimestampInsideOptionalClassName.c_str(), value_endTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_endTimestampInsideOptional, value_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_endTimestampInsideOptional, value_endTimestamp); + } + jobject value_startSystime; + if (!cppValue.Value().startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_startSystime); + } + else + { + jobject value_startSystimeInsideOptional; + std::string value_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_startSystimeInsideOptional = static_cast(cppValue.Value().startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startSystimeInsideOptionalClassName.c_str(), value_startSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_startSystimeInsideOptional, value_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_startSystimeInsideOptional, value_startSystime); + } + jobject value_endSystime; + if (!cppValue.Value().endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_endSystime); + } + else + { + jobject value_endSystimeInsideOptional; + std::string value_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_endSystimeInsideOptional = static_cast(cppValue.Value().endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endSystimeInsideOptionalClassName.c_str(), value_endSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_endSystimeInsideOptional, value_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_endSystimeInsideOptional, value_endSystime); + } + + jclass energyMeasurementStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct", + energyMeasurementStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + return nullptr; + } + jmethodID energyMeasurementStructStructCtor_1 = env->GetMethodID( + energyMeasurementStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (energyMeasurementStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct constructor"); + return nullptr; + } + + value = env->NewObject(energyMeasurementStructStructClass_1, energyMeasurementStructStructCtor_1, value_energy, + value_startTimestamp, value_endTimestamp, value_startSystime, value_endSystime); + } + return value; + } + case Attributes::PeriodicEnergyImported::Id: { + using TypeInfo = Attributes::PeriodicEnergyImported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_energy; + std::string value_energyClassName = "java/lang/Long"; + std::string value_energyCtorSignature = "(J)V"; + jlong jnivalue_energy = static_cast(cppValue.Value().energy); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyClassName.c_str(), value_energyCtorSignature.c_str(), jnivalue_energy, value_energy); + jobject value_startTimestamp; + if (!cppValue.Value().startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_startTimestamp); + } + else + { + jobject value_startTimestampInsideOptional; + std::string value_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_startTimestampInsideOptional = static_cast(cppValue.Value().startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startTimestampInsideOptionalClassName.c_str(), + value_startTimestampInsideOptionalCtorSignature.c_str(), jnivalue_startTimestampInsideOptional, + value_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_startTimestampInsideOptional, value_startTimestamp); + } + jobject value_endTimestamp; + if (!cppValue.Value().endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_endTimestamp); + } + else + { + jobject value_endTimestampInsideOptional; + std::string value_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_endTimestampInsideOptional = static_cast(cppValue.Value().endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endTimestampInsideOptionalClassName.c_str(), value_endTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_endTimestampInsideOptional, value_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_endTimestampInsideOptional, value_endTimestamp); + } + jobject value_startSystime; + if (!cppValue.Value().startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_startSystime); + } + else + { + jobject value_startSystimeInsideOptional; + std::string value_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_startSystimeInsideOptional = static_cast(cppValue.Value().startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startSystimeInsideOptionalClassName.c_str(), value_startSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_startSystimeInsideOptional, value_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_startSystimeInsideOptional, value_startSystime); + } + jobject value_endSystime; + if (!cppValue.Value().endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_endSystime); + } + else + { + jobject value_endSystimeInsideOptional; + std::string value_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_endSystimeInsideOptional = static_cast(cppValue.Value().endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endSystimeInsideOptionalClassName.c_str(), value_endSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_endSystimeInsideOptional, value_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_endSystimeInsideOptional, value_endSystime); + } + + jclass energyMeasurementStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct", + energyMeasurementStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + return nullptr; + } + jmethodID energyMeasurementStructStructCtor_1 = env->GetMethodID( + energyMeasurementStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (energyMeasurementStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct constructor"); + return nullptr; + } + + value = env->NewObject(energyMeasurementStructStructClass_1, energyMeasurementStructStructCtor_1, value_energy, + value_startTimestamp, value_endTimestamp, value_startSystime, value_endSystime); + } + return value; + } + case Attributes::PeriodicEnergyExported::Id: { + using TypeInfo = Attributes::PeriodicEnergyExported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + jobject value_energy; + std::string value_energyClassName = "java/lang/Long"; + std::string value_energyCtorSignature = "(J)V"; + jlong jnivalue_energy = static_cast(cppValue.Value().energy); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyClassName.c_str(), value_energyCtorSignature.c_str(), jnivalue_energy, value_energy); + jobject value_startTimestamp; + if (!cppValue.Value().startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_startTimestamp); + } + else + { + jobject value_startTimestampInsideOptional; + std::string value_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_startTimestampInsideOptional = static_cast(cppValue.Value().startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startTimestampInsideOptionalClassName.c_str(), + value_startTimestampInsideOptionalCtorSignature.c_str(), jnivalue_startTimestampInsideOptional, + value_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_startTimestampInsideOptional, value_startTimestamp); + } + jobject value_endTimestamp; + if (!cppValue.Value().endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_endTimestamp); + } + else + { + jobject value_endTimestampInsideOptional; + std::string value_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_endTimestampInsideOptional = static_cast(cppValue.Value().endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endTimestampInsideOptionalClassName.c_str(), value_endTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_endTimestampInsideOptional, value_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_endTimestampInsideOptional, value_endTimestamp); + } + jobject value_startSystime; + if (!cppValue.Value().startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_startSystime); + } + else + { + jobject value_startSystimeInsideOptional; + std::string value_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_startSystimeInsideOptional = static_cast(cppValue.Value().startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_startSystimeInsideOptionalClassName.c_str(), value_startSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_startSystimeInsideOptional, value_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_startSystimeInsideOptional, value_startSystime); + } + jobject value_endSystime; + if (!cppValue.Value().endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_endSystime); + } + else + { + jobject value_endSystimeInsideOptional; + std::string value_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_endSystimeInsideOptional = static_cast(cppValue.Value().endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_endSystimeInsideOptionalClassName.c_str(), value_endSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_endSystimeInsideOptional, value_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_endSystimeInsideOptional, value_endSystime); + } + + jclass energyMeasurementStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct", + energyMeasurementStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + return nullptr; + } + jmethodID energyMeasurementStructStructCtor_1 = env->GetMethodID( + energyMeasurementStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (energyMeasurementStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct constructor"); + return nullptr; + } + + value = env->NewObject(energyMeasurementStructStructClass_1, energyMeasurementStructStructCtor_1, value_energy, + value_startTimestamp, value_endTimestamp, value_startSystime, value_endSystime); + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::EventList::Id: { + using TypeInfo = Attributes::EventList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_0 = cppValue.begin(); + while (iter_value_0.Next()) + { + auto & entry_0 = iter_value_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + jint jnivalue = static_cast(cppValue); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), jnivalue, + value); + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + break; + } + break; + } case app::Clusters::DemandResponseLoadControl::Id: { using namespace app::Clusters::DemandResponseLoadControl; switch (aPath.mAttributeId) diff --git a/src/controller/java/zap-generated/CHIPClientCallbacks.h b/src/controller/java/zap-generated/CHIPClientCallbacks.h index 09e7aaeb545cc5..fdc34c7fee5595 100644 --- a/src/controller/java/zap-generated/CHIPClientCallbacks.h +++ b/src/controller/java/zap-generated/CHIPClientCallbacks.h @@ -729,6 +729,14 @@ typedef void (*ValveConfigurationAndControlEventListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); typedef void (*ValveConfigurationAndControlAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ElectricalEnergyMeasurementGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ElectricalEnergyMeasurementAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ElectricalEnergyMeasurementEventListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +typedef void (*ElectricalEnergyMeasurementAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); typedef void (*DemandResponseLoadControlLoadControlProgramsListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList< diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index 4b67ac79cd7b9f..26bd0d48009066 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -3837,6 +3837,580 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::ElectricalEnergyMeasurement::Id: { + using namespace app::Clusters::ElectricalEnergyMeasurement; + switch (aPath.mEventId) + { + case Events::CumulativeEnergyMeasured::Id: { + Events::CumulativeEnergyMeasured::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_energyImported; + if (!cppValue.energyImported.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImported); + } + else + { + jobject value_energyImportedInsideOptional; + jobject value_energyImportedInsideOptional_energy; + std::string value_energyImportedInsideOptional_energyClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_energyCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_energy = static_cast(cppValue.energyImported.Value().energy); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_energyClassName.c_str(), + value_energyImportedInsideOptional_energyCtorSignature.c_str(), jnivalue_energyImportedInsideOptional_energy, + value_energyImportedInsideOptional_energy); + jobject value_energyImportedInsideOptional_startTimestamp; + if (!cppValue.energyImported.Value().startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImportedInsideOptional_startTimestamp); + } + else + { + jobject value_energyImportedInsideOptional_startTimestampInsideOptional; + std::string value_energyImportedInsideOptional_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_startTimestampInsideOptional = + static_cast(cppValue.energyImported.Value().startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_startTimestampInsideOptionalClassName.c_str(), + value_energyImportedInsideOptional_startTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_energyImportedInsideOptional_startTimestampInsideOptional, + value_energyImportedInsideOptional_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional( + value_energyImportedInsideOptional_startTimestampInsideOptional, + value_energyImportedInsideOptional_startTimestamp); + } + jobject value_energyImportedInsideOptional_endTimestamp; + if (!cppValue.energyImported.Value().endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImportedInsideOptional_endTimestamp); + } + else + { + jobject value_energyImportedInsideOptional_endTimestampInsideOptional; + std::string value_energyImportedInsideOptional_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_endTimestampInsideOptional = + static_cast(cppValue.energyImported.Value().endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_endTimestampInsideOptionalClassName.c_str(), + value_energyImportedInsideOptional_endTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_energyImportedInsideOptional_endTimestampInsideOptional, + value_energyImportedInsideOptional_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyImportedInsideOptional_endTimestampInsideOptional, + value_energyImportedInsideOptional_endTimestamp); + } + jobject value_energyImportedInsideOptional_startSystime; + if (!cppValue.energyImported.Value().startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImportedInsideOptional_startSystime); + } + else + { + jobject value_energyImportedInsideOptional_startSystimeInsideOptional; + std::string value_energyImportedInsideOptional_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_startSystimeInsideOptional = + static_cast(cppValue.energyImported.Value().startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_startSystimeInsideOptionalClassName.c_str(), + value_energyImportedInsideOptional_startSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_energyImportedInsideOptional_startSystimeInsideOptional, + value_energyImportedInsideOptional_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyImportedInsideOptional_startSystimeInsideOptional, + value_energyImportedInsideOptional_startSystime); + } + jobject value_energyImportedInsideOptional_endSystime; + if (!cppValue.energyImported.Value().endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImportedInsideOptional_endSystime); + } + else + { + jobject value_energyImportedInsideOptional_endSystimeInsideOptional; + std::string value_energyImportedInsideOptional_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_endSystimeInsideOptional = + static_cast(cppValue.energyImported.Value().endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_endSystimeInsideOptionalClassName.c_str(), + value_energyImportedInsideOptional_endSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_energyImportedInsideOptional_endSystimeInsideOptional, + value_energyImportedInsideOptional_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyImportedInsideOptional_endSystimeInsideOptional, + value_energyImportedInsideOptional_endSystime); + } + + jclass energyMeasurementStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct", + energyMeasurementStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + return nullptr; + } + jmethodID energyMeasurementStructStructCtor_1 = env->GetMethodID( + energyMeasurementStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (energyMeasurementStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct constructor"); + return nullptr; + } + + value_energyImportedInsideOptional = + env->NewObject(energyMeasurementStructStructClass_1, energyMeasurementStructStructCtor_1, + value_energyImportedInsideOptional_energy, value_energyImportedInsideOptional_startTimestamp, + value_energyImportedInsideOptional_endTimestamp, value_energyImportedInsideOptional_startSystime, + value_energyImportedInsideOptional_endSystime); + chip::JniReferences::GetInstance().CreateOptional(value_energyImportedInsideOptional, value_energyImported); + } + + jobject value_energyExported; + if (!cppValue.energyExported.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExported); + } + else + { + jobject value_energyExportedInsideOptional; + jobject value_energyExportedInsideOptional_energy; + std::string value_energyExportedInsideOptional_energyClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_energyCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_energy = static_cast(cppValue.energyExported.Value().energy); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_energyClassName.c_str(), + value_energyExportedInsideOptional_energyCtorSignature.c_str(), jnivalue_energyExportedInsideOptional_energy, + value_energyExportedInsideOptional_energy); + jobject value_energyExportedInsideOptional_startTimestamp; + if (!cppValue.energyExported.Value().startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExportedInsideOptional_startTimestamp); + } + else + { + jobject value_energyExportedInsideOptional_startTimestampInsideOptional; + std::string value_energyExportedInsideOptional_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_startTimestampInsideOptional = + static_cast(cppValue.energyExported.Value().startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_startTimestampInsideOptionalClassName.c_str(), + value_energyExportedInsideOptional_startTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_energyExportedInsideOptional_startTimestampInsideOptional, + value_energyExportedInsideOptional_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional( + value_energyExportedInsideOptional_startTimestampInsideOptional, + value_energyExportedInsideOptional_startTimestamp); + } + jobject value_energyExportedInsideOptional_endTimestamp; + if (!cppValue.energyExported.Value().endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExportedInsideOptional_endTimestamp); + } + else + { + jobject value_energyExportedInsideOptional_endTimestampInsideOptional; + std::string value_energyExportedInsideOptional_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_endTimestampInsideOptional = + static_cast(cppValue.energyExported.Value().endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_endTimestampInsideOptionalClassName.c_str(), + value_energyExportedInsideOptional_endTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_energyExportedInsideOptional_endTimestampInsideOptional, + value_energyExportedInsideOptional_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyExportedInsideOptional_endTimestampInsideOptional, + value_energyExportedInsideOptional_endTimestamp); + } + jobject value_energyExportedInsideOptional_startSystime; + if (!cppValue.energyExported.Value().startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExportedInsideOptional_startSystime); + } + else + { + jobject value_energyExportedInsideOptional_startSystimeInsideOptional; + std::string value_energyExportedInsideOptional_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_startSystimeInsideOptional = + static_cast(cppValue.energyExported.Value().startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_startSystimeInsideOptionalClassName.c_str(), + value_energyExportedInsideOptional_startSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_energyExportedInsideOptional_startSystimeInsideOptional, + value_energyExportedInsideOptional_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyExportedInsideOptional_startSystimeInsideOptional, + value_energyExportedInsideOptional_startSystime); + } + jobject value_energyExportedInsideOptional_endSystime; + if (!cppValue.energyExported.Value().endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExportedInsideOptional_endSystime); + } + else + { + jobject value_energyExportedInsideOptional_endSystimeInsideOptional; + std::string value_energyExportedInsideOptional_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_endSystimeInsideOptional = + static_cast(cppValue.energyExported.Value().endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_endSystimeInsideOptionalClassName.c_str(), + value_energyExportedInsideOptional_endSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_energyExportedInsideOptional_endSystimeInsideOptional, + value_energyExportedInsideOptional_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyExportedInsideOptional_endSystimeInsideOptional, + value_energyExportedInsideOptional_endSystime); + } + + jclass energyMeasurementStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct", + energyMeasurementStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + return nullptr; + } + jmethodID energyMeasurementStructStructCtor_1 = env->GetMethodID( + energyMeasurementStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (energyMeasurementStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct constructor"); + return nullptr; + } + + value_energyExportedInsideOptional = + env->NewObject(energyMeasurementStructStructClass_1, energyMeasurementStructStructCtor_1, + value_energyExportedInsideOptional_energy, value_energyExportedInsideOptional_startTimestamp, + value_energyExportedInsideOptional_endTimestamp, value_energyExportedInsideOptional_startSystime, + value_energyExportedInsideOptional_endSystime); + chip::JniReferences::GetInstance().CreateOptional(value_energyExportedInsideOptional, value_energyExported); + } + + jclass cumulativeEnergyMeasuredStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipEventStructs$ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent", + cumulativeEnergyMeasuredStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, "Could not find class ChipEventStructs$ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent"); + return nullptr; + } + jmethodID cumulativeEnergyMeasuredStructCtor = + env->GetMethodID(cumulativeEnergyMeasuredStructClass, "", "(Ljava/util/Optional;Ljava/util/Optional;)V"); + if (cumulativeEnergyMeasuredStructCtor == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipEventStructs$ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent constructor"); + return nullptr; + } + + jobject value = env->NewObject(cumulativeEnergyMeasuredStructClass, cumulativeEnergyMeasuredStructCtor, + value_energyImported, value_energyExported); + + return value; + } + case Events::PeriodicEnergyMeasured::Id: { + Events::PeriodicEnergyMeasured::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_energyImported; + if (!cppValue.energyImported.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImported); + } + else + { + jobject value_energyImportedInsideOptional; + jobject value_energyImportedInsideOptional_energy; + std::string value_energyImportedInsideOptional_energyClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_energyCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_energy = static_cast(cppValue.energyImported.Value().energy); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_energyClassName.c_str(), + value_energyImportedInsideOptional_energyCtorSignature.c_str(), jnivalue_energyImportedInsideOptional_energy, + value_energyImportedInsideOptional_energy); + jobject value_energyImportedInsideOptional_startTimestamp; + if (!cppValue.energyImported.Value().startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImportedInsideOptional_startTimestamp); + } + else + { + jobject value_energyImportedInsideOptional_startTimestampInsideOptional; + std::string value_energyImportedInsideOptional_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_startTimestampInsideOptional = + static_cast(cppValue.energyImported.Value().startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_startTimestampInsideOptionalClassName.c_str(), + value_energyImportedInsideOptional_startTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_energyImportedInsideOptional_startTimestampInsideOptional, + value_energyImportedInsideOptional_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional( + value_energyImportedInsideOptional_startTimestampInsideOptional, + value_energyImportedInsideOptional_startTimestamp); + } + jobject value_energyImportedInsideOptional_endTimestamp; + if (!cppValue.energyImported.Value().endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImportedInsideOptional_endTimestamp); + } + else + { + jobject value_energyImportedInsideOptional_endTimestampInsideOptional; + std::string value_energyImportedInsideOptional_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_endTimestampInsideOptional = + static_cast(cppValue.energyImported.Value().endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_endTimestampInsideOptionalClassName.c_str(), + value_energyImportedInsideOptional_endTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_energyImportedInsideOptional_endTimestampInsideOptional, + value_energyImportedInsideOptional_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyImportedInsideOptional_endTimestampInsideOptional, + value_energyImportedInsideOptional_endTimestamp); + } + jobject value_energyImportedInsideOptional_startSystime; + if (!cppValue.energyImported.Value().startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImportedInsideOptional_startSystime); + } + else + { + jobject value_energyImportedInsideOptional_startSystimeInsideOptional; + std::string value_energyImportedInsideOptional_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_startSystimeInsideOptional = + static_cast(cppValue.energyImported.Value().startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_startSystimeInsideOptionalClassName.c_str(), + value_energyImportedInsideOptional_startSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_energyImportedInsideOptional_startSystimeInsideOptional, + value_energyImportedInsideOptional_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyImportedInsideOptional_startSystimeInsideOptional, + value_energyImportedInsideOptional_startSystime); + } + jobject value_energyImportedInsideOptional_endSystime; + if (!cppValue.energyImported.Value().endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyImportedInsideOptional_endSystime); + } + else + { + jobject value_energyImportedInsideOptional_endSystimeInsideOptional; + std::string value_energyImportedInsideOptional_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_energyImportedInsideOptional_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyImportedInsideOptional_endSystimeInsideOptional = + static_cast(cppValue.energyImported.Value().endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyImportedInsideOptional_endSystimeInsideOptionalClassName.c_str(), + value_energyImportedInsideOptional_endSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_energyImportedInsideOptional_endSystimeInsideOptional, + value_energyImportedInsideOptional_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyImportedInsideOptional_endSystimeInsideOptional, + value_energyImportedInsideOptional_endSystime); + } + + jclass energyMeasurementStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct", + energyMeasurementStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + return nullptr; + } + jmethodID energyMeasurementStructStructCtor_1 = env->GetMethodID( + energyMeasurementStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (energyMeasurementStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct constructor"); + return nullptr; + } + + value_energyImportedInsideOptional = + env->NewObject(energyMeasurementStructStructClass_1, energyMeasurementStructStructCtor_1, + value_energyImportedInsideOptional_energy, value_energyImportedInsideOptional_startTimestamp, + value_energyImportedInsideOptional_endTimestamp, value_energyImportedInsideOptional_startSystime, + value_energyImportedInsideOptional_endSystime); + chip::JniReferences::GetInstance().CreateOptional(value_energyImportedInsideOptional, value_energyImported); + } + + jobject value_energyExported; + if (!cppValue.energyExported.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExported); + } + else + { + jobject value_energyExportedInsideOptional; + jobject value_energyExportedInsideOptional_energy; + std::string value_energyExportedInsideOptional_energyClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_energyCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_energy = static_cast(cppValue.energyExported.Value().energy); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_energyClassName.c_str(), + value_energyExportedInsideOptional_energyCtorSignature.c_str(), jnivalue_energyExportedInsideOptional_energy, + value_energyExportedInsideOptional_energy); + jobject value_energyExportedInsideOptional_startTimestamp; + if (!cppValue.energyExported.Value().startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExportedInsideOptional_startTimestamp); + } + else + { + jobject value_energyExportedInsideOptional_startTimestampInsideOptional; + std::string value_energyExportedInsideOptional_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_startTimestampInsideOptional = + static_cast(cppValue.energyExported.Value().startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_startTimestampInsideOptionalClassName.c_str(), + value_energyExportedInsideOptional_startTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_energyExportedInsideOptional_startTimestampInsideOptional, + value_energyExportedInsideOptional_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional( + value_energyExportedInsideOptional_startTimestampInsideOptional, + value_energyExportedInsideOptional_startTimestamp); + } + jobject value_energyExportedInsideOptional_endTimestamp; + if (!cppValue.energyExported.Value().endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExportedInsideOptional_endTimestamp); + } + else + { + jobject value_energyExportedInsideOptional_endTimestampInsideOptional; + std::string value_energyExportedInsideOptional_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_endTimestampInsideOptional = + static_cast(cppValue.energyExported.Value().endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_endTimestampInsideOptionalClassName.c_str(), + value_energyExportedInsideOptional_endTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_energyExportedInsideOptional_endTimestampInsideOptional, + value_energyExportedInsideOptional_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyExportedInsideOptional_endTimestampInsideOptional, + value_energyExportedInsideOptional_endTimestamp); + } + jobject value_energyExportedInsideOptional_startSystime; + if (!cppValue.energyExported.Value().startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExportedInsideOptional_startSystime); + } + else + { + jobject value_energyExportedInsideOptional_startSystimeInsideOptional; + std::string value_energyExportedInsideOptional_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_startSystimeInsideOptional = + static_cast(cppValue.energyExported.Value().startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_startSystimeInsideOptionalClassName.c_str(), + value_energyExportedInsideOptional_startSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_energyExportedInsideOptional_startSystimeInsideOptional, + value_energyExportedInsideOptional_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyExportedInsideOptional_startSystimeInsideOptional, + value_energyExportedInsideOptional_startSystime); + } + jobject value_energyExportedInsideOptional_endSystime; + if (!cppValue.energyExported.Value().endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_energyExportedInsideOptional_endSystime); + } + else + { + jobject value_energyExportedInsideOptional_endSystimeInsideOptional; + std::string value_energyExportedInsideOptional_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_energyExportedInsideOptional_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_energyExportedInsideOptional_endSystimeInsideOptional = + static_cast(cppValue.energyExported.Value().endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_energyExportedInsideOptional_endSystimeInsideOptionalClassName.c_str(), + value_energyExportedInsideOptional_endSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_energyExportedInsideOptional_endSystimeInsideOptional, + value_energyExportedInsideOptional_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(value_energyExportedInsideOptional_endSystimeInsideOptional, + value_energyExportedInsideOptional_endSystime); + } + + jclass energyMeasurementStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct", + energyMeasurementStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct"); + return nullptr; + } + jmethodID energyMeasurementStructStructCtor_1 = env->GetMethodID( + energyMeasurementStructStructClass_1, "", + "(Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V"); + if (energyMeasurementStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$ElectricalEnergyMeasurementClusterEnergyMeasurementStruct constructor"); + return nullptr; + } + + value_energyExportedInsideOptional = + env->NewObject(energyMeasurementStructStructClass_1, energyMeasurementStructStructCtor_1, + value_energyExportedInsideOptional_energy, value_energyExportedInsideOptional_startTimestamp, + value_energyExportedInsideOptional_endTimestamp, value_energyExportedInsideOptional_startSystime, + value_energyExportedInsideOptional_endSystime); + chip::JniReferences::GetInstance().CreateOptional(value_energyExportedInsideOptional, value_energyExported); + } + + jclass periodicEnergyMeasuredStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipEventStructs$ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent", + periodicEnergyMeasuredStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipEventStructs$ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent"); + return nullptr; + } + jmethodID periodicEnergyMeasuredStructCtor = + env->GetMethodID(periodicEnergyMeasuredStructClass, "", "(Ljava/util/Optional;Ljava/util/Optional;)V"); + if (periodicEnergyMeasuredStructCtor == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipEventStructs$ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent constructor"); + return nullptr; + } + + jobject value = env->NewObject(periodicEnergyMeasuredStructClass, periodicEnergyMeasuredStructCtor, + value_energyImported, value_energyExported); + + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::DemandResponseLoadControl::Id: { using namespace app::Clusters::DemandResponseLoadControl; switch (aPath.mEventId) diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index ee1a17cf61f369..630984be29b0a7 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -30848,6 +30848,296 @@ void CHIPValveConfigurationAndControlAttributeListAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } +CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback:: +CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback::~ +CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPElectricalEnergyMeasurementGeneratedCommandListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback:: +CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback::~ +CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPElectricalEnergyMeasurementAcceptedCommandListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPElectricalEnergyMeasurementEventListAttributeCallback::CHIPElectricalEnergyMeasurementEventListAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPElectricalEnergyMeasurementEventListAttributeCallback::~CHIPElectricalEnergyMeasurementEventListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPElectricalEnergyMeasurementEventListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + +CHIPElectricalEnergyMeasurementAttributeListAttributeCallback::CHIPElectricalEnergyMeasurementAttributeListAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPElectricalEnergyMeasurementAttributeListAttributeCallback::~CHIPElectricalEnergyMeasurementAttributeListAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPElectricalEnergyMeasurementAttributeListAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::DecodableList & list) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/util/List;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject arrayListObj; + chip::JniReferences::GetInstance().CreateArrayList(arrayListObj); + + auto iter_arrayListObj_0 = list.begin(); + while (iter_arrayListObj_0.Next()) + { + auto & entry_0 = iter_arrayListObj_0.GetValue(); + jobject newElement_0; + std::string newElement_0ClassName = "java/lang/Long"; + std::string newElement_0CtorSignature = "(J)V"; + jlong jninewElement_0 = static_cast(entry_0); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0); + chip::JniReferences::GetInstance().AddToList(arrayListObj, newElement_0); + } + + env->ExceptionClear(); + env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); +} + CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback:: CHIPDemandResponseLoadControlLoadControlProgramsAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index ceaa6c58fc82fa..e6a384cd3336a9 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -6340,6 +6340,80 @@ class ChipClusters: }, }, } + _ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_INFO = { + "clusterName": "ElectricalEnergyMeasurement", + "clusterId": 0x00000091, + "commands": { + }, + "attributes": { + 0x00000000: { + "attributeName": "Accuracy", + "attributeId": 0x00000000, + "type": "", + "reportable": True, + }, + 0x00000001: { + "attributeName": "CumulativeEnergyImported", + "attributeId": 0x00000001, + "type": "", + "reportable": True, + }, + 0x00000002: { + "attributeName": "CumulativeEnergyExported", + "attributeId": 0x00000002, + "type": "", + "reportable": True, + }, + 0x00000003: { + "attributeName": "PeriodicEnergyImported", + "attributeId": 0x00000003, + "type": "", + "reportable": True, + }, + 0x00000004: { + "attributeName": "PeriodicEnergyExported", + "attributeId": 0x00000004, + "type": "", + "reportable": True, + }, + 0x0000FFF8: { + "attributeName": "GeneratedCommandList", + "attributeId": 0x0000FFF8, + "type": "int", + "reportable": True, + }, + 0x0000FFF9: { + "attributeName": "AcceptedCommandList", + "attributeId": 0x0000FFF9, + "type": "int", + "reportable": True, + }, + 0x0000FFFA: { + "attributeName": "EventList", + "attributeId": 0x0000FFFA, + "type": "int", + "reportable": True, + }, + 0x0000FFFB: { + "attributeName": "AttributeList", + "attributeId": 0x0000FFFB, + "type": "int", + "reportable": True, + }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, + 0x0000FFFD: { + "attributeName": "ClusterRevision", + "attributeId": 0x0000FFFD, + "type": "int", + "reportable": True, + }, + }, + } _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO = { "clusterName": "DemandResponseLoadControl", "clusterId": 0x00000096, @@ -13764,6 +13838,7 @@ class ChipClusters: 0x00000072: _ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER_INFO, 0x00000080: _BOOLEAN_SENSOR_CONFIGURATION_CLUSTER_INFO, 0x00000081: _VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_INFO, + 0x00000091: _ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_INFO, 0x00000096: _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO, 0x00000098: _DEVICE_ENERGY_MANAGEMENT_CLUSTER_INFO, 0x00000099: _ENERGY_EVSE_CLUSTER_INFO, @@ -13878,6 +13953,7 @@ class ChipClusters: "ActivatedCarbonFilterMonitoring": _ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER_INFO, "BooleanSensorConfiguration": _BOOLEAN_SENSOR_CONFIGURATION_CLUSTER_INFO, "ValveConfigurationAndControl": _VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_INFO, + "ElectricalEnergyMeasurement": _ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_INFO, "DemandResponseLoadControl": _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO, "DeviceEnergyManagement": _DEVICE_ENERGY_MANAGEMENT_CLUSTER_INFO, "EnergyEvse": _ENERGY_EVSE_CLUSTER_INFO, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 9b7b5c38555d43..f346a96ecb3785 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -22160,6 +22160,354 @@ def descriptor(cls) -> ClusterObjectDescriptor: valveFault: 'uint' = 0 +@dataclass +class ElectricalEnergyMeasurement(Cluster): + id: typing.ClassVar[int] = 0x00000091 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="accuracy", Tag=0x00000000, Type=ElectricalEnergyMeasurement.Structs.MeasurementAccuracyStruct), + ClusterObjectFieldDescriptor(Label="cumulativeEnergyImported", Tag=0x00000001, Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]), + ClusterObjectFieldDescriptor(Label="cumulativeEnergyExported", Tag=0x00000002, Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]), + ClusterObjectFieldDescriptor(Label="periodicEnergyImported", Tag=0x00000003, Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]), + ClusterObjectFieldDescriptor(Label="periodicEnergyExported", Tag=0x00000004, Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]), + ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), + ClusterObjectFieldDescriptor(Label="featureMap", Tag=0x0000FFFC, Type=uint), + ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), + ]) + + accuracy: 'ElectricalEnergyMeasurement.Structs.MeasurementAccuracyStruct' = None + cumulativeEnergyImported: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + cumulativeEnergyExported: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + periodicEnergyImported: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + periodicEnergyExported: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + generatedCommandList: 'typing.List[uint]' = None + acceptedCommandList: 'typing.List[uint]' = None + eventList: 'typing.List[uint]' = None + attributeList: 'typing.List[uint]' = None + featureMap: 'uint' = None + clusterRevision: 'uint' = None + + class Enums: + class MeasurementTypeEnum(MatterIntEnum): + kUnspecified = 0x00 + kVoltage = 0x01 + kActiveCurrent = 0x02 + kReactiveCurrent = 0x03 + kApparentCurrent = 0x04 + kActivePower = 0x05 + kReactivePower = 0x06 + kApparentPower = 0x07 + kRMSVoltage = 0x08 + kRMSCurrent = 0x09 + kRMSPower = 0x0A + kFrequency = 0x0B + kPowerFactor = 0x0C + kNeutralCurrent = 0x0D + kElectricalEnergy = 0x0E + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 15, + + class Bitmaps: + class Feature(IntFlag): + kImportedEnergy = 0x1 + kExportedEnergy = 0x2 + kCumulativeEnergy = 0x4 + kPeriodicEnergy = 0x8 + + class Structs: + @dataclass + class MeasurementAccuracyRangeStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="rangeMin", Tag=0, Type=int), + ClusterObjectFieldDescriptor(Label="rangeMax", Tag=1, Type=int), + ClusterObjectFieldDescriptor(Label="percentMax", Tag=2, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="percentMin", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="percentTypical", Tag=4, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="fixedMax", Tag=5, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="fixedMin", Tag=6, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="fixedTypical", Tag=7, Type=typing.Optional[uint]), + ]) + + rangeMin: 'int' = 0 + rangeMax: 'int' = 0 + percentMax: 'typing.Optional[uint]' = None + percentMin: 'typing.Optional[uint]' = None + percentTypical: 'typing.Optional[uint]' = None + fixedMax: 'typing.Optional[uint]' = None + fixedMin: 'typing.Optional[uint]' = None + fixedTypical: 'typing.Optional[uint]' = None + + @dataclass + class MeasurementAccuracyStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="measurementType", Tag=0, Type=ElectricalEnergyMeasurement.Enums.MeasurementTypeEnum), + ClusterObjectFieldDescriptor(Label="measured", Tag=1, Type=bool), + ClusterObjectFieldDescriptor(Label="minMeasuredValue", Tag=2, Type=int), + ClusterObjectFieldDescriptor(Label="maxMeasuredValue", Tag=3, Type=int), + ClusterObjectFieldDescriptor(Label="accuracyRanges", Tag=4, Type=typing.List[ElectricalEnergyMeasurement.Structs.MeasurementAccuracyRangeStruct]), + ]) + + measurementType: 'ElectricalEnergyMeasurement.Enums.MeasurementTypeEnum' = 0 + measured: 'bool' = False + minMeasuredValue: 'int' = 0 + maxMeasuredValue: 'int' = 0 + accuracyRanges: 'typing.List[ElectricalEnergyMeasurement.Structs.MeasurementAccuracyRangeStruct]' = field(default_factory=lambda: []) + + @dataclass + class EnergyMeasurementStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="energy", Tag=0, Type=int), + ClusterObjectFieldDescriptor(Label="startTimestamp", Tag=1, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="endTimestamp", Tag=2, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="startSystime", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="endSystime", Tag=4, Type=typing.Optional[uint]), + ]) + + energy: 'int' = 0 + startTimestamp: 'typing.Optional[uint]' = None + endTimestamp: 'typing.Optional[uint]' = None + startSystime: 'typing.Optional[uint]' = None + endSystime: 'typing.Optional[uint]' = None + + class Attributes: + @dataclass + class Accuracy(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=ElectricalEnergyMeasurement.Structs.MeasurementAccuracyStruct) + + value: 'ElectricalEnergyMeasurement.Structs.MeasurementAccuracyStruct' = field(default_factory=lambda: ElectricalEnergyMeasurement.Structs.MeasurementAccuracyStruct()) + + @dataclass + class CumulativeEnergyImported(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]) + + value: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + + @dataclass + class CumulativeEnergyExported(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]) + + value: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + + @dataclass + class PeriodicEnergyImported(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]) + + value: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + + @dataclass + class PeriodicEnergyExported(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]) + + value: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF8 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AcceptedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFF9 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class EventList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFA + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class AttributeList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFB + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[uint]) + + value: 'typing.List[uint]' = field(default_factory=lambda: []) + + @dataclass + class FeatureMap(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFC + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class ClusterRevision(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000FFFD + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + class Events: + @dataclass + class CumulativeEnergyMeasured(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="energyImported", Tag=0, Type=typing.Optional[ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]), + ClusterObjectFieldDescriptor(Label="energyExported", Tag=1, Type=typing.Optional[ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]), + ]) + + energyImported: 'typing.Optional[ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + energyExported: 'typing.Optional[ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + + @dataclass + class PeriodicEnergyMeasured(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="energyImported", Tag=0, Type=typing.Optional[ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]), + ClusterObjectFieldDescriptor(Label="energyExported", Tag=1, Type=typing.Optional[ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]), + ]) + + energyImported: 'typing.Optional[ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + energyExported: 'typing.Optional[ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + + @dataclass class DemandResponseLoadControl(Cluster): id: typing.ClassVar[int] = 0x00000096 diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 243dbc40dd5e3a..1f7d91156734b9 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -2915,6 +2915,48 @@ static BOOL AttributeIsSpecifiedInValveConfigurationAndControlCluster(AttributeI } } } +static BOOL AttributeIsSpecifiedInElectricalEnergyMeasurementCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ElectricalEnergyMeasurement; + switch (aAttributeId) { + case Attributes::Accuracy::Id: { + return YES; + } + case Attributes::CumulativeEnergyImported::Id: { + return YES; + } + case Attributes::CumulativeEnergyExported::Id: { + return YES; + } + case Attributes::PeriodicEnergyImported::Id: { + return YES; + } + case Attributes::PeriodicEnergyExported::Id: { + return YES; + } + case Attributes::GeneratedCommandList::Id: { + return YES; + } + case Attributes::AcceptedCommandList::Id: { + return YES; + } + case Attributes::EventList::Id: { + return YES; + } + case Attributes::AttributeList::Id: { + return YES; + } + case Attributes::FeatureMap::Id: { + return YES; + } + case Attributes::ClusterRevision::Id: { + return YES; + } + default: { + return NO; + } + } +} static BOOL AttributeIsSpecifiedInDemandResponseLoadControlCluster(AttributeId aAttributeId) { using namespace Clusters::DemandResponseLoadControl; @@ -6306,6 +6348,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::ValveConfigurationAndControl::Id: { return AttributeIsSpecifiedInValveConfigurationAndControlCluster(aAttributeId); } + case Clusters::ElectricalEnergyMeasurement::Id: { + return AttributeIsSpecifiedInElectricalEnergyMeasurementCluster(aAttributeId); + } case Clusters::DemandResponseLoadControl::Id: { return AttributeIsSpecifiedInDemandResponseLoadControlCluster(aAttributeId); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index 068658d831aeac..2deb87873533aa 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -7591,6 +7591,225 @@ static id _Nullable DecodeAttributeValueForValveConfigurationAndControlCluster(A *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ElectricalEnergyMeasurement; + switch (aAttributeId) { + case Attributes::Accuracy::Id: { + using TypeInfo = Attributes::Accuracy::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nonnull value; + value = [MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct new]; + value.measurementType = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue.measurementType)]; + value.measured = [NSNumber numberWithBool:cppValue.measured]; + value.minMeasuredValue = [NSNumber numberWithLongLong:cppValue.minMeasuredValue]; + value.maxMeasuredValue = [NSNumber numberWithLongLong:cppValue.maxMeasuredValue]; + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + auto iter_1 = cppValue.accuracyRanges.begin(); + while (iter_1.Next()) { + auto & entry_1 = iter_1.GetValue(); + MTRElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct * newElement_1; + newElement_1 = [MTRElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct new]; + newElement_1.rangeMin = [NSNumber numberWithLongLong:entry_1.rangeMin]; + newElement_1.rangeMax = [NSNumber numberWithLongLong:entry_1.rangeMax]; + if (entry_1.percentMax.HasValue()) { + newElement_1.percentMax = [NSNumber numberWithUnsignedShort:entry_1.percentMax.Value()]; + } else { + newElement_1.percentMax = nil; + } + if (entry_1.percentMin.HasValue()) { + newElement_1.percentMin = [NSNumber numberWithUnsignedShort:entry_1.percentMin.Value()]; + } else { + newElement_1.percentMin = nil; + } + if (entry_1.percentTypical.HasValue()) { + newElement_1.percentTypical = [NSNumber numberWithUnsignedShort:entry_1.percentTypical.Value()]; + } else { + newElement_1.percentTypical = nil; + } + if (entry_1.fixedMax.HasValue()) { + newElement_1.fixedMax = [NSNumber numberWithUnsignedLongLong:entry_1.fixedMax.Value()]; + } else { + newElement_1.fixedMax = nil; + } + if (entry_1.fixedMin.HasValue()) { + newElement_1.fixedMin = [NSNumber numberWithUnsignedLongLong:entry_1.fixedMin.Value()]; + } else { + newElement_1.fixedMin = nil; + } + if (entry_1.fixedTypical.HasValue()) { + newElement_1.fixedTypical = [NSNumber numberWithUnsignedLongLong:entry_1.fixedTypical.Value()]; + } else { + newElement_1.fixedTypical = nil; + } + [array_1 addObject:newElement_1]; + } + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value.accuracyRanges = array_1; + } + return value; + } + case Attributes::CumulativeEnergyImported::Id: { + using TypeInfo = Attributes::CumulativeEnergyImported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + value.energy = [NSNumber numberWithLongLong:cppValue.Value().energy]; + if (cppValue.Value().startTimestamp.HasValue()) { + value.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().startTimestamp.Value()]; + } else { + value.startTimestamp = nil; + } + if (cppValue.Value().endTimestamp.HasValue()) { + value.endTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().endTimestamp.Value()]; + } else { + value.endTimestamp = nil; + } + if (cppValue.Value().startSystime.HasValue()) { + value.startSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().startSystime.Value()]; + } else { + value.startSystime = nil; + } + if (cppValue.Value().endSystime.HasValue()) { + value.endSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().endSystime.Value()]; + } else { + value.endSystime = nil; + } + } + return value; + } + case Attributes::CumulativeEnergyExported::Id: { + using TypeInfo = Attributes::CumulativeEnergyExported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + value.energy = [NSNumber numberWithLongLong:cppValue.Value().energy]; + if (cppValue.Value().startTimestamp.HasValue()) { + value.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().startTimestamp.Value()]; + } else { + value.startTimestamp = nil; + } + if (cppValue.Value().endTimestamp.HasValue()) { + value.endTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().endTimestamp.Value()]; + } else { + value.endTimestamp = nil; + } + if (cppValue.Value().startSystime.HasValue()) { + value.startSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().startSystime.Value()]; + } else { + value.startSystime = nil; + } + if (cppValue.Value().endSystime.HasValue()) { + value.endSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().endSystime.Value()]; + } else { + value.endSystime = nil; + } + } + return value; + } + case Attributes::PeriodicEnergyImported::Id: { + using TypeInfo = Attributes::PeriodicEnergyImported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + value.energy = [NSNumber numberWithLongLong:cppValue.Value().energy]; + if (cppValue.Value().startTimestamp.HasValue()) { + value.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().startTimestamp.Value()]; + } else { + value.startTimestamp = nil; + } + if (cppValue.Value().endTimestamp.HasValue()) { + value.endTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().endTimestamp.Value()]; + } else { + value.endTimestamp = nil; + } + if (cppValue.Value().startSystime.HasValue()) { + value.startSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().startSystime.Value()]; + } else { + value.startSystime = nil; + } + if (cppValue.Value().endSystime.HasValue()) { + value.endSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().endSystime.Value()]; + } else { + value.endSystime = nil; + } + } + return value; + } + case Attributes::PeriodicEnergyExported::Id: { + using TypeInfo = Attributes::PeriodicEnergyExported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + value.energy = [NSNumber numberWithLongLong:cppValue.Value().energy]; + if (cppValue.Value().startTimestamp.HasValue()) { + value.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().startTimestamp.Value()]; + } else { + value.startTimestamp = nil; + } + if (cppValue.Value().endTimestamp.HasValue()) { + value.endTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().endTimestamp.Value()]; + } else { + value.endTimestamp = nil; + } + if (cppValue.Value().startSystime.HasValue()) { + value.startSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().startSystime.Value()]; + } else { + value.startSystime = nil; + } + if (cppValue.Value().endSystime.HasValue()) { + value.endSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().endSystime.Value()]; + } else { + value.endSystime = nil; + } + } + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} static id _Nullable DecodeAttributeValueForDemandResponseLoadControlCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::DemandResponseLoadControl; @@ -17679,6 +17898,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::ValveConfigurationAndControl::Id: { return DecodeAttributeValueForValveConfigurationAndControlCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::ElectricalEnergyMeasurement::Id: { + return DecodeAttributeValueForElectricalEnergyMeasurementCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::DemandResponseLoadControl::Id: { return DecodeAttributeValueForDemandResponseLoadControlCluster(aPath.mAttributeId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 1db156e4c1428c..ad4120b06c3ee5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -7228,6 +7228,97 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Electrical Energy Measurement + * + * This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterElectricalEnergyMeasurement : MTRGenericBaseCluster + +- (void)readAttributeAccuracyWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAccuracyWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAccuracyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCumulativeEnergyImportedWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCumulativeEnergyImportedWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCumulativeEnergyImportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeCumulativeEnergyExportedWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCumulativeEnergyExportedWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCumulativeEnergyExportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributePeriodicEnergyImportedWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributePeriodicEnergyImportedWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributePeriodicEnergyImportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributePeriodicEnergyExportedWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributePeriodicEnergyExportedWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributePeriodicEnergyExportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRBaseClusterElectricalEnergyMeasurement (Availability) + +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ +- (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Demand Response Load Control * @@ -16754,6 +16845,31 @@ typedef NS_OPTIONS(uint16_t, MTRValveConfigurationAndControlValveFaultBitmap) { MTRValveConfigurationAndControlValveFaultBitmapLeaking MTR_PROVISIONALLY_AVAILABLE = 0x4, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint16_t, MTRElectricalEnergyMeasurementMeasurementType) { + MTRElectricalEnergyMeasurementMeasurementTypeUnspecified MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRElectricalEnergyMeasurementMeasurementTypeVoltage MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRElectricalEnergyMeasurementMeasurementTypeActiveCurrent MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRElectricalEnergyMeasurementMeasurementTypeReactiveCurrent MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRElectricalEnergyMeasurementMeasurementTypeApparentCurrent MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRElectricalEnergyMeasurementMeasurementTypeActivePower MTR_PROVISIONALLY_AVAILABLE = 0x05, + MTRElectricalEnergyMeasurementMeasurementTypeReactivePower MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRElectricalEnergyMeasurementMeasurementTypeApparentPower MTR_PROVISIONALLY_AVAILABLE = 0x07, + MTRElectricalEnergyMeasurementMeasurementTypeRMSVoltage MTR_PROVISIONALLY_AVAILABLE = 0x08, + MTRElectricalEnergyMeasurementMeasurementTypeRMSCurrent MTR_PROVISIONALLY_AVAILABLE = 0x09, + MTRElectricalEnergyMeasurementMeasurementTypeRMSPower MTR_PROVISIONALLY_AVAILABLE = 0x0A, + MTRElectricalEnergyMeasurementMeasurementTypeFrequency MTR_PROVISIONALLY_AVAILABLE = 0x0B, + MTRElectricalEnergyMeasurementMeasurementTypePowerFactor MTR_PROVISIONALLY_AVAILABLE = 0x0C, + MTRElectricalEnergyMeasurementMeasurementTypeNeutralCurrent MTR_PROVISIONALLY_AVAILABLE = 0x0D, + MTRElectricalEnergyMeasurementMeasurementTypeElectricalEnergy MTR_PROVISIONALLY_AVAILABLE = 0x0E, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRElectricalEnergyMeasurementFeature) { + MTRElectricalEnergyMeasurementFeatureImportedEnergy MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRElectricalEnergyMeasurementFeatureExportedEnergy MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRElectricalEnergyMeasurementFeatureCumulativeEnergy MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRElectricalEnergyMeasurementFeaturePeriodicEnergy MTR_PROVISIONALLY_AVAILABLE = 0x8, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint8_t, MTRDemandResponseLoadControlCriticalityLevel) { MTRDemandResponseLoadControlCriticalityLevelUnknown MTR_PROVISIONALLY_AVAILABLE = 0x00, MTRDemandResponseLoadControlCriticalityLevelGreen MTR_PROVISIONALLY_AVAILABLE = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm index 447b836708be5c..45c8b38f7a85dc 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -50278,6 +50278,406 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end +@implementation MTRBaseClusterElectricalEnergyMeasurement + +- (void)readAttributeAccuracyWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::Accuracy::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAccuracyWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::Accuracy::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAccuracyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::Accuracy::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeCumulativeEnergyImportedWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCumulativeEnergyImportedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCumulativeEnergyImportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeCumulativeEnergyExportedWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::CumulativeEnergyExported::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCumulativeEnergyExportedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::CumulativeEnergyExported::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCumulativeEnergyExportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::CumulativeEnergyExported::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributePeriodicEnergyImportedWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::PeriodicEnergyImported::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributePeriodicEnergyImportedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::PeriodicEnergyImported::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributePeriodicEnergyImportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::PeriodicEnergyImported::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributePeriodicEnergyExportedWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::PeriodicEnergyExported::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributePeriodicEnergyExportedWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::PeriodicEnergyExported::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributePeriodicEnergyExportedWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::PeriodicEnergyExported::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeGeneratedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeGeneratedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeGeneratedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAcceptedCommandListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAcceptedCommandListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAcceptedCommandListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeEventListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::EventList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeEventListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::EventList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeEventListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::EventList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAttributeListWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAttributeListWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeAttributeListWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::AttributeList::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeFeatureMapWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeFeatureMapWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeFeatureMapWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::FeatureMap::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeClusterRevisionWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeClusterRevisionWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:@(self.endpoint) + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + @implementation MTRBaseClusterDemandResponseLoadControl - (void)registerLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams *)params completion:(MTRStatusCompletion)completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 0907ddf7c3bb0d..d01196579b4023 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -150,6 +150,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeActivatedCarbonFilterMonitoringID MTR_PROVISIONALLY_AVAILABLE = 0x00000072, MTRClusterIDTypeBooleanSensorConfigurationID MTR_PROVISIONALLY_AVAILABLE = 0x00000080, MTRClusterIDTypeValveConfigurationAndControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000081, + MTRClusterIDTypeElectricalEnergyMeasurementID MTR_PROVISIONALLY_AVAILABLE = 0x00000091, MTRClusterIDTypeDemandResponseLoadControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000096, MTRClusterIDTypeDeviceEnergyManagementID MTR_PROVISIONALLY_AVAILABLE = 0x00000098, MTRClusterIDTypeEnergyEVSEID MTR_PROVISIONALLY_AVAILABLE = 0x00000099, @@ -2605,6 +2606,19 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster ElectricalEnergyMeasurement attributes + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeAccuracyID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeCumulativeEnergyImportedID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeCumulativeEnergyExportedID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributePeriodicEnergyImportedID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributePeriodicEnergyExportedID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster DemandResponseLoadControl attributes MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeLoadControlProgramsID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTRAttributeIDTypeClusterDemandResponseLoadControlAttributeNumberOfLoadControlProgramsID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, @@ -7138,6 +7152,10 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { MTREventIDTypeClusterValveConfigurationAndControlEventValveStateChangedID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTREventIDTypeClusterValveConfigurationAndControlEventValveFaultID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster ElectricalEnergyMeasurement events + MTREventIDTypeClusterElectricalEnergyMeasurementEventCumulativeEnergyMeasuredID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTREventIDTypeClusterElectricalEnergyMeasurementEventPeriodicEnergyMeasuredID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster DemandResponseLoadControl events MTREventIDTypeClusterDemandResponseLoadControlEventLoadControlEventStatusChangeID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index 8e2ff98413a206..12e03cd11b4e27 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -3428,6 +3428,52 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Electrical Energy Measurement + * This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterElectricalEnergyMeasurement : MTRGenericCluster + +- (NSDictionary * _Nullable)readAttributeAccuracyWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCumulativeEnergyImportedWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeCumulativeEnergyExportedWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributePeriodicEnergyImportedWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributePeriodicEnergyExportedWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +@end + +@interface MTRClusterElectricalEnergyMeasurement (Availability) + +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ +- (instancetype _Nullable)initWithDevice:(MTRDevice *)device + endpointID:(NSNumber *)endpointID + queue:(dispatch_queue_t)queue MTR_PROVISIONALLY_AVAILABLE; + +@end + /** * Cluster Demand Response Load Control * This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 6a24ca9281c63c..fbf736a5882e3e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -9253,6 +9253,65 @@ - (void)writeAttributeOpenLevelWithValue:(NSDictionary *)dataVal @end +@implementation MTRClusterElectricalEnergyMeasurement + +- (NSDictionary * _Nullable)readAttributeAccuracyWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeAccuracyID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeCumulativeEnergyImportedWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeCumulativeEnergyImportedID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeCumulativeEnergyExportedWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeCumulativeEnergyExportedID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributePeriodicEnergyImportedWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributePeriodicEnergyImportedID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributePeriodicEnergyExportedWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributePeriodicEnergyExportedID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:@(self.endpoint) clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterDemandResponseLoadControl - (void)registerLoadControlProgramRequestWithParams:(MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams *)params expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueIntervalMs completion:(MTRStatusCompletion)completion diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm index d9ac43efc72db2..a3dbd7d0369423 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm @@ -590,6 +590,15 @@ static BOOL CommandNeedsTimedInvokeInValveConfigurationAndControlCluster(Attribu } } } +static BOOL CommandNeedsTimedInvokeInElectricalEnergyMeasurementCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ElectricalEnergyMeasurement; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInDemandResponseLoadControlCluster(AttributeId aAttributeId) { using namespace Clusters::DemandResponseLoadControl; @@ -1245,6 +1254,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::ValveConfigurationAndControl::Id: { return CommandNeedsTimedInvokeInValveConfigurationAndControlCluster(commandID); } + case Clusters::ElectricalEnergyMeasurement::Id: { + return CommandNeedsTimedInvokeInElectricalEnergyMeasurementCluster(commandID); + } case Clusters::DemandResponseLoadControl::Id: { return CommandNeedsTimedInvokeInDemandResponseLoadControlCluster(commandID); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 5912d3d8d6454e..8119e5be2e3021 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -2461,6 +2461,162 @@ static id _Nullable DecodeEventPayloadForValveConfigurationAndControlCluster(Eve *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForElectricalEnergyMeasurementCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ElectricalEnergyMeasurement; + switch (aEventId) { + case Events::CumulativeEnergyMeasured::Id: { + Events::CumulativeEnergyMeasured::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent new]; + + do { + MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable memberValue; + if (cppValue.energyImported.HasValue()) { + memberValue = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + memberValue.energy = [NSNumber numberWithLongLong:cppValue.energyImported.Value().energy]; + if (cppValue.energyImported.Value().startTimestamp.HasValue()) { + memberValue.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.energyImported.Value().startTimestamp.Value()]; + } else { + memberValue.startTimestamp = nil; + } + if (cppValue.energyImported.Value().endTimestamp.HasValue()) { + memberValue.endTimestamp = [NSNumber numberWithUnsignedInt:cppValue.energyImported.Value().endTimestamp.Value()]; + } else { + memberValue.endTimestamp = nil; + } + if (cppValue.energyImported.Value().startSystime.HasValue()) { + memberValue.startSystime = [NSNumber numberWithUnsignedLongLong:cppValue.energyImported.Value().startSystime.Value()]; + } else { + memberValue.startSystime = nil; + } + if (cppValue.energyImported.Value().endSystime.HasValue()) { + memberValue.endSystime = [NSNumber numberWithUnsignedLongLong:cppValue.energyImported.Value().endSystime.Value()]; + } else { + memberValue.endSystime = nil; + } + } else { + memberValue = nil; + } + value.energyImported = memberValue; + } while (0); + do { + MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable memberValue; + if (cppValue.energyExported.HasValue()) { + memberValue = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + memberValue.energy = [NSNumber numberWithLongLong:cppValue.energyExported.Value().energy]; + if (cppValue.energyExported.Value().startTimestamp.HasValue()) { + memberValue.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.energyExported.Value().startTimestamp.Value()]; + } else { + memberValue.startTimestamp = nil; + } + if (cppValue.energyExported.Value().endTimestamp.HasValue()) { + memberValue.endTimestamp = [NSNumber numberWithUnsignedInt:cppValue.energyExported.Value().endTimestamp.Value()]; + } else { + memberValue.endTimestamp = nil; + } + if (cppValue.energyExported.Value().startSystime.HasValue()) { + memberValue.startSystime = [NSNumber numberWithUnsignedLongLong:cppValue.energyExported.Value().startSystime.Value()]; + } else { + memberValue.startSystime = nil; + } + if (cppValue.energyExported.Value().endSystime.HasValue()) { + memberValue.endSystime = [NSNumber numberWithUnsignedLongLong:cppValue.energyExported.Value().endSystime.Value()]; + } else { + memberValue.endSystime = nil; + } + } else { + memberValue = nil; + } + value.energyExported = memberValue; + } while (0); + + return value; + } + case Events::PeriodicEnergyMeasured::Id: { + Events::PeriodicEnergyMeasured::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent new]; + + do { + MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable memberValue; + if (cppValue.energyImported.HasValue()) { + memberValue = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + memberValue.energy = [NSNumber numberWithLongLong:cppValue.energyImported.Value().energy]; + if (cppValue.energyImported.Value().startTimestamp.HasValue()) { + memberValue.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.energyImported.Value().startTimestamp.Value()]; + } else { + memberValue.startTimestamp = nil; + } + if (cppValue.energyImported.Value().endTimestamp.HasValue()) { + memberValue.endTimestamp = [NSNumber numberWithUnsignedInt:cppValue.energyImported.Value().endTimestamp.Value()]; + } else { + memberValue.endTimestamp = nil; + } + if (cppValue.energyImported.Value().startSystime.HasValue()) { + memberValue.startSystime = [NSNumber numberWithUnsignedLongLong:cppValue.energyImported.Value().startSystime.Value()]; + } else { + memberValue.startSystime = nil; + } + if (cppValue.energyImported.Value().endSystime.HasValue()) { + memberValue.endSystime = [NSNumber numberWithUnsignedLongLong:cppValue.energyImported.Value().endSystime.Value()]; + } else { + memberValue.endSystime = nil; + } + } else { + memberValue = nil; + } + value.energyImported = memberValue; + } while (0); + do { + MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable memberValue; + if (cppValue.energyExported.HasValue()) { + memberValue = [MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct new]; + memberValue.energy = [NSNumber numberWithLongLong:cppValue.energyExported.Value().energy]; + if (cppValue.energyExported.Value().startTimestamp.HasValue()) { + memberValue.startTimestamp = [NSNumber numberWithUnsignedInt:cppValue.energyExported.Value().startTimestamp.Value()]; + } else { + memberValue.startTimestamp = nil; + } + if (cppValue.energyExported.Value().endTimestamp.HasValue()) { + memberValue.endTimestamp = [NSNumber numberWithUnsignedInt:cppValue.energyExported.Value().endTimestamp.Value()]; + } else { + memberValue.endTimestamp = nil; + } + if (cppValue.energyExported.Value().startSystime.HasValue()) { + memberValue.startSystime = [NSNumber numberWithUnsignedLongLong:cppValue.energyExported.Value().startSystime.Value()]; + } else { + memberValue.startSystime = nil; + } + if (cppValue.energyExported.Value().endSystime.HasValue()) { + memberValue.endSystime = [NSNumber numberWithUnsignedLongLong:cppValue.energyExported.Value().endSystime.Value()]; + } else { + memberValue.endSystime = nil; + } + } else { + memberValue = nil; + } + value.energyExported = memberValue; + } while (0); + + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} static id _Nullable DecodeEventPayloadForDemandResponseLoadControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { using namespace Clusters::DemandResponseLoadControl; @@ -4273,6 +4429,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::ValveConfigurationAndControl::Id: { return DecodeEventPayloadForValveConfigurationAndControlCluster(aPath.mEventId, aReader, aError); } + case Clusters::ElectricalEnergyMeasurement::Id: { + return DecodeEventPayloadForElectricalEnergyMeasurementCluster(aPath.mEventId, aReader, aError); + } case Clusters::DemandResponseLoadControl::Id: { return DecodeEventPayloadForDemandResponseLoadControlCluster(aPath.mEventId, aReader, aError); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index 65a361cf605a95..b21a35ab11b40f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1072,6 +1072,48 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull valveFault MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull rangeMin MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull rangeMax MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable percentMax MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable percentMin MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable percentTypical MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable fixedMax MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable fixedMin MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable fixedTypical MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull measurementType MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull measured MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull minMeasuredValue MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull maxMeasuredValue MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSArray * _Nonnull accuracyRanges MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull energy MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable startTimestamp MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable endTimestamp MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable startSystime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable endSystime MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent : NSObject +@property (nonatomic, copy) MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable energyImported MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable energyExported MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent : NSObject +@property (nonatomic, copy) MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable energyImported MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable energyExported MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRDemandResponseLoadControlClusterHeatingSourceControlStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull heatingSource MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 1262d5d534593a..074a9001c288b5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -4310,6 +4310,192 @@ - (NSString *)description @end +@implementation MTRElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct +- (instancetype)init +{ + if (self = [super init]) { + + _rangeMin = @(0); + + _rangeMax = @(0); + + _percentMax = nil; + + _percentMin = nil; + + _percentTypical = nil; + + _fixedMax = nil; + + _fixedMin = nil; + + _fixedTypical = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct alloc] init]; + + other.rangeMin = self.rangeMin; + other.rangeMax = self.rangeMax; + other.percentMax = self.percentMax; + other.percentMin = self.percentMin; + other.percentTypical = self.percentTypical; + other.fixedMax = self.fixedMax; + other.fixedMin = self.fixedMin; + other.fixedTypical = self.fixedTypical; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: rangeMin:%@; rangeMax:%@; percentMax:%@; percentMin:%@; percentTypical:%@; fixedMax:%@; fixedMin:%@; fixedTypical:%@; >", NSStringFromClass([self class]), _rangeMin, _rangeMax, _percentMax, _percentMin, _percentTypical, _fixedMax, _fixedMin, _fixedTypical]; + return descriptionString; +} + +@end + +@implementation MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct +- (instancetype)init +{ + if (self = [super init]) { + + _measurementType = @(0); + + _measured = @(0); + + _minMeasuredValue = @(0); + + _maxMeasuredValue = @(0); + + _accuracyRanges = [NSArray array]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct alloc] init]; + + other.measurementType = self.measurementType; + other.measured = self.measured; + other.minMeasuredValue = self.minMeasuredValue; + other.maxMeasuredValue = self.maxMeasuredValue; + other.accuracyRanges = self.accuracyRanges; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: measurementType:%@; measured:%@; minMeasuredValue:%@; maxMeasuredValue:%@; accuracyRanges:%@; >", NSStringFromClass([self class]), _measurementType, _measured, _minMeasuredValue, _maxMeasuredValue, _accuracyRanges]; + return descriptionString; +} + +@end + +@implementation MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct +- (instancetype)init +{ + if (self = [super init]) { + + _energy = @(0); + + _startTimestamp = nil; + + _endTimestamp = nil; + + _startSystime = nil; + + _endSystime = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct alloc] init]; + + other.energy = self.energy; + other.startTimestamp = self.startTimestamp; + other.endTimestamp = self.endTimestamp; + other.startSystime = self.startSystime; + other.endSystime = self.endSystime; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: energy:%@; startTimestamp:%@; endTimestamp:%@; startSystime:%@; endSystime:%@; >", NSStringFromClass([self class]), _energy, _startTimestamp, _endTimestamp, _startSystime, _endSystime]; + return descriptionString; +} + +@end + +@implementation MTRElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent +- (instancetype)init +{ + if (self = [super init]) { + + _energyImported = nil; + + _energyExported = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent alloc] init]; + + other.energyImported = self.energyImported; + other.energyExported = self.energyExported; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: energyImported:%@; energyExported:%@; >", NSStringFromClass([self class]), _energyImported, _energyExported]; + return descriptionString; +} + +@end + +@implementation MTRElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent +- (instancetype)init +{ + if (self = [super init]) { + + _energyImported = nil; + + _energyExported = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent alloc] init]; + + other.energyImported = self.energyImported; + other.energyExported = self.energyExported; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: energyImported:%@; energyExported:%@; >", NSStringFromClass([self class]), _energyImported, _energyExported]; + return descriptionString; +} + +@end + @implementation MTRDemandResponseLoadControlClusterHeatingSourceControlStruct - (instancetype)init { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 8a37b3770fe22c..66f3ff69bb6949 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -10130,6 +10130,74 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) } // namespace Attributes } // namespace ValveConfigurationAndControl +namespace ElectricalEnergyMeasurement { +namespace Attributes { + +namespace FeatureMap { + +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::ElectricalEnergyMeasurement::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ElectricalEnergyMeasurement::Id, Id, writable, ZCL_BITMAP32_ATTRIBUTE_TYPE); +} + +} // namespace FeatureMap + +namespace ClusterRevision { + +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::ElectricalEnergyMeasurement::Id, Id, readable, sizeof(temp)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + *value = Traits::StorageToWorking(temp); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::ElectricalEnergyMeasurement::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); +} + +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ElectricalEnergyMeasurement + namespace DemandResponseLoadControl { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 616148bb9327fa..4222d40ea76f9f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -1961,6 +1961,22 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace Attributes } // namespace ValveConfigurationAndControl +namespace ElectricalEnergyMeasurement { +namespace Attributes { + +namespace FeatureMap { +EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 +EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value); +} // namespace FeatureMap + +namespace ClusterRevision { +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ElectricalEnergyMeasurement + namespace DemandResponseLoadControl { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 858328342defbb..ff5751ddcb52ee 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -553,6 +553,14 @@ void emberAfBooleanSensorConfigurationClusterInitCallback(chip::EndpointId endpo */ void emberAfValveConfigurationAndControlClusterInitCallback(chip::EndpointId endpoint); +/** @brief Electrical Energy Measurement Cluster Init + * + * Cluster Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfElectricalEnergyMeasurementClusterInitCallback(chip::EndpointId endpoint); + /** @brief Demand Response Load Control Cluster Init * * Cluster Init @@ -5937,6 +5945,82 @@ void emberAfValveConfigurationAndControlClusterServerTickCallback(chip::Endpoint */ void emberAfValveConfigurationAndControlClusterClientTickCallback(chip::EndpointId endpoint); +// +// Electrical Energy Measurement Cluster +// + +/** @brief Electrical Energy Measurement Cluster Server Init + * + * Server Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfElectricalEnergyMeasurementClusterServerInitCallback(chip::EndpointId endpoint); + +/** @brief Electrical Energy Measurement Cluster Server Shutdown + * + * Server Shutdown + * + * @param endpoint Endpoint that is being shutdown + */ +void MatterElectricalEnergyMeasurementClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** @brief Electrical Energy Measurement Cluster Client Init + * + * Client Init + * + * @param endpoint Endpoint that is being initialized + */ +void emberAfElectricalEnergyMeasurementClusterClientInitCallback(chip::EndpointId endpoint); + +/** @brief Electrical Energy Measurement Cluster Server Attribute Changed + * + * Server Attribute Changed + * + * @param attributePath Concrete attribute path that changed + */ +void MatterElectricalEnergyMeasurementClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** @brief Electrical Energy Measurement Cluster Server Pre Attribute Changed + * + * Server Pre Attribute Changed + * + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterElectricalEnergyMeasurementClusterServerPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** @brief Electrical Energy Measurement Cluster Client Pre Attribute Changed + * + * Client Pre Attribute Changed + * + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterElectricalEnergyMeasurementClusterClientPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** @brief Electrical Energy Measurement Cluster Server Tick + * + * Server Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfElectricalEnergyMeasurementClusterServerTickCallback(chip::EndpointId endpoint); + +/** @brief Electrical Energy Measurement Cluster Client Tick + * + * Client Tick + * + * @param endpoint Endpoint that is being served + */ +void emberAfElectricalEnergyMeasurementClusterClientTickCallback(chip::EndpointId endpoint); + // // Demand Response Load Control Cluster // diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index 7ef15603b1df39..48a2a5094ad527 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -1535,6 +1535,32 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(ValveConfigurationAndCo } } +static auto __attribute__((unused)) EnsureKnownEnumValue(ElectricalEnergyMeasurement::MeasurementTypeEnum val) +{ + using EnumType = ElectricalEnergyMeasurement::MeasurementTypeEnum; + switch (val) + { + case EnumType::kUnspecified: + case EnumType::kVoltage: + case EnumType::kActiveCurrent: + case EnumType::kReactiveCurrent: + case EnumType::kApparentCurrent: + case EnumType::kActivePower: + case EnumType::kReactivePower: + case EnumType::kApparentPower: + case EnumType::kRMSVoltage: + case EnumType::kRMSCurrent: + case EnumType::kRMSPower: + case EnumType::kFrequency: + case EnumType::kPowerFactor: + case EnumType::kNeutralCurrent: + case EnumType::kElectricalEnergy: + return val; + default: + return static_cast(15); + } +} + static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::CriticalityLevelEnum val) { using EnumType = DemandResponseLoadControl::CriticalityLevelEnum; diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index bd815d7b2bdebe..adcca6f89087af 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -2187,6 +2187,43 @@ enum class ValveFaultBitmap : uint16_t }; } // namespace ValveConfigurationAndControl +namespace ElectricalEnergyMeasurement { + +// Enum for MeasurementTypeEnum +enum class MeasurementTypeEnum : uint16_t +{ + kUnspecified = 0x00, + kVoltage = 0x01, + kActiveCurrent = 0x02, + kReactiveCurrent = 0x03, + kApparentCurrent = 0x04, + kActivePower = 0x05, + kReactivePower = 0x06, + kApparentPower = 0x07, + kRMSVoltage = 0x08, + kRMSCurrent = 0x09, + kRMSPower = 0x0A, + kFrequency = 0x0B, + kPowerFactor = 0x0C, + kNeutralCurrent = 0x0D, + kElectricalEnergy = 0x0E, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 15, +}; + +// Bitmap for Feature +enum class Feature : uint32_t +{ + kImportedEnergy = 0x1, + kExportedEnergy = 0x2, + kCumulativeEnergy = 0x4, + kPeriodicEnergy = 0x8, +}; +} // namespace ElectricalEnergyMeasurement + namespace DemandResponseLoadControl { // Enum for CriticalityLevelEnum diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 56efe1d5e0bc3e..78bf30815c3084 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -13999,6 +13999,312 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace Events } // namespace ValveConfigurationAndControl +namespace ElectricalEnergyMeasurement { +namespace Structs { + +namespace MeasurementAccuracyRangeStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kRangeMin), rangeMin); + encoder.Encode(to_underlying(Fields::kRangeMax), rangeMax); + encoder.Encode(to_underlying(Fields::kPercentMax), percentMax); + encoder.Encode(to_underlying(Fields::kPercentMin), percentMin); + encoder.Encode(to_underlying(Fields::kPercentTypical), percentTypical); + encoder.Encode(to_underlying(Fields::kFixedMax), fixedMax); + encoder.Encode(to_underlying(Fields::kFixedMin), fixedMin); + encoder.Encode(to_underlying(Fields::kFixedTypical), fixedTypical); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kRangeMin)) + { + err = DataModel::Decode(reader, rangeMin); + } + else if (__context_tag == to_underlying(Fields::kRangeMax)) + { + err = DataModel::Decode(reader, rangeMax); + } + else if (__context_tag == to_underlying(Fields::kPercentMax)) + { + err = DataModel::Decode(reader, percentMax); + } + else if (__context_tag == to_underlying(Fields::kPercentMin)) + { + err = DataModel::Decode(reader, percentMin); + } + else if (__context_tag == to_underlying(Fields::kPercentTypical)) + { + err = DataModel::Decode(reader, percentTypical); + } + else if (__context_tag == to_underlying(Fields::kFixedMax)) + { + err = DataModel::Decode(reader, fixedMax); + } + else if (__context_tag == to_underlying(Fields::kFixedMin)) + { + err = DataModel::Decode(reader, fixedMin); + } + else if (__context_tag == to_underlying(Fields::kFixedTypical)) + { + err = DataModel::Decode(reader, fixedTypical); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace MeasurementAccuracyRangeStruct + +namespace MeasurementAccuracyStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kMeasurementType), measurementType); + encoder.Encode(to_underlying(Fields::kMeasured), measured); + encoder.Encode(to_underlying(Fields::kMinMeasuredValue), minMeasuredValue); + encoder.Encode(to_underlying(Fields::kMaxMeasuredValue), maxMeasuredValue); + encoder.Encode(to_underlying(Fields::kAccuracyRanges), accuracyRanges); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kMeasurementType)) + { + err = DataModel::Decode(reader, measurementType); + } + else if (__context_tag == to_underlying(Fields::kMeasured)) + { + err = DataModel::Decode(reader, measured); + } + else if (__context_tag == to_underlying(Fields::kMinMeasuredValue)) + { + err = DataModel::Decode(reader, minMeasuredValue); + } + else if (__context_tag == to_underlying(Fields::kMaxMeasuredValue)) + { + err = DataModel::Decode(reader, maxMeasuredValue); + } + else if (__context_tag == to_underlying(Fields::kAccuracyRanges)) + { + err = DataModel::Decode(reader, accuracyRanges); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace MeasurementAccuracyStruct + +namespace EnergyMeasurementStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kEnergy), energy); + encoder.Encode(to_underlying(Fields::kStartTimestamp), startTimestamp); + encoder.Encode(to_underlying(Fields::kEndTimestamp), endTimestamp); + encoder.Encode(to_underlying(Fields::kStartSystime), startSystime); + encoder.Encode(to_underlying(Fields::kEndSystime), endSystime); + return encoder.Finalize(); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kEnergy)) + { + err = DataModel::Decode(reader, energy); + } + else if (__context_tag == to_underlying(Fields::kStartTimestamp)) + { + err = DataModel::Decode(reader, startTimestamp); + } + else if (__context_tag == to_underlying(Fields::kEndTimestamp)) + { + err = DataModel::Decode(reader, endTimestamp); + } + else if (__context_tag == to_underlying(Fields::kStartSystime)) + { + err = DataModel::Decode(reader, startSystime); + } + else if (__context_tag == to_underlying(Fields::kEndSystime)) + { + err = DataModel::Decode(reader, endSystime); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} + +} // namespace EnergyMeasurementStruct +} // namespace Structs + +namespace Commands {} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::Accuracy::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, accuracy); + case Attributes::CumulativeEnergyImported::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, cumulativeEnergyImported); + case Attributes::CumulativeEnergyExported::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, cumulativeEnergyExported); + case Attributes::PeriodicEnergyImported::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, periodicEnergyImported); + case Attributes::PeriodicEnergyExported::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, periodicEnergyExported); + case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, generatedCommandList); + case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, acceptedCommandList); + case Attributes::EventList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, eventList); + case Attributes::AttributeList::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, attributeList); + case Attributes::FeatureMap::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, featureMap); + case Attributes::ClusterRevision::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, clusterRevision); + default: + return CHIP_NO_ERROR; + } +} +} // namespace Attributes + +namespace Events { +namespace CumulativeEnergyMeasured { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEnergyImported), energyImported)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEnergyExported), energyExported)); + return aWriter.EndContainer(outer); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kEnergyImported)) + { + err = DataModel::Decode(reader, energyImported); + } + else if (__context_tag == to_underlying(Fields::kEnergyExported)) + { + err = DataModel::Decode(reader, energyExported); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace CumulativeEnergyMeasured. +namespace PeriodicEnergyMeasured { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEnergyImported), energyImported)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kEnergyExported), energyExported)); + return aWriter.EndContainer(outer); +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + detail::StructDecodeIterator __iterator(reader); + while (true) + { + auto __element = __iterator.Next(); + if (std::holds_alternative(__element)) + { + return std::get(__element); + } + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kEnergyImported)) + { + err = DataModel::Decode(reader, energyImported); + } + else if (__context_tag == to_underlying(Fields::kEnergyExported)) + { + err = DataModel::Decode(reader, energyExported); + } + else + { + } + + ReturnErrorOnFailure(err); + } +} +} // namespace PeriodicEnergyMeasured. +} // namespace Events + +} // namespace ElectricalEnergyMeasurement namespace DemandResponseLoadControl { namespace Structs { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 421dad0af3e981..afb183bc0de418 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -20112,6 +20112,322 @@ struct DecodableType } // namespace ValveFault } // namespace Events } // namespace ValveConfigurationAndControl +namespace ElectricalEnergyMeasurement { +namespace Structs { +namespace MeasurementAccuracyRangeStruct { +enum class Fields : uint8_t +{ + kRangeMin = 0, + kRangeMax = 1, + kPercentMax = 2, + kPercentMin = 3, + kPercentTypical = 4, + kFixedMax = 5, + kFixedMin = 6, + kFixedTypical = 7, +}; + +struct Type +{ +public: + int64_t rangeMin = static_cast(0); + int64_t rangeMax = static_cast(0); + Optional percentMax; + Optional percentMin; + Optional percentTypical; + Optional fixedMax; + Optional fixedMin; + Optional fixedTypical; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace MeasurementAccuracyRangeStruct +namespace MeasurementAccuracyStruct { +enum class Fields : uint8_t +{ + kMeasurementType = 0, + kMeasured = 1, + kMinMeasuredValue = 2, + kMaxMeasuredValue = 3, + kAccuracyRanges = 4, +}; + +struct Type +{ +public: + MeasurementTypeEnum measurementType = static_cast(0); + bool measured = static_cast(0); + int64_t minMeasuredValue = static_cast(0); + int64_t maxMeasuredValue = static_cast(0); + DataModel::List accuracyRanges; + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + MeasurementTypeEnum measurementType = static_cast(0); + bool measured = static_cast(0); + int64_t minMeasuredValue = static_cast(0); + int64_t maxMeasuredValue = static_cast(0); + DataModel::DecodableList accuracyRanges; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; +}; + +} // namespace MeasurementAccuracyStruct +namespace EnergyMeasurementStruct { +enum class Fields : uint8_t +{ + kEnergy = 0, + kStartTimestamp = 1, + kEndTimestamp = 2, + kStartSystime = 3, + kEndSystime = 4, +}; + +struct Type +{ +public: + int64_t energy = static_cast(0); + Optional startTimestamp; + Optional endTimestamp; + Optional startSystime; + Optional endSystime; + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +using DecodableType = Type; + +} // namespace EnergyMeasurementStruct +} // namespace Structs + +namespace Attributes { + +namespace Accuracy { +struct TypeInfo +{ + using Type = chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type; + using DecodableType = chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::DecodableType; + using DecodableArgType = + const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::DecodableType &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Accuracy::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace Accuracy +namespace CumulativeEnergyImported { +struct TypeInfo +{ + using Type = + chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CumulativeEnergyImported::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CumulativeEnergyImported +namespace CumulativeEnergyExported { +struct TypeInfo +{ + using Type = + chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CumulativeEnergyExported::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CumulativeEnergyExported +namespace PeriodicEnergyImported { +struct TypeInfo +{ + using Type = + chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::PeriodicEnergyImported::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace PeriodicEnergyImported +namespace PeriodicEnergyExported { +struct TypeInfo +{ + using Type = + chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::PeriodicEnergyExported::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace PeriodicEnergyExported +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + + Attributes::Accuracy::TypeInfo::DecodableType accuracy; + Attributes::CumulativeEnergyImported::TypeInfo::DecodableType cumulativeEnergyImported; + Attributes::CumulativeEnergyExported::TypeInfo::DecodableType cumulativeEnergyExported; + Attributes::PeriodicEnergyImported::TypeInfo::DecodableType periodicEnergyImported; + Attributes::PeriodicEnergyExported::TypeInfo::DecodableType periodicEnergyExported; + Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; + Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; + Attributes::EventList::TypeInfo::DecodableType eventList; + Attributes::AttributeList::TypeInfo::DecodableType attributeList; + Attributes::FeatureMap::TypeInfo::DecodableType featureMap = static_cast(0); + Attributes::ClusterRevision::TypeInfo::DecodableType clusterRevision = static_cast(0); + }; +}; +} // namespace Attributes +namespace Events { +namespace CumulativeEnergyMeasured { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kEnergyImported = 0, + kEnergyExported = 1, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::CumulativeEnergyMeasured::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + static constexpr bool kIsFabricScoped = false; + + Optional energyImported; + Optional energyExported; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::CumulativeEnergyMeasured::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + + Optional energyImported; + Optional energyExported; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace CumulativeEnergyMeasured +namespace PeriodicEnergyMeasured { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kEnergyImported = 0, + kEnergyExported = 1, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::PeriodicEnergyMeasured::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + static constexpr bool kIsFabricScoped = false; + + Optional energyImported; + Optional energyExported; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::PeriodicEnergyMeasured::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + + Optional energyImported; + Optional energyExported; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace PeriodicEnergyMeasured +} // namespace Events +} // namespace ElectricalEnergyMeasurement namespace DemandResponseLoadControl { namespace Structs { namespace HeatingSourceControlStruct { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 505b66778784e2..732997cd74bf35 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -3629,6 +3629,56 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace ValveConfigurationAndControl +namespace ElectricalEnergyMeasurement { +namespace Attributes { + +namespace Accuracy { +static constexpr AttributeId Id = 0x00000000; +} // namespace Accuracy + +namespace CumulativeEnergyImported { +static constexpr AttributeId Id = 0x00000001; +} // namespace CumulativeEnergyImported + +namespace CumulativeEnergyExported { +static constexpr AttributeId Id = 0x00000002; +} // namespace CumulativeEnergyExported + +namespace PeriodicEnergyImported { +static constexpr AttributeId Id = 0x00000003; +} // namespace PeriodicEnergyImported + +namespace PeriodicEnergyExported { +static constexpr AttributeId Id = 0x00000004; +} // namespace PeriodicEnergyExported + +namespace GeneratedCommandList { +static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; +} // namespace GeneratedCommandList + +namespace AcceptedCommandList { +static constexpr AttributeId Id = Globals::Attributes::AcceptedCommandList::Id; +} // namespace AcceptedCommandList + +namespace EventList { +static constexpr AttributeId Id = Globals::Attributes::EventList::Id; +} // namespace EventList + +namespace AttributeList { +static constexpr AttributeId Id = Globals::Attributes::AttributeList::Id; +} // namespace AttributeList + +namespace FeatureMap { +static constexpr AttributeId Id = Globals::Attributes::FeatureMap::Id; +} // namespace FeatureMap + +namespace ClusterRevision { +static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ElectricalEnergyMeasurement + namespace DemandResponseLoadControl { namespace Attributes { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h index e213295cfaffdf..30795284640706 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Clusters.h @@ -220,6 +220,9 @@ static constexpr ClusterId Id = 0x00000080; namespace ValveConfigurationAndControl { static constexpr ClusterId Id = 0x00000081; } // namespace ValveConfigurationAndControl +namespace ElectricalEnergyMeasurement { +static constexpr ClusterId Id = 0x00000091; +} // namespace ElectricalEnergyMeasurement namespace DemandResponseLoadControl { static constexpr ClusterId Id = 0x00000096; } // namespace DemandResponseLoadControl diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h index 38d917c669e297..9fadaafb4062d3 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h @@ -407,6 +407,20 @@ static constexpr EventId Id = 0x00000001; } // namespace Events } // namespace ValveConfigurationAndControl +namespace ElectricalEnergyMeasurement { +namespace Events { + +namespace CumulativeEnergyMeasured { +static constexpr EventId Id = 0x00000000; +} // namespace CumulativeEnergyMeasured + +namespace PeriodicEnergyMeasured { +static constexpr EventId Id = 0x00000001; +} // namespace PeriodicEnergyMeasured + +} // namespace Events +} // namespace ElectricalEnergyMeasurement + namespace DemandResponseLoadControl { namespace Events { diff --git a/zzz_generated/app-common/app-common/zap-generated/print-cluster.h b/zzz_generated/app-common/app-common/zap-generated/print-cluster.h index 8bf39558bca336..dce92e23194866 100644 --- a/zzz_generated/app-common/app-common/zap-generated/print-cluster.h +++ b/zzz_generated/app-common/app-common/zap-generated/print-cluster.h @@ -443,6 +443,14 @@ #define CHIP_PRINTCLUSTER_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER #endif +#if defined(ZCL_USING_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_SERVER) || \ + defined(ZCL_USING_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER \ + { chip::app::Clusters::ElectricalEnergyMeasurement::Id, "Electrical Energy Measurement" }, +#else +#define CHIP_PRINTCLUSTER_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER +#endif + #if defined(ZCL_USING_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_SERVER) || defined(ZCL_USING_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_CLIENT) #define CHIP_PRINTCLUSTER_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER \ { chip::app::Clusters::DemandResponseLoadControl::Id, "Demand Response Load Control" }, @@ -817,6 +825,7 @@ CHIP_PRINTCLUSTER_ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER \ CHIP_PRINTCLUSTER_BOOLEAN_SENSOR_CONFIGURATION_CLUSTER \ CHIP_PRINTCLUSTER_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER \ + CHIP_PRINTCLUSTER_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER \ CHIP_PRINTCLUSTER_DEVICE_ENERGY_MANAGEMENT_CLUSTER \ CHIP_PRINTCLUSTER_ENERGY_EVSE_CLUSTER \ diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index c966ee0534f603..645a06603e14c0 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -99,6 +99,7 @@ | ActivatedCarbonFilterMonitoring | 0x0072 | | BooleanSensorConfiguration | 0x0080 | | ValveConfigurationAndControl | 0x0081 | +| ElectricalEnergyMeasurement | 0x0091 | | DemandResponseLoadControl | 0x0096 | | DeviceEnergyManagement | 0x0098 | | EnergyEvse | 0x0099 | @@ -6573,6 +6574,29 @@ class ValveConfigurationAndControlSetLevel : public ClusterCommand chip::app::Clusters::ValveConfigurationAndControl::Commands::SetLevel::Type mRequest; }; +/*----------------------------------------------------------------------------*\ +| Cluster ElectricalEnergyMeasurement | 0x0091 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Accuracy | 0x0000 | +| * CumulativeEnergyImported | 0x0001 | +| * CumulativeEnergyExported | 0x0002 | +| * PeriodicEnergyImported | 0x0003 | +| * PeriodicEnergyExported | 0x0004 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * CumulativeEnergyMeasured | 0x0000 | +| * PeriodicEnergyMeasured | 0x0001 | +\*----------------------------------------------------------------------------*/ + /*----------------------------------------------------------------------------*\ | Cluster DemandResponseLoadControl | 0x0096 | |------------------------------------------------------------------------------| @@ -19324,6 +19348,96 @@ void registerClusterValveConfigurationAndControl(Commands & commands, Credential commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterElectricalEnergyMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::ElectricalEnergyMeasurement; + + const char * clusterName = "ElectricalEnergyMeasurement"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "accuracy", Attributes::Accuracy::Id, credsIssuerConfig), // + make_unique(Id, "cumulative-energy-imported", Attributes::CumulativeEnergyImported::Id, + credsIssuerConfig), // + make_unique(Id, "cumulative-energy-exported", Attributes::CumulativeEnergyExported::Id, + credsIssuerConfig), // + make_unique(Id, "periodic-energy-imported", Attributes::PeriodicEnergyImported::Id, credsIssuerConfig), // + make_unique(Id, "periodic-energy-exported", Attributes::PeriodicEnergyExported::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // + make_unique< + WriteAttributeAsComplex>( + Id, "accuracy", Attributes::Accuracy::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "cumulative-energy-imported", Attributes::CumulativeEnergyImported::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "cumulative-energy-exported", Attributes::CumulativeEnergyExported::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "periodic-energy-imported", Attributes::PeriodicEnergyImported::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "periodic-energy-exported", Attributes::PeriodicEnergyExported::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "event-list", Attributes::EventList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "attribute-list", Attributes::AttributeList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "accuracy", Attributes::Accuracy::Id, credsIssuerConfig), // + make_unique(Id, "cumulative-energy-imported", Attributes::CumulativeEnergyImported::Id, + credsIssuerConfig), // + make_unique(Id, "cumulative-energy-exported", Attributes::CumulativeEnergyExported::Id, + credsIssuerConfig), // + make_unique(Id, "periodic-energy-imported", Attributes::PeriodicEnergyImported::Id, + credsIssuerConfig), // + make_unique(Id, "periodic-energy-exported", Attributes::PeriodicEnergyExported::Id, + credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + // + // Events + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "cumulative-energy-measured", Events::CumulativeEnergyMeasured::Id, credsIssuerConfig), // + make_unique(Id, "periodic-energy-measured", Events::PeriodicEnergyMeasured::Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "cumulative-energy-measured", Events::CumulativeEnergyMeasured::Id, credsIssuerConfig), // + make_unique(Id, "periodic-energy-measured", Events::PeriodicEnergyMeasured::Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterDemandResponseLoadControl(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::DemandResponseLoadControl; @@ -25266,6 +25380,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterActivatedCarbonFilterMonitoring(commands, credsIssuerConfig); registerClusterBooleanSensorConfiguration(commands, credsIssuerConfig); registerClusterValveConfigurationAndControl(commands, credsIssuerConfig); + registerClusterElectricalEnergyMeasurement(commands, credsIssuerConfig); registerClusterDemandResponseLoadControl(commands, credsIssuerConfig); registerClusterDeviceEnergyManagement(commands, credsIssuerConfig); registerClusterEnergyEvse(commands, credsIssuerConfig); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index 0a6a0757b2bf82..7aeb538c962c95 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -2221,6 +2221,201 @@ void ComplexArgumentParser::Finalize( ComplexArgumentParser::Finalize(request.productIdentifierValue); } +CHIP_ERROR ComplexArgumentParser::Setup( + const char * label, chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("MeasurementAccuracyRangeStruct.rangeMin", "rangeMin", + value.isMember("rangeMin"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("MeasurementAccuracyRangeStruct.rangeMax", "rangeMax", + value.isMember("rangeMax"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rangeMin"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rangeMin, value["rangeMin"])); + valueCopy.removeMember("rangeMin"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rangeMax"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rangeMax, value["rangeMax"])); + valueCopy.removeMember("rangeMax"); + + if (value.isMember("percentMax")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "percentMax"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.percentMax, value["percentMax"])); + } + valueCopy.removeMember("percentMax"); + + if (value.isMember("percentMin")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "percentMin"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.percentMin, value["percentMin"])); + } + valueCopy.removeMember("percentMin"); + + if (value.isMember("percentTypical")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "percentTypical"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.percentTypical, value["percentTypical"])); + } + valueCopy.removeMember("percentTypical"); + + if (value.isMember("fixedMax")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fixedMax"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fixedMax, value["fixedMax"])); + } + valueCopy.removeMember("fixedMax"); + + if (value.isMember("fixedMin")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fixedMin"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fixedMin, value["fixedMin"])); + } + valueCopy.removeMember("fixedMin"); + + if (value.isMember("fixedTypical")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fixedTypical"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fixedTypical, value["fixedTypical"])); + } + valueCopy.removeMember("fixedTypical"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.rangeMin); + ComplexArgumentParser::Finalize(request.rangeMax); + ComplexArgumentParser::Finalize(request.percentMax); + ComplexArgumentParser::Finalize(request.percentMin); + ComplexArgumentParser::Finalize(request.percentTypical); + ComplexArgumentParser::Finalize(request.fixedMax); + ComplexArgumentParser::Finalize(request.fixedMin); + ComplexArgumentParser::Finalize(request.fixedTypical); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("MeasurementAccuracyStruct.measurementType", "measurementType", + value.isMember("measurementType"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("MeasurementAccuracyStruct.measured", "measured", value.isMember("measured"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("MeasurementAccuracyStruct.minMeasuredValue", "minMeasuredValue", + value.isMember("minMeasuredValue"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("MeasurementAccuracyStruct.maxMeasuredValue", "maxMeasuredValue", + value.isMember("maxMeasuredValue"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("MeasurementAccuracyStruct.accuracyRanges", "accuracyRanges", + value.isMember("accuracyRanges"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "measurementType"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.measurementType, value["measurementType"])); + valueCopy.removeMember("measurementType"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "measured"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.measured, value["measured"])); + valueCopy.removeMember("measured"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minMeasuredValue"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.minMeasuredValue, value["minMeasuredValue"])); + valueCopy.removeMember("minMeasuredValue"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxMeasuredValue"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.maxMeasuredValue, value["maxMeasuredValue"])); + valueCopy.removeMember("maxMeasuredValue"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "accuracyRanges"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.accuracyRanges, value["accuracyRanges"])); + valueCopy.removeMember("accuracyRanges"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.measurementType); + ComplexArgumentParser::Finalize(request.measured); + ComplexArgumentParser::Finalize(request.minMeasuredValue); + ComplexArgumentParser::Finalize(request.maxMeasuredValue); + ComplexArgumentParser::Finalize(request.accuracyRanges); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("EnergyMeasurementStruct.energy", "energy", value.isMember("energy"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "energy"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.energy, value["energy"])); + valueCopy.removeMember("energy"); + + if (value.isMember("startTimestamp")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "startTimestamp"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.startTimestamp, value["startTimestamp"])); + } + valueCopy.removeMember("startTimestamp"); + + if (value.isMember("endTimestamp")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endTimestamp"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endTimestamp, value["endTimestamp"])); + } + valueCopy.removeMember("endTimestamp"); + + if (value.isMember("startSystime")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "startSystime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.startSystime, value["startSystime"])); + } + valueCopy.removeMember("startSystime"); + + if (value.isMember("endSystime")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endSystime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endSystime, value["endSystime"])); + } + valueCopy.removeMember("endSystime"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.energy); + ComplexArgumentParser::Finalize(request.startTimestamp); + ComplexArgumentParser::Finalize(request.endTimestamp); + ComplexArgumentParser::Finalize(request.startSystime); + ComplexArgumentParser::Finalize(request.endSystime); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::Type & request, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 8c5b30bd425cd8..c7affea5f68209 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -276,6 +276,24 @@ static CHIP_ERROR Setup(const char * label, static void Finalize(chip::app::Clusters::ActivatedCarbonFilterMonitoring::Structs::ReplacementProductStruct::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index f6e11f2ac60c10..63017e72e36b37 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -1985,6 +1985,180 @@ CHIP_ERROR DataModelLogger::LogValue( return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("RangeMin", indent + 1, value.rangeMin); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'RangeMin'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("RangeMax", indent + 1, value.rangeMax); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'RangeMax'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PercentMax", indent + 1, value.percentMax); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PercentMax'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PercentMin", indent + 1, value.percentMin); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PercentMin'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("PercentTypical", indent + 1, value.percentTypical); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PercentTypical'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FixedMax", indent + 1, value.fixedMax); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FixedMax'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FixedMin", indent + 1, value.fixedMin); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FixedMin'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("FixedTypical", indent + 1, value.fixedTypical); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FixedTypical'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("MeasurementType", indent + 1, value.measurementType); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MeasurementType'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Measured", indent + 1, value.measured); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Measured'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("MinMeasuredValue", indent + 1, value.minMeasuredValue); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MinMeasuredValue'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("MaxMeasuredValue", indent + 1, value.maxMeasuredValue); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MaxMeasuredValue'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("AccuracyRanges", indent + 1, value.accuracyRanges); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'AccuracyRanges'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("Energy", indent + 1, value.energy); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Energy'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("StartTimestamp", indent + 1, value.startTimestamp); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'StartTimestamp'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("EndTimestamp", indent + 1, value.endTimestamp); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'EndTimestamp'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("StartSystime", indent + 1, value.startSystime); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'StartSystime'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("EndSystime", indent + 1, value.endSystime); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'EndSystime'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue( const char * label, size_t indent, const chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::DecodableType & value) @@ -5370,6 +5544,54 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const ElectricalEnergyMeasurement::Events::CumulativeEnergyMeasured::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("EnergyImported", indent + 1, value.energyImported); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'EnergyImported'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("EnergyExported", indent + 1, value.energyExported); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'EnergyExported'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const ElectricalEnergyMeasurement::Events::PeriodicEnergyMeasured::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("EnergyImported", indent + 1, value.energyImported); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'EnergyImported'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("EnergyExported", indent + 1, value.energyExported); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'EnergyExported'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const DemandResponseLoadControl::Events::LoadControlEventStatusChange::DecodableType & value) { @@ -11446,6 +11668,75 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case ElectricalEnergyMeasurement::Id: { + switch (path.mAttributeId) + { + case ElectricalEnergyMeasurement::Attributes::Accuracy::Id: { + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("Accuracy", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::Id: { + chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CumulativeEnergyImported", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::CumulativeEnergyExported::Id: { + chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CumulativeEnergyExported", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::PeriodicEnergyImported::Id: { + chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("PeriodicEnergyImported", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::PeriodicEnergyExported::Id: { + chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("PeriodicEnergyExported", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case ElectricalEnergyMeasurement::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case DemandResponseLoadControl::Id: { switch (path.mAttributeId) { @@ -17513,6 +17804,22 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip } break; } + case ElectricalEnergyMeasurement::Id: { + switch (header.mPath.mEventId) + { + case ElectricalEnergyMeasurement::Events::CumulativeEnergyMeasured::Id: { + chip::app::Clusters::ElectricalEnergyMeasurement::Events::CumulativeEnergyMeasured::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CumulativeEnergyMeasured", 1, value); + } + case ElectricalEnergyMeasurement::Events::PeriodicEnergyMeasured::Id: { + chip::app::Clusters::ElectricalEnergyMeasurement::Events::PeriodicEnergyMeasured::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("PeriodicEnergyMeasured", 1, value); + } + } + break; + } case DemandResponseLoadControl::Id: { switch (header.mPath.mEventId) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index ac9d4a8a4ccd5b..5dc0cb3d19ef90 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -173,6 +173,18 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ActivatedCarbonFilterMonitoring::Structs::ReplacementProductStruct::DecodableType & value); +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DemandResponseLoadControl::Structs::HeatingSourceControlStruct::DecodableType & value); @@ -461,6 +473,12 @@ LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ValveConfigurationAndControl::Events::ValveFault::DecodableType & value); static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ElectricalEnergyMeasurement::Events::CumulativeEnergyMeasured::DecodableType & value); +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ElectricalEnergyMeasurement::Events::PeriodicEnergyMeasured::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::DemandResponseLoadControl::Events::LoadControlEventStatusChange::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, diff --git a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h index b481d620a2a43b..80646cb029a5d7 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/cluster/Commands.h @@ -102,6 +102,7 @@ | ActivatedCarbonFilterMonitoring | 0x0072 | | BooleanSensorConfiguration | 0x0080 | | ValveConfigurationAndControl | 0x0081 | +| ElectricalEnergyMeasurement | 0x0091 | | DemandResponseLoadControl | 0x0096 | | DeviceEnergyManagement | 0x0098 | | EnergyEvse | 0x0099 | @@ -76007,6 +76008,966 @@ class SubscribeAttributeValveConfigurationAndControlClusterRevision : public Sub } }; +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster ElectricalEnergyMeasurement | 0x0091 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * Accuracy | 0x0000 | +| * CumulativeEnergyImported | 0x0001 | +| * CumulativeEnergyExported | 0x0002 | +| * PeriodicEnergyImported | 0x0003 | +| * PeriodicEnergyExported | 0x0004 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * CumulativeEnergyMeasured | 0x0000 | +| * PeriodicEnergyMeasured | 0x0001 | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute Accuracy + */ +class ReadElectricalEnergyMeasurementAccuracy : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementAccuracy() + : ReadAttribute("accuracy") + { + } + + ~ReadElectricalEnergyMeasurementAccuracy() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::Accuracy::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAccuracyWithCompletion:^(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.Accuracy response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement Accuracy read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementAccuracy : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementAccuracy() + : SubscribeAttribute("accuracy") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementAccuracy() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::Accuracy::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAccuracyWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.Accuracy response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CumulativeEnergyImported + */ +class ReadElectricalEnergyMeasurementCumulativeEnergyImported : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementCumulativeEnergyImported() + : ReadAttribute("cumulative-energy-imported") + { + } + + ~ReadElectricalEnergyMeasurementCumulativeEnergyImported() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCumulativeEnergyImportedWithCompletion:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyImported response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement CumulativeEnergyImported read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyImported : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyImported() + : SubscribeAttribute("cumulative-energy-imported") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyImported() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCumulativeEnergyImportedWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyImported response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute CumulativeEnergyExported + */ +class ReadElectricalEnergyMeasurementCumulativeEnergyExported : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementCumulativeEnergyExported() + : ReadAttribute("cumulative-energy-exported") + { + } + + ~ReadElectricalEnergyMeasurementCumulativeEnergyExported() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyExported::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeCumulativeEnergyExportedWithCompletion:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyExported response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement CumulativeEnergyExported read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyExported : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyExported() + : SubscribeAttribute("cumulative-energy-exported") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyExported() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyExported::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeCumulativeEnergyExportedWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyExported response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute PeriodicEnergyImported + */ +class ReadElectricalEnergyMeasurementPeriodicEnergyImported : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementPeriodicEnergyImported() + : ReadAttribute("periodic-energy-imported") + { + } + + ~ReadElectricalEnergyMeasurementPeriodicEnergyImported() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyImported::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributePeriodicEnergyImportedWithCompletion:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.PeriodicEnergyImported response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement PeriodicEnergyImported read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyImported : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyImported() + : SubscribeAttribute("periodic-energy-imported") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyImported() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyImported::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePeriodicEnergyImportedWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.PeriodicEnergyImported response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute PeriodicEnergyExported + */ +class ReadElectricalEnergyMeasurementPeriodicEnergyExported : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementPeriodicEnergyExported() + : ReadAttribute("periodic-energy-exported") + { + } + + ~ReadElectricalEnergyMeasurementPeriodicEnergyExported() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyExported::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributePeriodicEnergyExportedWithCompletion:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.PeriodicEnergyExported response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement PeriodicEnergyExported read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyExported : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyExported() + : SubscribeAttribute("periodic-energy-exported") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyExported() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyExported::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributePeriodicEnergyExportedWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.PeriodicEnergyExported response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute GeneratedCommandList + */ +class ReadElectricalEnergyMeasurementGeneratedCommandList : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadElectricalEnergyMeasurementGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeGeneratedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AcceptedCommandList + */ +class ReadElectricalEnergyMeasurementAcceptedCommandList : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadElectricalEnergyMeasurementAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAcceptedCommandListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute EventList + */ +class ReadElectricalEnergyMeasurementEventList : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementEventList() + : ReadAttribute("event-list") + { + } + + ~ReadElectricalEnergyMeasurementEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::EventList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementEventList : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::EventList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeEventListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute AttributeList + */ +class ReadElectricalEnergyMeasurementAttributeList : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadElectricalEnergyMeasurementAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AttributeList::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeAttributeListWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute FeatureMap + */ +class ReadElectricalEnergyMeasurementFeatureMap : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadElectricalEnergyMeasurementFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::FeatureMap::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeFeatureMapWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute ClusterRevision + */ +class ReadElectricalEnergyMeasurementClusterRevision : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadElectricalEnergyMeasurementClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::ClusterRevision::Id; + + ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; + if (mKeepSubscriptions.HasValue()) { + params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); + } + if (mFabricFiltered.HasValue()) { + params.filterByFabric = mFabricFiltered.Value(); + } + if (mAutoResubscribe.HasValue()) { + params.resubscribeAutomatically = mAutoResubscribe.Value(); + } + [cluster subscribeAttributeClusterRevisionWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + + return CHIP_NO_ERROR; + } +}; + #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL @@ -175473,6 +176434,69 @@ void registerClusterValveConfigurationAndControl(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } +void registerClusterElectricalEnergyMeasurement(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::ElectricalEnergyMeasurement; + + const char * clusterName = "ElectricalEnergyMeasurement"; + + commands_list clusterCommands = { + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // + make_unique(Id), // +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL + make_unique(), // + make_unique(), // +#endif // MTR_ENABLE_PROVISIONAL + make_unique(Id), // + make_unique(Id), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +#endif // MTR_ENABLE_PROVISIONAL +} void registerClusterDemandResponseLoadControl(Commands & commands) { #if MTR_ENABLE_PROVISIONAL @@ -179145,6 +180169,7 @@ void registerClusters(Commands & commands) registerClusterActivatedCarbonFilterMonitoring(commands); registerClusterBooleanSensorConfiguration(commands); registerClusterValveConfigurationAndControl(commands); + registerClusterElectricalEnergyMeasurement(commands); registerClusterDemandResponseLoadControl(commands); registerClusterDeviceEnergyManagement(commands); registerClusterEnergyEvse(commands);