diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6bdad9413be591..9fbe9a970a0495 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -118,6 +118,7 @@ jobs: src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/measurement-and-sensing.xml \ src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml \ @@ -194,6 +195,8 @@ jobs: src/app/zap-templates/zcl/data-model/draft/onoff-switch-configuration-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml \ src/app/zap-templates/zcl/data-model/chip/sample-mei-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml \ + src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml \ " - name: Build Apps run: | diff --git a/docs/clusters.md b/docs/clusters.md index 28a817e0a044a9..d197e1b8bc0ed1 100644 --- a/docs/clusters.md +++ b/docs/clusters.md @@ -77,6 +77,7 @@ Generally regenerate using one of: | 114 | 0x72 | ActivatedCarbonFilterMonitoring | | 128 | 0x80 | BooleanStateConfiguration | | 129 | 0x81 | ValveConfigurationAndControl | +| 144 | 0x90 | ElectricalPowerMeasurement | | 145 | 0x91 | ElectricalEnergyMeasurement | | 150 | 0x96 | DemandResponseLoadControl | | 151 | 0x97 | Messages | 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 4d1ac5923ff553..044a51213fd746 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 @@ -3859,6 +3859,111 @@ provisional cluster ValveConfigurationAndControl = 129 { command Close(): DefaultSuccess = 1; } +/** This cluster provides a mechanism for querying data about electrical power as measured by the server. */ +provisional cluster ElectricalPowerMeasurement = 144 { + 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; + } + + enum PowerModeEnum : enum8 { + kUnknown = 0; + kDC = 1; + kAC = 2; + } + + bitmap Feature : bitmap32 { + kDirectCurrent = 0x1; + kAlternatingCurrent = 0x2; + kPolyphasePower = 0x4; + kHarmonics = 0x8; + kPowerQuality = 0x10; + } + + 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 HarmonicMeasurementStruct { + int8u order = 0; + nullable int64s measurement = 1; + } + + struct MeasurementRangeStruct { + MeasurementTypeEnum measurementType = 0; + int64s min = 1; + int64s max = 2; + optional epoch_s startTimestamp = 3; + optional epoch_s endTimestamp = 4; + optional epoch_s minTimestamp = 5; + optional epoch_s maxTimestamp = 6; + optional systime_ms startSystime = 7; + optional systime_ms endSystime = 8; + optional systime_ms minSystime = 9; + optional systime_ms maxSystime = 10; + } + + info event MeasurementPeriodRanges = 0 { + MeasurementRangeStruct ranges[] = 0; + } + + readonly attribute PowerModeEnum powerMode = 0; + readonly attribute int8u numberOfMeasurementTypes = 1; + readonly attribute MeasurementAccuracyStruct accuracy[] = 2; + readonly attribute optional MeasurementRangeStruct ranges[] = 3; + readonly attribute optional nullable voltage_mv voltage = 4; + readonly attribute optional nullable amperage_ma activeCurrent = 5; + readonly attribute optional nullable amperage_ma reactiveCurrent = 6; + readonly attribute optional nullable amperage_ma apparentCurrent = 7; + readonly attribute nullable power_mw activePower = 8; + readonly attribute optional nullable power_mw reactivePower = 9; + readonly attribute optional nullable power_mw apparentPower = 10; + readonly attribute optional nullable voltage_mv RMSVoltage = 11; + readonly attribute optional nullable amperage_ma RMSCurrent = 12; + readonly attribute optional nullable power_mw RMSPower = 13; + readonly attribute optional nullable int64s frequency = 14; + readonly attribute optional nullable HarmonicMeasurementStruct harmonicCurrents[] = 15; + readonly attribute optional nullable HarmonicMeasurementStruct harmonicPhases[] = 16; + readonly attribute optional nullable int64s powerFactor = 17; + readonly attribute optional nullable amperage_ma neutralCurrent = 18; + 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 a mechanism for querying data about the electrical energy imported or provided by the server. */ provisional cluster ElectricalEnergyMeasurement = 145 { revision 1; @@ -3907,8 +4012,15 @@ provisional cluster ElectricalEnergyMeasurement = 145 { MeasurementAccuracyRangeStruct accuracyRanges[] = 4; } + struct CumulativeEnergyResetStruct { + optional nullable epoch_s importedResetTimestamp = 0; + optional nullable epoch_s exportedResetTimestamp = 1; + optional nullable systime_ms importedResetSystime = 2; + optional nullable systime_ms exportedResetSystime = 3; + } + struct EnergyMeasurementStruct { - int64s energy = 0; + energy_mwh energy = 0; optional epoch_s startTimestamp = 1; optional epoch_s endTimestamp = 2; optional systime_ms startSystime = 3; @@ -3930,6 +4042,7 @@ provisional cluster ElectricalEnergyMeasurement = 145 { readonly attribute optional nullable EnergyMeasurementStruct cumulativeEnergyExported = 2; readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyImported = 3; readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyExported = 4; + readonly attribute optional nullable CumulativeEnergyResetStruct cumulativeEnergyReset = 5; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -8083,6 +8196,35 @@ endpoint 1 { handle command Close; } + server cluster ElectricalPowerMeasurement { + emits event MeasurementPeriodRanges; + callback attribute powerMode; + callback attribute numberOfMeasurementTypes; + callback attribute accuracy; + callback attribute ranges; + callback attribute voltage; + callback attribute activeCurrent; + callback attribute reactiveCurrent; + callback attribute apparentCurrent; + callback attribute activePower; + callback attribute reactivePower; + callback attribute apparentPower; + callback attribute RMSVoltage; + callback attribute RMSCurrent; + callback attribute RMSPower; + callback attribute frequency; + callback attribute harmonicCurrents; + callback attribute harmonicPhases; + callback attribute powerFactor; + callback attribute neutralCurrent; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + callback attribute featureMap; + ram attribute clusterRevision default = 1; + } + server cluster ElectricalEnergyMeasurement { emits event CumulativeEnergyMeasured; emits event PeriodicEnergyMeasured; @@ -8091,11 +8233,12 @@ endpoint 1 { callback attribute cumulativeEnergyExported; callback attribute periodicEnergyImported; callback attribute periodicEnergyExported; + callback attribute cumulativeEnergyReset; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 0x000F; + callback attribute featureMap; ram attribute clusterRevision default = 1; } 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 b06c93baae9358..87d3e856477718 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 @@ -17,12 +17,6 @@ } ], "package": [ - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" - }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json", @@ -30,6 +24,12 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data with some extensions" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" } ], "endpointTypes": [ @@ -9511,7 +9511,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -9667,7 +9667,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -11363,7 +11363,7 @@ "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -12690,6 +12690,426 @@ } ] }, + { + "name": "Electrical Power Measurement", + "code": 144, + "mfgCode": null, + "define": "ELECTRICAL_POWER_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "PowerMode", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "PowerModeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NumberOfMeasurementTypes", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Accuracy", + "code": 2, + "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": "Ranges", + "code": 3, + "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": "Voltage", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "voltage_mv", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveCurrent", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ReactiveCurrent", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ApparentCurrent", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActivePower", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ReactivePower", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ApparentPower", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RMSVoltage", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "voltage_mv", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RMSCurrent", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RMSPower", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "power_mw", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Frequency", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "int64s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "HarmonicCurrents", + "code": 15, + "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": "HarmonicPhases", + "code": 16, + "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": "PowerFactor", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "int64s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "NeutralCurrent", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "amperage_ma", + "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": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "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": "MeasurementPeriodRanges", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, { "name": "Electrical Energy Measurement", "code": 145, @@ -12779,6 +13199,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "CumulativeEnergyReset", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "CumulativeEnergyResetStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -12850,10 +13286,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x000F", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/all-clusters-app/all-clusters-common/src/electrical-energy-measurement-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/electrical-energy-measurement-stub.cpp new file mode 100644 index 00000000000000..41716d3033022b --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/electrical-energy-measurement-stub.cpp @@ -0,0 +1,42 @@ +/* + * + * 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 + +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ElectricalEnergyMeasurement; +using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Structs; + +static std::unique_ptr gAttrAccess; + +void emberAfElectricalEnergyMeasurementClusterInitCallback(chip::EndpointId endpointId) +{ + VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. + VerifyOrDie(!gAttrAccess); + + gAttrAccess = std::make_unique( + BitMask(Feature::kImportedEnergy, Feature::kExportedEnergy, Feature::kCumulativeEnergy, + Feature::kPeriodicEnergy), + BitMask(OptionalAttributes::kOptionalAttributeCumulativeEnergyReset)); + + if (gAttrAccess) + { + gAttrAccess->Init(); + } +} diff --git a/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp b/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp new file mode 100644 index 00000000000000..bac73dd0441634 --- /dev/null +++ b/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp @@ -0,0 +1,265 @@ +/* + * + * 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 + +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ElectricalPowerMeasurement; +using namespace chip::app::Clusters::ElectricalPowerMeasurement::Structs; + +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalPowerMeasurement { + +static MeasurementAccuracyRangeStruct::Type activeCurrentAccuracyRanges[] = { { .rangeMin = 500, .rangeMax = 1000 } }; + +class StubAccuracyIterator : public Delegate::AccuracyIterator +{ +public: + size_t Count() override; + bool Next(MeasurementAccuracyStruct::Type & output) override; + void Release() override; + +private: + uint8_t mIndex; +}; + +size_t StubAccuracyIterator::Count() +{ + return 1; +} + +bool StubAccuracyIterator::Next(MeasurementAccuracyStruct::Type & output) +{ + if (mIndex >= 1) + { + return false; + } + output.measurementType = MeasurementTypeEnum::kActiveCurrent; + output.measured = true; + output.minMeasuredValue = -10000000; + output.maxMeasuredValue = 10000000; + output.accuracyRanges = DataModel::List(activeCurrentAccuracyRanges); + mIndex++; + return true; +} + +void StubAccuracyIterator::Release() +{ + mIndex = 0; +} + +class StubRangeIterator : public Delegate::RangeIterator +{ +public: + size_t Count() override; + bool Next(MeasurementRangeStruct::Type & output) override; + void Release() override; +}; + +size_t StubRangeIterator::Count() +{ + return 0; +} + +bool StubRangeIterator::Next(MeasurementRangeStruct::Type & output) +{ + return false; +} + +void StubRangeIterator::Release() {} + +class StubHarmonicMeasurementIterator : public Delegate::HarmonicMeasurementIterator +{ +public: + size_t Count() override; + bool Next(HarmonicMeasurementStruct::Type & output) override; + void Release() override; +}; + +size_t StubHarmonicMeasurementIterator::Count() +{ + return 0; +} + +bool StubHarmonicMeasurementIterator::Next(HarmonicMeasurementStruct::Type & output) +{ + return false; +} + +void StubHarmonicMeasurementIterator::Release() {} + +static StubAccuracyIterator accuracyIterator; +static StubRangeIterator rangeIterator; +static StubHarmonicMeasurementIterator harmonicMeasurementIterator; + +class ElectricalPowerMeasurementDelegate : public Delegate +{ +public: + PowerModeEnum GetPowerMode() override; + uint8_t GetNumberOfMeasurementTypes() override; + AccuracyIterator * IterateAccuracy() override; + RangeIterator * IterateRanges() override; + DataModel::Nullable GetVoltage() override; + DataModel::Nullable GetActiveCurrent() override; + DataModel::Nullable GetReactiveCurrent() override; + DataModel::Nullable GetApparentCurrent() override; + DataModel::Nullable GetActivePower() override; + DataModel::Nullable GetReactivePower() override; + DataModel::Nullable GetApparentPower() override; + DataModel::Nullable GetRMSVoltage() override; + DataModel::Nullable GetRMSCurrent() override; + DataModel::Nullable GetRMSPower() override; + DataModel::Nullable GetFrequency() override; + HarmonicMeasurementIterator * IterateHarmonicCurrents() override; + HarmonicMeasurementIterator * IterateHarmonicPhases() override; + DataModel::Nullable GetPowerFactor() override; + DataModel::Nullable GetNeutralCurrent() override; + + ~ElectricalPowerMeasurementDelegate() = default; +}; + +PowerModeEnum ElectricalPowerMeasurementDelegate::GetPowerMode() +{ + return PowerModeEnum::kAc; +} + +uint8_t ElectricalPowerMeasurementDelegate::GetNumberOfMeasurementTypes() +{ + return 1; +} + +Delegate::AccuracyIterator * ElectricalPowerMeasurementDelegate::IterateAccuracy() +{ + return &accuracyIterator; +} + +Delegate::RangeIterator * ElectricalPowerMeasurementDelegate::IterateRanges() +{ + return &rangeIterator; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetVoltage() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetActiveCurrent() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetReactiveCurrent() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetApparentCurrent() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetActivePower() +{ + return DataModel::Nullable(10000); +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetReactivePower() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetApparentPower() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetRMSVoltage() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetRMSCurrent() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetRMSPower() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetFrequency() +{ + return {}; +} + +Delegate::HarmonicMeasurementIterator * ElectricalPowerMeasurementDelegate::IterateHarmonicCurrents() +{ + return &harmonicMeasurementIterator; +} + +Delegate::HarmonicMeasurementIterator * ElectricalPowerMeasurementDelegate::IterateHarmonicPhases() +{ + return &harmonicMeasurementIterator; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetPowerFactor() +{ + return {}; +} + +DataModel::Nullable ElectricalPowerMeasurementDelegate::GetNeutralCurrent() +{ + return {}; +} + +} // namespace ElectricalPowerMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip + +static std::unique_ptr gDelegate; +static std::unique_ptr gInstance; + +void emberAfElectricalPowerMeasurementClusterInitCallback(chip::EndpointId endpointId) +{ + VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1. + VerifyOrDie(!gInstance); + + gDelegate = std::make_unique(); + if (gDelegate) + { + gInstance = std::make_unique( + endpointId, *gDelegate, + BitMask(Feature::kDirectCurrent, Feature::kAlternatingCurrent, Feature::kPolyphasePower, + Feature::kHarmonics, Feature::kPowerQuality), + BitMask( + OptionalAttributes::kOptionalAttributeRanges, OptionalAttributes::kOptionalAttributeVoltage, + OptionalAttributes::kOptionalAttributeActiveCurrent, OptionalAttributes::kOptionalAttributeReactiveCurrent, + OptionalAttributes::kOptionalAttributeApparentCurrent, OptionalAttributes::kOptionalAttributeReactivePower, + OptionalAttributes::kOptionalAttributeApparentPower, OptionalAttributes::kOptionalAttributeRMSVoltage, + OptionalAttributes::kOptionalAttributeRMSCurrent, OptionalAttributes::kOptionalAttributeRMSPower, + OptionalAttributes::kOptionalAttributeFrequency, OptionalAttributes::kOptionalAttributePowerFactor, + OptionalAttributes::kOptionalAttributeNeutralCurrent)); + + gInstance->Init(); + } +} diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index b47def73690bf8..641cbca7b55af0 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -98,6 +98,7 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-washer-controls-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/laundry-dryer-controls-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-energy-measurement-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/electrical-power-measurement-server" ) diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index 20dd248abf2a1a..799c9ab3f1f451 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -29,6 +29,8 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-alarm-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/electrical-energy-measurement-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/laundry-dryer-controls-delegate-impl.cpp", diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index e9bb7f56e4bfaa..23a045a7532429 100644 --- a/examples/all-clusters-app/tizen/BUILD.gn +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -28,6 +28,8 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/concentration-measurement-instances.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/device-energy-management-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/electrical-energy-measurement-stub.cpp", + "${chip_root}/examples/all-clusters-app/all-clusters-common/src/electrical-power-measurement-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/energy-evse-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/fan-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/oven-modes.cpp", diff --git a/examples/energy-management-app/energy-management-common/energy-management-app.matter b/examples/energy-management-app/energy-management-common/energy-management-app.matter index dae189309d4dbb..0e997312433125 100644 --- a/examples/energy-management-app/energy-management-common/energy-management-app.matter +++ b/examples/energy-management-app/energy-management-common/energy-management-app.matter @@ -948,8 +948,15 @@ provisional cluster ElectricalEnergyMeasurement = 145 { MeasurementAccuracyRangeStruct accuracyRanges[] = 4; } + struct CumulativeEnergyResetStruct { + optional nullable epoch_s importedResetTimestamp = 0; + optional nullable epoch_s exportedResetTimestamp = 1; + optional nullable systime_ms importedResetSystime = 2; + optional nullable systime_ms exportedResetSystime = 3; + } + struct EnergyMeasurementStruct { - int64s energy = 0; + energy_mwh energy = 0; optional epoch_s startTimestamp = 1; optional epoch_s endTimestamp = 2; optional systime_ms startSystime = 3; @@ -971,6 +978,7 @@ provisional cluster ElectricalEnergyMeasurement = 145 { readonly attribute optional nullable EnergyMeasurementStruct cumulativeEnergyExported = 2; readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyImported = 3; readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyExported = 4; + readonly attribute optional nullable CumulativeEnergyResetStruct cumulativeEnergyReset = 5; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1685,7 +1693,7 @@ endpoint 1 { callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 5; + callback attribute featureMap; ram attribute clusterRevision default = 1; } diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint index d2fff0f9a53750..6e95447e1a2cda 100644 --- a/scripts/rules.matterlint +++ b/scripts/rules.matterlint @@ -29,6 +29,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/device-energy-management-mode load "../src/app/zap-templates/zcl/data-model/chip/diagnostic-logs-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/dishwasher-alarm-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/dishwasher-mode-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/measurement-and-sensing.xml"; load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-mode-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/microwave-oven-control-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/door-lock-cluster.xml"; @@ -98,13 +99,15 @@ load "../src/app/zap-templates/zcl/data-model/chip/wifi-network-diagnostics-clus load "../src/app/zap-templates/zcl/data-model/chip/window-covering.xml"; load "../src/app/zap-templates/zcl/data-model/chip/temperature-control-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/chip/refrigerator-alarm.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/air-quality-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/sample-mei-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/electrical-energy-measurement-cluster.xml"; +load "../src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/draft/barrier-control-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/draft/electrical-measurement-cluster.xml"; load "../src/app/zap-templates/zcl/data-model/draft/input-output-value-clusters.xml"; load "../src/app/zap-templates/zcl/data-model/draft/onoff-switch-configuration-cluster.xml"; -load "../src/app/zap-templates/zcl/data-model/chip/air-quality-cluster.xml"; -load "../src/app/zap-templates/zcl/data-model/chip/resource-monitoring-cluster.xml"; -load "../src/app/zap-templates/zcl/data-model/chip/sample-mei-cluster.xml"; all endpoints { // These attributes follow a different code path and do not have to be diff --git a/scripts/setup/zap.json b/scripts/setup/zap.json index 5eb1bc2a8986c0..c5d0defa49903e 100644 --- a/scripts/setup/zap.json +++ b/scripts/setup/zap.json @@ -8,13 +8,13 @@ "mac-amd64", "windows-amd64" ], - "tags": ["version:2@v2023.12.06-nightly.1"] + "tags": ["version:2@v2024.01.05-nightly.1"] }, { "_comment": "Always get the amd64 version on mac until usable arm64 zap build is available", "path": "fuchsia/third_party/zap/mac-amd64", "platforms": ["mac-arm64"], - "tags": ["version:2@v2023.12.06-nightly.1"] + "tags": ["version:2@v2024.01.05-nightly.1"] } ] } diff --git a/scripts/setup/zap.version b/scripts/setup/zap.version index ef81141953af89..ed26575a140e19 100644 --- a/scripts/setup/zap.version +++ b/scripts/setup/zap.version @@ -1 +1 @@ -v2023.12.06-nightly +v2024.01.05-nightly diff --git a/scripts/tools/zap/tests/inputs/all-clusters-app.zap b/scripts/tools/zap/tests/inputs/all-clusters-app.zap index 1fbaef89d23d16..dda93888f29a16 100644 --- a/scripts/tools/zap/tests/inputs/all-clusters-app.zap +++ b/scripts/tools/zap/tests/inputs/all-clusters-app.zap @@ -12937,7 +12937,6 @@ "define": "ELECTRICAL_MEASUREMENT_CLUSTER", "side": "server", "enabled": 1, - "apiMaturity": "deprecated", "attributes": [ { "name": "measurement type", diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index fb4c9100bb63d1..685fbacdc366e2 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -23,7 +23,7 @@ # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions # -MIN_ZAP_VERSION = '2023.12.6' +MIN_ZAP_VERSION = '2024.1.5' class ZapTool: 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 index 728b41dee02f74..38911ff7e54358 100644 --- 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 @@ -26,25 +26,28 @@ using chip::Protocols::InteractionModel::Status; -namespace { +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalEnergyMeasurement { using namespace chip; -using namespace chip::app::Clusters::ElectricalEnergyMeasurement; using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Attributes; using namespace chip::app::Clusters::ElectricalEnergyMeasurement::Structs; MeasurementData gMeasurements[EMBER_AF_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT]; -class ElectricalEnergyMeasurementAttrAccess : public app::AttributeAccessInterface +CHIP_ERROR ElectricalEnergyMeasurementAttrAccess::Init() { -public: - ElectricalEnergyMeasurementAttrAccess() : - app::AttributeAccessInterface(Optional::Missing(), app::Clusters::ElectricalEnergyMeasurement::Id) - {} + VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); + return CHIP_NO_ERROR; +} - CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override; -}; +void ElectricalEnergyMeasurementAttrAccess::Shutdown() +{ + unregisterAttributeAccessOverride(this); +} CHIP_ERROR ElectricalEnergyMeasurementAttrAccess::Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) @@ -55,6 +58,9 @@ CHIP_ERROR ElectricalEnergyMeasurementAttrAccess::Read(const app::ConcreteReadAt switch (aPath.mAttributeId) { + case FeatureMap::Id: + ReturnErrorOnFailure(aEncoder.Encode(mFeature)); + break; case Accuracy::Id: if (data == nullptr) { @@ -62,42 +68,77 @@ CHIP_ERROR ElectricalEnergyMeasurementAttrAccess::Read(const app::ConcreteReadAt } return aEncoder.Encode(data->measurementAccuracy); case CumulativeEnergyImported::Id: + VerifyOrReturnError( + HasFeature(ElectricalEnergyMeasurement::Feature::kCumulativeEnergy) && + HasFeature(ElectricalEnergyMeasurement::Feature::kImportedEnergy), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Energy Measurement: can not get CumulativeEnergyImported, feature is not supported")); if ((data == nullptr) || !data->cumulativeImported.HasValue()) { return aEncoder.EncodeNull(); } return aEncoder.Encode(data->cumulativeImported.Value()); case CumulativeEnergyExported::Id: + VerifyOrReturnError( + HasFeature(ElectricalEnergyMeasurement::Feature::kCumulativeEnergy) && + HasFeature(ElectricalEnergyMeasurement::Feature::kExportedEnergy), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Energy Measurement: can not get CumulativeEnergyExported, feature is not supported")); if ((data == nullptr) || !data->cumulativeExported.HasValue()) { return aEncoder.EncodeNull(); } return aEncoder.Encode(data->cumulativeExported.Value()); case PeriodicEnergyImported::Id: + VerifyOrReturnError( + HasFeature(ElectricalEnergyMeasurement::Feature::kPeriodicEnergy) && + HasFeature(ElectricalEnergyMeasurement::Feature::kImportedEnergy), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Energy Measurement: can not get PeriodicEnergyImported, feature is not supported")); if ((data == nullptr) || !data->periodicImported.HasValue()) { return aEncoder.EncodeNull(); } return aEncoder.Encode(data->periodicImported.Value()); case PeriodicEnergyExported::Id: + VerifyOrReturnError( + HasFeature(ElectricalEnergyMeasurement::Feature::kPeriodicEnergy) && + HasFeature(ElectricalEnergyMeasurement::Feature::kExportedEnergy), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Energy Measurement: can not get PeriodicEnergyExported, feature is not supported")); if ((data == nullptr) || !data->periodicExported.HasValue()) { return aEncoder.EncodeNull(); } return aEncoder.Encode(data->periodicExported.Value()); + case CumulativeEnergyReset::Id: + VerifyOrReturnError( + HasFeature(ElectricalEnergyMeasurement::Feature::kCumulativeEnergy), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Energy Measurement: can not get CumulativeEnergyReset, feature is not supported")); + + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeCumulativeEnergyReset)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + if ((data == nullptr) || !data->cumulativeReset.HasValue()) + { + return aEncoder.EncodeNull(); + } + return aEncoder.Encode(data->cumulativeReset.Value()); } return CHIP_NO_ERROR; } -ElectricalEnergyMeasurementAttrAccess gAttrAccess; - -} // namespace +bool ElectricalEnergyMeasurementAttrAccess::HasFeature(Feature aFeature) const +{ + return mFeature.Has(aFeature); +} -namespace chip { -namespace app { -namespace Clusters { -namespace ElectricalEnergyMeasurement { +bool ElectricalEnergyMeasurementAttrAccess::SupportsOptAttr(OptionalAttributes aOptionalAttrs) const +{ + return mOptionalAttrs.Has(aOptionalAttrs); +} MeasurementData * MeasurementDataForEndpoint(EndpointId endpointId) { @@ -130,6 +171,19 @@ CHIP_ERROR SetMeasurementAccuracy(EndpointId endpointId, const MeasurementAccura return CHIP_NO_ERROR; } +CHIP_ERROR SetCumulativeReset(EndpointId endpointId, const Optional & cumulativeReset) +{ + + MeasurementData * data = MeasurementDataForEndpoint(endpointId); + VerifyOrReturnError(data != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + data->cumulativeReset = cumulativeReset; + + MatterReportingAttributeChangeCallback(endpointId, ElectricalEnergyMeasurement::Id, CumulativeEnergyReset::Id); + + return CHIP_NO_ERROR; +} + bool NotifyCumulativeEnergyMeasured(EndpointId endpointId, const Optional & energyImported, const Optional & energyExported) { @@ -192,8 +246,3 @@ bool NotifyPeriodicEnergyMeasured(EndpointId endpointId, const Optional #include +#include namespace chip { namespace app { @@ -33,6 +34,35 @@ struct MeasurementData Optional cumulativeExported; Optional periodicImported; Optional periodicExported; + Optional cumulativeReset; +}; + +enum class OptionalAttributes : uint32_t +{ + kOptionalAttributeCumulativeEnergyReset = 0x1, +}; + +class ElectricalEnergyMeasurementAttrAccess : public AttributeAccessInterface +{ +public: + ElectricalEnergyMeasurementAttrAccess(BitMask aFeature, BitMask aOptionalAttrs) : + app::AttributeAccessInterface(Optional::Missing(), app::Clusters::ElectricalEnergyMeasurement::Id), + mFeature(aFeature), mOptionalAttrs(aOptionalAttrs) + {} + + ~ElectricalEnergyMeasurementAttrAccess() { Shutdown(); } + + CHIP_ERROR Init(); + void Shutdown(); + + CHIP_ERROR Read(const app::ConcreteReadAttributePath & aPath, app::AttributeValueEncoder & aEncoder) override; + + bool HasFeature(Feature aFeature) const; + bool SupportsOptAttr(OptionalAttributes aOptionalAttrs) const; + +private: + BitMask mFeature; + BitMask mOptionalAttrs; }; bool NotifyCumulativeEnergyMeasured(EndpointId endpointId, const Optional & energyImported, @@ -43,6 +73,8 @@ bool NotifyPeriodicEnergyMeasured(EndpointId endpointId, const Optional & cumulativeReset); + MeasurementData * MeasurementDataForEndpoint(EndpointId endpointId); } // namespace ElectricalEnergyMeasurement diff --git a/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.cpp b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.cpp new file mode 100644 index 00000000000000..1b248310a686ef --- /dev/null +++ b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.cpp @@ -0,0 +1,318 @@ +/* + * + * Copyright (c) 2024 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-power-measurement-server.h" + +#include + +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::DataModel; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ElectricalPowerMeasurement; +using namespace chip::app::Clusters::ElectricalPowerMeasurement::Attributes; +using namespace chip::app::Clusters::ElectricalPowerMeasurement::Structs; + +using chip::Protocols::InteractionModel::Status; + +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalPowerMeasurement { + +CHIP_ERROR Instance::Init() +{ + VerifyOrReturnError(registerAttributeAccessOverride(this), CHIP_ERROR_INCORRECT_STATE); + return CHIP_NO_ERROR; +} + +void Instance::Shutdown() +{ + unregisterAttributeAccessOverride(this); +} + +bool Instance::HasFeature(Feature aFeature) const +{ + return mFeature.Has(aFeature); +} + +bool Instance::SupportsOptAttr(OptionalAttributes aOptionalAttrs) const +{ + return mOptionalAttrs.Has(aOptionalAttrs); +} + +// AttributeAccessInterface +CHIP_ERROR Instance::Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) +{ + switch (aPath.mAttributeId) + { + case FeatureMap::Id: + ReturnErrorOnFailure(aEncoder.Encode(mFeature)); + break; + case PowerMode::Id: + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetPowerMode())); + break; + case NumberOfMeasurementTypes::Id: + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetNumberOfMeasurementTypes())); + break; + case Accuracy::Id: + return ReadAccuracy(aEncoder); + case Ranges::Id: + return ReadRanges(aEncoder); + case Voltage::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeVoltage)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetVoltage())); + break; + case ActiveCurrent::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeActiveCurrent)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetActiveCurrent())); + break; + case ReactiveCurrent::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeReactiveCurrent)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError( + HasFeature(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get ReactiveCurrent, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetReactiveCurrent())); + break; + case ApparentCurrent::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeApparentCurrent)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError( + HasFeature(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get ApparentCurrent, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetApparentCurrent())); + break; + case ActivePower::Id: + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetActivePower())); + break; + case ReactivePower::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeReactivePower)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError(HasFeature(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get ReactivePower, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetReactivePower())); + break; + case ApparentPower::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeApparentPower)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError(HasFeature(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get ApparentPower, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetApparentPower())); + break; + case RMSVoltage::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeRMSVoltage)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError(HasFeature(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get RMSVoltage, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetRMSVoltage())); + break; + case RMSCurrent::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeRMSCurrent)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError(HasFeature(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get RMSCurrent, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetRMSCurrent())); + break; + case RMSPower::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeRMSPower)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError(HasFeature(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get RMSPower, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetRMSPower())); + break; + case Frequency::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeFrequency)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError(HasFeature(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get Frequency, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetFrequency())); + break; + case HarmonicCurrents::Id: + return ReadHarmonicCurrents(aEncoder); + case HarmonicPhases::Id: + return ReadHarmonicPhases(aEncoder); + case PowerFactor::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributePowerFactor)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError(HasFeature(ElectricalPowerMeasurement::Feature::kAlternatingCurrent), + CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get PowerFactor, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetPowerFactor())); + break; + case NeutralCurrent::Id: + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeNeutralCurrent)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + VerifyOrReturnError( + HasFeature(ElectricalPowerMeasurement::Feature::kPolyphasePower), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get NeutralCurrent, feature is not supported")); + ReturnErrorOnFailure(aEncoder.Encode(mDelegate.GetNeutralCurrent())); + break; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR Instance::ReadAccuracy(AttributeValueEncoder & aEncoder) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + auto accuracies = mDelegate.IterateAccuracy(); + VerifyOrReturnError(accuracies != nullptr, CHIP_IM_GLOBAL_STATUS(ResourceExhausted)); + if (accuracies->Count() == 0) + { + err = aEncoder.EncodeEmptyList(); + } + else + { + err = aEncoder.EncodeList([&accuracies](const auto & encoder) -> CHIP_ERROR { + Structs::MeasurementAccuracyStruct::Type accuracy; + while (accuracies->Next(accuracy)) + { + encoder.Encode(accuracy); + } + + return CHIP_NO_ERROR; + }); + } + accuracies->Release(); + return err; +} + +CHIP_ERROR Instance::ReadRanges(AttributeValueEncoder & aEncoder) +{ + if (!SupportsOptAttr(OptionalAttributes::kOptionalAttributeRanges)) + { + return CHIP_IM_GLOBAL_STATUS(UnsupportedAttribute); + } + CHIP_ERROR err = CHIP_NO_ERROR; + auto ranges = mDelegate.IterateRanges(); + VerifyOrReturnError(ranges != nullptr, CHIP_IM_GLOBAL_STATUS(ResourceExhausted)); + if (ranges->Count() == 0) + { + err = aEncoder.EncodeEmptyList(); + } + else + { + err = aEncoder.EncodeList([&ranges](const auto & encoder) -> CHIP_ERROR { + Structs::MeasurementRangeStruct::Type range; + while (ranges->Next(range)) + { + encoder.Encode(range); + } + + return CHIP_NO_ERROR; + }); + } + ranges->Release(); + return err; +} + +CHIP_ERROR Instance::ReadHarmonicCurrents(AttributeValueEncoder & aEncoder) +{ + VerifyOrReturnError(HasFeature(ElectricalPowerMeasurement::Feature::kHarmonics), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get HarmonicCurrents, feature is not supported")); + + CHIP_ERROR err = CHIP_NO_ERROR; + auto currents = mDelegate.IterateHarmonicCurrents(); + VerifyOrReturnError(currents != nullptr, CHIP_IM_GLOBAL_STATUS(ResourceExhausted)); + if (currents->Count() == 0) + { + err = aEncoder.EncodeEmptyList(); + } + else + { + err = aEncoder.EncodeList([¤ts](const auto & encoder) -> CHIP_ERROR { + Structs::HarmonicMeasurementStruct::Type current; + while (currents->Next(current)) + { + encoder.Encode(current); + } + + return CHIP_NO_ERROR; + }); + } + currents->Release(); + return err; +} + +CHIP_ERROR Instance::ReadHarmonicPhases(AttributeValueEncoder & aEncoder) +{ + VerifyOrReturnError(HasFeature(ElectricalPowerMeasurement::Feature::kPowerQuality), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE, + ChipLogError(Zcl, "Electrical Power Measurement: can not get HarmonicPhases, feature is not supported")); + CHIP_ERROR err = CHIP_NO_ERROR; + auto phases = mDelegate.IterateHarmonicPhases(); + VerifyOrReturnError(phases != nullptr, CHIP_IM_GLOBAL_STATUS(ResourceExhausted)); + if (phases->Count() == 0) + { + err = aEncoder.EncodeEmptyList(); + } + else + { + err = aEncoder.EncodeList([&phases](const auto & encoder) -> CHIP_ERROR { + Structs::HarmonicMeasurementStruct::Type phase; + while (phases->Next(phase)) + { + encoder.Encode(phase); + } + + return CHIP_NO_ERROR; + }); + } + phases->Release(); + return err; +} + +} // namespace ElectricalPowerMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h new file mode 100644 index 00000000000000..dff7b44b1d13a4 --- /dev/null +++ b/src/app/clusters/electrical-power-measurement-server/electrical-power-measurement-server.h @@ -0,0 +1,124 @@ +/* + * + * Copyright (c) 2024 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 +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ElectricalPowerMeasurement { + +using namespace chip::app::Clusters::ElectricalPowerMeasurement::Attributes; +using namespace chip::app::Clusters::ElectricalPowerMeasurement::Structs; + +using chip::Protocols::InteractionModel::Status; + +class Delegate +{ +public: + virtual ~Delegate() = default; + + void SetEndpointId(EndpointId aEndpoint) { mEndpointId = aEndpoint; } + + using AccuracyIterator = CommonIterator; + using RangeIterator = CommonIterator; + using HarmonicMeasurementIterator = CommonIterator; + + virtual PowerModeEnum GetPowerMode() = 0; + virtual uint8_t GetNumberOfMeasurementTypes() = 0; + virtual AccuracyIterator * IterateAccuracy() = 0; + virtual RangeIterator * IterateRanges() = 0; + virtual DataModel::Nullable GetVoltage() = 0; + virtual DataModel::Nullable GetActiveCurrent() = 0; + virtual DataModel::Nullable GetReactiveCurrent() = 0; + virtual DataModel::Nullable GetApparentCurrent() = 0; + virtual DataModel::Nullable GetActivePower() = 0; + virtual DataModel::Nullable GetReactivePower() = 0; + virtual DataModel::Nullable GetApparentPower() = 0; + virtual DataModel::Nullable GetRMSVoltage() = 0; + virtual DataModel::Nullable GetRMSCurrent() = 0; + virtual DataModel::Nullable GetRMSPower() = 0; + virtual DataModel::Nullable GetFrequency() = 0; + virtual HarmonicMeasurementIterator * IterateHarmonicCurrents() = 0; + virtual HarmonicMeasurementIterator * IterateHarmonicPhases() = 0; + virtual DataModel::Nullable GetPowerFactor() = 0; + virtual DataModel::Nullable GetNeutralCurrent() = 0; + +protected: + EndpointId mEndpointId = 0; +}; + +enum class OptionalAttributes : uint32_t +{ + kOptionalAttributeRanges = 0x1, + kOptionalAttributeVoltage = 0x2, + kOptionalAttributeActiveCurrent = 0x4, + kOptionalAttributeReactiveCurrent = 0x8, + kOptionalAttributeApparentCurrent = 0x10, + kOptionalAttributeReactivePower = 0x20, + kOptionalAttributeApparentPower = 0x40, + kOptionalAttributeRMSVoltage = 0x80, + kOptionalAttributeRMSCurrent = 0x100, + kOptionalAttributeRMSPower = 0x200, + kOptionalAttributeFrequency = 0x400, + kOptionalAttributePowerFactor = 0x800, + kOptionalAttributeNeutralCurrent = 0x1000, +}; + +class Instance : public AttributeAccessInterface +{ +public: + Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask aFeature, + BitMask aOptionalAttributes) : + AttributeAccessInterface(MakeOptional(aEndpointId), Id), + mDelegate(aDelegate), mFeature(aFeature), mOptionalAttrs(aOptionalAttributes) + { + /* set the base class delegates endpointId */ + mDelegate.SetEndpointId(aEndpointId); + } + ~Instance() { Shutdown(); } + + CHIP_ERROR Init(); + void Shutdown(); + + bool HasFeature(Feature aFeature) const; + bool SupportsOptAttr(OptionalAttributes aOptionalAttrs) const; + +private: + Delegate & mDelegate; + BitMask mFeature; + BitMask mOptionalAttrs; + + // AttributeAccessInterface + CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override; + + CHIP_ERROR ReadAccuracy(AttributeValueEncoder & aEncoder); + CHIP_ERROR ReadRanges(AttributeValueEncoder & aEncoder); + CHIP_ERROR ReadHarmonicCurrents(AttributeValueEncoder & aEncoder); + CHIP_ERROR ReadHarmonicPhases(AttributeValueEncoder & aEncoder); +}; + +} // namespace ElectricalPowerMeasurement +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/src/app/common/templates/config-data.yaml b/src/app/common/templates/config-data.yaml index 26f4356f517f10..20677184632c6c 100644 --- a/src/app/common/templates/config-data.yaml +++ b/src/app/common/templates/config-data.yaml @@ -38,6 +38,8 @@ CommandHandlerInterfaceOnlyClusters: - Energy EVSE Mode - Device Energy Management - Device Energy Management Mode + - Electrical Power Measurement + - Electrical Energy Measurement # We need a more configurable way of deciding which clusters have which init functions.... # See https://github.com/project-chip/connectedhomeip/issues/4369 diff --git a/src/app/common/templates/templates.json b/src/app/common/templates/templates.json index 6d253d5e1b2d6f..de26d76697d0ad 100644 --- a/src/app/common/templates/templates.json +++ b/src/app/common/templates/templates.json @@ -21,6 +21,10 @@ "name": "cluster_objects_struct", "path": "../../zap-templates/partials/cluster-objects-struct.zapt" }, + { + "name": "cluster_enums_enum", + "path": "../../zap-templates/partials/cluster-enums-enum.zapt" + }, { "name": "cluster_objects_field_init", "path": "../../zap-templates/partials/cluster-objects-field-init.zapt" diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index e66ce70d7cdf9b..fb166ff72453bd 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -163,6 +163,8 @@ void MatterDishwasherAlarmPluginServerInitCallback() {} void MatterMicrowaveOvenModePluginServerInitCallback() {} void MatterDeviceEnergyManagementModePluginServerInitCallback() {} void MatterEnergyEvseModePluginServerInitCallback() {} +void MatterElectricalEnergyMeasurementPluginServerInitCallback() {} +void MatterElectricalPowerMeasurementPluginServerInitCallback() {} // **************************************** // Print out information about each cluster // **************************************** diff --git a/src/app/zap-templates/partials/cluster-enums-enum.zapt b/src/app/zap-templates/partials/cluster-enums-enum.zapt new file mode 100644 index 00000000000000..43aac026a5b488 --- /dev/null +++ b/src/app/zap-templates/partials/cluster-enums-enum.zapt @@ -0,0 +1,19 @@ +// Enum for {{label}} +enum class {{asType label}} : {{asUnderlyingZclType name}} { +{{#zcl_enum_items}} +k{{asUpperCamelCase label}} = {{asHex value 2}}, +{{/zcl_enum_items}} +{{#unless (isInConfigList (concat ns "::" label) "EnumsNotUsedAsTypeInXML")}} +// 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 = {{first_unused_enum_value mode="first_unused"}}, +{{else}} +// kUnknownEnumValue intentionally not defined. This enum never goes +// through DataModel::Decode, likely because it is a part of a derived +// cluster. As a result having kUnknownEnumValue in this enum is error +// prone, and was removed. See +// src/app/common/templates/config-data.yaml. +{{/unless}} +}; \ No newline at end of file diff --git a/src/app/zap-templates/templates/app/cluster-enums-check.zapt b/src/app/zap-templates/templates/app/cluster-enums-check.zapt index cb263c05153db1..c2a57f2c936d14 100644 --- a/src/app/zap-templates/templates/app/cluster-enums-check.zapt +++ b/src/app/zap-templates/templates/app/cluster-enums-check.zapt @@ -7,8 +7,28 @@ namespace chip { namespace app { namespace Clusters { +{{#zcl_enums}} +{{#if has_more_than_one_cluster}} +{{#unless (isInConfigList (concat "::" label) "EnumsNotUsedAsTypeInXML")}} +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::{{asType label}} val) +{ + using EnumType = detail::{{asType label}}; + switch (val) { + {{#zcl_enum_items}} + case EnumType::k{{asUpperCamelCase label}}: + {{/zcl_enum_items}} + return val; + default: + return static_cast({{first_unused_enum_value mode="first_unused"}}); + } +} +{{/unless}} +{{/if}} +{{/zcl_enums}} + {{#zcl_clusters}} {{#zcl_enums}} +{{#unless has_more_than_one_cluster}} {{#unless (isInConfigList (concat (asUpperCamelCase ../name) "::" label) "EnumsNotUsedAsTypeInXML")}} static auto __attribute__((unused)) EnsureKnownEnumValue({{asUpperCamelCase ../name}}::{{asType label}} val) { @@ -23,6 +43,7 @@ static auto __attribute__((unused)) EnsureKnownEnumValue({{asUpperCamelCase ../n } } {{/unless}} +{{/unless}} {{/zcl_enums}} {{/zcl_clusters}} diff --git a/src/app/zap-templates/templates/app/cluster-enums.zapt b/src/app/zap-templates/templates/app/cluster-enums.zapt index 34092a124f519e..612b3dd6a29d4b 100644 --- a/src/app/zap-templates/templates/app/cluster-enums.zapt +++ b/src/app/zap-templates/templates/app/cluster-enums.zapt @@ -9,38 +9,58 @@ namespace chip { namespace app { namespace Clusters { +namespace detail { +// Enums shared across multiple clusters. +{{#zcl_enums}} + +{{#if has_more_than_one_cluster}} + +{{> cluster_enums_enum ns=""}} + +{{/if}} +{{/zcl_enums}} + +// Bitmaps shared across multiple clusters. +{{#zcl_bitmaps}} + +{{#if has_more_than_one_cluster}} + +// Bitmap for {{label}} +enum class {{asType label}} : {{asUnderlyingZclType name}} { +{{#zcl_bitmap_items}} +k{{asUpperCamelCase label}} = {{asHex mask}}, +{{/zcl_bitmap_items}} +}; + +{{/if}} +{{/zcl_bitmaps}} + +} // namespace detail + + {{#zcl_clusters}} namespace {{asUpperCamelCase name}} { {{#zcl_enums}} -// Enum for {{label}} -enum class {{asType label}} : {{asUnderlyingZclType name}} { -{{#zcl_enum_items}} -k{{asUpperCamelCase label}} = {{asHex value 2}}, -{{/zcl_enum_items}} -{{#unless (isInConfigList (concat (asUpperCamelCase ../name) "::" label) "EnumsNotUsedAsTypeInXML")}} -// 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 = {{first_unused_enum_value mode="first_unused"}}, +{{#if has_more_than_one_cluster}} +using {{asUpperCamelCase name}} = Clusters::detail::{{asUpperCamelCase name}}; {{else}} -// kUnknownEnumValue intentionally not defined. This enum never goes -// through DataModel::Decode, likely because it is a part of a derived -// cluster. As a result having kUnknownEnumValue in this enum is error -// prone, and was removed. See -// src/app/common/templates/config-data.yaml. -{{/unless}} -}; +{{> cluster_enums_enum ns=(asUpperCamelCase ../name)}} + +{{/if}} {{/zcl_enums}} {{#zcl_bitmaps}} +{{#if has_more_than_one_cluster}} +using {{asUpperCamelCase name}} = Clusters::detail::{{asUpperCamelCase name}}; +{{else}} // Bitmap for {{label}} enum class {{asType label}} : {{asUnderlyingZclType name}} { {{#zcl_bitmap_items}} k{{asUpperCamelCase label}} = {{asHex mask}}, {{/zcl_bitmap_items}} }; +{{/if}} {{/zcl_bitmaps}} } // namespace {{asUpperCamelCase name}} diff --git a/src/app/zap-templates/templates/app/cluster-objects.zapt b/src/app/zap-templates/templates/app/cluster-objects.zapt index 4e17d227629f34..1453523b1b7986 100644 --- a/src/app/zap-templates/templates/app/cluster-objects.zapt +++ b/src/app/zap-templates/templates/app/cluster-objects.zapt @@ -25,6 +25,7 @@ namespace Clusters { namespace detail { // Structs shared across multiple clusters. namespace Structs { + {{#zcl_structs}} {{#if has_more_than_one_cluster}} {{> cluster_objects_struct header=true}} diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml index ac22765069d4d6..255be8b0328e1b 100644 --- a/src/app/zap-templates/zcl/data-model/all.xml +++ b/src/app/zap-templates/zcl/data-model/all.xml @@ -27,6 +27,9 @@ + + + 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 index 6271b56d235a61..55a298ee596e53 100644 --- 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 @@ -15,93 +15,58 @@ See the License for the specific language governing permissions and limitations under the License. --> - - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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. + true + true + + This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. + + Accuracy + CumulativeEnergyImported + + CumulativeEnergyExported + + PeriodicEnergyImported + + PeriodicEnergyExported + CumulativeEnergyReset + + + CumulativeEnergyMeasured - - - This event SHALL be generated when the server reaches the end of a reporting period for imported energy, exported energy, or both. + + PeriodicEnergyMeasured - + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml new file mode 100644 index 00000000000000..e723982ee0ffe8 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/electrical-power-measurement-cluster.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + Electrical Power Measurement + Measurement & Sensing + 0x0090 + ELECTRICAL_POWER_MEASUREMENT_CLUSTER + true + true + + This cluster provides a mechanism for querying data about electrical power as measured by the server. + + PowerMode + NumberOfMeasurementTypes + Accuracy + Ranges + Voltage + + ActiveCurrent + + ReactiveCurrent + ApparentCurrent + + ActivePower + + ReactivePower + + ApparentPower + + RMSVoltage + + RMSCurrent + + RMSPower + + Frequency + + HarmonicCurrents + + HarmonicPhases + + PowerFactor + NeutralCurrent + + MeasurementPeriodRanges + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml index 31ff5abbbc2460..9943bc6992a016 100644 --- a/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml +++ b/src/app/zap-templates/zcl/data-model/chip/matter-devices.xml @@ -107,6 +107,20 @@ limitations under the License. + + MA-electricalsensor + CHIP + Matter Electrical Sensor + 0x0103 + 0x0510 + Utility + Node + + + + + + MA-otarequestor CHIP diff --git a/src/app/zap-templates/zcl/data-model/chip/measurement-and-sensing.xml b/src/app/zap-templates/zcl/data-model/chip/measurement-and-sensing.xml new file mode 100644 index 00000000000000..bef6dd86091676 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/measurement-and-sensing.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 4512f11959822c..18c21d04851dce 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -49,6 +49,7 @@ "energy-preference-cluster.xml", "electrical-energy-measurement-cluster.xml", "electrical-measurement-cluster.xml", + "electrical-power-measurement-cluster.xml", "energy-evse-cluster.xml", "energy-evse-mode-cluster.xml", "ethernet-network-diagnostics-cluster.xml", @@ -71,6 +72,7 @@ "level-control-cluster.xml", "localization-configuration-cluster.xml", "low-power-cluster.xml", + "measurement-and-sensing.xml", "media-input-cluster.xml", "media-playback-cluster.xml", "messages-cluster.xml", @@ -599,7 +601,31 @@ "CumulativeEnergyImported", "CumulativeEnergyExported", "PeriodicEnergyImported", - "PeriodicEnergyExported" + "PeriodicEnergyExported", + "CumulativeEnergyReset", + "FeatureMap" + ], + "Electrical Power Measurement": [ + "PowerMode", + "NumberOfMeasurementTypes", + "Accuracy", + "Ranges", + "Voltage", + "ActiveCurrent", + "ReactiveCurrent", + "ApparentCurrent", + "ActivePower", + "ReactivePower", + "ApparentPower", + "RMSVoltage", + "RMSCurrent", + "RMSPower", + "Frequency", + "HarmonicCurrents", + "HarmonicPhases", + "PowerFactor", + "NeutralCurrent", + "FeatureMap" ], "Valve Configuration and Control": ["RemainingDuration"], "Boolean State Configuration": ["CurrentSensitivityLevel"] diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 12ed5d6cd2142d..7d6ae97ac990b2 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -43,9 +43,10 @@ "dishwasher-mode-cluster.xml", "microwave-oven-mode-cluster.xml", "door-lock-cluster.xml", - "electrical-energy-measurement-cluster.xml", "drlc-cluster.xml", + "electrical-energy-measurement-cluster.xml", "electrical-measurement-cluster.xml", + "electrical-power-measurement-cluster.xml", "energy-evse-cluster.xml", "energy-evse-mode-cluster.xml", "energy-preference-cluster.xml", @@ -69,6 +70,7 @@ "level-control-cluster.xml", "localization-configuration-cluster.xml", "low-power-cluster.xml", + "measurement-and-sensing.xml", "media-input-cluster.xml", "media-playback-cluster.xml", "messages-cluster.xml", @@ -597,7 +599,31 @@ "CumulativeEnergyImported", "CumulativeEnergyExported", "PeriodicEnergyImported", - "PeriodicEnergyExported" + "PeriodicEnergyExported", + "CumulativeEnergyReset", + "FeatureMap" + ], + "Electrical Power Measurement": [ + "PowerMode", + "NumberOfMeasurementTypes", + "Accuracy", + "Ranges", + "Voltage", + "ActiveCurrent", + "ReactiveCurrent", + "ApparentCurrent", + "ActivePower", + "ReactivePower", + "ApparentPower", + "RMSVoltage", + "RMSCurrent", + "RMSPower", + "Frequency", + "HarmonicCurrents", + "HarmonicPhases", + "PowerFactor", + "NeutralCurrent", + "FeatureMap" ], "Valve Configuration and Control": ["RemainingDuration"], "Boolean State Configuration": ["CurrentSensitivityLevel"] diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 8c496c03782325..3d60b7279bd61c 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -38,6 +38,7 @@ "DOOR_LOCK_CLUSTER": [], "ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER": [], "ELECTRICAL_MEASUREMENT_CLUSTER": [], + "ELECTRICAL_POWER_MEASUREMENT_CLUSTER": [], "ENERGY_EVSE_CLUSTER": [], "ENERGY_EVSE_MODE_CLUSTER": [], "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [], @@ -182,6 +183,9 @@ "electrical-energy-measurement-server" ], "ELECTRICAL_MEASUREMENT_CLUSTER": [], + "ELECTRICAL_POWER_MEASUREMENT_CLUSTER": [ + "electrical-power-measurement-server" + ], "ENERGY_EVSE_CLUSTER": ["energy-evse-server"], "ENERGY_EVSE_MODE_CLUSTER": ["mode-base-server"], "ETHERNET_NETWORK_DIAGNOSTICS_CLUSTER": [ diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index dbad9659e2f85f..96a2f775df3b85 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -4091,6 +4091,111 @@ provisional cluster ValveConfigurationAndControl = 129 { command Close(): DefaultSuccess = 1; } +/** This cluster provides a mechanism for querying data about electrical power as measured by the server. */ +provisional cluster ElectricalPowerMeasurement = 144 { + 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; + } + + enum PowerModeEnum : enum8 { + kUnknown = 0; + kDC = 1; + kAC = 2; + } + + bitmap Feature : bitmap32 { + kDirectCurrent = 0x1; + kAlternatingCurrent = 0x2; + kPolyphasePower = 0x4; + kHarmonics = 0x8; + kPowerQuality = 0x10; + } + + 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 HarmonicMeasurementStruct { + int8u order = 0; + nullable int64s measurement = 1; + } + + struct MeasurementRangeStruct { + MeasurementTypeEnum measurementType = 0; + int64s min = 1; + int64s max = 2; + optional epoch_s startTimestamp = 3; + optional epoch_s endTimestamp = 4; + optional epoch_s minTimestamp = 5; + optional epoch_s maxTimestamp = 6; + optional systime_ms startSystime = 7; + optional systime_ms endSystime = 8; + optional systime_ms minSystime = 9; + optional systime_ms maxSystime = 10; + } + + info event MeasurementPeriodRanges = 0 { + MeasurementRangeStruct ranges[] = 0; + } + + readonly attribute PowerModeEnum powerMode = 0; + readonly attribute int8u numberOfMeasurementTypes = 1; + readonly attribute MeasurementAccuracyStruct accuracy[] = 2; + readonly attribute optional MeasurementRangeStruct ranges[] = 3; + readonly attribute optional nullable voltage_mv voltage = 4; + readonly attribute optional nullable amperage_ma activeCurrent = 5; + readonly attribute optional nullable amperage_ma reactiveCurrent = 6; + readonly attribute optional nullable amperage_ma apparentCurrent = 7; + readonly attribute nullable power_mw activePower = 8; + readonly attribute optional nullable power_mw reactivePower = 9; + readonly attribute optional nullable power_mw apparentPower = 10; + readonly attribute optional nullable voltage_mv RMSVoltage = 11; + readonly attribute optional nullable amperage_ma RMSCurrent = 12; + readonly attribute optional nullable power_mw RMSPower = 13; + readonly attribute optional nullable int64s frequency = 14; + readonly attribute optional nullable HarmonicMeasurementStruct harmonicCurrents[] = 15; + readonly attribute optional nullable HarmonicMeasurementStruct harmonicPhases[] = 16; + readonly attribute optional nullable int64s powerFactor = 17; + readonly attribute optional nullable amperage_ma neutralCurrent = 18; + 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 a mechanism for querying data about the electrical energy imported or provided by the server. */ provisional cluster ElectricalEnergyMeasurement = 145 { revision 1; @@ -4139,8 +4244,15 @@ provisional cluster ElectricalEnergyMeasurement = 145 { MeasurementAccuracyRangeStruct accuracyRanges[] = 4; } + struct CumulativeEnergyResetStruct { + optional nullable epoch_s importedResetTimestamp = 0; + optional nullable epoch_s exportedResetTimestamp = 1; + optional nullable systime_ms importedResetSystime = 2; + optional nullable systime_ms exportedResetSystime = 3; + } + struct EnergyMeasurementStruct { - int64s energy = 0; + energy_mwh energy = 0; optional epoch_s startTimestamp = 1; optional epoch_s endTimestamp = 2; optional systime_ms startSystime = 3; @@ -4162,6 +4274,7 @@ provisional cluster ElectricalEnergyMeasurement = 145 { readonly attribute optional nullable EnergyMeasurementStruct cumulativeEnergyExported = 2; readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyImported = 3; readonly attribute optional nullable EnergyMeasurementStruct periodicEnergyExported = 4; + readonly attribute optional nullable CumulativeEnergyResetStruct cumulativeEnergyReset = 5; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 727872d00da0a6..df0b178cad6397 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -3124,6 +3124,92 @@ } ] }, + { + "name": "Electrical Power Measurement", + "code": 144, + "mfgCode": null, + "define": "ELECTRICAL_POWER_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Electrical Energy Measurement", + "code": 145, + "mfgCode": null, + "define": "ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 1, + "apiMaturity": "provisional", + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Device Energy Management", "code": 152, diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 262059e5f3b85f..57853e1eed76c4 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -28194,6 +28194,755 @@ public void onSuccess(byte[] tlv) { } } + public static class ElectricalPowerMeasurementCluster extends BaseChipCluster { + public static final long CLUSTER_ID = 144L; + + private static final long POWER_MODE_ATTRIBUTE_ID = 0L; + private static final long NUMBER_OF_MEASUREMENT_TYPES_ATTRIBUTE_ID = 1L; + private static final long ACCURACY_ATTRIBUTE_ID = 2L; + private static final long RANGES_ATTRIBUTE_ID = 3L; + private static final long VOLTAGE_ATTRIBUTE_ID = 4L; + private static final long ACTIVE_CURRENT_ATTRIBUTE_ID = 5L; + private static final long REACTIVE_CURRENT_ATTRIBUTE_ID = 6L; + private static final long APPARENT_CURRENT_ATTRIBUTE_ID = 7L; + private static final long ACTIVE_POWER_ATTRIBUTE_ID = 8L; + private static final long REACTIVE_POWER_ATTRIBUTE_ID = 9L; + private static final long APPARENT_POWER_ATTRIBUTE_ID = 10L; + private static final long R_M_S_VOLTAGE_ATTRIBUTE_ID = 11L; + private static final long R_M_S_CURRENT_ATTRIBUTE_ID = 12L; + private static final long R_M_S_POWER_ATTRIBUTE_ID = 13L; + private static final long FREQUENCY_ATTRIBUTE_ID = 14L; + private static final long HARMONIC_CURRENTS_ATTRIBUTE_ID = 15L; + private static final long HARMONIC_PHASES_ATTRIBUTE_ID = 16L; + private static final long POWER_FACTOR_ATTRIBUTE_ID = 17L; + private static final long NEUTRAL_CURRENT_ATTRIBUTE_ID = 18L; + 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 ElectricalPowerMeasurementCluster(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(List value); + } + + public interface RangesAttributeCallback extends BaseAttributeCallback { + void onSuccess(List value); + } + + public interface VoltageAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface ActiveCurrentAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface ReactiveCurrentAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface ApparentCurrentAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface ActivePowerAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface ReactivePowerAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface ApparentPowerAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface RMSVoltageAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface RMSCurrentAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface RMSPowerAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface FrequencyAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface HarmonicCurrentsAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable List value); + } + + public interface HarmonicPhasesAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable List value); + } + + public interface PowerFactorAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long value); + } + + public interface NeutralCurrentAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable Long 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 readPowerModeAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, POWER_MODE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, POWER_MODE_ATTRIBUTE_ID, true); + } + + public void subscribePowerModeAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, POWER_MODE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, POWER_MODE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNumberOfMeasurementTypesAttribute( + IntegerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_MEASUREMENT_TYPES_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NUMBER_OF_MEASUREMENT_TYPES_ATTRIBUTE_ID, true); + } + + public void subscribeNumberOfMeasurementTypesAttribute( + IntegerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_MEASUREMENT_TYPES_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, NUMBER_OF_MEASUREMENT_TYPES_ATTRIBUTE_ID, minInterval, maxInterval); + } + + 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) { + List 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) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, ACCURACY_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readRangesAttribute( + RangesAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RANGES_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, RANGES_ATTRIBUTE_ID, true); + } + + public void subscribeRangesAttribute( + RangesAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RANGES_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, RANGES_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readVoltageAttribute( + VoltageAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VOLTAGE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, VOLTAGE_ATTRIBUTE_ID, true); + } + + public void subscribeVoltageAttribute( + VoltageAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VOLTAGE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readActiveCurrentAttribute( + ActiveCurrentAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_CURRENT_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACTIVE_CURRENT_ATTRIBUTE_ID, true); + } + + public void subscribeActiveCurrentAttribute( + ActiveCurrentAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_CURRENT_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, ACTIVE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readReactiveCurrentAttribute( + ReactiveCurrentAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REACTIVE_CURRENT_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, REACTIVE_CURRENT_ATTRIBUTE_ID, true); + } + + public void subscribeReactiveCurrentAttribute( + ReactiveCurrentAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REACTIVE_CURRENT_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, REACTIVE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readApparentCurrentAttribute( + ApparentCurrentAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPARENT_CURRENT_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, APPARENT_CURRENT_ATTRIBUTE_ID, true); + } + + public void subscribeApparentCurrentAttribute( + ApparentCurrentAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPARENT_CURRENT_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, APPARENT_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readActivePowerAttribute( + ActivePowerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_POWER_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, ACTIVE_POWER_ATTRIBUTE_ID, true); + } + + public void subscribeActivePowerAttribute( + ActivePowerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACTIVE_POWER_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, ACTIVE_POWER_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readReactivePowerAttribute( + ReactivePowerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REACTIVE_POWER_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, REACTIVE_POWER_ATTRIBUTE_ID, true); + } + + public void subscribeReactivePowerAttribute( + ReactivePowerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REACTIVE_POWER_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, REACTIVE_POWER_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readApparentPowerAttribute( + ApparentPowerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPARENT_POWER_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, APPARENT_POWER_ATTRIBUTE_ID, true); + } + + public void subscribeApparentPowerAttribute( + ApparentPowerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPARENT_POWER_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, APPARENT_POWER_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readRMSVoltageAttribute( + RMSVoltageAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_VOLTAGE_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, R_M_S_VOLTAGE_ATTRIBUTE_ID, true); + } + + public void subscribeRMSVoltageAttribute( + RMSVoltageAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_VOLTAGE_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, R_M_S_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readRMSCurrentAttribute( + RMSCurrentAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_CURRENT_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, R_M_S_CURRENT_ATTRIBUTE_ID, true); + } + + public void subscribeRMSCurrentAttribute( + RMSCurrentAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_CURRENT_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, R_M_S_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readRMSPowerAttribute( + RMSPowerAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_POWER_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, R_M_S_POWER_ATTRIBUTE_ID, true); + } + + public void subscribeRMSPowerAttribute( + RMSPowerAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_POWER_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, R_M_S_POWER_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readFrequencyAttribute( + FrequencyAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FREQUENCY_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, FREQUENCY_ATTRIBUTE_ID, true); + } + + public void subscribeFrequencyAttribute( + FrequencyAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FREQUENCY_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, FREQUENCY_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readHarmonicCurrentsAttribute( + HarmonicCurrentsAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HARMONIC_CURRENTS_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, HARMONIC_CURRENTS_ATTRIBUTE_ID, true); + } + + public void subscribeHarmonicCurrentsAttribute( + HarmonicCurrentsAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HARMONIC_CURRENTS_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, HARMONIC_CURRENTS_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readHarmonicPhasesAttribute( + HarmonicPhasesAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HARMONIC_PHASES_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, HARMONIC_PHASES_ATTRIBUTE_ID, true); + } + + public void subscribeHarmonicPhasesAttribute( + HarmonicPhasesAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HARMONIC_PHASES_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, HARMONIC_PHASES_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readPowerFactorAttribute( + PowerFactorAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, POWER_FACTOR_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, POWER_FACTOR_ATTRIBUTE_ID, true); + } + + public void subscribePowerFactorAttribute( + PowerFactorAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, POWER_FACTOR_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, POWER_FACTOR_ATTRIBUTE_ID, minInterval, maxInterval); + } + + public void readNeutralCurrentAttribute( + NeutralCurrentAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEUTRAL_CURRENT_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, NEUTRAL_CURRENT_ATTRIBUTE_ID, true); + } + + public void subscribeNeutralCurrentAttribute( + NeutralCurrentAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NEUTRAL_CURRENT_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, NEUTRAL_CURRENT_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 ElectricalEnergyMeasurementCluster extends BaseChipCluster { public static final long CLUSTER_ID = 145L; @@ -28202,6 +28951,7 @@ public static class ElectricalEnergyMeasurementCluster extends BaseChipCluster { 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 CUMULATIVE_ENERGY_RESET_ATTRIBUTE_ID = 5L; 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; @@ -28239,6 +28989,10 @@ public interface PeriodicEnergyExportedAttributeCallback extends BaseAttributeCa void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value); } + public interface CumulativeEnergyResetAttributeCallback extends BaseAttributeCallback { + void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct value); + } + public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback { void onSuccess(List value); } @@ -28380,6 +29134,31 @@ public void onSuccess(byte[] tlv) { }, PERIODIC_ENERGY_EXPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } + public void readCumulativeEnergyResetAttribute( + CumulativeEnergyResetAttributeCallback callback) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CUMULATIVE_ENERGY_RESET_ATTRIBUTE_ID); + + readAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); + } + }, CUMULATIVE_ENERGY_RESET_ATTRIBUTE_ID, true); + } + + public void subscribeCumulativeEnergyResetAttribute( + CumulativeEnergyResetAttributeCallback callback, int minInterval, int maxInterval) { + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CUMULATIVE_ENERGY_RESET_ATTRIBUTE_ID); + + subscribeAttribute(new ReportCallbackImpl(callback, path) { + @Override + public void onSuccess(byte[] tlv) { + @Nullable ChipStructs.ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + } + }, CUMULATIVE_ENERGY_RESET_ATTRIBUTE_ID, minInterval, maxInterval); + } + public void readGeneratedCommandListAttribute( GeneratedCommandListAttributeCallback callback) { ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index b759822df155b5..ce1a79c5a4a710 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -3457,6 +3457,52 @@ public String toString() { return output.toString(); } } +public static class ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent { + public ArrayList ranges; + private static final long RANGES_ID = 0L; + + public ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent( + ArrayList ranges + ) { + this.ranges = ranges; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(RANGES_ID, ArrayType.generateArrayType(ranges, (elementranges) -> elementranges.encodeTlv()))); + + return new StructType(values); + } + + public static ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + ArrayList ranges = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == RANGES_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Array) { + ArrayType castingValue = element.value(ArrayType.class); + ranges = castingValue.map((elementcastingValue) -> ChipStructs.ElectricalPowerMeasurementClusterMeasurementRangeStruct.decodeTlv(elementcastingValue)); + } + } + } + return new ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent( + ranges + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent {\n"); + output.append("\tranges: "); + output.append(ranges); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent { public Optional energyImported; public Optional energyExported; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index cfc67037e90260..6fb0469aded45c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -5428,6 +5428,520 @@ public String toString() { return output.toString(); } } +public static class ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct { + 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 ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct( + 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 ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct 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 ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct( + rangeMin, + rangeMax, + percentMax, + percentMin, + percentTypical, + fixedMax, + fixedMin, + fixedTypical + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct {\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 ElectricalPowerMeasurementClusterMeasurementAccuracyStruct { + 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 ElectricalPowerMeasurementClusterMeasurementAccuracyStruct( + 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 ElectricalPowerMeasurementClusterMeasurementAccuracyStruct 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.ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.decodeTlv(elementcastingValue)); + } + } + } + return new ElectricalPowerMeasurementClusterMeasurementAccuracyStruct( + measurementType, + measured, + minMeasuredValue, + maxMeasuredValue, + accuracyRanges + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalPowerMeasurementClusterMeasurementAccuracyStruct {\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 ElectricalPowerMeasurementClusterHarmonicMeasurementStruct { + public Integer order; + public @Nullable Long measurement; + private static final long ORDER_ID = 0L; + private static final long MEASUREMENT_ID = 1L; + + public ElectricalPowerMeasurementClusterHarmonicMeasurementStruct( + Integer order, + @Nullable Long measurement + ) { + this.order = order; + this.measurement = measurement; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(ORDER_ID, new UIntType(order))); + values.add(new StructElement(MEASUREMENT_ID, measurement != null ? new IntType(measurement) : new NullType())); + + return new StructType(values); + } + + public static ElectricalPowerMeasurementClusterHarmonicMeasurementStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer order = null; + @Nullable Long measurement = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == ORDER_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + order = castingValue.value(Integer.class); + } + } else if (element.contextTagNum() == MEASUREMENT_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + measurement = castingValue.value(Long.class); + } + } + } + return new ElectricalPowerMeasurementClusterHarmonicMeasurementStruct( + order, + measurement + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalPowerMeasurementClusterHarmonicMeasurementStruct {\n"); + output.append("\torder: "); + output.append(order); + output.append("\n"); + output.append("\tmeasurement: "); + output.append(measurement); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} +public static class ElectricalPowerMeasurementClusterMeasurementRangeStruct { + public Integer measurementType; + public Long min; + public Long max; + public Optional startTimestamp; + public Optional endTimestamp; + public Optional minTimestamp; + public Optional maxTimestamp; + public Optional startSystime; + public Optional endSystime; + public Optional minSystime; + public Optional maxSystime; + private static final long MEASUREMENT_TYPE_ID = 0L; + private static final long MIN_ID = 1L; + private static final long MAX_ID = 2L; + private static final long START_TIMESTAMP_ID = 3L; + private static final long END_TIMESTAMP_ID = 4L; + private static final long MIN_TIMESTAMP_ID = 5L; + private static final long MAX_TIMESTAMP_ID = 6L; + private static final long START_SYSTIME_ID = 7L; + private static final long END_SYSTIME_ID = 8L; + private static final long MIN_SYSTIME_ID = 9L; + private static final long MAX_SYSTIME_ID = 10L; + + public ElectricalPowerMeasurementClusterMeasurementRangeStruct( + Integer measurementType, + Long min, + Long max, + Optional startTimestamp, + Optional endTimestamp, + Optional minTimestamp, + Optional maxTimestamp, + Optional startSystime, + Optional endSystime, + Optional minSystime, + Optional maxSystime + ) { + this.measurementType = measurementType; + this.min = min; + this.max = max; + this.startTimestamp = startTimestamp; + this.endTimestamp = endTimestamp; + this.minTimestamp = minTimestamp; + this.maxTimestamp = maxTimestamp; + this.startSystime = startSystime; + this.endSystime = endSystime; + this.minSystime = minSystime; + this.maxSystime = maxSystime; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(MEASUREMENT_TYPE_ID, new UIntType(measurementType))); + values.add(new StructElement(MIN_ID, new IntType(min))); + values.add(new StructElement(MAX_ID, new IntType(max))); + 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(MIN_TIMESTAMP_ID, minTimestamp.map((nonOptionalminTimestamp) -> new UIntType(nonOptionalminTimestamp)).orElse(new EmptyType()))); + values.add(new StructElement(MAX_TIMESTAMP_ID, maxTimestamp.map((nonOptionalmaxTimestamp) -> new UIntType(nonOptionalmaxTimestamp)).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()))); + values.add(new StructElement(MIN_SYSTIME_ID, minSystime.map((nonOptionalminSystime) -> new UIntType(nonOptionalminSystime)).orElse(new EmptyType()))); + values.add(new StructElement(MAX_SYSTIME_ID, maxSystime.map((nonOptionalmaxSystime) -> new UIntType(nonOptionalmaxSystime)).orElse(new EmptyType()))); + + return new StructType(values); + } + + public static ElectricalPowerMeasurementClusterMeasurementRangeStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + Integer measurementType = null; + Long min = null; + Long max = null; + Optional startTimestamp = Optional.empty(); + Optional endTimestamp = Optional.empty(); + Optional minTimestamp = Optional.empty(); + Optional maxTimestamp = Optional.empty(); + Optional startSystime = Optional.empty(); + Optional endSystime = Optional.empty(); + Optional minSystime = Optional.empty(); + Optional maxSystime = Optional.empty(); + 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() == MIN_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + min = castingValue.value(Long.class); + } + } else if (element.contextTagNum() == MAX_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.Int) { + IntType castingValue = element.value(IntType.class); + max = 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() == MIN_TIMESTAMP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + minTimestamp = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == MAX_TIMESTAMP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + maxTimestamp = 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)); + } + } else if (element.contextTagNum() == MIN_SYSTIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + minSystime = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == MAX_SYSTIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + maxSystime = Optional.of(castingValue.value(Long.class)); + } + } + } + return new ElectricalPowerMeasurementClusterMeasurementRangeStruct( + measurementType, + min, + max, + startTimestamp, + endTimestamp, + minTimestamp, + maxTimestamp, + startSystime, + endSystime, + minSystime, + maxSystime + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalPowerMeasurementClusterMeasurementRangeStruct {\n"); + output.append("\tmeasurementType: "); + output.append(measurementType); + output.append("\n"); + output.append("\tmin: "); + output.append(min); + output.append("\n"); + output.append("\tmax: "); + output.append(max); + output.append("\n"); + output.append("\tstartTimestamp: "); + output.append(startTimestamp); + output.append("\n"); + output.append("\tendTimestamp: "); + output.append(endTimestamp); + output.append("\n"); + output.append("\tminTimestamp: "); + output.append(minTimestamp); + output.append("\n"); + output.append("\tmaxTimestamp: "); + output.append(maxTimestamp); + output.append("\n"); + output.append("\tstartSystime: "); + output.append(startSystime); + output.append("\n"); + output.append("\tendSystime: "); + output.append(endSystime); + output.append("\n"); + output.append("\tminSystime: "); + output.append(minSystime); + output.append("\n"); + output.append("\tmaxSystime: "); + output.append(maxSystime); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct { public Long rangeMin; public Long rangeMax; @@ -5685,6 +6199,97 @@ public String toString() { return output.toString(); } } +public static class ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct { + public @Nullable Optional importedResetTimestamp; + public @Nullable Optional exportedResetTimestamp; + public @Nullable Optional importedResetSystime; + public @Nullable Optional exportedResetSystime; + private static final long IMPORTED_RESET_TIMESTAMP_ID = 0L; + private static final long EXPORTED_RESET_TIMESTAMP_ID = 1L; + private static final long IMPORTED_RESET_SYSTIME_ID = 2L; + private static final long EXPORTED_RESET_SYSTIME_ID = 3L; + + public ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct( + @Nullable Optional importedResetTimestamp, + @Nullable Optional exportedResetTimestamp, + @Nullable Optional importedResetSystime, + @Nullable Optional exportedResetSystime + ) { + this.importedResetTimestamp = importedResetTimestamp; + this.exportedResetTimestamp = exportedResetTimestamp; + this.importedResetSystime = importedResetSystime; + this.exportedResetSystime = exportedResetSystime; + } + + public StructType encodeTlv() { + ArrayList values = new ArrayList<>(); + values.add(new StructElement(IMPORTED_RESET_TIMESTAMP_ID, importedResetTimestamp != null ? importedResetTimestamp.map((nonOptionalimportedResetTimestamp) -> new UIntType(nonOptionalimportedResetTimestamp)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(EXPORTED_RESET_TIMESTAMP_ID, exportedResetTimestamp != null ? exportedResetTimestamp.map((nonOptionalexportedResetTimestamp) -> new UIntType(nonOptionalexportedResetTimestamp)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(IMPORTED_RESET_SYSTIME_ID, importedResetSystime != null ? importedResetSystime.map((nonOptionalimportedResetSystime) -> new UIntType(nonOptionalimportedResetSystime)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(EXPORTED_RESET_SYSTIME_ID, exportedResetSystime != null ? exportedResetSystime.map((nonOptionalexportedResetSystime) -> new UIntType(nonOptionalexportedResetSystime)).orElse(new EmptyType()) : new NullType())); + + return new StructType(values); + } + + public static ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct decodeTlv(BaseTLVType tlvValue) { + if (tlvValue == null || tlvValue.type() != TLVType.Struct) { + return null; + } + @Nullable Optional importedResetTimestamp = null; + @Nullable Optional exportedResetTimestamp = null; + @Nullable Optional importedResetSystime = null; + @Nullable Optional exportedResetSystime = null; + for (StructElement element: ((StructType)tlvValue).value()) { + if (element.contextTagNum() == IMPORTED_RESET_TIMESTAMP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + importedResetTimestamp = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == EXPORTED_RESET_TIMESTAMP_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + exportedResetTimestamp = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == IMPORTED_RESET_SYSTIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + importedResetSystime = Optional.of(castingValue.value(Long.class)); + } + } else if (element.contextTagNum() == EXPORTED_RESET_SYSTIME_ID) { + if (element.value(BaseTLVType.class).type() == TLVType.UInt) { + UIntType castingValue = element.value(UIntType.class); + exportedResetSystime = Optional.of(castingValue.value(Long.class)); + } + } + } + return new ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct( + importedResetTimestamp, + exportedResetTimestamp, + importedResetSystime, + exportedResetSystime + ); + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct {\n"); + output.append("\timportedResetTimestamp: "); + output.append(importedResetTimestamp); + output.append("\n"); + output.append("\texportedResetTimestamp: "); + output.append(exportedResetTimestamp); + output.append("\n"); + output.append("\timportedResetSystime: "); + output.append(importedResetSystime); + output.append("\n"); + output.append("\texportedResetSystime: "); + output.append(exportedResetSystime); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } +} public static class ElectricalEnergyMeasurementClusterEnergyMeasurementStruct { public Long energy; public Optional startTimestamp; diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java index 43e246a70b6d81..8e8e0d91c5d23d 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 == ElectricalPowerMeasurement.ID) { + return new ElectricalPowerMeasurement(); + } if (clusterId == ElectricalEnergyMeasurement.ID) { return new ElectricalEnergyMeasurement(); } @@ -9019,6 +9022,126 @@ public long getCommandID(String name) throws IllegalArgumentException { return Command.valueOf(name).getID(); } } + public static class ElectricalPowerMeasurement implements BaseCluster { + public static final long ID = 144L; + public long getID() { + return ID; + } + + public enum Attribute { + PowerMode(0L), + NumberOfMeasurementTypes(1L), + Accuracy(2L), + Ranges(3L), + Voltage(4L), + ActiveCurrent(5L), + ReactiveCurrent(6L), + ApparentCurrent(7L), + ActivePower(8L), + ReactivePower(9L), + ApparentPower(10L), + RMSVoltage(11L), + RMSCurrent(12L), + RMSPower(13L), + Frequency(14L), + HarmonicCurrents(15L), + HarmonicPhases(16L), + PowerFactor(17L), + NeutralCurrent(18L), + 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 { + MeasurementPeriodRanges(0L),; + 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 ElectricalEnergyMeasurement implements BaseCluster { public static final long ID = 145L; public long getID() { @@ -9031,6 +9154,7 @@ public enum Attribute { CumulativeEnergyExported(2L), PeriodicEnergyImported(3L), PeriodicEnergyExported(4L), + CumulativeEnergyReset(5L), GeneratedCommandList(65528L), AcceptedCommandList(65529L), EventList(65530L), diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java index 837e6e72bd193c..3f01a08cb3a911 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java @@ -9928,6 +9928,447 @@ public void onError(Exception ex) { } } + public static class DelegatedElectricalPowerMeasurementClusterAccuracyAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.AccuracyAttributeCallback, 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 DelegatedElectricalPowerMeasurementClusterRangesAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.RangesAttributeCallback, 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 DelegatedElectricalPowerMeasurementClusterVoltageAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.VoltageAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterActiveCurrentAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.ActiveCurrentAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterReactiveCurrentAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.ReactiveCurrentAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterApparentCurrentAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.ApparentCurrentAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterActivePowerAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.ActivePowerAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterReactivePowerAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.ReactivePowerAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterApparentPowerAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.ApparentPowerAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterRMSVoltageAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.RMSVoltageAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterRMSCurrentAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.RMSCurrentAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterRMSPowerAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.RMSPowerAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterFrequencyAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.FrequencyAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterHarmonicCurrentsAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.HarmonicCurrentsAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable 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 DelegatedElectricalPowerMeasurementClusterHarmonicPhasesAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.HarmonicPhasesAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable 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 DelegatedElectricalPowerMeasurementClusterPowerFactorAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.PowerFactorAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterNeutralCurrentAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.NeutralCurrentAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable Long value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long"); + responseValues.put(commandResponseInfo, value); + callback.onSuccess(responseValues); + } + + @Override + public void onError(Exception ex) { + callback.onFailure(ex); + } + } + + public static class DelegatedElectricalPowerMeasurementClusterGeneratedCommandListAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.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 DelegatedElectricalPowerMeasurementClusterAcceptedCommandListAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.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 DelegatedElectricalPowerMeasurementClusterEventListAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.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 DelegatedElectricalPowerMeasurementClusterAttributeListAttributeCallback implements ChipClusters.ElectricalPowerMeasurementCluster.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 DelegatedElectricalEnergyMeasurementClusterAccuracyAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.AccuracyAttributeCallback, DelegatedClusterCallback { private ClusterCommandCallback callback; @Override @@ -10033,6 +10474,27 @@ public void onError(Exception ex) { } } + public static class DelegatedElectricalEnergyMeasurementClusterCumulativeEnergyResetAttributeCallback implements ChipClusters.ElectricalEnergyMeasurementCluster.CumulativeEnergyResetAttributeCallback, DelegatedClusterCallback { + private ClusterCommandCallback callback; + @Override + public void setCallbackDelegate(ClusterCommandCallback callback) { + this.callback = callback; + } + + @Override + public void onSuccess(@Nullable ChipStructs.ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct value) { + Map responseValues = new LinkedHashMap<>(); + CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "ChipStructs.ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct"); + 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 @@ -20427,6 +20889,10 @@ public Map initializeClusterMap() { (ptr, endpointId) -> new ChipClusters.ValveConfigurationAndControlCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("valveConfigurationAndControl", valveConfigurationAndControlClusterInfo); + ClusterInfo electricalPowerMeasurementClusterInfo = new ClusterInfo( + (ptr, endpointId) -> new ChipClusters.ElectricalPowerMeasurementCluster(ptr, endpointId), new HashMap<>()); + clusterMap.put("electricalPowerMeasurement", electricalPowerMeasurementClusterInfo); + ClusterInfo electricalEnergyMeasurementClusterInfo = new ClusterInfo( (ptr, endpointId) -> new ChipClusters.ElectricalEnergyMeasurementCluster(ptr, endpointId), new HashMap<>()); clusterMap.put("electricalEnergyMeasurement", electricalEnergyMeasurementClusterInfo); @@ -20700,6 +21166,7 @@ public void combineCommand(Map destination, Map> getCommandMap() { commandMap.put("valveConfigurationAndControl", valveConfigurationAndControlClusterInteractionInfoMap); + Map electricalPowerMeasurementClusterInteractionInfoMap = new LinkedHashMap<>(); + + commandMap.put("electricalPowerMeasurement", electricalPowerMeasurementClusterInteractionInfoMap); + Map electricalEnergyMeasurementClusterInteractionInfoMap = new LinkedHashMap<>(); commandMap.put("electricalEnergyMeasurement", electricalEnergyMeasurementClusterInteractionInfoMap); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java index 85f913818cf9f8..5835a37623934a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java @@ -8964,6 +8964,285 @@ private static Map readValveConfigurationAndControlInte return result; } + private static Map readElectricalPowerMeasurementInteractionInfo() { + Map result = new LinkedHashMap<>();Map readElectricalPowerMeasurementPowerModeCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementPowerModeAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readPowerModeAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readElectricalPowerMeasurementPowerModeCommandParams + ); + result.put("readPowerModeAttribute", readElectricalPowerMeasurementPowerModeAttributeInteractionInfo); + Map readElectricalPowerMeasurementNumberOfMeasurementTypesCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementNumberOfMeasurementTypesAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readNumberOfMeasurementTypesAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readElectricalPowerMeasurementNumberOfMeasurementTypesCommandParams + ); + result.put("readNumberOfMeasurementTypesAttribute", readElectricalPowerMeasurementNumberOfMeasurementTypesAttributeInteractionInfo); + Map readElectricalPowerMeasurementAccuracyCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementAccuracyAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readAccuracyAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.AccuracyAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterAccuracyAttributeCallback(), + readElectricalPowerMeasurementAccuracyCommandParams + ); + result.put("readAccuracyAttribute", readElectricalPowerMeasurementAccuracyAttributeInteractionInfo); + Map readElectricalPowerMeasurementRangesCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementRangesAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readRangesAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.RangesAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterRangesAttributeCallback(), + readElectricalPowerMeasurementRangesCommandParams + ); + result.put("readRangesAttribute", readElectricalPowerMeasurementRangesAttributeInteractionInfo); + Map readElectricalPowerMeasurementVoltageCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementVoltageAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readVoltageAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.VoltageAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterVoltageAttributeCallback(), + readElectricalPowerMeasurementVoltageCommandParams + ); + result.put("readVoltageAttribute", readElectricalPowerMeasurementVoltageAttributeInteractionInfo); + Map readElectricalPowerMeasurementActiveCurrentCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementActiveCurrentAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readActiveCurrentAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.ActiveCurrentAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterActiveCurrentAttributeCallback(), + readElectricalPowerMeasurementActiveCurrentCommandParams + ); + result.put("readActiveCurrentAttribute", readElectricalPowerMeasurementActiveCurrentAttributeInteractionInfo); + Map readElectricalPowerMeasurementReactiveCurrentCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementReactiveCurrentAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readReactiveCurrentAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.ReactiveCurrentAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterReactiveCurrentAttributeCallback(), + readElectricalPowerMeasurementReactiveCurrentCommandParams + ); + result.put("readReactiveCurrentAttribute", readElectricalPowerMeasurementReactiveCurrentAttributeInteractionInfo); + Map readElectricalPowerMeasurementApparentCurrentCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementApparentCurrentAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readApparentCurrentAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.ApparentCurrentAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterApparentCurrentAttributeCallback(), + readElectricalPowerMeasurementApparentCurrentCommandParams + ); + result.put("readApparentCurrentAttribute", readElectricalPowerMeasurementApparentCurrentAttributeInteractionInfo); + Map readElectricalPowerMeasurementActivePowerCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementActivePowerAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readActivePowerAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.ActivePowerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterActivePowerAttributeCallback(), + readElectricalPowerMeasurementActivePowerCommandParams + ); + result.put("readActivePowerAttribute", readElectricalPowerMeasurementActivePowerAttributeInteractionInfo); + Map readElectricalPowerMeasurementReactivePowerCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementReactivePowerAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readReactivePowerAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.ReactivePowerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterReactivePowerAttributeCallback(), + readElectricalPowerMeasurementReactivePowerCommandParams + ); + result.put("readReactivePowerAttribute", readElectricalPowerMeasurementReactivePowerAttributeInteractionInfo); + Map readElectricalPowerMeasurementApparentPowerCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementApparentPowerAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readApparentPowerAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.ApparentPowerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterApparentPowerAttributeCallback(), + readElectricalPowerMeasurementApparentPowerCommandParams + ); + result.put("readApparentPowerAttribute", readElectricalPowerMeasurementApparentPowerAttributeInteractionInfo); + Map readElectricalPowerMeasurementRMSVoltageCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementRMSVoltageAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readRMSVoltageAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.RMSVoltageAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterRMSVoltageAttributeCallback(), + readElectricalPowerMeasurementRMSVoltageCommandParams + ); + result.put("readRMSVoltageAttribute", readElectricalPowerMeasurementRMSVoltageAttributeInteractionInfo); + Map readElectricalPowerMeasurementRMSCurrentCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementRMSCurrentAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readRMSCurrentAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.RMSCurrentAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterRMSCurrentAttributeCallback(), + readElectricalPowerMeasurementRMSCurrentCommandParams + ); + result.put("readRMSCurrentAttribute", readElectricalPowerMeasurementRMSCurrentAttributeInteractionInfo); + Map readElectricalPowerMeasurementRMSPowerCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementRMSPowerAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readRMSPowerAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.RMSPowerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterRMSPowerAttributeCallback(), + readElectricalPowerMeasurementRMSPowerCommandParams + ); + result.put("readRMSPowerAttribute", readElectricalPowerMeasurementRMSPowerAttributeInteractionInfo); + Map readElectricalPowerMeasurementFrequencyCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementFrequencyAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readFrequencyAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.FrequencyAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterFrequencyAttributeCallback(), + readElectricalPowerMeasurementFrequencyCommandParams + ); + result.put("readFrequencyAttribute", readElectricalPowerMeasurementFrequencyAttributeInteractionInfo); + Map readElectricalPowerMeasurementHarmonicCurrentsCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementHarmonicCurrentsAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readHarmonicCurrentsAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.HarmonicCurrentsAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterHarmonicCurrentsAttributeCallback(), + readElectricalPowerMeasurementHarmonicCurrentsCommandParams + ); + result.put("readHarmonicCurrentsAttribute", readElectricalPowerMeasurementHarmonicCurrentsAttributeInteractionInfo); + Map readElectricalPowerMeasurementHarmonicPhasesCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementHarmonicPhasesAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readHarmonicPhasesAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.HarmonicPhasesAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterHarmonicPhasesAttributeCallback(), + readElectricalPowerMeasurementHarmonicPhasesCommandParams + ); + result.put("readHarmonicPhasesAttribute", readElectricalPowerMeasurementHarmonicPhasesAttributeInteractionInfo); + Map readElectricalPowerMeasurementPowerFactorCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementPowerFactorAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readPowerFactorAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.PowerFactorAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterPowerFactorAttributeCallback(), + readElectricalPowerMeasurementPowerFactorCommandParams + ); + result.put("readPowerFactorAttribute", readElectricalPowerMeasurementPowerFactorAttributeInteractionInfo); + Map readElectricalPowerMeasurementNeutralCurrentCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementNeutralCurrentAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readNeutralCurrentAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.NeutralCurrentAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterNeutralCurrentAttributeCallback(), + readElectricalPowerMeasurementNeutralCurrentCommandParams + ); + result.put("readNeutralCurrentAttribute", readElectricalPowerMeasurementNeutralCurrentAttributeInteractionInfo); + Map readElectricalPowerMeasurementGeneratedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readGeneratedCommandListAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.GeneratedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterGeneratedCommandListAttributeCallback(), + readElectricalPowerMeasurementGeneratedCommandListCommandParams + ); + result.put("readGeneratedCommandListAttribute", readElectricalPowerMeasurementGeneratedCommandListAttributeInteractionInfo); + Map readElectricalPowerMeasurementAcceptedCommandListCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementAcceptedCommandListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readAcceptedCommandListAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.AcceptedCommandListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterAcceptedCommandListAttributeCallback(), + readElectricalPowerMeasurementAcceptedCommandListCommandParams + ); + result.put("readAcceptedCommandListAttribute", readElectricalPowerMeasurementAcceptedCommandListAttributeInteractionInfo); + Map readElectricalPowerMeasurementEventListCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementEventListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readEventListAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.EventListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterEventListAttributeCallback(), + readElectricalPowerMeasurementEventListCommandParams + ); + result.put("readEventListAttribute", readElectricalPowerMeasurementEventListAttributeInteractionInfo); + Map readElectricalPowerMeasurementAttributeListCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementAttributeListAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readAttributeListAttribute( + (ChipClusters.ElectricalPowerMeasurementCluster.AttributeListAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedElectricalPowerMeasurementClusterAttributeListAttributeCallback(), + readElectricalPowerMeasurementAttributeListCommandParams + ); + result.put("readAttributeListAttribute", readElectricalPowerMeasurementAttributeListAttributeInteractionInfo); + Map readElectricalPowerMeasurementFeatureMapCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementFeatureMapAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readFeatureMapAttribute( + (ChipClusters.LongAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readElectricalPowerMeasurementFeatureMapCommandParams + ); + result.put("readFeatureMapAttribute", readElectricalPowerMeasurementFeatureMapAttributeInteractionInfo); + Map readElectricalPowerMeasurementClusterRevisionCommandParams = new LinkedHashMap(); + InteractionInfo readElectricalPowerMeasurementClusterRevisionAttributeInteractionInfo = new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ElectricalPowerMeasurementCluster) cluster).readClusterRevisionAttribute( + (ChipClusters.IntegerAttributeCallback) callback + ); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readElectricalPowerMeasurementClusterRevisionCommandParams + ); + result.put("readClusterRevisionAttribute", readElectricalPowerMeasurementClusterRevisionAttributeInteractionInfo); + + return result; + } private static Map readElectricalEnergyMeasurementInteractionInfo() { Map result = new LinkedHashMap<>();Map readElectricalEnergyMeasurementGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readElectricalEnergyMeasurementGeneratedCommandListAttributeInteractionInfo = new InteractionInfo( @@ -20182,6 +20461,7 @@ public Map> getReadAttributeMap() { put("activatedCarbonFilterMonitoring", readActivatedCarbonFilterMonitoringInteractionInfo()); put("booleanStateConfiguration", readBooleanStateConfigurationInteractionInfo()); put("valveConfigurationAndControl", readValveConfigurationAndControlInteractionInfo()); + put("electricalPowerMeasurement", readElectricalPowerMeasurementInteractionInfo()); put("electricalEnergyMeasurement", readElectricalEnergyMeasurementInteractionInfo()); put("demandResponseLoadControl", readDemandResponseLoadControlInteractionInfo()); put("messages", readMessagesInteractionInfo()); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java index dc674be7a4a7ec..fe23d32c236579 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java @@ -1190,6 +1190,8 @@ public Map> getWriteAttributeMap() { ); writeValveConfigurationAndControlInteractionInfo.put("writeDefaultOpenLevelAttribute", writeValveConfigurationAndControlDefaultOpenLevelAttributeInteractionInfo); writeAttributeMap.put("valveConfigurationAndControl", writeValveConfigurationAndControlInteractionInfo); + Map writeElectricalPowerMeasurementInteractionInfo = new LinkedHashMap<>(); + writeAttributeMap.put("electricalPowerMeasurement", writeElectricalPowerMeasurementInteractionInfo); Map writeElectricalEnergyMeasurementInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("electricalEnergyMeasurement", writeElectricalEnergyMeasurementInteractionInfo); Map writeDemandResponseLoadControlInteractionInfo = new LinkedHashMap<>(); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent.kt new file mode 100644 index 00000000000000..cc399a62cbc419 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent.kt @@ -0,0 +1,78 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.eventstructs + +import chip.devicecontroller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent( + val ranges: + List< + chip.devicecontroller.cluster.structs.ElectricalPowerMeasurementClusterMeasurementRangeStruct + > +) { + override fun toString(): String = buildString { + append("ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent {\n") + append("\tranges : $ranges\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + startArray(ContextSpecificTag(TAG_RANGES)) + for (item in ranges.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_RANGES = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent { + tlvReader.enterStructure(tlvTag) + val ranges = + buildList< + chip.devicecontroller.cluster.structs.ElectricalPowerMeasurementClusterMeasurementRangeStruct + > { + tlvReader.enterArray(ContextSpecificTag(TAG_RANGES)) + while (!tlvReader.isEndOfContainer()) { + this.add( + chip.devicecontroller.cluster.structs + .ElectricalPowerMeasurementClusterMeasurementRangeStruct + .fromTlv(AnonymousTag, tlvReader) + ) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent(ranges) + } + } +} 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 d5fe7ad8fcc5ce..34fd21bb27d770 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni @@ -55,9 +55,14 @@ 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/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.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/ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", + "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.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/EnergyEvseModeClusterModeOptionStruct.kt", @@ -161,6 +166,7 @@ eventstructs_sources = [ "${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/ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent.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/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt new file mode 100644 index 00000000000000..e16d78d8de18e1 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt @@ -0,0 +1,146 @@ +/* + * + * 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 ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct( + val importedResetTimestamp: Optional?, + val exportedResetTimestamp: Optional?, + val importedResetSystime: Optional?, + val exportedResetSystime: Optional? +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct {\n") + append("\timportedResetTimestamp : $importedResetTimestamp\n") + append("\texportedResetTimestamp : $exportedResetTimestamp\n") + append("\timportedResetSystime : $importedResetSystime\n") + append("\texportedResetSystime : $exportedResetSystime\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (importedResetTimestamp != null) { + if (importedResetTimestamp.isPresent) { + val optimportedResetTimestamp = importedResetTimestamp.get() + put(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP), optimportedResetTimestamp) + } + } else { + putNull(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP)) + } + if (exportedResetTimestamp != null) { + if (exportedResetTimestamp.isPresent) { + val optexportedResetTimestamp = exportedResetTimestamp.get() + put(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP), optexportedResetTimestamp) + } + } else { + putNull(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP)) + } + if (importedResetSystime != null) { + if (importedResetSystime.isPresent) { + val optimportedResetSystime = importedResetSystime.get() + put(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME), optimportedResetSystime) + } + } else { + putNull(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME)) + } + if (exportedResetSystime != null) { + if (exportedResetSystime.isPresent) { + val optexportedResetSystime = exportedResetSystime.get() + put(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME), optexportedResetSystime) + } + } else { + putNull(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME)) + } + endStructure() + } + } + + companion object { + private const val TAG_IMPORTED_RESET_TIMESTAMP = 0 + private const val TAG_EXPORTED_RESET_TIMESTAMP = 1 + private const val TAG_IMPORTED_RESET_SYSTIME = 2 + private const val TAG_EXPORTED_RESET_SYSTIME = 3 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct { + tlvReader.enterStructure(tlvTag) + val importedResetTimestamp = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP)) + null + } + val exportedResetTimestamp = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP)) + null + } + val importedResetSystime = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME)) + null + } + val exportedResetSystime = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME)) + null + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct( + importedResetTimestamp, + exportedResetTimestamp, + importedResetSystime, + exportedResetSystime + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.kt new file mode 100644 index 00000000000000..dd4286af08c7f2 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.kt @@ -0,0 +1,72 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package chip.devicecontroller.cluster.structs + +import chip.devicecontroller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalPowerMeasurementClusterHarmonicMeasurementStruct( + val order: UInt, + val measurement: Long? +) { + override fun toString(): String = buildString { + append("ElectricalPowerMeasurementClusterHarmonicMeasurementStruct {\n") + append("\torder : $order\n") + append("\tmeasurement : $measurement\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ORDER), order) + if (measurement != null) { + put(ContextSpecificTag(TAG_MEASUREMENT), measurement) + } else { + putNull(ContextSpecificTag(TAG_MEASUREMENT)) + } + endStructure() + } + } + + companion object { + private const val TAG_ORDER = 0 + private const val TAG_MEASUREMENT = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalPowerMeasurementClusterHarmonicMeasurementStruct { + tlvReader.enterStructure(tlvTag) + val order = tlvReader.getUInt(ContextSpecificTag(TAG_ORDER)) + val measurement = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_MEASUREMENT)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_MEASUREMENT)) + null + } + + tlvReader.exitContainer() + + return ElectricalPowerMeasurementClusterHarmonicMeasurementStruct(order, measurement) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt new file mode 100644 index 00000000000000..b937601980e488 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.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 ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct( + 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("ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct {\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 + ): ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct { + 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 ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct( + rangeMin, + rangeMax, + percentMax, + percentMin, + percentTypical, + fixedMax, + fixedMin, + fixedTypical + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt new file mode 100644 index 00000000000000..8197ccc39696ae --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.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 ElectricalPowerMeasurementClusterMeasurementAccuracyStruct( + val measurementType: UInt, + val measured: Boolean, + val minMeasuredValue: Long, + val maxMeasuredValue: Long, + val accuracyRanges: List +) { + override fun toString(): String = buildString { + append("ElectricalPowerMeasurementClusterMeasurementAccuracyStruct {\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 + ): ElectricalPowerMeasurementClusterMeasurementAccuracyStruct { + 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( + ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ElectricalPowerMeasurementClusterMeasurementAccuracyStruct( + measurementType, + measured, + minMeasuredValue, + maxMeasuredValue, + accuracyRanges + ) + } + } +} diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt new file mode 100644 index 00000000000000..8ddb817032d7f3 --- /dev/null +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt @@ -0,0 +1,184 @@ +/* + * + * 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 ElectricalPowerMeasurementClusterMeasurementRangeStruct( + val measurementType: UInt, + val min: Long, + val max: Long, + val startTimestamp: Optional, + val endTimestamp: Optional, + val minTimestamp: Optional, + val maxTimestamp: Optional, + val startSystime: Optional, + val endSystime: Optional, + val minSystime: Optional, + val maxSystime: Optional +) { + override fun toString(): String = buildString { + append("ElectricalPowerMeasurementClusterMeasurementRangeStruct {\n") + append("\tmeasurementType : $measurementType\n") + append("\tmin : $min\n") + append("\tmax : $max\n") + append("\tstartTimestamp : $startTimestamp\n") + append("\tendTimestamp : $endTimestamp\n") + append("\tminTimestamp : $minTimestamp\n") + append("\tmaxTimestamp : $maxTimestamp\n") + append("\tstartSystime : $startSystime\n") + append("\tendSystime : $endSystime\n") + append("\tminSystime : $minSystime\n") + append("\tmaxSystime : $maxSystime\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_MEASUREMENT_TYPE), measurementType) + put(ContextSpecificTag(TAG_MIN), min) + put(ContextSpecificTag(TAG_MAX), max) + 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 (minTimestamp.isPresent) { + val optminTimestamp = minTimestamp.get() + put(ContextSpecificTag(TAG_MIN_TIMESTAMP), optminTimestamp) + } + if (maxTimestamp.isPresent) { + val optmaxTimestamp = maxTimestamp.get() + put(ContextSpecificTag(TAG_MAX_TIMESTAMP), optmaxTimestamp) + } + 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) + } + if (minSystime.isPresent) { + val optminSystime = minSystime.get() + put(ContextSpecificTag(TAG_MIN_SYSTIME), optminSystime) + } + if (maxSystime.isPresent) { + val optmaxSystime = maxSystime.get() + put(ContextSpecificTag(TAG_MAX_SYSTIME), optmaxSystime) + } + endStructure() + } + } + + companion object { + private const val TAG_MEASUREMENT_TYPE = 0 + private const val TAG_MIN = 1 + private const val TAG_MAX = 2 + private const val TAG_START_TIMESTAMP = 3 + private const val TAG_END_TIMESTAMP = 4 + private const val TAG_MIN_TIMESTAMP = 5 + private const val TAG_MAX_TIMESTAMP = 6 + private const val TAG_START_SYSTIME = 7 + private const val TAG_END_SYSTIME = 8 + private const val TAG_MIN_SYSTIME = 9 + private const val TAG_MAX_SYSTIME = 10 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalPowerMeasurementClusterMeasurementRangeStruct { + tlvReader.enterStructure(tlvTag) + val measurementType = tlvReader.getUInt(ContextSpecificTag(TAG_MEASUREMENT_TYPE)) + val min = tlvReader.getLong(ContextSpecificTag(TAG_MIN)) + val max = tlvReader.getLong(ContextSpecificTag(TAG_MAX)) + 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 minTimestamp = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MIN_TIMESTAMP))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_MIN_TIMESTAMP))) + } else { + Optional.empty() + } + val maxTimestamp = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MAX_TIMESTAMP))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_MAX_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() + } + val minSystime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MIN_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_MIN_SYSTIME))) + } else { + Optional.empty() + } + val maxSystime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MAX_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_MAX_SYSTIME))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalPowerMeasurementClusterMeasurementRangeStruct( + measurementType, + min, + max, + startTimestamp, + endTimestamp, + minTimestamp, + maxTimestamp, + startSystime, + endSystime, + minSystime, + maxSystime + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt index 8be25c67fbcda4..64ade41965a6e9 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt @@ -103,6 +103,19 @@ class ElectricalEnergyMeasurementCluster( object SubscriptionEstablished : PeriodicEnergyExportedAttributeSubscriptionState() } + class CumulativeEnergyResetAttribute( + val value: ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct? + ) + + sealed class CumulativeEnergyResetAttributeSubscriptionState { + data class Success(val value: ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct?) : + CumulativeEnergyResetAttributeSubscriptionState() + + data class Error(val exception: Exception) : CumulativeEnergyResetAttributeSubscriptionState() + + object SubscriptionEstablished : CumulativeEnergyResetAttributeSubscriptionState() + } + class GeneratedCommandListAttribute(val value: List) sealed class GeneratedCommandListAttributeSubscriptionState { @@ -653,6 +666,115 @@ class ElectricalEnergyMeasurementCluster( } } + suspend fun readCumulativeEnergyResetAttribute(): CumulativeEnergyResetAttribute { + val ATTRIBUTE_ID: UInt = 5u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Cumulativeenergyreset attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.fromTlv( + AnonymousTag, + tlvReader + ) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return CumulativeEnergyResetAttribute(decodedValue) + } + + suspend fun subscribeCumulativeEnergyResetAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 5u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + CumulativeEnergyResetAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Cumulativeenergyreset attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.fromTlv( + AnonymousTag, + tlvReader + ) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(CumulativeEnergyResetAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(CumulativeEnergyResetAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { val ATTRIBUTE_ID: UInt = 65528u diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalPowerMeasurementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalPowerMeasurementCluster.kt new file mode 100644 index 00000000000000..6932934b50f103 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalPowerMeasurementCluster.kt @@ -0,0 +1,2760 @@ +/* + * + * 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.controller.cluster.clusters + +import java.time.Duration +import java.util.logging.Level +import java.util.logging.Logger +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.transform +import matter.controller.MatterController +import matter.controller.ReadData +import matter.controller.ReadRequest +import matter.controller.SubscribeRequest +import matter.controller.SubscriptionState +import matter.controller.UByteSubscriptionState +import matter.controller.UIntSubscriptionState +import matter.controller.UShortSubscriptionState +import matter.controller.cluster.structs.* +import matter.controller.model.AttributePath +import matter.tlv.AnonymousTag +import matter.tlv.TlvReader + +class ElectricalPowerMeasurementCluster( + private val controller: MatterController, + private val endpointId: UShort +) { + class AccuracyAttribute( + val value: List + ) + + sealed class AccuracyAttributeSubscriptionState { + data class Success( + val value: List + ) : AccuracyAttributeSubscriptionState() + + data class Error(val exception: Exception) : AccuracyAttributeSubscriptionState() + + object SubscriptionEstablished : AccuracyAttributeSubscriptionState() + } + + class RangesAttribute(val value: List?) + + sealed class RangesAttributeSubscriptionState { + data class Success(val value: List?) : + RangesAttributeSubscriptionState() + + data class Error(val exception: Exception) : RangesAttributeSubscriptionState() + + object SubscriptionEstablished : RangesAttributeSubscriptionState() + } + + class VoltageAttribute(val value: Long?) + + sealed class VoltageAttributeSubscriptionState { + data class Success(val value: Long?) : VoltageAttributeSubscriptionState() + + data class Error(val exception: Exception) : VoltageAttributeSubscriptionState() + + object SubscriptionEstablished : VoltageAttributeSubscriptionState() + } + + class ActiveCurrentAttribute(val value: Long?) + + sealed class ActiveCurrentAttributeSubscriptionState { + data class Success(val value: Long?) : ActiveCurrentAttributeSubscriptionState() + + data class Error(val exception: Exception) : ActiveCurrentAttributeSubscriptionState() + + object SubscriptionEstablished : ActiveCurrentAttributeSubscriptionState() + } + + class ReactiveCurrentAttribute(val value: Long?) + + sealed class ReactiveCurrentAttributeSubscriptionState { + data class Success(val value: Long?) : ReactiveCurrentAttributeSubscriptionState() + + data class Error(val exception: Exception) : ReactiveCurrentAttributeSubscriptionState() + + object SubscriptionEstablished : ReactiveCurrentAttributeSubscriptionState() + } + + class ApparentCurrentAttribute(val value: Long?) + + sealed class ApparentCurrentAttributeSubscriptionState { + data class Success(val value: Long?) : ApparentCurrentAttributeSubscriptionState() + + data class Error(val exception: Exception) : ApparentCurrentAttributeSubscriptionState() + + object SubscriptionEstablished : ApparentCurrentAttributeSubscriptionState() + } + + class ActivePowerAttribute(val value: Long?) + + sealed class ActivePowerAttributeSubscriptionState { + data class Success(val value: Long?) : ActivePowerAttributeSubscriptionState() + + data class Error(val exception: Exception) : ActivePowerAttributeSubscriptionState() + + object SubscriptionEstablished : ActivePowerAttributeSubscriptionState() + } + + class ReactivePowerAttribute(val value: Long?) + + sealed class ReactivePowerAttributeSubscriptionState { + data class Success(val value: Long?) : ReactivePowerAttributeSubscriptionState() + + data class Error(val exception: Exception) : ReactivePowerAttributeSubscriptionState() + + object SubscriptionEstablished : ReactivePowerAttributeSubscriptionState() + } + + class ApparentPowerAttribute(val value: Long?) + + sealed class ApparentPowerAttributeSubscriptionState { + data class Success(val value: Long?) : ApparentPowerAttributeSubscriptionState() + + data class Error(val exception: Exception) : ApparentPowerAttributeSubscriptionState() + + object SubscriptionEstablished : ApparentPowerAttributeSubscriptionState() + } + + class RMSVoltageAttribute(val value: Long?) + + sealed class RMSVoltageAttributeSubscriptionState { + data class Success(val value: Long?) : RMSVoltageAttributeSubscriptionState() + + data class Error(val exception: Exception) : RMSVoltageAttributeSubscriptionState() + + object SubscriptionEstablished : RMSVoltageAttributeSubscriptionState() + } + + class RMSCurrentAttribute(val value: Long?) + + sealed class RMSCurrentAttributeSubscriptionState { + data class Success(val value: Long?) : RMSCurrentAttributeSubscriptionState() + + data class Error(val exception: Exception) : RMSCurrentAttributeSubscriptionState() + + object SubscriptionEstablished : RMSCurrentAttributeSubscriptionState() + } + + class RMSPowerAttribute(val value: Long?) + + sealed class RMSPowerAttributeSubscriptionState { + data class Success(val value: Long?) : RMSPowerAttributeSubscriptionState() + + data class Error(val exception: Exception) : RMSPowerAttributeSubscriptionState() + + object SubscriptionEstablished : RMSPowerAttributeSubscriptionState() + } + + class FrequencyAttribute(val value: Long?) + + sealed class FrequencyAttributeSubscriptionState { + data class Success(val value: Long?) : FrequencyAttributeSubscriptionState() + + data class Error(val exception: Exception) : FrequencyAttributeSubscriptionState() + + object SubscriptionEstablished : FrequencyAttributeSubscriptionState() + } + + class HarmonicCurrentsAttribute( + val value: List? + ) + + sealed class HarmonicCurrentsAttributeSubscriptionState { + data class Success( + val value: List? + ) : HarmonicCurrentsAttributeSubscriptionState() + + data class Error(val exception: Exception) : HarmonicCurrentsAttributeSubscriptionState() + + object SubscriptionEstablished : HarmonicCurrentsAttributeSubscriptionState() + } + + class HarmonicPhasesAttribute( + val value: List? + ) + + sealed class HarmonicPhasesAttributeSubscriptionState { + data class Success( + val value: List? + ) : HarmonicPhasesAttributeSubscriptionState() + + data class Error(val exception: Exception) : HarmonicPhasesAttributeSubscriptionState() + + object SubscriptionEstablished : HarmonicPhasesAttributeSubscriptionState() + } + + class PowerFactorAttribute(val value: Long?) + + sealed class PowerFactorAttributeSubscriptionState { + data class Success(val value: Long?) : PowerFactorAttributeSubscriptionState() + + data class Error(val exception: Exception) : PowerFactorAttributeSubscriptionState() + + object SubscriptionEstablished : PowerFactorAttributeSubscriptionState() + } + + class NeutralCurrentAttribute(val value: Long?) + + sealed class NeutralCurrentAttributeSubscriptionState { + data class Success(val value: Long?) : NeutralCurrentAttributeSubscriptionState() + + data class Error(val exception: Exception) : NeutralCurrentAttributeSubscriptionState() + + object SubscriptionEstablished : NeutralCurrentAttributeSubscriptionState() + } + + class GeneratedCommandListAttribute(val value: List) + + sealed class GeneratedCommandListAttributeSubscriptionState { + data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState() + } + + class AcceptedCommandListAttribute(val value: List) + + sealed class AcceptedCommandListAttributeSubscriptionState { + data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState() + + object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState() + } + + class EventListAttribute(val value: List) + + sealed class EventListAttributeSubscriptionState { + data class Success(val value: List) : EventListAttributeSubscriptionState() + + data class Error(val exception: Exception) : EventListAttributeSubscriptionState() + + object SubscriptionEstablished : EventListAttributeSubscriptionState() + } + + class AttributeListAttribute(val value: List) + + sealed class AttributeListAttributeSubscriptionState { + data class Success(val value: List) : AttributeListAttributeSubscriptionState() + + data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState() + + object SubscriptionEstablished : AttributeListAttributeSubscriptionState() + } + + suspend fun readPowerModeAttribute(): UByte { + val ATTRIBUTE_ID: UInt = 0u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Powermode attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + return decodedValue + } + + suspend fun subscribePowerModeAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 0u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UByteSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Powermode attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + emit(UByteSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readNumberOfMeasurementTypesAttribute(): UByte { + val ATTRIBUTE_ID: UInt = 1u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Numberofmeasurementtypes attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeNumberOfMeasurementTypesAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 1u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UByteSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Numberofmeasurementtypes attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UByte = tlvReader.getUByte(AnonymousTag) + + emit(UByteSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UByteSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAccuracyAttribute(): AccuracyAttribute { + val ATTRIBUTE_ID: UInt = 2u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Accuracy attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + + return AccuracyAttribute(decodedValue) + } + + suspend fun subscribeAccuracyAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 2u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AccuracyAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Accuracy attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + + emit(AccuracyAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AccuracyAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readRangesAttribute(): RangesAttribute { + val ATTRIBUTE_ID: UInt = 3u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Ranges attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalPowerMeasurementClusterMeasurementRangeStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + } else { + null + } + + return RangesAttribute(decodedValue) + } + + suspend fun subscribeRangesAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 3u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + RangesAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Ranges attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalPowerMeasurementClusterMeasurementRangeStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + } else { + null + } + + decodedValue?.let { emit(RangesAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(RangesAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readVoltageAttribute(): VoltageAttribute { + val ATTRIBUTE_ID: UInt = 4u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Voltage attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return VoltageAttribute(decodedValue) + } + + suspend fun subscribeVoltageAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 4u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + VoltageAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Voltage attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(VoltageAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(VoltageAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readActiveCurrentAttribute(): ActiveCurrentAttribute { + val ATTRIBUTE_ID: UInt = 5u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Activecurrent attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return ActiveCurrentAttribute(decodedValue) + } + + suspend fun subscribeActiveCurrentAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 5u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ActiveCurrentAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Activecurrent attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(ActiveCurrentAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ActiveCurrentAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readReactiveCurrentAttribute(): ReactiveCurrentAttribute { + val ATTRIBUTE_ID: UInt = 6u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Reactivecurrent attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return ReactiveCurrentAttribute(decodedValue) + } + + suspend fun subscribeReactiveCurrentAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 6u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ReactiveCurrentAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Reactivecurrent attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(ReactiveCurrentAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ReactiveCurrentAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readApparentCurrentAttribute(): ApparentCurrentAttribute { + val ATTRIBUTE_ID: UInt = 7u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Apparentcurrent attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return ApparentCurrentAttribute(decodedValue) + } + + suspend fun subscribeApparentCurrentAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 7u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ApparentCurrentAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Apparentcurrent attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(ApparentCurrentAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ApparentCurrentAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readActivePowerAttribute(): ActivePowerAttribute { + val ATTRIBUTE_ID: UInt = 8u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Activepower attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + tlvReader.getLong(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return ActivePowerAttribute(decodedValue) + } + + suspend fun subscribeActivePowerAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 8u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ActivePowerAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Activepower attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + tlvReader.getLong(AnonymousTag) + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(ActivePowerAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ActivePowerAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readReactivePowerAttribute(): ReactivePowerAttribute { + val ATTRIBUTE_ID: UInt = 9u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Reactivepower attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return ReactivePowerAttribute(decodedValue) + } + + suspend fun subscribeReactivePowerAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 9u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ReactivePowerAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Reactivepower attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(ReactivePowerAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ReactivePowerAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readApparentPowerAttribute(): ApparentPowerAttribute { + val ATTRIBUTE_ID: UInt = 10u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Apparentpower attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return ApparentPowerAttribute(decodedValue) + } + + suspend fun subscribeApparentPowerAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 10u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + ApparentPowerAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Apparentpower attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(ApparentPowerAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(ApparentPowerAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readRMSVoltageAttribute(): RMSVoltageAttribute { + val ATTRIBUTE_ID: UInt = 11u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Rmsvoltage attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return RMSVoltageAttribute(decodedValue) + } + + suspend fun subscribeRMSVoltageAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 11u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + RMSVoltageAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Rmsvoltage attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(RMSVoltageAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(RMSVoltageAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readRMSCurrentAttribute(): RMSCurrentAttribute { + val ATTRIBUTE_ID: UInt = 12u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Rmscurrent attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return RMSCurrentAttribute(decodedValue) + } + + suspend fun subscribeRMSCurrentAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 12u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + RMSCurrentAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Rmscurrent attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(RMSCurrentAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(RMSCurrentAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readRMSPowerAttribute(): RMSPowerAttribute { + val ATTRIBUTE_ID: UInt = 13u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Rmspower attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return RMSPowerAttribute(decodedValue) + } + + suspend fun subscribeRMSPowerAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 13u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + RMSPowerAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Rmspower attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(RMSPowerAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(RMSPowerAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFrequencyAttribute(): FrequencyAttribute { + val ATTRIBUTE_ID: UInt = 14u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Frequency attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return FrequencyAttribute(decodedValue) + } + + suspend fun subscribeFrequencyAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 14u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + FrequencyAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Frequency attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(FrequencyAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(FrequencyAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readHarmonicCurrentsAttribute(): HarmonicCurrentsAttribute { + val ATTRIBUTE_ID: UInt = 15u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Harmoniccurrents attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return HarmonicCurrentsAttribute(decodedValue) + } + + suspend fun subscribeHarmonicCurrentsAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 15u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + HarmonicCurrentsAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Harmoniccurrents attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(HarmonicCurrentsAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(HarmonicCurrentsAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readHarmonicPhasesAttribute(): HarmonicPhasesAttribute { + val ATTRIBUTE_ID: UInt = 16u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Harmonicphases attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return HarmonicPhasesAttribute(decodedValue) + } + + suspend fun subscribeHarmonicPhasesAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 16u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + HarmonicPhasesAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Harmonicphases attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add( + ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(HarmonicPhasesAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(HarmonicPhasesAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readPowerFactorAttribute(): PowerFactorAttribute { + val ATTRIBUTE_ID: UInt = 17u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Powerfactor attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return PowerFactorAttribute(decodedValue) + } + + suspend fun subscribePowerFactorAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 17u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + PowerFactorAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Powerfactor attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(PowerFactorAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(PowerFactorAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readNeutralCurrentAttribute(): NeutralCurrentAttribute { + val ATTRIBUTE_ID: UInt = 18u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Neutralcurrent attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + return NeutralCurrentAttribute(decodedValue) + } + + suspend fun subscribeNeutralCurrentAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 18u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + NeutralCurrentAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Neutralcurrent attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: Long? = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(AnonymousTag)) { + tlvReader.getLong(AnonymousTag) + } else { + null + } + } else { + tlvReader.getNull(AnonymousTag) + null + } + + decodedValue?.let { emit(NeutralCurrentAttributeSubscriptionState.Success(it)) } + } + SubscriptionState.SubscriptionEstablished -> { + emit(NeutralCurrentAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65528u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Generatedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return GeneratedCommandListAttribute(decodedValue) + } + + suspend fun subscribeGeneratedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65528u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + GeneratedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Generatedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute { + val ATTRIBUTE_ID: UInt = 65529u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Acceptedcommandlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AcceptedCommandListAttribute(decodedValue) + } + + suspend fun subscribeAcceptedCommandListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65529u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AcceptedCommandListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Acceptedcommandlist attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readEventListAttribute(): EventListAttribute { + val ATTRIBUTE_ID: UInt = 65530u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Eventlist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return EventListAttribute(decodedValue) + } + + suspend fun subscribeEventListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65530u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + EventListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Eventlist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(EventListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(EventListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readAttributeListAttribute(): AttributeListAttribute { + val ATTRIBUTE_ID: UInt = 65531u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Attributelist attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + return AttributeListAttribute(decodedValue) + } + + suspend fun subscribeAttributeListAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65531u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + AttributeListAttributeSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Attributelist attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: List = + buildList { + tlvReader.enterArray(AnonymousTag) + while (!tlvReader.isEndOfContainer()) { + add(tlvReader.getUInt(AnonymousTag)) + } + tlvReader.exitContainer() + } + + emit(AttributeListAttributeSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readFeatureMapAttribute(): UInt { + val ATTRIBUTE_ID: UInt = 65532u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Featuremap attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeFeatureMapAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65532u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UIntSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { "Featuremap attribute not found in Node State update" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UInt = tlvReader.getUInt(AnonymousTag) + + emit(UIntSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UIntSubscriptionState.SubscriptionEstablished) + } + } + } + } + + suspend fun readClusterRevisionAttribute(): UShort { + val ATTRIBUTE_ID: UInt = 65533u + + val attributePath = + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + + val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath)) + + val response = controller.read(readRequest) + + if (response.successes.isEmpty()) { + logger.log(Level.WARNING, "Read command failed") + throw IllegalStateException("Read command failed with failures: ${response.failures}") + } + + logger.log(Level.FINE, "Read command succeeded") + + val attributeData = + response.successes.filterIsInstance().firstOrNull { + it.path.attributeId == ATTRIBUTE_ID + } + + requireNotNull(attributeData) { "Clusterrevision attribute not found in response" } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + return decodedValue + } + + suspend fun subscribeClusterRevisionAttribute( + minInterval: Int, + maxInterval: Int + ): Flow { + val ATTRIBUTE_ID: UInt = 65533u + val attributePaths = + listOf( + AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID) + ) + + val subscribeRequest: SubscribeRequest = + SubscribeRequest( + eventPaths = emptyList(), + attributePaths = attributePaths, + minInterval = Duration.ofSeconds(minInterval.toLong()), + maxInterval = Duration.ofSeconds(maxInterval.toLong()) + ) + + return controller.subscribe(subscribeRequest).transform { subscriptionState -> + when (subscriptionState) { + is SubscriptionState.SubscriptionErrorNotification -> { + emit( + UShortSubscriptionState.Error( + Exception( + "Subscription terminated with error code: ${subscriptionState.terminationCause}" + ) + ) + ) + } + is SubscriptionState.NodeStateUpdate -> { + val attributeData = + subscriptionState.updateState.successes + .filterIsInstance() + .firstOrNull { it.path.attributeId == ATTRIBUTE_ID } + + requireNotNull(attributeData) { + "Clusterrevision attribute not found in Node State update" + } + + // Decode the TLV data into the appropriate type + val tlvReader = TlvReader(attributeData.data) + val decodedValue: UShort = tlvReader.getUShort(AnonymousTag) + + emit(UShortSubscriptionState.Success(decodedValue)) + } + SubscriptionState.SubscriptionEstablished -> { + emit(UShortSubscriptionState.SubscriptionEstablished) + } + } + } + } + + companion object { + private val logger = Logger.getLogger(ElectricalPowerMeasurementCluster::class.java.name) + const val CLUSTER_ID: UInt = 144u + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent.kt new file mode 100644 index 00000000000000..1618b5cc9ac5a9 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent.kt @@ -0,0 +1,76 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.eventstructs + +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent( + val ranges: + List +) { + override fun toString(): String = buildString { + append("ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent {\n") + append("\tranges : $ranges\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + startArray(ContextSpecificTag(TAG_RANGES)) + for (item in ranges.iterator()) { + item.toTlv(AnonymousTag, this) + } + endArray() + endStructure() + } + } + + companion object { + private const val TAG_RANGES = 0 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent { + tlvReader.enterStructure(tlvTag) + val ranges = + buildList< + matter.controller.cluster.structs.ElectricalPowerMeasurementClusterMeasurementRangeStruct + > { + tlvReader.enterArray(ContextSpecificTag(TAG_RANGES)) + while (!tlvReader.isEndOfContainer()) { + this.add( + matter.controller.cluster.structs + .ElectricalPowerMeasurementClusterMeasurementRangeStruct + .fromTlv(AnonymousTag, tlvReader) + ) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent(ranges) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni index 83a43a79ffe791..a5ca9a57966e49 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/files.gni +++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni @@ -55,9 +55,14 @@ matter_structs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DishwasherModeClusterModeOptionStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DishwasherModeClusterModeTagStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/DoorLockClusterCredentialStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterEnergyMeasurementStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetScheduleStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseClusterChargingTargetStruct.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/EnergyEvseModeClusterModeOptionStruct.kt", @@ -161,6 +166,7 @@ matter_eventstructs_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/DoorLockClusterLockUserChangeEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ElectricalEnergyMeasurementClusterCumulativeEnergyMeasuredEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ElectricalEnergyMeasurementClusterPeriodicEnergyMeasuredEvent.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt", @@ -252,6 +258,7 @@ matter_clusters_sources = [ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalEnergyMeasurementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalMeasurementCluster.kt", + "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ElectricalPowerMeasurementCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyEvseModeCluster.kt", "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/EnergyPreferenceCluster.kt", diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt new file mode 100644 index 00000000000000..9ae505db1e48b3 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct.kt @@ -0,0 +1,146 @@ +/* + * + * 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.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct( + val importedResetTimestamp: Optional?, + val exportedResetTimestamp: Optional?, + val importedResetSystime: Optional?, + val exportedResetSystime: Optional? +) { + override fun toString(): String = buildString { + append("ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct {\n") + append("\timportedResetTimestamp : $importedResetTimestamp\n") + append("\texportedResetTimestamp : $exportedResetTimestamp\n") + append("\timportedResetSystime : $importedResetSystime\n") + append("\texportedResetSystime : $exportedResetSystime\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + if (importedResetTimestamp != null) { + if (importedResetTimestamp.isPresent) { + val optimportedResetTimestamp = importedResetTimestamp.get() + put(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP), optimportedResetTimestamp) + } + } else { + putNull(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP)) + } + if (exportedResetTimestamp != null) { + if (exportedResetTimestamp.isPresent) { + val optexportedResetTimestamp = exportedResetTimestamp.get() + put(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP), optexportedResetTimestamp) + } + } else { + putNull(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP)) + } + if (importedResetSystime != null) { + if (importedResetSystime.isPresent) { + val optimportedResetSystime = importedResetSystime.get() + put(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME), optimportedResetSystime) + } + } else { + putNull(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME)) + } + if (exportedResetSystime != null) { + if (exportedResetSystime.isPresent) { + val optexportedResetSystime = exportedResetSystime.get() + put(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME), optexportedResetSystime) + } + } else { + putNull(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME)) + } + endStructure() + } + } + + companion object { + private const val TAG_IMPORTED_RESET_TIMESTAMP = 0 + private const val TAG_EXPORTED_RESET_TIMESTAMP = 1 + private const val TAG_IMPORTED_RESET_SYSTIME = 2 + private const val TAG_EXPORTED_RESET_SYSTIME = 3 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct { + tlvReader.enterStructure(tlvTag) + val importedResetTimestamp = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_IMPORTED_RESET_TIMESTAMP)) + null + } + val exportedResetTimestamp = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EXPORTED_RESET_TIMESTAMP)) + null + } + val importedResetSystime = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_IMPORTED_RESET_SYSTIME)) + null + } + val exportedResetSystime = + if (!tlvReader.isNull()) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME))) + } else { + Optional.empty() + } + } else { + tlvReader.getNull(ContextSpecificTag(TAG_EXPORTED_RESET_SYSTIME)) + null + } + + tlvReader.exitContainer() + + return ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct( + importedResetTimestamp, + exportedResetTimestamp, + importedResetSystime, + exportedResetSystime + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.kt new file mode 100644 index 00000000000000..54c2868f6dd8f0 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterHarmonicMeasurementStruct.kt @@ -0,0 +1,72 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package matter.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalPowerMeasurementClusterHarmonicMeasurementStruct( + val order: UByte, + val measurement: Long? +) { + override fun toString(): String = buildString { + append("ElectricalPowerMeasurementClusterHarmonicMeasurementStruct {\n") + append("\torder : $order\n") + append("\tmeasurement : $measurement\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_ORDER), order) + if (measurement != null) { + put(ContextSpecificTag(TAG_MEASUREMENT), measurement) + } else { + putNull(ContextSpecificTag(TAG_MEASUREMENT)) + } + endStructure() + } + } + + companion object { + private const val TAG_ORDER = 0 + private const val TAG_MEASUREMENT = 1 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalPowerMeasurementClusterHarmonicMeasurementStruct { + tlvReader.enterStructure(tlvTag) + val order = tlvReader.getUByte(ContextSpecificTag(TAG_ORDER)) + val measurement = + if (!tlvReader.isNull()) { + tlvReader.getLong(ContextSpecificTag(TAG_MEASUREMENT)) + } else { + tlvReader.getNull(ContextSpecificTag(TAG_MEASUREMENT)) + null + } + + tlvReader.exitContainer() + + return ElectricalPowerMeasurementClusterHarmonicMeasurementStruct(order, measurement) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.kt new file mode 100644 index 00000000000000..18e5534ff45480 --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.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.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct( + 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("ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct {\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 + ): ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct { + 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 ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct( + rangeMin, + rangeMax, + percentMax, + percentMin, + percentTypical, + fixedMax, + fixedMin, + fixedTypical + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.kt new file mode 100644 index 00000000000000..895b52e30fca5f --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementAccuracyStruct.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.controller.cluster.structs + +import matter.controller.cluster.* +import matter.tlv.AnonymousTag +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalPowerMeasurementClusterMeasurementAccuracyStruct( + val measurementType: UShort, + val measured: Boolean, + val minMeasuredValue: Long, + val maxMeasuredValue: Long, + val accuracyRanges: List +) { + override fun toString(): String = buildString { + append("ElectricalPowerMeasurementClusterMeasurementAccuracyStruct {\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 + ): ElectricalPowerMeasurementClusterMeasurementAccuracyStruct { + tlvReader.enterStructure(tlvTag) + val measurementType = tlvReader.getUShort(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( + ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct.fromTlv( + AnonymousTag, + tlvReader + ) + ) + } + tlvReader.exitContainer() + } + + tlvReader.exitContainer() + + return ElectricalPowerMeasurementClusterMeasurementAccuracyStruct( + measurementType, + measured, + minMeasuredValue, + maxMeasuredValue, + accuracyRanges + ) + } + } +} diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt new file mode 100644 index 00000000000000..4550a6a514b22e --- /dev/null +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ElectricalPowerMeasurementClusterMeasurementRangeStruct.kt @@ -0,0 +1,184 @@ +/* + * + * 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.controller.cluster.structs + +import java.util.Optional +import matter.controller.cluster.* +import matter.tlv.ContextSpecificTag +import matter.tlv.Tag +import matter.tlv.TlvReader +import matter.tlv.TlvWriter + +class ElectricalPowerMeasurementClusterMeasurementRangeStruct( + val measurementType: UShort, + val min: Long, + val max: Long, + val startTimestamp: Optional, + val endTimestamp: Optional, + val minTimestamp: Optional, + val maxTimestamp: Optional, + val startSystime: Optional, + val endSystime: Optional, + val minSystime: Optional, + val maxSystime: Optional +) { + override fun toString(): String = buildString { + append("ElectricalPowerMeasurementClusterMeasurementRangeStruct {\n") + append("\tmeasurementType : $measurementType\n") + append("\tmin : $min\n") + append("\tmax : $max\n") + append("\tstartTimestamp : $startTimestamp\n") + append("\tendTimestamp : $endTimestamp\n") + append("\tminTimestamp : $minTimestamp\n") + append("\tmaxTimestamp : $maxTimestamp\n") + append("\tstartSystime : $startSystime\n") + append("\tendSystime : $endSystime\n") + append("\tminSystime : $minSystime\n") + append("\tmaxSystime : $maxSystime\n") + append("}\n") + } + + fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { + tlvWriter.apply { + startStructure(tlvTag) + put(ContextSpecificTag(TAG_MEASUREMENT_TYPE), measurementType) + put(ContextSpecificTag(TAG_MIN), min) + put(ContextSpecificTag(TAG_MAX), max) + 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 (minTimestamp.isPresent) { + val optminTimestamp = minTimestamp.get() + put(ContextSpecificTag(TAG_MIN_TIMESTAMP), optminTimestamp) + } + if (maxTimestamp.isPresent) { + val optmaxTimestamp = maxTimestamp.get() + put(ContextSpecificTag(TAG_MAX_TIMESTAMP), optmaxTimestamp) + } + 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) + } + if (minSystime.isPresent) { + val optminSystime = minSystime.get() + put(ContextSpecificTag(TAG_MIN_SYSTIME), optminSystime) + } + if (maxSystime.isPresent) { + val optmaxSystime = maxSystime.get() + put(ContextSpecificTag(TAG_MAX_SYSTIME), optmaxSystime) + } + endStructure() + } + } + + companion object { + private const val TAG_MEASUREMENT_TYPE = 0 + private const val TAG_MIN = 1 + private const val TAG_MAX = 2 + private const val TAG_START_TIMESTAMP = 3 + private const val TAG_END_TIMESTAMP = 4 + private const val TAG_MIN_TIMESTAMP = 5 + private const val TAG_MAX_TIMESTAMP = 6 + private const val TAG_START_SYSTIME = 7 + private const val TAG_END_SYSTIME = 8 + private const val TAG_MIN_SYSTIME = 9 + private const val TAG_MAX_SYSTIME = 10 + + fun fromTlv( + tlvTag: Tag, + tlvReader: TlvReader + ): ElectricalPowerMeasurementClusterMeasurementRangeStruct { + tlvReader.enterStructure(tlvTag) + val measurementType = tlvReader.getUShort(ContextSpecificTag(TAG_MEASUREMENT_TYPE)) + val min = tlvReader.getLong(ContextSpecificTag(TAG_MIN)) + val max = tlvReader.getLong(ContextSpecificTag(TAG_MAX)) + 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 minTimestamp = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MIN_TIMESTAMP))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MIN_TIMESTAMP))) + } else { + Optional.empty() + } + val maxTimestamp = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MAX_TIMESTAMP))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MAX_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() + } + val minSystime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MIN_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_MIN_SYSTIME))) + } else { + Optional.empty() + } + val maxSystime = + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MAX_SYSTIME))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_MAX_SYSTIME))) + } else { + Optional.empty() + } + + tlvReader.exitContainer() + + return ElectricalPowerMeasurementClusterMeasurementRangeStruct( + measurementType, + min, + max, + startTimestamp, + endTimestamp, + minTimestamp, + maxTimestamp, + startSystime, + endSystime, + minSystime, + maxSystime + ) + } + } +} diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 96243f8da40123..ed442d794794ff 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -19550,6 +19550,1080 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } break; } + case app::Clusters::ElectricalPowerMeasurement::Id: { + using namespace app::Clusters::ElectricalPowerMeasurement; + switch (aPath.mAttributeId) + { + case Attributes::PowerMode::Id: { + using TypeInfo = Attributes::PowerMode::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; + } + case Attributes::NumberOfMeasurementTypes::Id: { + using TypeInfo = Attributes::NumberOfMeasurementTypes::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; + } + 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; + 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; + jobject newElement_0_measurementType; + std::string newElement_0_measurementTypeClassName = "java/lang/Integer"; + std::string newElement_0_measurementTypeCtorSignature = "(I)V"; + jint jninewElement_0_measurementType = static_cast(entry_0.measurementType); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_measurementTypeClassName.c_str(), newElement_0_measurementTypeCtorSignature.c_str(), + jninewElement_0_measurementType, newElement_0_measurementType); + jobject newElement_0_measured; + std::string newElement_0_measuredClassName = "java/lang/Boolean"; + std::string newElement_0_measuredCtorSignature = "(Z)V"; + jboolean jninewElement_0_measured = static_cast(entry_0.measured); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_measuredClassName.c_str(), + newElement_0_measuredCtorSignature.c_str(), + jninewElement_0_measured, newElement_0_measured); + jobject newElement_0_minMeasuredValue; + std::string newElement_0_minMeasuredValueClassName = "java/lang/Long"; + std::string newElement_0_minMeasuredValueCtorSignature = "(J)V"; + jlong jninewElement_0_minMeasuredValue = static_cast(entry_0.minMeasuredValue); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_minMeasuredValueClassName.c_str(), newElement_0_minMeasuredValueCtorSignature.c_str(), + jninewElement_0_minMeasuredValue, newElement_0_minMeasuredValue); + jobject newElement_0_maxMeasuredValue; + std::string newElement_0_maxMeasuredValueClassName = "java/lang/Long"; + std::string newElement_0_maxMeasuredValueCtorSignature = "(J)V"; + jlong jninewElement_0_maxMeasuredValue = static_cast(entry_0.maxMeasuredValue); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_maxMeasuredValueClassName.c_str(), newElement_0_maxMeasuredValueCtorSignature.c_str(), + jninewElement_0_maxMeasuredValue, newElement_0_maxMeasuredValue); + jobject newElement_0_accuracyRanges; + chip::JniReferences::GetInstance().CreateArrayList(newElement_0_accuracyRanges); + + auto iter_newElement_0_accuracyRanges_2 = entry_0.accuracyRanges.begin(); + while (iter_newElement_0_accuracyRanges_2.Next()) + { + auto & entry_2 = iter_newElement_0_accuracyRanges_2.GetValue(); + jobject newElement_2; + jobject newElement_2_rangeMin; + std::string newElement_2_rangeMinClassName = "java/lang/Long"; + std::string newElement_2_rangeMinCtorSignature = "(J)V"; + jlong jninewElement_2_rangeMin = static_cast(entry_2.rangeMin); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_rangeMinClassName.c_str(), + newElement_2_rangeMinCtorSignature.c_str(), + jninewElement_2_rangeMin, newElement_2_rangeMin); + jobject newElement_2_rangeMax; + std::string newElement_2_rangeMaxClassName = "java/lang/Long"; + std::string newElement_2_rangeMaxCtorSignature = "(J)V"; + jlong jninewElement_2_rangeMax = static_cast(entry_2.rangeMax); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_2_rangeMaxClassName.c_str(), + newElement_2_rangeMaxCtorSignature.c_str(), + jninewElement_2_rangeMax, newElement_2_rangeMax); + jobject newElement_2_percentMax; + if (!entry_2.percentMax.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_percentMax); + } + else + { + jobject newElement_2_percentMaxInsideOptional; + std::string newElement_2_percentMaxInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_percentMaxInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_percentMaxInsideOptional = static_cast(entry_2.percentMax.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_percentMaxInsideOptionalClassName.c_str(), + newElement_2_percentMaxInsideOptionalCtorSignature.c_str(), jninewElement_2_percentMaxInsideOptional, + newElement_2_percentMaxInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_percentMaxInsideOptional, + newElement_2_percentMax); + } + jobject newElement_2_percentMin; + if (!entry_2.percentMin.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_percentMin); + } + else + { + jobject newElement_2_percentMinInsideOptional; + std::string newElement_2_percentMinInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_percentMinInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_percentMinInsideOptional = static_cast(entry_2.percentMin.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_percentMinInsideOptionalClassName.c_str(), + newElement_2_percentMinInsideOptionalCtorSignature.c_str(), jninewElement_2_percentMinInsideOptional, + newElement_2_percentMinInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_percentMinInsideOptional, + newElement_2_percentMin); + } + jobject newElement_2_percentTypical; + if (!entry_2.percentTypical.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_percentTypical); + } + else + { + jobject newElement_2_percentTypicalInsideOptional; + std::string newElement_2_percentTypicalInsideOptionalClassName = "java/lang/Integer"; + std::string newElement_2_percentTypicalInsideOptionalCtorSignature = "(I)V"; + jint jninewElement_2_percentTypicalInsideOptional = static_cast(entry_2.percentTypical.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_percentTypicalInsideOptionalClassName.c_str(), + newElement_2_percentTypicalInsideOptionalCtorSignature.c_str(), + jninewElement_2_percentTypicalInsideOptional, newElement_2_percentTypicalInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_percentTypicalInsideOptional, + newElement_2_percentTypical); + } + jobject newElement_2_fixedMax; + if (!entry_2.fixedMax.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_fixedMax); + } + else + { + jobject newElement_2_fixedMaxInsideOptional; + std::string newElement_2_fixedMaxInsideOptionalClassName = "java/lang/Long"; + std::string newElement_2_fixedMaxInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_2_fixedMaxInsideOptional = static_cast(entry_2.fixedMax.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_fixedMaxInsideOptionalClassName.c_str(), + newElement_2_fixedMaxInsideOptionalCtorSignature.c_str(), jninewElement_2_fixedMaxInsideOptional, + newElement_2_fixedMaxInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_fixedMaxInsideOptional, + newElement_2_fixedMax); + } + jobject newElement_2_fixedMin; + if (!entry_2.fixedMin.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_fixedMin); + } + else + { + jobject newElement_2_fixedMinInsideOptional; + std::string newElement_2_fixedMinInsideOptionalClassName = "java/lang/Long"; + std::string newElement_2_fixedMinInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_2_fixedMinInsideOptional = static_cast(entry_2.fixedMin.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_fixedMinInsideOptionalClassName.c_str(), + newElement_2_fixedMinInsideOptionalCtorSignature.c_str(), jninewElement_2_fixedMinInsideOptional, + newElement_2_fixedMinInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_fixedMinInsideOptional, + newElement_2_fixedMin); + } + jobject newElement_2_fixedTypical; + if (!entry_2.fixedTypical.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_2_fixedTypical); + } + else + { + jobject newElement_2_fixedTypicalInsideOptional; + std::string newElement_2_fixedTypicalInsideOptionalClassName = "java/lang/Long"; + std::string newElement_2_fixedTypicalInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_2_fixedTypicalInsideOptional = static_cast(entry_2.fixedTypical.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_2_fixedTypicalInsideOptionalClassName.c_str(), + newElement_2_fixedTypicalInsideOptionalCtorSignature.c_str(), + jninewElement_2_fixedTypicalInsideOptional, newElement_2_fixedTypicalInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_2_fixedTypicalInsideOptional, + newElement_2_fixedTypical); + } + + jclass measurementAccuracyRangeStructStructClass_3; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct", + measurementAccuracyRangeStructStructClass_3); + if (err != CHIP_NO_ERROR) + { + ChipLogError( + Zcl, + "Could not find class ChipStructs$ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct"); + return nullptr; + } + + jmethodID measurementAccuracyRangeStructStructCtor_3; + err = chip::JniReferences::GetInstance().FindMethod( + env, measurementAccuracyRangeStructStructClass_3, "", + "(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", + &measurementAccuracyRangeStructStructCtor_3); + if (err != CHIP_NO_ERROR || measurementAccuracyRangeStructStructCtor_3 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$ElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct " + "constructor"); + return nullptr; + } + + newElement_2 = env->NewObject( + measurementAccuracyRangeStructStructClass_3, measurementAccuracyRangeStructStructCtor_3, + newElement_2_rangeMin, newElement_2_rangeMax, newElement_2_percentMax, newElement_2_percentMin, + newElement_2_percentTypical, newElement_2_fixedMax, newElement_2_fixedMin, newElement_2_fixedTypical); + chip::JniReferences::GetInstance().AddToList(newElement_0_accuracyRanges, newElement_2); + } + + jclass measurementAccuracyStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalPowerMeasurementClusterMeasurementAccuracyStruct", + measurementAccuracyStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$ElectricalPowerMeasurementClusterMeasurementAccuracyStruct"); + return nullptr; + } + + jmethodID measurementAccuracyStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, measurementAccuracyStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Long;Ljava/lang/Long;Ljava/util/ArrayList;)V", + &measurementAccuracyStructStructCtor_1); + if (err != CHIP_NO_ERROR || measurementAccuracyStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, "Could not find ChipStructs$ElectricalPowerMeasurementClusterMeasurementAccuracyStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(measurementAccuracyStructStructClass_1, measurementAccuracyStructStructCtor_1, + newElement_0_measurementType, newElement_0_measured, newElement_0_minMeasuredValue, + newElement_0_maxMeasuredValue, newElement_0_accuracyRanges); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::Ranges::Id: { + using TypeInfo = Attributes::Ranges::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; + jobject newElement_0_measurementType; + std::string newElement_0_measurementTypeClassName = "java/lang/Integer"; + std::string newElement_0_measurementTypeCtorSignature = "(I)V"; + jint jninewElement_0_measurementType = static_cast(entry_0.measurementType); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_measurementTypeClassName.c_str(), newElement_0_measurementTypeCtorSignature.c_str(), + jninewElement_0_measurementType, newElement_0_measurementType); + jobject newElement_0_min; + std::string newElement_0_minClassName = "java/lang/Long"; + std::string newElement_0_minCtorSignature = "(J)V"; + jlong jninewElement_0_min = static_cast(entry_0.min); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_minClassName.c_str(), + newElement_0_minCtorSignature.c_str(), + jninewElement_0_min, newElement_0_min); + jobject newElement_0_max; + std::string newElement_0_maxClassName = "java/lang/Long"; + std::string newElement_0_maxCtorSignature = "(J)V"; + jlong jninewElement_0_max = static_cast(entry_0.max); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_maxClassName.c_str(), + newElement_0_maxCtorSignature.c_str(), + jninewElement_0_max, newElement_0_max); + jobject newElement_0_startTimestamp; + if (!entry_0.startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_startTimestamp); + } + else + { + jobject newElement_0_startTimestampInsideOptional; + std::string newElement_0_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_startTimestampInsideOptional = static_cast(entry_0.startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_startTimestampInsideOptionalClassName.c_str(), + newElement_0_startTimestampInsideOptionalCtorSignature.c_str(), + jninewElement_0_startTimestampInsideOptional, newElement_0_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_startTimestampInsideOptional, + newElement_0_startTimestamp); + } + jobject newElement_0_endTimestamp; + if (!entry_0.endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_endTimestamp); + } + else + { + jobject newElement_0_endTimestampInsideOptional; + std::string newElement_0_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_endTimestampInsideOptional = static_cast(entry_0.endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_endTimestampInsideOptionalClassName.c_str(), + newElement_0_endTimestampInsideOptionalCtorSignature.c_str(), jninewElement_0_endTimestampInsideOptional, + newElement_0_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_endTimestampInsideOptional, + newElement_0_endTimestamp); + } + jobject newElement_0_minTimestamp; + if (!entry_0.minTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_minTimestamp); + } + else + { + jobject newElement_0_minTimestampInsideOptional; + std::string newElement_0_minTimestampInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_minTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_minTimestampInsideOptional = static_cast(entry_0.minTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_minTimestampInsideOptionalClassName.c_str(), + newElement_0_minTimestampInsideOptionalCtorSignature.c_str(), jninewElement_0_minTimestampInsideOptional, + newElement_0_minTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_minTimestampInsideOptional, + newElement_0_minTimestamp); + } + jobject newElement_0_maxTimestamp; + if (!entry_0.maxTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_maxTimestamp); + } + else + { + jobject newElement_0_maxTimestampInsideOptional; + std::string newElement_0_maxTimestampInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_maxTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_maxTimestampInsideOptional = static_cast(entry_0.maxTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_maxTimestampInsideOptionalClassName.c_str(), + newElement_0_maxTimestampInsideOptionalCtorSignature.c_str(), jninewElement_0_maxTimestampInsideOptional, + newElement_0_maxTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_maxTimestampInsideOptional, + newElement_0_maxTimestamp); + } + jobject newElement_0_startSystime; + if (!entry_0.startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_startSystime); + } + else + { + jobject newElement_0_startSystimeInsideOptional; + std::string newElement_0_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_startSystimeInsideOptional = static_cast(entry_0.startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_startSystimeInsideOptionalClassName.c_str(), + newElement_0_startSystimeInsideOptionalCtorSignature.c_str(), jninewElement_0_startSystimeInsideOptional, + newElement_0_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_startSystimeInsideOptional, + newElement_0_startSystime); + } + jobject newElement_0_endSystime; + if (!entry_0.endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_endSystime); + } + else + { + jobject newElement_0_endSystimeInsideOptional; + std::string newElement_0_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_endSystimeInsideOptional = static_cast(entry_0.endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_endSystimeInsideOptionalClassName.c_str(), + newElement_0_endSystimeInsideOptionalCtorSignature.c_str(), jninewElement_0_endSystimeInsideOptional, + newElement_0_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_endSystimeInsideOptional, + newElement_0_endSystime); + } + jobject newElement_0_minSystime; + if (!entry_0.minSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_minSystime); + } + else + { + jobject newElement_0_minSystimeInsideOptional; + std::string newElement_0_minSystimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_minSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_minSystimeInsideOptional = static_cast(entry_0.minSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_minSystimeInsideOptionalClassName.c_str(), + newElement_0_minSystimeInsideOptionalCtorSignature.c_str(), jninewElement_0_minSystimeInsideOptional, + newElement_0_minSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_minSystimeInsideOptional, + newElement_0_minSystime); + } + jobject newElement_0_maxSystime; + if (!entry_0.maxSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_maxSystime); + } + else + { + jobject newElement_0_maxSystimeInsideOptional; + std::string newElement_0_maxSystimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_maxSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_maxSystimeInsideOptional = static_cast(entry_0.maxSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_maxSystimeInsideOptionalClassName.c_str(), + newElement_0_maxSystimeInsideOptionalCtorSignature.c_str(), jninewElement_0_maxSystimeInsideOptional, + newElement_0_maxSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_maxSystimeInsideOptional, + newElement_0_maxSystime); + } + + jclass measurementRangeStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalPowerMeasurementClusterMeasurementRangeStruct", + measurementRangeStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalPowerMeasurementClusterMeasurementRangeStruct"); + return nullptr; + } + + jmethodID measurementRangeStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, measurementRangeStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/" + "Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/" + "Optional;)V", + &measurementRangeStructStructCtor_1); + if (err != CHIP_NO_ERROR || measurementRangeStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$ElectricalPowerMeasurementClusterMeasurementRangeStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(measurementRangeStructStructClass_1, measurementRangeStructStructCtor_1, + newElement_0_measurementType, newElement_0_min, newElement_0_max, + newElement_0_startTimestamp, newElement_0_endTimestamp, newElement_0_minTimestamp, + newElement_0_maxTimestamp, newElement_0_startSystime, newElement_0_endSystime, + newElement_0_minSystime, newElement_0_maxSystime); + chip::JniReferences::GetInstance().AddToList(value, newElement_0); + } + return value; + } + case Attributes::Voltage::Id: { + using TypeInfo = Attributes::Voltage::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::ActiveCurrent::Id: { + using TypeInfo = Attributes::ActiveCurrent::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::ReactiveCurrent::Id: { + using TypeInfo = Attributes::ReactiveCurrent::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::ApparentCurrent::Id: { + using TypeInfo = Attributes::ApparentCurrent::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::ActivePower::Id: { + using TypeInfo = Attributes::ActivePower::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::ReactivePower::Id: { + using TypeInfo = Attributes::ReactivePower::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::ApparentPower::Id: { + using TypeInfo = Attributes::ApparentPower::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::RMSVoltage::Id: { + using TypeInfo = Attributes::RMSVoltage::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::RMSCurrent::Id: { + using TypeInfo = Attributes::RMSCurrent::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::RMSPower::Id: { + using TypeInfo = Attributes::RMSPower::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::Frequency::Id: { + using TypeInfo = Attributes::Frequency::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::HarmonicCurrents::Id: { + using TypeInfo = Attributes::HarmonicCurrents::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 + { + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_1 = cppValue.Value().begin(); + while (iter_value_1.Next()) + { + auto & entry_1 = iter_value_1.GetValue(); + jobject newElement_1; + jobject newElement_1_order; + std::string newElement_1_orderClassName = "java/lang/Integer"; + std::string newElement_1_orderCtorSignature = "(I)V"; + jint jninewElement_1_order = static_cast(entry_1.order); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_orderClassName.c_str(), + newElement_1_orderCtorSignature.c_str(), + jninewElement_1_order, newElement_1_order); + jobject newElement_1_measurement; + if (entry_1.measurement.IsNull()) + { + newElement_1_measurement = nullptr; + } + else + { + std::string newElement_1_measurementClassName = "java/lang/Long"; + std::string newElement_1_measurementCtorSignature = "(J)V"; + jlong jninewElement_1_measurement = static_cast(entry_1.measurement.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_measurementClassName.c_str(), newElement_1_measurementCtorSignature.c_str(), + jninewElement_1_measurement, newElement_1_measurement); + } + + jclass harmonicMeasurementStructStructClass_2; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalPowerMeasurementClusterHarmonicMeasurementStruct", + harmonicMeasurementStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$ElectricalPowerMeasurementClusterHarmonicMeasurementStruct"); + return nullptr; + } + + jmethodID harmonicMeasurementStructStructCtor_2; + err = chip::JniReferences::GetInstance().FindMethod(env, harmonicMeasurementStructStructClass_2, "", + "(Ljava/lang/Integer;Ljava/lang/Long;)V", + &harmonicMeasurementStructStructCtor_2); + if (err != CHIP_NO_ERROR || harmonicMeasurementStructStructCtor_2 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$ElectricalPowerMeasurementClusterHarmonicMeasurementStruct constructor"); + return nullptr; + } + + newElement_1 = env->NewObject(harmonicMeasurementStructStructClass_2, harmonicMeasurementStructStructCtor_2, + newElement_1_order, newElement_1_measurement); + chip::JniReferences::GetInstance().AddToList(value, newElement_1); + } + } + return value; + } + case Attributes::HarmonicPhases::Id: { + using TypeInfo = Attributes::HarmonicPhases::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 + { + chip::JniReferences::GetInstance().CreateArrayList(value); + + auto iter_value_1 = cppValue.Value().begin(); + while (iter_value_1.Next()) + { + auto & entry_1 = iter_value_1.GetValue(); + jobject newElement_1; + jobject newElement_1_order; + std::string newElement_1_orderClassName = "java/lang/Integer"; + std::string newElement_1_orderCtorSignature = "(I)V"; + jint jninewElement_1_order = static_cast(entry_1.order); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_orderClassName.c_str(), + newElement_1_orderCtorSignature.c_str(), + jninewElement_1_order, newElement_1_order); + jobject newElement_1_measurement; + if (entry_1.measurement.IsNull()) + { + newElement_1_measurement = nullptr; + } + else + { + std::string newElement_1_measurementClassName = "java/lang/Long"; + std::string newElement_1_measurementCtorSignature = "(J)V"; + jlong jninewElement_1_measurement = static_cast(entry_1.measurement.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_1_measurementClassName.c_str(), newElement_1_measurementCtorSignature.c_str(), + jninewElement_1_measurement, newElement_1_measurement); + } + + jclass harmonicMeasurementStructStructClass_2; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalPowerMeasurementClusterHarmonicMeasurementStruct", + harmonicMeasurementStructStructClass_2); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$ElectricalPowerMeasurementClusterHarmonicMeasurementStruct"); + return nullptr; + } + + jmethodID harmonicMeasurementStructStructCtor_2; + err = chip::JniReferences::GetInstance().FindMethod(env, harmonicMeasurementStructStructClass_2, "", + "(Ljava/lang/Integer;Ljava/lang/Long;)V", + &harmonicMeasurementStructStructCtor_2); + if (err != CHIP_NO_ERROR || harmonicMeasurementStructStructCtor_2 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$ElectricalPowerMeasurementClusterHarmonicMeasurementStruct constructor"); + return nullptr; + } + + newElement_1 = env->NewObject(harmonicMeasurementStructStructClass_2, harmonicMeasurementStructStructCtor_2, + newElement_1_order, newElement_1_measurement); + chip::JniReferences::GetInstance().AddToList(value, newElement_1); + } + } + return value; + } + case Attributes::PowerFactor::Id: { + using TypeInfo = Attributes::PowerFactor::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + return value; + } + case Attributes::NeutralCurrent::Id: { + using TypeInfo = Attributes::NeutralCurrent::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 + { + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + jlong jnivalue = static_cast(cppValue.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + jnivalue, value); + } + 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::ElectricalEnergyMeasurement::Id: { using namespace app::Clusters::ElectricalEnergyMeasurement; switch (aPath.mAttributeId) @@ -20234,6 +21308,156 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } + case Attributes::CumulativeEnergyReset::Id: { + using TypeInfo = Attributes::CumulativeEnergyReset::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_importedResetTimestamp; + if (!cppValue.Value().importedResetTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_importedResetTimestamp); + } + else + { + jobject value_importedResetTimestampInsideOptional; + if (cppValue.Value().importedResetTimestamp.Value().IsNull()) + { + value_importedResetTimestampInsideOptional = nullptr; + } + else + { + std::string value_importedResetTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_importedResetTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_importedResetTimestampInsideOptional = + static_cast(cppValue.Value().importedResetTimestamp.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_importedResetTimestampInsideOptionalClassName.c_str(), + value_importedResetTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_importedResetTimestampInsideOptional, value_importedResetTimestampInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional(value_importedResetTimestampInsideOptional, + value_importedResetTimestamp); + } + jobject value_exportedResetTimestamp; + if (!cppValue.Value().exportedResetTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_exportedResetTimestamp); + } + else + { + jobject value_exportedResetTimestampInsideOptional; + if (cppValue.Value().exportedResetTimestamp.Value().IsNull()) + { + value_exportedResetTimestampInsideOptional = nullptr; + } + else + { + std::string value_exportedResetTimestampInsideOptionalClassName = "java/lang/Long"; + std::string value_exportedResetTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_exportedResetTimestampInsideOptional = + static_cast(cppValue.Value().exportedResetTimestamp.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_exportedResetTimestampInsideOptionalClassName.c_str(), + value_exportedResetTimestampInsideOptionalCtorSignature.c_str(), + jnivalue_exportedResetTimestampInsideOptional, value_exportedResetTimestampInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional(value_exportedResetTimestampInsideOptional, + value_exportedResetTimestamp); + } + jobject value_importedResetSystime; + if (!cppValue.Value().importedResetSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_importedResetSystime); + } + else + { + jobject value_importedResetSystimeInsideOptional; + if (cppValue.Value().importedResetSystime.Value().IsNull()) + { + value_importedResetSystimeInsideOptional = nullptr; + } + else + { + std::string value_importedResetSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_importedResetSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_importedResetSystimeInsideOptional = + static_cast(cppValue.Value().importedResetSystime.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_importedResetSystimeInsideOptionalClassName.c_str(), + value_importedResetSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_importedResetSystimeInsideOptional, value_importedResetSystimeInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional(value_importedResetSystimeInsideOptional, + value_importedResetSystime); + } + jobject value_exportedResetSystime; + if (!cppValue.Value().exportedResetSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, value_exportedResetSystime); + } + else + { + jobject value_exportedResetSystimeInsideOptional; + if (cppValue.Value().exportedResetSystime.Value().IsNull()) + { + value_exportedResetSystimeInsideOptional = nullptr; + } + else + { + std::string value_exportedResetSystimeInsideOptionalClassName = "java/lang/Long"; + std::string value_exportedResetSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jnivalue_exportedResetSystimeInsideOptional = + static_cast(cppValue.Value().exportedResetSystime.Value().Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + value_exportedResetSystimeInsideOptionalClassName.c_str(), + value_exportedResetSystimeInsideOptionalCtorSignature.c_str(), + jnivalue_exportedResetSystimeInsideOptional, value_exportedResetSystimeInsideOptional); + } + chip::JniReferences::GetInstance().CreateOptional(value_exportedResetSystimeInsideOptional, + value_exportedResetSystime); + } + + jclass cumulativeEnergyResetStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct", + cumulativeEnergyResetStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipStructs$ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct"); + return nullptr; + } + + jmethodID cumulativeEnergyResetStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, cumulativeEnergyResetStructStructClass_1, "", + "(Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;)V", + &cumulativeEnergyResetStructStructCtor_1); + if (err != CHIP_NO_ERROR || cumulativeEnergyResetStructStructCtor_1 == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipStructs$ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct constructor"); + return nullptr; + } + + value = env->NewObject(cumulativeEnergyResetStructStructClass_1, cumulativeEnergyResetStructStructCtor_1, + value_importedResetTimestamp, value_exportedResetTimestamp, value_importedResetSystime, + value_exportedResetSystime); + } + return value; + } case Attributes::GeneratedCommandList::Id: { using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp index ebab2644189f6a..8214bbe30644f0 100644 --- a/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPEventTLVValueDecoder.cpp @@ -4055,6 +4055,255 @@ jobject DecodeEventValue(const app::ConcreteEventPath & aPath, TLV::TLVReader & } break; } + case app::Clusters::ElectricalPowerMeasurement::Id: { + using namespace app::Clusters::ElectricalPowerMeasurement; + switch (aPath.mEventId) + { + case Events::MeasurementPeriodRanges::Id: { + Events::MeasurementPeriodRanges::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value_ranges; + chip::JniReferences::GetInstance().CreateArrayList(value_ranges); + + auto iter_value_ranges_0 = cppValue.ranges.begin(); + while (iter_value_ranges_0.Next()) + { + auto & entry_0 = iter_value_ranges_0.GetValue(); + jobject newElement_0; + jobject newElement_0_measurementType; + std::string newElement_0_measurementTypeClassName = "java/lang/Integer"; + std::string newElement_0_measurementTypeCtorSignature = "(I)V"; + jint jninewElement_0_measurementType = static_cast(entry_0.measurementType); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_measurementTypeClassName.c_str(), newElement_0_measurementTypeCtorSignature.c_str(), + jninewElement_0_measurementType, newElement_0_measurementType); + jobject newElement_0_min; + std::string newElement_0_minClassName = "java/lang/Long"; + std::string newElement_0_minCtorSignature = "(J)V"; + jlong jninewElement_0_min = static_cast(entry_0.min); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_minClassName.c_str(), + newElement_0_minCtorSignature.c_str(), + jninewElement_0_min, newElement_0_min); + jobject newElement_0_max; + std::string newElement_0_maxClassName = "java/lang/Long"; + std::string newElement_0_maxCtorSignature = "(J)V"; + jlong jninewElement_0_max = static_cast(entry_0.max); + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_maxClassName.c_str(), + newElement_0_maxCtorSignature.c_str(), + jninewElement_0_max, newElement_0_max); + jobject newElement_0_startTimestamp; + if (!entry_0.startTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_startTimestamp); + } + else + { + jobject newElement_0_startTimestampInsideOptional; + std::string newElement_0_startTimestampInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_startTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_startTimestampInsideOptional = static_cast(entry_0.startTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_startTimestampInsideOptionalClassName.c_str(), + newElement_0_startTimestampInsideOptionalCtorSignature.c_str(), + jninewElement_0_startTimestampInsideOptional, newElement_0_startTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_startTimestampInsideOptional, + newElement_0_startTimestamp); + } + jobject newElement_0_endTimestamp; + if (!entry_0.endTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_endTimestamp); + } + else + { + jobject newElement_0_endTimestampInsideOptional; + std::string newElement_0_endTimestampInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_endTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_endTimestampInsideOptional = static_cast(entry_0.endTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_endTimestampInsideOptionalClassName.c_str(), + newElement_0_endTimestampInsideOptionalCtorSignature.c_str(), jninewElement_0_endTimestampInsideOptional, + newElement_0_endTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_endTimestampInsideOptional, + newElement_0_endTimestamp); + } + jobject newElement_0_minTimestamp; + if (!entry_0.minTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_minTimestamp); + } + else + { + jobject newElement_0_minTimestampInsideOptional; + std::string newElement_0_minTimestampInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_minTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_minTimestampInsideOptional = static_cast(entry_0.minTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_minTimestampInsideOptionalClassName.c_str(), + newElement_0_minTimestampInsideOptionalCtorSignature.c_str(), jninewElement_0_minTimestampInsideOptional, + newElement_0_minTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_minTimestampInsideOptional, + newElement_0_minTimestamp); + } + jobject newElement_0_maxTimestamp; + if (!entry_0.maxTimestamp.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_maxTimestamp); + } + else + { + jobject newElement_0_maxTimestampInsideOptional; + std::string newElement_0_maxTimestampInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_maxTimestampInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_maxTimestampInsideOptional = static_cast(entry_0.maxTimestamp.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_maxTimestampInsideOptionalClassName.c_str(), + newElement_0_maxTimestampInsideOptionalCtorSignature.c_str(), jninewElement_0_maxTimestampInsideOptional, + newElement_0_maxTimestampInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_maxTimestampInsideOptional, + newElement_0_maxTimestamp); + } + jobject newElement_0_startSystime; + if (!entry_0.startSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_startSystime); + } + else + { + jobject newElement_0_startSystimeInsideOptional; + std::string newElement_0_startSystimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_startSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_startSystimeInsideOptional = static_cast(entry_0.startSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_startSystimeInsideOptionalClassName.c_str(), + newElement_0_startSystimeInsideOptionalCtorSignature.c_str(), jninewElement_0_startSystimeInsideOptional, + newElement_0_startSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_startSystimeInsideOptional, + newElement_0_startSystime); + } + jobject newElement_0_endSystime; + if (!entry_0.endSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_endSystime); + } + else + { + jobject newElement_0_endSystimeInsideOptional; + std::string newElement_0_endSystimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_endSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_endSystimeInsideOptional = static_cast(entry_0.endSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_endSystimeInsideOptionalClassName.c_str(), + newElement_0_endSystimeInsideOptionalCtorSignature.c_str(), jninewElement_0_endSystimeInsideOptional, + newElement_0_endSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_endSystimeInsideOptional, + newElement_0_endSystime); + } + jobject newElement_0_minSystime; + if (!entry_0.minSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_minSystime); + } + else + { + jobject newElement_0_minSystimeInsideOptional; + std::string newElement_0_minSystimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_minSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_minSystimeInsideOptional = static_cast(entry_0.minSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_minSystimeInsideOptionalClassName.c_str(), + newElement_0_minSystimeInsideOptionalCtorSignature.c_str(), jninewElement_0_minSystimeInsideOptional, + newElement_0_minSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_minSystimeInsideOptional, + newElement_0_minSystime); + } + jobject newElement_0_maxSystime; + if (!entry_0.maxSystime.HasValue()) + { + chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_0_maxSystime); + } + else + { + jobject newElement_0_maxSystimeInsideOptional; + std::string newElement_0_maxSystimeInsideOptionalClassName = "java/lang/Long"; + std::string newElement_0_maxSystimeInsideOptionalCtorSignature = "(J)V"; + jlong jninewElement_0_maxSystimeInsideOptional = static_cast(entry_0.maxSystime.Value()); + chip::JniReferences::GetInstance().CreateBoxedObject( + newElement_0_maxSystimeInsideOptionalClassName.c_str(), + newElement_0_maxSystimeInsideOptionalCtorSignature.c_str(), jninewElement_0_maxSystimeInsideOptional, + newElement_0_maxSystimeInsideOptional); + chip::JniReferences::GetInstance().CreateOptional(newElement_0_maxSystimeInsideOptional, + newElement_0_maxSystime); + } + + jclass measurementRangeStructStructClass_1; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipStructs$ElectricalPowerMeasurementClusterMeasurementRangeStruct", + measurementRangeStructStructClass_1); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, "Could not find class ChipStructs$ElectricalPowerMeasurementClusterMeasurementRangeStruct"); + return nullptr; + } + + jmethodID measurementRangeStructStructCtor_1; + err = chip::JniReferences::GetInstance().FindMethod( + env, measurementRangeStructStructClass_1, "", + "(Ljava/lang/Integer;Ljava/lang/Long;Ljava/lang/Long;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/" + "Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/Optional;Ljava/util/" + "Optional;)V", + &measurementRangeStructStructCtor_1); + if (err != CHIP_NO_ERROR || measurementRangeStructStructCtor_1 == nullptr) + { + ChipLogError(Zcl, + "Could not find ChipStructs$ElectricalPowerMeasurementClusterMeasurementRangeStruct constructor"); + return nullptr; + } + + newElement_0 = env->NewObject(measurementRangeStructStructClass_1, measurementRangeStructStructCtor_1, + newElement_0_measurementType, newElement_0_min, newElement_0_max, + newElement_0_startTimestamp, newElement_0_endTimestamp, newElement_0_minTimestamp, + newElement_0_maxTimestamp, newElement_0_startSystime, newElement_0_endSystime, + newElement_0_minSystime, newElement_0_maxSystime); + chip::JniReferences::GetInstance().AddToList(value_ranges, newElement_0); + } + + jclass measurementPeriodRangesStructClass; + err = chip::JniReferences::GetInstance().GetClassRef( + env, "chip/devicecontroller/ChipEventStructs$ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent", + measurementPeriodRangesStructClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Zcl, + "Could not find class ChipEventStructs$ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent"); + return nullptr; + } + + jmethodID measurementPeriodRangesStructCtor; + err = chip::JniReferences::GetInstance().FindMethod(env, measurementPeriodRangesStructClass, "", + "(Ljava/util/ArrayList;)V", &measurementPeriodRangesStructCtor); + if (err != CHIP_NO_ERROR || measurementPeriodRangesStructCtor == nullptr) + { + ChipLogError( + Zcl, + "Could not find ChipEventStructs$ElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent constructor"); + return nullptr; + } + + jobject value = env->NewObject(measurementPeriodRangesStructClass, measurementPeriodRangesStructCtor, value_ranges); + + return value; + } + default: + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + break; + } + break; + } case app::Clusters::ElectricalEnergyMeasurement::Id: { using namespace app::Clusters::ElectricalEnergyMeasurement; switch (aPath.mEventId) diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 56486a09e15a42..260f0badf6dce0 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -6331,6 +6331,164 @@ class ChipClusters: }, }, } + _ELECTRICAL_POWER_MEASUREMENT_CLUSTER_INFO = { + "clusterName": "ElectricalPowerMeasurement", + "clusterId": 0x00000090, + "commands": { + }, + "attributes": { + 0x00000000: { + "attributeName": "PowerMode", + "attributeId": 0x00000000, + "type": "int", + "reportable": True, + }, + 0x00000001: { + "attributeName": "NumberOfMeasurementTypes", + "attributeId": 0x00000001, + "type": "int", + "reportable": True, + }, + 0x00000002: { + "attributeName": "Accuracy", + "attributeId": 0x00000002, + "type": "", + "reportable": True, + }, + 0x00000003: { + "attributeName": "Ranges", + "attributeId": 0x00000003, + "type": "", + "reportable": True, + }, + 0x00000004: { + "attributeName": "Voltage", + "attributeId": 0x00000004, + "type": "int", + "reportable": True, + }, + 0x00000005: { + "attributeName": "ActiveCurrent", + "attributeId": 0x00000005, + "type": "int", + "reportable": True, + }, + 0x00000006: { + "attributeName": "ReactiveCurrent", + "attributeId": 0x00000006, + "type": "int", + "reportable": True, + }, + 0x00000007: { + "attributeName": "ApparentCurrent", + "attributeId": 0x00000007, + "type": "int", + "reportable": True, + }, + 0x00000008: { + "attributeName": "ActivePower", + "attributeId": 0x00000008, + "type": "int", + "reportable": True, + }, + 0x00000009: { + "attributeName": "ReactivePower", + "attributeId": 0x00000009, + "type": "int", + "reportable": True, + }, + 0x0000000A: { + "attributeName": "ApparentPower", + "attributeId": 0x0000000A, + "type": "int", + "reportable": True, + }, + 0x0000000B: { + "attributeName": "RMSVoltage", + "attributeId": 0x0000000B, + "type": "int", + "reportable": True, + }, + 0x0000000C: { + "attributeName": "RMSCurrent", + "attributeId": 0x0000000C, + "type": "int", + "reportable": True, + }, + 0x0000000D: { + "attributeName": "RMSPower", + "attributeId": 0x0000000D, + "type": "int", + "reportable": True, + }, + 0x0000000E: { + "attributeName": "Frequency", + "attributeId": 0x0000000E, + "type": "int", + "reportable": True, + }, + 0x0000000F: { + "attributeName": "HarmonicCurrents", + "attributeId": 0x0000000F, + "type": "", + "reportable": True, + }, + 0x00000010: { + "attributeName": "HarmonicPhases", + "attributeId": 0x00000010, + "type": "", + "reportable": True, + }, + 0x00000011: { + "attributeName": "PowerFactor", + "attributeId": 0x00000011, + "type": "int", + "reportable": True, + }, + 0x00000012: { + "attributeName": "NeutralCurrent", + "attributeId": 0x00000012, + "type": "int", + "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, + }, + }, + } _ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_INFO = { "clusterName": "ElectricalEnergyMeasurement", "clusterId": 0x00000091, @@ -6367,6 +6525,12 @@ class ChipClusters: "type": "", "reportable": True, }, + 0x00000005: { + "attributeName": "CumulativeEnergyReset", + "attributeId": 0x00000005, + "type": "", + "reportable": True, + }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, @@ -14373,6 +14537,7 @@ class ChipClusters: 0x00000072: _ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER_INFO, 0x00000080: _BOOLEAN_STATE_CONFIGURATION_CLUSTER_INFO, 0x00000081: _VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_INFO, + 0x00000090: _ELECTRICAL_POWER_MEASUREMENT_CLUSTER_INFO, 0x00000091: _ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_INFO, 0x00000096: _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO, 0x00000097: _MESSAGES_CLUSTER_INFO, @@ -14492,6 +14657,7 @@ class ChipClusters: "ActivatedCarbonFilterMonitoring": _ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER_INFO, "BooleanStateConfiguration": _BOOLEAN_STATE_CONFIGURATION_CLUSTER_INFO, "ValveConfigurationAndControl": _VALVE_CONFIGURATION_AND_CONTROL_CLUSTER_INFO, + "ElectricalPowerMeasurement": _ELECTRICAL_POWER_MEASUREMENT_CLUSTER_INFO, "ElectricalEnergyMeasurement": _ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER_INFO, "DemandResponseLoadControl": _DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER_INFO, "Messages": _MESSAGES_CLUSTER_INFO, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index 38a40194feff0a..71f77cd384bc55 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -22137,6 +22137,619 @@ def descriptor(cls) -> ClusterObjectDescriptor: valveFault: 'uint' = 0 +@dataclass +class ElectricalPowerMeasurement(Cluster): + id: typing.ClassVar[int] = 0x00000090 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="powerMode", Tag=0x00000000, Type=ElectricalPowerMeasurement.Enums.PowerModeEnum), + ClusterObjectFieldDescriptor(Label="numberOfMeasurementTypes", Tag=0x00000001, Type=uint), + ClusterObjectFieldDescriptor(Label="accuracy", Tag=0x00000002, Type=typing.List[ElectricalPowerMeasurement.Structs.MeasurementAccuracyStruct]), + ClusterObjectFieldDescriptor(Label="ranges", Tag=0x00000003, Type=typing.Optional[typing.List[ElectricalPowerMeasurement.Structs.MeasurementRangeStruct]]), + ClusterObjectFieldDescriptor(Label="voltage", Tag=0x00000004, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="activeCurrent", Tag=0x00000005, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="reactiveCurrent", Tag=0x00000006, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="apparentCurrent", Tag=0x00000007, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="activePower", Tag=0x00000008, Type=typing.Union[Nullable, int]), + ClusterObjectFieldDescriptor(Label="reactivePower", Tag=0x00000009, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="apparentPower", Tag=0x0000000A, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="RMSVoltage", Tag=0x0000000B, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="RMSCurrent", Tag=0x0000000C, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="RMSPower", Tag=0x0000000D, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="frequency", Tag=0x0000000E, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="harmonicCurrents", Tag=0x0000000F, Type=typing.Union[None, Nullable, typing.List[ElectricalPowerMeasurement.Structs.HarmonicMeasurementStruct]]), + ClusterObjectFieldDescriptor(Label="harmonicPhases", Tag=0x00000010, Type=typing.Union[None, Nullable, typing.List[ElectricalPowerMeasurement.Structs.HarmonicMeasurementStruct]]), + ClusterObjectFieldDescriptor(Label="powerFactor", Tag=0x00000011, Type=typing.Union[None, Nullable, int]), + ClusterObjectFieldDescriptor(Label="neutralCurrent", Tag=0x00000012, Type=typing.Union[None, Nullable, int]), + 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), + ]) + + powerMode: 'ElectricalPowerMeasurement.Enums.PowerModeEnum' = None + numberOfMeasurementTypes: 'uint' = None + accuracy: 'typing.List[ElectricalPowerMeasurement.Structs.MeasurementAccuracyStruct]' = None + ranges: 'typing.Optional[typing.List[ElectricalPowerMeasurement.Structs.MeasurementRangeStruct]]' = None + voltage: 'typing.Union[None, Nullable, int]' = None + activeCurrent: 'typing.Union[None, Nullable, int]' = None + reactiveCurrent: 'typing.Union[None, Nullable, int]' = None + apparentCurrent: 'typing.Union[None, Nullable, int]' = None + activePower: 'typing.Union[Nullable, int]' = None + reactivePower: 'typing.Union[None, Nullable, int]' = None + apparentPower: 'typing.Union[None, Nullable, int]' = None + RMSVoltage: 'typing.Union[None, Nullable, int]' = None + RMSCurrent: 'typing.Union[None, Nullable, int]' = None + RMSPower: 'typing.Union[None, Nullable, int]' = None + frequency: 'typing.Union[None, Nullable, int]' = None + harmonicCurrents: 'typing.Union[None, Nullable, typing.List[ElectricalPowerMeasurement.Structs.HarmonicMeasurementStruct]]' = None + harmonicPhases: 'typing.Union[None, Nullable, typing.List[ElectricalPowerMeasurement.Structs.HarmonicMeasurementStruct]]' = None + powerFactor: 'typing.Union[None, Nullable, int]' = None + neutralCurrent: 'typing.Union[None, Nullable, int]' = 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 PowerModeEnum(MatterIntEnum): + kUnknown = 0x00 + kDc = 0x01 + kAc = 0x02 + # 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 = 3, + + class Bitmaps: + class Feature(IntFlag): + kDirectCurrent = 0x1 + kAlternatingCurrent = 0x2 + kPolyphasePower = 0x4 + kHarmonics = 0x8 + kPowerQuality = 0x10 + + 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=ElectricalPowerMeasurement.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[ElectricalPowerMeasurement.Structs.MeasurementAccuracyRangeStruct]), + ]) + + measurementType: 'ElectricalPowerMeasurement.Enums.MeasurementTypeEnum' = 0 + measured: 'bool' = False + minMeasuredValue: 'int' = 0 + maxMeasuredValue: 'int' = 0 + accuracyRanges: 'typing.List[ElectricalPowerMeasurement.Structs.MeasurementAccuracyRangeStruct]' = field(default_factory=lambda: []) + + @dataclass + class HarmonicMeasurementStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="order", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="measurement", Tag=1, Type=typing.Union[Nullable, int]), + ]) + + order: 'uint' = 0 + measurement: 'typing.Union[Nullable, int]' = NullValue + + @dataclass + class MeasurementRangeStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="measurementType", Tag=0, Type=ElectricalPowerMeasurement.Enums.MeasurementTypeEnum), + ClusterObjectFieldDescriptor(Label="min", Tag=1, Type=int), + ClusterObjectFieldDescriptor(Label="max", Tag=2, Type=int), + ClusterObjectFieldDescriptor(Label="startTimestamp", Tag=3, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="endTimestamp", Tag=4, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="minTimestamp", Tag=5, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="maxTimestamp", Tag=6, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="startSystime", Tag=7, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="endSystime", Tag=8, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="minSystime", Tag=9, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="maxSystime", Tag=10, Type=typing.Optional[uint]), + ]) + + measurementType: 'ElectricalPowerMeasurement.Enums.MeasurementTypeEnum' = 0 + min: 'int' = 0 + max: 'int' = 0 + startTimestamp: 'typing.Optional[uint]' = None + endTimestamp: 'typing.Optional[uint]' = None + minTimestamp: 'typing.Optional[uint]' = None + maxTimestamp: 'typing.Optional[uint]' = None + startSystime: 'typing.Optional[uint]' = None + endSystime: 'typing.Optional[uint]' = None + minSystime: 'typing.Optional[uint]' = None + maxSystime: 'typing.Optional[uint]' = None + + class Attributes: + @dataclass + class PowerMode(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=ElectricalPowerMeasurement.Enums.PowerModeEnum) + + value: 'ElectricalPowerMeasurement.Enums.PowerModeEnum' = 0 + + @dataclass + class NumberOfMeasurementTypes(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=uint) + + value: 'uint' = 0 + + @dataclass + class Accuracy(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.List[ElectricalPowerMeasurement.Structs.MeasurementAccuracyStruct]) + + value: 'typing.List[ElectricalPowerMeasurement.Structs.MeasurementAccuracyStruct]' = field(default_factory=lambda: []) + + @dataclass + class Ranges(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[typing.List[ElectricalPowerMeasurement.Structs.MeasurementRangeStruct]]) + + value: 'typing.Optional[typing.List[ElectricalPowerMeasurement.Structs.MeasurementRangeStruct]]' = None + + @dataclass + class Voltage(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class ActiveCurrent(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class ReactiveCurrent(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000006 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class ApparentCurrent(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000007 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class ActivePower(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000008 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, int]) + + value: 'typing.Union[Nullable, int]' = NullValue + + @dataclass + class ReactivePower(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000009 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class ApparentPower(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000A + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class RMSVoltage(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000B + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class RMSCurrent(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000C + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class RMSPower(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000D + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class Frequency(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000E + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class HarmonicCurrents(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000F + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, typing.List[ElectricalPowerMeasurement.Structs.HarmonicMeasurementStruct]]) + + value: 'typing.Union[None, Nullable, typing.List[ElectricalPowerMeasurement.Structs.HarmonicMeasurementStruct]]' = None + + @dataclass + class HarmonicPhases(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000010 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, typing.List[ElectricalPowerMeasurement.Structs.HarmonicMeasurementStruct]]) + + value: 'typing.Union[None, Nullable, typing.List[ElectricalPowerMeasurement.Structs.HarmonicMeasurementStruct]]' = None + + @dataclass + class PowerFactor(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000011 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class NeutralCurrent(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000012 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, int]) + + value: 'typing.Union[None, Nullable, int]' = None + + @dataclass + class GeneratedCommandList(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @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 0x00000090 + + @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 0x00000090 + + @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 0x00000090 + + @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 0x00000090 + + @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 0x00000090 + + @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 MeasurementPeriodRanges(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000090 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="ranges", Tag=0, Type=typing.List[ElectricalPowerMeasurement.Structs.MeasurementRangeStruct]), + ]) + + ranges: 'typing.List[ElectricalPowerMeasurement.Structs.MeasurementRangeStruct]' = field(default_factory=lambda: []) + + @dataclass class ElectricalEnergyMeasurement(Cluster): id: typing.ClassVar[int] = 0x00000091 @@ -22150,6 +22763,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: 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="cumulativeEnergyReset", Tag=0x00000005, Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.CumulativeEnergyResetStruct]), 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]), @@ -22163,6 +22777,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: 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 + cumulativeEnergyReset: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.CumulativeEnergyResetStruct]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -22245,6 +22860,23 @@ def descriptor(cls) -> ClusterObjectDescriptor: maxMeasuredValue: 'int' = 0 accuracyRanges: 'typing.List[ElectricalEnergyMeasurement.Structs.MeasurementAccuracyRangeStruct]' = field(default_factory=lambda: []) + @dataclass + class CumulativeEnergyResetStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="importedResetTimestamp", Tag=0, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="exportedResetTimestamp", Tag=1, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="importedResetSystime", Tag=2, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="exportedResetSystime", Tag=3, Type=typing.Union[None, Nullable, uint]), + ]) + + importedResetTimestamp: 'typing.Union[None, Nullable, uint]' = None + exportedResetTimestamp: 'typing.Union[None, Nullable, uint]' = None + importedResetSystime: 'typing.Union[None, Nullable, uint]' = None + exportedResetSystime: 'typing.Union[None, Nullable, uint]' = None + @dataclass class EnergyMeasurementStruct(ClusterObject): @ChipUtility.classproperty @@ -22345,6 +22977,22 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.EnergyMeasurementStruct]' = None + @dataclass + class CumulativeEnergyReset(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x00000091 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.CumulativeEnergyResetStruct]) + + value: 'typing.Union[None, Nullable, ElectricalEnergyMeasurement.Structs.CumulativeEnergyResetStruct]' = None + @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @ChipUtility.classproperty diff --git a/src/controller/python/chip/clusters/__init__.py b/src/controller/python/chip/clusters/__init__.py index 47a53efde54af1..bd15d261d8962a 100644 --- a/src/controller/python/chip/clusters/__init__.py +++ b/src/controller/python/chip/clusters/__init__.py @@ -28,19 +28,19 @@ BinaryInputBasic, Binding, BooleanState, BooleanStateConfiguration, BridgedDeviceBasicInformation, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, Channel, ColorControl, ContentLauncher, Descriptor, DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, - DishwasherAlarm, DishwasherMode, DoorLock, ElectricalEnergyMeasurement, ElectricalMeasurement, EnergyEvse, - EnergyEvseMode, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, - FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, GroupKeyManagement, Groups, - HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, - LaundryWasherControls, LaundryWasherMode, LevelControl, LocalizationConfiguration, LowPower, MediaInput, - MediaPlayback, MicrowaveOvenControl, MicrowaveOvenMode, ModeSelect, NetworkCommissioning, - NitrogenDioxideConcentrationMeasurement, OccupancySensing, OnOff, OnOffSwitchConfiguration, - OperationalCredentials, OperationalState, OtaSoftwareUpdateProvider, OtaSoftwareUpdateRequestor, - OvenCavityOperationalState, OvenMode, OzoneConcentrationMeasurement, Pm1ConcentrationMeasurement, - Pm10ConcentrationMeasurement, Pm25ConcentrationMeasurement, PowerSource, PowerSourceConfiguration, - PressureMeasurement, ProxyConfiguration, ProxyDiscovery, ProxyValid, PulseWidthModulation, - PumpConfigurationAndControl, RadonConcentrationMeasurement, RefrigeratorAlarm, - RefrigeratorAndTemperatureControlledCabinetMode, RelativeHumidityMeasurement, RvcCleanMode, + DishwasherAlarm, DishwasherMode, DoorLock, ElectricalEnergyMeasurement, ElectricalMeasurement, + ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EthernetNetworkDiagnostics, FanControl, + FaultInjection, FixedLabel, FlowMeasurement, FormaldehydeConcentrationMeasurement, GeneralCommissioning, + GeneralDiagnostics, GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, + IlluminanceMeasurement, KeypadInput, LaundryDryerControls, LaundryWasherControls, LaundryWasherMode, + LevelControl, LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, + MicrowaveOvenMode, ModeSelect, NetworkCommissioning, NitrogenDioxideConcentrationMeasurement, + OccupancySensing, OnOff, OnOffSwitchConfiguration, OperationalCredentials, OperationalState, + OtaSoftwareUpdateProvider, OtaSoftwareUpdateRequestor, OvenCavityOperationalState, OvenMode, + OzoneConcentrationMeasurement, Pm1ConcentrationMeasurement, Pm10ConcentrationMeasurement, + Pm25ConcentrationMeasurement, PowerSource, PowerSourceConfiguration, PressureMeasurement, ProxyConfiguration, + ProxyDiscovery, ProxyValid, PulseWidthModulation, PumpConfigurationAndControl, RadonConcentrationMeasurement, + RefrigeratorAlarm, RefrigeratorAndTemperatureControlledCabinetMode, RelativeHumidityMeasurement, RvcCleanMode, RvcOperationalState, RvcRunMode, ScenesManagement, SmokeCoAlarm, SoftwareDiagnostics, Switch, TargetNavigator, TemperatureControl, TemperatureMeasurement, Thermostat, ThermostatUserInterfaceConfiguration, ThreadNetworkDiagnostics, TimeFormatLocalization, TimeSynchronization, @@ -52,7 +52,8 @@ BinaryInputBasic, Binding, BooleanState, BooleanStateConfiguration, BridgedDeviceBasicInformation, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, Channel, ColorControl, ContentLauncher, Descriptor, DeviceEnergyManagementMode, DeviceEnergyManagement, DiagnosticLogs, DishwasherAlarm, DishwasherMode, - DoorLock, ElectricalMeasurement, ElectricalEnergyMeasurement, EnergyEvse, EnergyEvseMode, EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, + DoorLock, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, + EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, LaundryWasherControls, LaundryWasherMode, LevelControl, LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm index 61aeca639079b2..41aa2e3d322825 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeSpecifiedCheck.mm @@ -2924,6 +2924,90 @@ static BOOL AttributeIsSpecifiedInValveConfigurationAndControlCluster(AttributeI } } } +static BOOL AttributeIsSpecifiedInElectricalPowerMeasurementCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ElectricalPowerMeasurement; + switch (aAttributeId) { + case Attributes::PowerMode::Id: { + return YES; + } + case Attributes::NumberOfMeasurementTypes::Id: { + return YES; + } + case Attributes::Accuracy::Id: { + return YES; + } + case Attributes::Ranges::Id: { + return YES; + } + case Attributes::Voltage::Id: { + return YES; + } + case Attributes::ActiveCurrent::Id: { + return YES; + } + case Attributes::ReactiveCurrent::Id: { + return YES; + } + case Attributes::ApparentCurrent::Id: { + return YES; + } + case Attributes::ActivePower::Id: { + return YES; + } + case Attributes::ReactivePower::Id: { + return YES; + } + case Attributes::ApparentPower::Id: { + return YES; + } + case Attributes::RMSVoltage::Id: { + return YES; + } + case Attributes::RMSCurrent::Id: { + return YES; + } + case Attributes::RMSPower::Id: { + return YES; + } + case Attributes::Frequency::Id: { + return YES; + } + case Attributes::HarmonicCurrents::Id: { + return YES; + } + case Attributes::HarmonicPhases::Id: { + return YES; + } + case Attributes::PowerFactor::Id: { + return YES; + } + case Attributes::NeutralCurrent::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 AttributeIsSpecifiedInElectricalEnergyMeasurementCluster(AttributeId aAttributeId) { using namespace Clusters::ElectricalEnergyMeasurement; @@ -2943,6 +3027,9 @@ static BOOL AttributeIsSpecifiedInElectricalEnergyMeasurementCluster(AttributeId case Attributes::PeriodicEnergyExported::Id: { return YES; } + case Attributes::CumulativeEnergyReset::Id: { + return YES; + } case Attributes::GeneratedCommandList::Id: { return YES; } @@ -6579,6 +6666,9 @@ BOOL MTRAttributeIsSpecified(ClusterId aClusterId, AttributeId aAttributeId) case Clusters::ValveConfigurationAndControl::Id: { return AttributeIsSpecifiedInValveConfigurationAndControlCluster(aAttributeId); } + case Clusters::ElectricalPowerMeasurement::Id: { + return AttributeIsSpecifiedInElectricalPowerMeasurementCluster(aAttributeId); + } case Clusters::ElectricalEnergyMeasurement::Id: { return AttributeIsSpecifiedInElectricalEnergyMeasurementCluster(aAttributeId); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index f11d395889afaa..4d4f21bc96dd3d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -7631,6 +7631,454 @@ static id _Nullable DecodeAttributeValueForValveConfigurationAndControlCluster(A *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } +static id _Nullable DecodeAttributeValueForElectricalPowerMeasurementCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ElectricalPowerMeasurement; + switch (aAttributeId) { + case Attributes::PowerMode::Id: { + using TypeInfo = Attributes::PowerMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::NumberOfMeasurementTypes::Id: { + using TypeInfo = Attributes::NumberOfMeasurementTypes::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::Accuracy::Id: { + using TypeInfo = Attributes::Accuracy::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRElectricalPowerMeasurementClusterMeasurementAccuracyStruct * newElement_0; + newElement_0 = [MTRElectricalPowerMeasurementClusterMeasurementAccuracyStruct new]; + newElement_0.measurementType = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0.measurementType)]; + newElement_0.measured = [NSNumber numberWithBool:entry_0.measured]; + newElement_0.minMeasuredValue = [NSNumber numberWithLongLong:entry_0.minMeasuredValue]; + newElement_0.maxMeasuredValue = [NSNumber numberWithLongLong:entry_0.maxMeasuredValue]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.accuracyRanges.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTRElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct * newElement_2; + newElement_2 = [MTRElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct new]; + newElement_2.rangeMin = [NSNumber numberWithLongLong:entry_2.rangeMin]; + newElement_2.rangeMax = [NSNumber numberWithLongLong:entry_2.rangeMax]; + if (entry_2.percentMax.HasValue()) { + newElement_2.percentMax = [NSNumber numberWithUnsignedShort:entry_2.percentMax.Value()]; + } else { + newElement_2.percentMax = nil; + } + if (entry_2.percentMin.HasValue()) { + newElement_2.percentMin = [NSNumber numberWithUnsignedShort:entry_2.percentMin.Value()]; + } else { + newElement_2.percentMin = nil; + } + if (entry_2.percentTypical.HasValue()) { + newElement_2.percentTypical = [NSNumber numberWithUnsignedShort:entry_2.percentTypical.Value()]; + } else { + newElement_2.percentTypical = nil; + } + if (entry_2.fixedMax.HasValue()) { + newElement_2.fixedMax = [NSNumber numberWithUnsignedLongLong:entry_2.fixedMax.Value()]; + } else { + newElement_2.fixedMax = nil; + } + if (entry_2.fixedMin.HasValue()) { + newElement_2.fixedMin = [NSNumber numberWithUnsignedLongLong:entry_2.fixedMin.Value()]; + } else { + newElement_2.fixedMin = nil; + } + if (entry_2.fixedTypical.HasValue()) { + newElement_2.fixedTypical = [NSNumber numberWithUnsignedLongLong:entry_2.fixedTypical.Value()]; + } else { + newElement_2.fixedTypical = nil; + } + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.accuracyRanges = array_2; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::Ranges::Id: { + using TypeInfo = Attributes::Ranges::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRElectricalPowerMeasurementClusterMeasurementRangeStruct * newElement_0; + newElement_0 = [MTRElectricalPowerMeasurementClusterMeasurementRangeStruct new]; + newElement_0.measurementType = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0.measurementType)]; + newElement_0.min = [NSNumber numberWithLongLong:entry_0.min]; + newElement_0.max = [NSNumber numberWithLongLong:entry_0.max]; + if (entry_0.startTimestamp.HasValue()) { + newElement_0.startTimestamp = [NSNumber numberWithUnsignedInt:entry_0.startTimestamp.Value()]; + } else { + newElement_0.startTimestamp = nil; + } + if (entry_0.endTimestamp.HasValue()) { + newElement_0.endTimestamp = [NSNumber numberWithUnsignedInt:entry_0.endTimestamp.Value()]; + } else { + newElement_0.endTimestamp = nil; + } + if (entry_0.minTimestamp.HasValue()) { + newElement_0.minTimestamp = [NSNumber numberWithUnsignedInt:entry_0.minTimestamp.Value()]; + } else { + newElement_0.minTimestamp = nil; + } + if (entry_0.maxTimestamp.HasValue()) { + newElement_0.maxTimestamp = [NSNumber numberWithUnsignedInt:entry_0.maxTimestamp.Value()]; + } else { + newElement_0.maxTimestamp = nil; + } + if (entry_0.startSystime.HasValue()) { + newElement_0.startSystime = [NSNumber numberWithUnsignedLongLong:entry_0.startSystime.Value()]; + } else { + newElement_0.startSystime = nil; + } + if (entry_0.endSystime.HasValue()) { + newElement_0.endSystime = [NSNumber numberWithUnsignedLongLong:entry_0.endSystime.Value()]; + } else { + newElement_0.endSystime = nil; + } + if (entry_0.minSystime.HasValue()) { + newElement_0.minSystime = [NSNumber numberWithUnsignedLongLong:entry_0.minSystime.Value()]; + } else { + newElement_0.minSystime = nil; + } + if (entry_0.maxSystime.HasValue()) { + newElement_0.maxSystime = [NSNumber numberWithUnsignedLongLong:entry_0.maxSystime.Value()]; + } else { + newElement_0.maxSystime = nil; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::Voltage::Id: { + using TypeInfo = Attributes::Voltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::ActiveCurrent::Id: { + using TypeInfo = Attributes::ActiveCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::ReactiveCurrent::Id: { + using TypeInfo = Attributes::ReactiveCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::ApparentCurrent::Id: { + using TypeInfo = Attributes::ApparentCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::ActivePower::Id: { + using TypeInfo = Attributes::ActivePower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::ReactivePower::Id: { + using TypeInfo = Attributes::ReactivePower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::ApparentPower::Id: { + using TypeInfo = Attributes::ApparentPower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::RMSVoltage::Id: { + using TypeInfo = Attributes::RMSVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::RMSCurrent::Id: { + using TypeInfo = Attributes::RMSCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::RMSPower::Id: { + using TypeInfo = Attributes::RMSPower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::Frequency::Id: { + using TypeInfo = Attributes::Frequency::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::HarmonicCurrents::Id: { + using TypeInfo = Attributes::HarmonicCurrents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + auto iter_1 = cppValue.Value().begin(); + while (iter_1.Next()) { + auto & entry_1 = iter_1.GetValue(); + MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct * newElement_1; + newElement_1 = [MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct new]; + newElement_1.order = [NSNumber numberWithUnsignedChar:entry_1.order]; + if (entry_1.measurement.IsNull()) { + newElement_1.measurement = nil; + } else { + newElement_1.measurement = [NSNumber numberWithLongLong:entry_1.measurement.Value()]; + } + [array_1 addObject:newElement_1]; + } + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_1; + } + } + return value; + } + case Attributes::HarmonicPhases::Id: { + using TypeInfo = Attributes::HarmonicPhases::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + { // Scope for our temporary variables + auto * array_1 = [NSMutableArray new]; + auto iter_1 = cppValue.Value().begin(); + while (iter_1.Next()) { + auto & entry_1 = iter_1.GetValue(); + MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct * newElement_1; + newElement_1 = [MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct new]; + newElement_1.order = [NSNumber numberWithUnsignedChar:entry_1.order]; + if (entry_1.measurement.IsNull()) { + newElement_1.measurement = nil; + } else { + newElement_1.measurement = [NSNumber numberWithLongLong:entry_1.measurement.Value()]; + } + [array_1 addObject:newElement_1]; + } + CHIP_ERROR err = iter_1.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_1; + } + } + return value; + } + case Attributes::PowerFactor::Id: { + using TypeInfo = Attributes::PowerFactor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::NeutralCurrent::Id: { + using TypeInfo = Attributes::NeutralCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + default: { + break; + } + } + + *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; @@ -7842,6 +8290,57 @@ static id _Nullable DecodeAttributeValueForElectricalEnergyMeasurementCluster(At } return value; } + case Attributes::CumulativeEnergyReset::Id: { + using TypeInfo = Attributes::CumulativeEnergyReset::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct new]; + if (cppValue.Value().importedResetTimestamp.HasValue()) { + if (cppValue.Value().importedResetTimestamp.Value().IsNull()) { + value.importedResetTimestamp = nil; + } else { + value.importedResetTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().importedResetTimestamp.Value().Value()]; + } + } else { + value.importedResetTimestamp = nil; + } + if (cppValue.Value().exportedResetTimestamp.HasValue()) { + if (cppValue.Value().exportedResetTimestamp.Value().IsNull()) { + value.exportedResetTimestamp = nil; + } else { + value.exportedResetTimestamp = [NSNumber numberWithUnsignedInt:cppValue.Value().exportedResetTimestamp.Value().Value()]; + } + } else { + value.exportedResetTimestamp = nil; + } + if (cppValue.Value().importedResetSystime.HasValue()) { + if (cppValue.Value().importedResetSystime.Value().IsNull()) { + value.importedResetSystime = nil; + } else { + value.importedResetSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().importedResetSystime.Value().Value()]; + } + } else { + value.importedResetSystime = nil; + } + if (cppValue.Value().exportedResetSystime.HasValue()) { + if (cppValue.Value().exportedResetSystime.Value().IsNull()) { + value.exportedResetSystime = nil; + } else { + value.exportedResetSystime = [NSNumber numberWithUnsignedLongLong:cppValue.Value().exportedResetSystime.Value().Value()]; + } + } else { + value.exportedResetSystime = nil; + } + } + return value; + } default: { break; } @@ -18925,6 +19424,9 @@ id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::T case Clusters::ValveConfigurationAndControl::Id: { return DecodeAttributeValueForValveConfigurationAndControlCluster(aPath.mAttributeId, aReader, aError); } + case Clusters::ElectricalPowerMeasurement::Id: { + return DecodeAttributeValueForElectricalPowerMeasurementCluster(aPath.mAttributeId, aReader, aError); + } case Clusters::ElectricalEnergyMeasurement::Id: { return DecodeAttributeValueForElectricalEnergyMeasurementCluster(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 61b8a750b3540a..fb16dbe03a412c 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -7226,6 +7226,181 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Electrical Power Measurement + * + * This cluster provides a mechanism for querying data about electrical power as measured by the server. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRBaseClusterElectricalPowerMeasurement : MTRGenericBaseCluster + +- (void)readAttributePowerModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributePowerModeWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributePowerModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeNumberOfMeasurementTypesWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNumberOfMeasurementTypesWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNumberOfMeasurementTypesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeAccuracyWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeAccuracyWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeAccuracyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeRangesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeRangesWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeRangesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeVoltageWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeVoltageWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeVoltageWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeActiveCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeActiveCurrentWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeActiveCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeReactiveCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeReactiveCurrentWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeReactiveCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeApparentCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeApparentCurrentWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeApparentCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeActivePowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeActivePowerWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeActivePowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeReactivePowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeReactivePowerWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeReactivePowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeApparentPowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeApparentPowerWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeApparentPowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeRMSVoltageWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeRMSVoltageWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeRMSVoltageWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeRMSCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeRMSCurrentWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeRMSCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeRMSPowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeRMSPowerWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeRMSPowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeFrequencyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeFrequencyWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeFrequencyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeHarmonicCurrentsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeHarmonicCurrentsWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeHarmonicCurrentsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeHarmonicPhasesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeHarmonicPhasesWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeHarmonicPhasesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributePowerFactorWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributePowerFactorWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributePowerFactorWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; + +- (void)readAttributeNeutralCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeNeutralCurrentWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeNeutralCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _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 MTRBaseClusterElectricalPowerMeasurement (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 Electrical Energy Measurement * @@ -7264,6 +7439,12 @@ MTR_PROVISIONALLY_AVAILABLE 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)readAttributeCumulativeEnergyResetWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value, NSError * _Nullable error))completion MTR_PROVISIONALLY_AVAILABLE; +- (void)subscribeAttributeCumulativeEnergyResetWithParams:(MTRSubscribeParams *)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value, NSError * _Nullable error))reportHandler MTR_PROVISIONALLY_AVAILABLE; ++ (void)readAttributeCumulativeEnergyResetWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _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 @@ -17476,6 +17657,38 @@ typedef NS_OPTIONS(uint16_t, MTRValveConfigurationAndControlValveFaultBitmap) { MTRValveConfigurationAndControlValveFaultBitmapCurrentExceeded MTR_PROVISIONALLY_AVAILABLE = 0x20, } MTR_PROVISIONALLY_AVAILABLE; +typedef NS_ENUM(uint16_t, MTRElectricalPowerMeasurementMeasurementType) { + MTRElectricalPowerMeasurementMeasurementTypeUnspecified MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRElectricalPowerMeasurementMeasurementTypeVoltage MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRElectricalPowerMeasurementMeasurementTypeActiveCurrent MTR_PROVISIONALLY_AVAILABLE = 0x02, + MTRElectricalPowerMeasurementMeasurementTypeReactiveCurrent MTR_PROVISIONALLY_AVAILABLE = 0x03, + MTRElectricalPowerMeasurementMeasurementTypeApparentCurrent MTR_PROVISIONALLY_AVAILABLE = 0x04, + MTRElectricalPowerMeasurementMeasurementTypeActivePower MTR_PROVISIONALLY_AVAILABLE = 0x05, + MTRElectricalPowerMeasurementMeasurementTypeReactivePower MTR_PROVISIONALLY_AVAILABLE = 0x06, + MTRElectricalPowerMeasurementMeasurementTypeApparentPower MTR_PROVISIONALLY_AVAILABLE = 0x07, + MTRElectricalPowerMeasurementMeasurementTypeRMSVoltage MTR_PROVISIONALLY_AVAILABLE = 0x08, + MTRElectricalPowerMeasurementMeasurementTypeRMSCurrent MTR_PROVISIONALLY_AVAILABLE = 0x09, + MTRElectricalPowerMeasurementMeasurementTypeRMSPower MTR_PROVISIONALLY_AVAILABLE = 0x0A, + MTRElectricalPowerMeasurementMeasurementTypeFrequency MTR_PROVISIONALLY_AVAILABLE = 0x0B, + MTRElectricalPowerMeasurementMeasurementTypePowerFactor MTR_PROVISIONALLY_AVAILABLE = 0x0C, + MTRElectricalPowerMeasurementMeasurementTypeNeutralCurrent MTR_PROVISIONALLY_AVAILABLE = 0x0D, + MTRElectricalPowerMeasurementMeasurementTypeElectricalEnergy MTR_PROVISIONALLY_AVAILABLE = 0x0E, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_ENUM(uint8_t, MTRElectricalPowerMeasurementPowerMode) { + MTRElectricalPowerMeasurementPowerModeUnknown MTR_PROVISIONALLY_AVAILABLE = 0x00, + MTRElectricalPowerMeasurementPowerModeDC MTR_PROVISIONALLY_AVAILABLE = 0x01, + MTRElectricalPowerMeasurementPowerModeAC MTR_PROVISIONALLY_AVAILABLE = 0x02, +} MTR_PROVISIONALLY_AVAILABLE; + +typedef NS_OPTIONS(uint32_t, MTRElectricalPowerMeasurementFeature) { + MTRElectricalPowerMeasurementFeatureDirectCurrent MTR_PROVISIONALLY_AVAILABLE = 0x1, + MTRElectricalPowerMeasurementFeatureAlternatingCurrent MTR_PROVISIONALLY_AVAILABLE = 0x2, + MTRElectricalPowerMeasurementFeaturePolyphasePower MTR_PROVISIONALLY_AVAILABLE = 0x4, + MTRElectricalPowerMeasurementFeatureHarmonics MTR_PROVISIONALLY_AVAILABLE = 0x8, + MTRElectricalPowerMeasurementFeaturePowerQuality MTR_PROVISIONALLY_AVAILABLE = 0x10, +} MTR_PROVISIONALLY_AVAILABLE; + typedef NS_ENUM(uint16_t, MTRElectricalEnergyMeasurementMeasurementType) { MTRElectricalEnergyMeasurementMeasurementTypeUnspecified MTR_PROVISIONALLY_AVAILABLE = 0x00, MTRElectricalEnergyMeasurementMeasurementTypeVoltage 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 50e411dad70331..cdb3a18b67c06b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.mm @@ -49725,6 +49725,910 @@ + (void)readAttributeClusterRevisionWithClusterStateCache:(MTRClusterStateCacheC @end +@implementation MTRBaseClusterElectricalPowerMeasurement + +- (void)readAttributePowerModeWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::PowerMode::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributePowerModeWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::PowerMode::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributePowerModeWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::PowerMode::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNumberOfMeasurementTypesWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::NumberOfMeasurementTypes::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNumberOfMeasurementTypesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::NumberOfMeasurementTypes::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNumberOfMeasurementTypesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::NumberOfMeasurementTypes::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeAccuracyWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Accuracy::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeAccuracyWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Accuracy::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + 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 (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Accuracy::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeRangesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Ranges::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeRangesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Ranges::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeRangesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Ranges::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeVoltageWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Voltage::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeVoltageWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Voltage::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeVoltageWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Voltage::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeActiveCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ActiveCurrent::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeActiveCurrentWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ActiveCurrent::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeActiveCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ActiveCurrent::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeReactiveCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ReactiveCurrent::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeReactiveCurrentWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ReactiveCurrent::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeReactiveCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ReactiveCurrent::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeApparentCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ApparentCurrent::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeApparentCurrentWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ApparentCurrent::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeApparentCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ApparentCurrent::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeActivePowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ActivePower::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeActivePowerWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ActivePower::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeActivePowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ActivePower::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeReactivePowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ReactivePower::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeReactivePowerWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ReactivePower::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeReactivePowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ReactivePower::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeApparentPowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ApparentPower::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeApparentPowerWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ApparentPower::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeApparentPowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::ApparentPower::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeRMSVoltageWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::RMSVoltage::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeRMSVoltageWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::RMSVoltage::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeRMSVoltageWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::RMSVoltage::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeRMSCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::RMSCurrent::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeRMSCurrentWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::RMSCurrent::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeRMSCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::RMSCurrent::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeRMSPowerWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::RMSPower::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeRMSPowerWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::RMSPower::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeRMSPowerWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::RMSPower::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeFrequencyWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Frequency::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeFrequencyWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Frequency::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeFrequencyWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::Frequency::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeHarmonicCurrentsWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::HarmonicCurrents::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeHarmonicCurrentsWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::HarmonicCurrents::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeHarmonicCurrentsWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::HarmonicCurrents::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeHarmonicPhasesWithCompletion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::HarmonicPhases::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeHarmonicPhasesWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::HarmonicPhases::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeHarmonicPhasesWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::HarmonicPhases::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributePowerFactorWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::PowerFactor::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributePowerFactorWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::PowerFactor::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributePowerFactorWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::PowerFactor::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +- (void)readAttributeNeutralCurrentWithCompletion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::NeutralCurrent::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeNeutralCurrentWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::NeutralCurrent::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeNeutralCurrentWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalPowerMeasurement::Attributes::NeutralCurrent::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 = ElectricalPowerMeasurement::Attributes::GeneratedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::Attributes::GeneratedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::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 = ElectricalPowerMeasurement::Attributes::AcceptedCommandList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::Attributes::AcceptedCommandList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::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 = ElectricalPowerMeasurement::Attributes::EventList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::Attributes::EventList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::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 = ElectricalPowerMeasurement::Attributes::AttributeList::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::Attributes::AttributeList::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::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 = ElectricalPowerMeasurement::Attributes::FeatureMap::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::Attributes::FeatureMap::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::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 = ElectricalPowerMeasurement::Attributes::ClusterRevision::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::Attributes::ClusterRevision::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + 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 = ElectricalPowerMeasurement::Attributes::ClusterRevision::TypeInfo; + [clusterStateCacheContainer + _readKnownCachedAttributeWithEndpointID:static_cast([endpoint unsignedShortValue]) + clusterID:TypeInfo::GetClusterId() + attributeID:TypeInfo::GetAttributeId() + queue:queue + completion:completion]; +} + +@end + @implementation MTRBaseClusterElectricalEnergyMeasurement - (void)readAttributeAccuracyWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error))completion @@ -49907,6 +50811,42 @@ + (void)readAttributePeriodicEnergyExportedWithClusterStateCache:(MTRClusterStat completion:completion]; } +- (void)readAttributeCumulativeEnergyResetWithCompletion:(void (^)(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::CumulativeEnergyReset::TypeInfo; + [self.device _readKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:nil + queue:self.callbackQueue + completion:completion]; +} + +- (void)subscribeAttributeCumulativeEnergyResetWithParams:(MTRSubscribeParams * _Nonnull)params + subscriptionEstablished:(MTRSubscriptionEstablishedHandler _Nullable)subscriptionEstablished + reportHandler:(void (^)(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value, NSError * _Nullable error))reportHandler +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::CumulativeEnergyReset::TypeInfo; + [self.device _subscribeToKnownAttributeWithEndpointID:self.endpointID + clusterID:@(TypeInfo::GetClusterId()) + attributeID:@(TypeInfo::GetAttributeId()) + params:params + queue:self.callbackQueue + reportHandler:reportHandler + subscriptionEstablished:subscriptionEstablished]; +} + ++ (void)readAttributeCumulativeEnergyResetWithClusterStateCache:(MTRClusterStateCacheContainer *)clusterStateCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completion:(void (^)(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value, NSError * _Nullable error))completion +{ + using TypeInfo = ElectricalEnergyMeasurement::Attributes::CumulativeEnergyReset::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; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 75aabe383e68c4..9518cb9ae6fcd5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -149,6 +149,7 @@ typedef NS_ENUM(uint32_t, MTRClusterIDType) { MTRClusterIDTypeActivatedCarbonFilterMonitoringID MTR_PROVISIONALLY_AVAILABLE = 0x00000072, MTRClusterIDTypeBooleanStateConfigurationID MTR_PROVISIONALLY_AVAILABLE = 0x00000080, MTRClusterIDTypeValveConfigurationAndControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000081, + MTRClusterIDTypeElectricalPowerMeasurementID MTR_PROVISIONALLY_AVAILABLE = 0x00000090, MTRClusterIDTypeElectricalEnergyMeasurementID MTR_PROVISIONALLY_AVAILABLE = 0x00000091, MTRClusterIDTypeDemandResponseLoadControlID MTR_PROVISIONALLY_AVAILABLE = 0x00000096, MTRClusterIDTypeMessagesID MTR_PROVISIONALLY_AVAILABLE = 0x00000097, @@ -2577,12 +2578,40 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, MTRAttributeIDTypeClusterValveConfigurationAndControlAttributeClusterRevisionID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeClusterRevisionID, + // Cluster ElectricalPowerMeasurement attributes + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributePowerModeID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeNumberOfMeasurementTypesID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeAccuracyID MTR_PROVISIONALLY_AVAILABLE = 0x00000002, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeRangesID MTR_PROVISIONALLY_AVAILABLE = 0x00000003, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeVoltageID MTR_PROVISIONALLY_AVAILABLE = 0x00000004, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeActiveCurrentID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeReactiveCurrentID MTR_PROVISIONALLY_AVAILABLE = 0x00000006, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeApparentCurrentID MTR_PROVISIONALLY_AVAILABLE = 0x00000007, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeActivePowerID MTR_PROVISIONALLY_AVAILABLE = 0x00000008, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeReactivePowerID MTR_PROVISIONALLY_AVAILABLE = 0x00000009, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeApparentPowerID MTR_PROVISIONALLY_AVAILABLE = 0x0000000A, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeRMSVoltageID MTR_PROVISIONALLY_AVAILABLE = 0x0000000B, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeRMSCurrentID MTR_PROVISIONALLY_AVAILABLE = 0x0000000C, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeRMSPowerID MTR_PROVISIONALLY_AVAILABLE = 0x0000000D, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeFrequencyID MTR_PROVISIONALLY_AVAILABLE = 0x0000000E, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeHarmonicCurrentsID MTR_PROVISIONALLY_AVAILABLE = 0x0000000F, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeHarmonicPhasesID MTR_PROVISIONALLY_AVAILABLE = 0x00000010, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributePowerFactorID MTR_PROVISIONALLY_AVAILABLE = 0x00000011, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeNeutralCurrentID MTR_PROVISIONALLY_AVAILABLE = 0x00000012, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeAttributeListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAttributeListID, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeFeatureMapID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeFeatureMapID, + MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeClusterRevisionID 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, + MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeCumulativeEnergyResetID MTR_PROVISIONALLY_AVAILABLE = 0x00000005, MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeGeneratedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeAcceptedCommandListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeAcceptedCommandListID, MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeEventListID MTR_PROVISIONALLY_AVAILABLE = MTRAttributeIDTypeGlobalAttributeEventListID, @@ -7156,6 +7185,9 @@ typedef NS_ENUM(uint32_t, MTREventIDType) { MTREventIDTypeClusterValveConfigurationAndControlEventValveStateChangedID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTREventIDTypeClusterValveConfigurationAndControlEventValveFaultID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, + // Cluster ElectricalPowerMeasurement events + MTREventIDTypeClusterElectricalPowerMeasurementEventMeasurementPeriodRangesID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, + // Cluster ElectricalEnergyMeasurement events MTREventIDTypeClusterElectricalEnergyMeasurementEventCumulativeEnergyMeasuredID MTR_PROVISIONALLY_AVAILABLE = 0x00000000, MTREventIDTypeClusterElectricalEnergyMeasurementEventPeriodicEnergyMeasuredID MTR_PROVISIONALLY_AVAILABLE = 0x00000001, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index bea9e4b57f52b4..d093371fdfd94a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -3429,6 +3429,80 @@ MTR_PROVISIONALLY_AVAILABLE @end +/** + * Cluster Electrical Power Measurement + * This cluster provides a mechanism for querying data about electrical power as measured by the server. + */ +MTR_PROVISIONALLY_AVAILABLE +@interface MTRClusterElectricalPowerMeasurement : MTRGenericCluster + +- (NSDictionary * _Nullable)readAttributePowerModeWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeNumberOfMeasurementTypesWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeAccuracyWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeRangesWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeVoltageWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeActiveCurrentWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeReactiveCurrentWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeApparentCurrentWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeActivePowerWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeReactivePowerWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeApparentPowerWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeRMSVoltageWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeRMSCurrentWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeRMSPowerWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeFrequencyWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeHarmonicCurrentsWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeHarmonicPhasesWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributePowerFactorWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + +- (NSDictionary * _Nullable)readAttributeNeutralCurrentWithParams:(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 MTRClusterElectricalPowerMeasurement (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 Electrical Energy Measurement * This cluster provides a mechanism for querying data about the electrical energy imported or provided by the server. @@ -3446,6 +3520,8 @@ MTR_PROVISIONALLY_AVAILABLE - (NSDictionary * _Nullable)readAttributePeriodicEnergyExportedWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; +- (NSDictionary * _Nullable)readAttributeCumulativeEnergyResetWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; - (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 5e4b455673849f..d81a35a1e50388 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -9069,6 +9069,135 @@ - (void)writeAttributeDefaultOpenLevelWithValue:(NSDictionary *) @end +@implementation MTRClusterElectricalPowerMeasurement + +- (NSDictionary * _Nullable)readAttributePowerModeWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributePowerModeID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeNumberOfMeasurementTypesWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeNumberOfMeasurementTypesID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAccuracyWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeAccuracyID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeRangesWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeRangesID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeVoltageWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeVoltageID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeActiveCurrentWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeActiveCurrentID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeReactiveCurrentWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeReactiveCurrentID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeApparentCurrentWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeApparentCurrentID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeActivePowerWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeActivePowerID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeReactivePowerWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeReactivePowerID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeApparentPowerWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeApparentPowerID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeRMSVoltageWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeRMSVoltageID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeRMSCurrentWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeRMSCurrentID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeRMSPowerWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeRMSPowerID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFrequencyWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeFrequencyID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeHarmonicCurrentsWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeHarmonicCurrentsID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeHarmonicPhasesWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeHarmonicPhasesID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributePowerFactorWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributePowerFactorID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeNeutralCurrentWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeNeutralCurrentID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeGeneratedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAcceptedCommandListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeAcceptedCommandListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeEventListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeEventListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeAttributeListWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeAttributeListID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeFeatureMapWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeFeatureMapID) params:params]; +} + +- (NSDictionary * _Nullable)readAttributeClusterRevisionWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalPowerMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalPowerMeasurementAttributeClusterRevisionID) params:params]; +} + +@end + @implementation MTRClusterElectricalEnergyMeasurement - (NSDictionary * _Nullable)readAttributeAccuracyWithParams:(MTRReadParams * _Nullable)params @@ -9096,6 +9225,11 @@ @implementation MTRClusterElectricalEnergyMeasurement return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributePeriodicEnergyExportedID) params:params]; } +- (NSDictionary * _Nullable)readAttributeCumulativeEnergyResetWithParams:(MTRReadParams * _Nullable)params +{ + return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeCumulativeEnergyResetID) params:params]; +} + - (NSDictionary * _Nullable)readAttributeGeneratedCommandListWithParams:(MTRReadParams * _Nullable)params { return [self.device readAttributeWithEndpointID:self.endpointID clusterID:@(MTRClusterIDTypeElectricalEnergyMeasurementID) attributeID:@(MTRAttributeIDTypeClusterElectricalEnergyMeasurementAttributeGeneratedCommandListID) params:params]; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm b/src/darwin/Framework/CHIP/zap-generated/MTRCommandTimedCheck.mm index e0269f1690b533..c599d23347fe22 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 CommandNeedsTimedInvokeInElectricalPowerMeasurementCluster(AttributeId aAttributeId) +{ + using namespace Clusters::ElectricalPowerMeasurement; + switch (aAttributeId) { + default: { + return NO; + } + } +} static BOOL CommandNeedsTimedInvokeInElectricalEnergyMeasurementCluster(AttributeId aAttributeId) { using namespace Clusters::ElectricalEnergyMeasurement; @@ -1296,6 +1305,9 @@ BOOL MTRCommandNeedsTimedInvoke(NSNumber * _Nonnull aClusterID, NSNumber * _Nonn case Clusters::ValveConfigurationAndControl::Id: { return CommandNeedsTimedInvokeInValveConfigurationAndControlCluster(commandID); } + case Clusters::ElectricalPowerMeasurement::Id: { + return CommandNeedsTimedInvokeInElectricalPowerMeasurementCluster(commandID); + } case Clusters::ElectricalEnergyMeasurement::Id: { return CommandNeedsTimedInvokeInElectricalEnergyMeasurementCluster(commandID); } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm index c9a5be796fc548..991f6fb6170e48 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRDeviceTypeMetadata.mm @@ -92,6 +92,7 @@ { 0x00000305, DeviceTypeClass::Simple, "Matter Pressure Sensor" }, { 0x00000306, DeviceTypeClass::Simple, "Matter Flow Sensor" }, { 0x00000307, DeviceTypeClass::Simple, "Matter Humidity Sensor" }, + { 0x00000510, DeviceTypeClass::Utility, "Matter Electrical Sensor" }, { 0x00000840, DeviceTypeClass::Simple, "Matter Control Bridge" }, { 0x00000850, DeviceTypeClass::Simple, "Matter On/Off Sensor" }, { 0xFFF10010, DeviceTypeClass::Simple, "Matter Network Infrastructure Manager" }, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index 431d29dac94ef3..a6a7256e379c57 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -2476,6 +2476,93 @@ static id _Nullable DecodeEventPayloadForValveConfigurationAndControlCluster(Eve *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } +static id _Nullable DecodeEventPayloadForElectricalPowerMeasurementCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ElectricalPowerMeasurement; + switch (aEventId) { + case Events::MeasurementPeriodRanges::Id: { + Events::MeasurementPeriodRanges::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.ranges.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRElectricalPowerMeasurementClusterMeasurementRangeStruct * newElement_0; + newElement_0 = [MTRElectricalPowerMeasurementClusterMeasurementRangeStruct new]; + newElement_0.measurementType = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0.measurementType)]; + newElement_0.min = [NSNumber numberWithLongLong:entry_0.min]; + newElement_0.max = [NSNumber numberWithLongLong:entry_0.max]; + if (entry_0.startTimestamp.HasValue()) { + newElement_0.startTimestamp = [NSNumber numberWithUnsignedInt:entry_0.startTimestamp.Value()]; + } else { + newElement_0.startTimestamp = nil; + } + if (entry_0.endTimestamp.HasValue()) { + newElement_0.endTimestamp = [NSNumber numberWithUnsignedInt:entry_0.endTimestamp.Value()]; + } else { + newElement_0.endTimestamp = nil; + } + if (entry_0.minTimestamp.HasValue()) { + newElement_0.minTimestamp = [NSNumber numberWithUnsignedInt:entry_0.minTimestamp.Value()]; + } else { + newElement_0.minTimestamp = nil; + } + if (entry_0.maxTimestamp.HasValue()) { + newElement_0.maxTimestamp = [NSNumber numberWithUnsignedInt:entry_0.maxTimestamp.Value()]; + } else { + newElement_0.maxTimestamp = nil; + } + if (entry_0.startSystime.HasValue()) { + newElement_0.startSystime = [NSNumber numberWithUnsignedLongLong:entry_0.startSystime.Value()]; + } else { + newElement_0.startSystime = nil; + } + if (entry_0.endSystime.HasValue()) { + newElement_0.endSystime = [NSNumber numberWithUnsignedLongLong:entry_0.endSystime.Value()]; + } else { + newElement_0.endSystime = nil; + } + if (entry_0.minSystime.HasValue()) { + newElement_0.minSystime = [NSNumber numberWithUnsignedLongLong:entry_0.minSystime.Value()]; + } else { + newElement_0.minSystime = nil; + } + if (entry_0.maxSystime.HasValue()) { + newElement_0.maxSystime = [NSNumber numberWithUnsignedLongLong:entry_0.maxSystime.Value()]; + } else { + newElement_0.maxSystime = nil; + } + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.ranges = memberValue; + } while (0); + + return value; + } + default: { + break; + } + } + + *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; @@ -4632,6 +4719,9 @@ id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVRead case Clusters::ValveConfigurationAndControl::Id: { return DecodeEventPayloadForValveConfigurationAndControlCluster(aPath.mEventId, aReader, aError); } + case Clusters::ElectricalPowerMeasurement::Id: { + return DecodeEventPayloadForElectricalPowerMeasurementCluster(aPath.mEventId, aReader, aError); + } case Clusters::ElectricalEnergyMeasurement::Id: { return DecodeEventPayloadForElectricalEnergyMeasurementCluster(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 395497c0bfc648..fb805fa04b3b43 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -1071,6 +1071,53 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSNumber * _Nonnull valveFault MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct : 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 MTRElectricalPowerMeasurementClusterMeasurementAccuracyStruct : 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 MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull order MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable measurement MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRElectricalPowerMeasurementClusterMeasurementRangeStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nonnull measurementType MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull min MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nonnull max 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 minTimestamp MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable maxTimestamp MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable startSystime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable endSystime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable minSystime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable maxSystime MTR_PROVISIONALLY_AVAILABLE; +@end + +MTR_PROVISIONALLY_AVAILABLE +@interface MTRElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent : NSObject +@property (nonatomic, copy) NSArray * _Nonnull ranges MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull rangeMin MTR_PROVISIONALLY_AVAILABLE; @@ -1092,6 +1139,14 @@ MTR_PROVISIONALLY_AVAILABLE @property (nonatomic, copy) NSArray * _Nonnull accuracyRanges MTR_PROVISIONALLY_AVAILABLE; @end +MTR_PROVISIONALLY_AVAILABLE +@interface MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct : NSObject +@property (nonatomic, copy) NSNumber * _Nullable importedResetTimestamp MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable exportedResetTimestamp MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable importedResetSystime MTR_PROVISIONALLY_AVAILABLE; +@property (nonatomic, copy) NSNumber * _Nullable exportedResetSystime MTR_PROVISIONALLY_AVAILABLE; +@end + MTR_PROVISIONALLY_AVAILABLE @interface MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull energy MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index 00c787feacb3c0..c9c38c72710756 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -4297,6 +4297,207 @@ - (NSString *)description @end +@implementation MTRElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct +- (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 = [[MTRElectricalPowerMeasurementClusterMeasurementAccuracyRangeStruct 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 MTRElectricalPowerMeasurementClusterMeasurementAccuracyStruct +- (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 = [[MTRElectricalPowerMeasurementClusterMeasurementAccuracyStruct 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 MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct +- (instancetype)init +{ + if (self = [super init]) { + + _order = @(0); + + _measurement = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRElectricalPowerMeasurementClusterHarmonicMeasurementStruct alloc] init]; + + other.order = self.order; + other.measurement = self.measurement; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: order:%@; measurement:%@; >", NSStringFromClass([self class]), _order, _measurement]; + return descriptionString; +} + +@end + +@implementation MTRElectricalPowerMeasurementClusterMeasurementRangeStruct +- (instancetype)init +{ + if (self = [super init]) { + + _measurementType = @(0); + + _min = @(0); + + _max = @(0); + + _startTimestamp = nil; + + _endTimestamp = nil; + + _minTimestamp = nil; + + _maxTimestamp = nil; + + _startSystime = nil; + + _endSystime = nil; + + _minSystime = nil; + + _maxSystime = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRElectricalPowerMeasurementClusterMeasurementRangeStruct alloc] init]; + + other.measurementType = self.measurementType; + other.min = self.min; + other.max = self.max; + other.startTimestamp = self.startTimestamp; + other.endTimestamp = self.endTimestamp; + other.minTimestamp = self.minTimestamp; + other.maxTimestamp = self.maxTimestamp; + other.startSystime = self.startSystime; + other.endSystime = self.endSystime; + other.minSystime = self.minSystime; + other.maxSystime = self.maxSystime; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: measurementType:%@; min:%@; max:%@; startTimestamp:%@; endTimestamp:%@; minTimestamp:%@; maxTimestamp:%@; startSystime:%@; endSystime:%@; minSystime:%@; maxSystime:%@; >", NSStringFromClass([self class]), _measurementType, _min, _max, _startTimestamp, _endTimestamp, _minTimestamp, _maxTimestamp, _startSystime, _endSystime, _minSystime, _maxSystime]; + return descriptionString; +} + +@end + +@implementation MTRElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent +- (instancetype)init +{ + if (self = [super init]) { + + _ranges = [NSArray array]; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRElectricalPowerMeasurementClusterMeasurementPeriodRangesEvent alloc] init]; + + other.ranges = self.ranges; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: ranges:%@; >", NSStringFromClass([self class]), _ranges]; + return descriptionString; +} + +@end + @implementation MTRElectricalEnergyMeasurementClusterMeasurementAccuracyRangeStruct - (instancetype)init { @@ -4384,6 +4585,42 @@ - (NSString *)description @end +@implementation MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct +- (instancetype)init +{ + if (self = [super init]) { + + _importedResetTimestamp = nil; + + _exportedResetTimestamp = nil; + + _importedResetSystime = nil; + + _exportedResetSystime = nil; + } + return self; +} + +- (id)copyWithZone:(NSZone * _Nullable)zone +{ + auto other = [[MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct alloc] init]; + + other.importedResetTimestamp = self.importedResetTimestamp; + other.exportedResetTimestamp = self.exportedResetTimestamp; + other.importedResetSystime = self.importedResetSystime; + other.exportedResetSystime = self.exportedResetSystime; + + return other; +} + +- (NSString *)description +{ + NSString * descriptionString = [NSString stringWithFormat:@"<%@: importedResetTimestamp:%@; exportedResetTimestamp:%@; importedResetSystime:%@; exportedResetSystime:%@; >", NSStringFromClass([self class]), _importedResetTimestamp, _exportedResetTimestamp, _importedResetSystime, _exportedResetSystime]; + return descriptionString; +} + +@end + @implementation MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct - (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 912428b16a4b25..957132452b900c 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 @@ -9918,17 +9918,17 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) } // namespace Attributes } // namespace ValveConfigurationAndControl -namespace ElectricalEnergyMeasurement { +namespace ElectricalPowerMeasurement { namespace Attributes { -namespace FeatureMap { +namespace ClusterRevision { -EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::ElectricalEnergyMeasurement::Id, Id, readable, sizeof(temp)); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::ElectricalPowerMeasurement::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { @@ -9937,9 +9937,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -9947,10 +9947,16 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint32_t value) 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); + return emberAfWriteAttribute(endpoint, Clusters::ElectricalPowerMeasurement::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); } -} // namespace FeatureMap +} // namespace ClusterRevision + +} // namespace Attributes +} // namespace ElectricalPowerMeasurement + +namespace ElectricalEnergyMeasurement { +namespace Attributes { namespace ClusterRevision { 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 841ec992bfc42d..c37d28b28bc936 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 @@ -1936,13 +1936,19 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace Attributes } // namespace ValveConfigurationAndControl -namespace ElectricalEnergyMeasurement { +namespace ElectricalPowerMeasurement { 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 ElectricalPowerMeasurement + +namespace ElectricalEnergyMeasurement { +namespace Attributes { namespace ClusterRevision { EmberAfStatus Get(chip::EndpointId endpoint, uint16_t * value); // int16u 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 9989e8424bbe87..7cf3765f7ba28c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -358,6 +358,11 @@ void emberAfBooleanStateConfigurationClusterInitCallback(chip::EndpointId endpoi */ void emberAfValveConfigurationAndControlClusterInitCallback(chip::EndpointId endpoint); +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfElectricalPowerMeasurementClusterInitCallback(chip::EndpointId endpoint); + /** * @param endpoint Endpoint that is being initialized */ @@ -3124,6 +3129,44 @@ chip::Protocols::InteractionModel::Status MatterValveConfigurationAndControlClus */ void emberAfValveConfigurationAndControlClusterServerTickCallback(chip::EndpointId endpoint); +// +// Electrical Power Measurement Cluster +// + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfElectricalPowerMeasurementClusterServerInitCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being shutdown + */ +void MatterElectricalPowerMeasurementClusterServerShutdownCallback(chip::EndpointId endpoint); + +/** + * @param endpoint Endpoint that is being initialized + */ +void emberAfElectricalPowerMeasurementClusterClientInitCallback(chip::EndpointId endpoint); + +/** + * @param attributePath Concrete attribute path that changed + */ +void MatterElectricalPowerMeasurementClusterServerAttributeChangedCallback(const chip::app::ConcreteAttributePath & attributePath); + +/** + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +chip::Protocols::InteractionModel::Status MatterElectricalPowerMeasurementClusterServerPreAttributeChangedCallback( + const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); + +/** + * @param endpoint Endpoint that is being served + */ +void emberAfElectricalPowerMeasurementClusterServerTickCallback(chip::EndpointId endpoint); + // // Electrical Energy Measurement 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 988e6b713a862e..727ddd76e02024 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 @@ -24,6 +24,146 @@ namespace chip { namespace app { namespace Clusters { +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::ChangeIndicationEnum val) +{ + using EnumType = detail::ChangeIndicationEnum; + switch (val) + { + case EnumType::kOk: + case EnumType::kWarning: + case EnumType::kCritical: + return val; + default: + return static_cast(3); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::DegradationDirectionEnum val) +{ + using EnumType = detail::DegradationDirectionEnum; + switch (val) + { + case EnumType::kUp: + case EnumType::kDown: + return val; + default: + return static_cast(2); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::ErrorStateEnum val) +{ + using EnumType = detail::ErrorStateEnum; + switch (val) + { + case EnumType::kNoError: + case EnumType::kUnableToStartOrResume: + case EnumType::kUnableToCompleteOperation: + case EnumType::kCommandInvalidInState: + return val; + default: + return static_cast(4); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::LevelValueEnum val) +{ + using EnumType = detail::LevelValueEnum; + switch (val) + { + case EnumType::kUnknown: + case EnumType::kLow: + case EnumType::kMedium: + case EnumType::kHigh: + case EnumType::kCritical: + return val; + default: + return static_cast(5); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::MeasurementMediumEnum val) +{ + using EnumType = detail::MeasurementMediumEnum; + switch (val) + { + case EnumType::kAir: + case EnumType::kWater: + case EnumType::kSoil: + return val; + default: + return static_cast(3); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::MeasurementTypeEnum val) +{ + using EnumType = detail::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(detail::MeasurementUnitEnum val) +{ + using EnumType = detail::MeasurementUnitEnum; + switch (val) + { + case EnumType::kPpm: + case EnumType::kPpb: + case EnumType::kPpt: + case EnumType::kMgm3: + case EnumType::kUgm3: + case EnumType::kNgm3: + case EnumType::kPm3: + case EnumType::kBqm3: + return val; + default: + return static_cast(8); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::OperationalStateEnum val) +{ + using EnumType = detail::OperationalStateEnum; + switch (val) + { + case EnumType::kStopped: + case EnumType::kRunning: + case EnumType::kPaused: + case EnumType::kError: + return val; + default: + return static_cast(4); + } +} +static auto __attribute__((unused)) EnsureKnownEnumValue(detail::ProductIdentifierTypeEnum val) +{ + using EnumType = detail::ProductIdentifierTypeEnum; + switch (val) + { + case EnumType::kUpc: + case EnumType::kGtin8: + case EnumType::kEan: + case EnumType::kGtin14: + case EnumType::kOem: + return val; + default: + return static_cast(5); + } +} + static auto __attribute__((unused)) EnsureKnownEnumValue(Identify::EffectIdentifierEnum val) { using EnumType = Identify::EffectIdentifierEnum; @@ -1216,35 +1356,6 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(Timer::TimerStatusEnum } } -static auto __attribute__((unused)) EnsureKnownEnumValue(OvenCavityOperationalState::ErrorStateEnum val) -{ - using EnumType = OvenCavityOperationalState::ErrorStateEnum; - switch (val) - { - case EnumType::kNoError: - case EnumType::kUnableToStartOrResume: - case EnumType::kUnableToCompleteOperation: - case EnumType::kCommandInvalidInState: - return val; - default: - return static_cast(4); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(OvenCavityOperationalState::OperationalStateEnum val) -{ - using EnumType = OvenCavityOperationalState::OperationalStateEnum; - switch (val) - { - case EnumType::kStopped: - case EnumType::kRunning: - case EnumType::kPaused: - case EnumType::kError: - return val; - default: - return static_cast(4); - } -} - static auto __attribute__((unused)) EnsureKnownEnumValue(OvenMode::ModeTag val) { using EnumType = OvenMode::ModeTag; @@ -1410,264 +1521,141 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(MicrowaveOvenMode::Mode } } -static auto __attribute__((unused)) EnsureKnownEnumValue(OperationalState::ErrorStateEnum val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ValveConfigurationAndControl::StatusCodeEnum val) { - using EnumType = OperationalState::ErrorStateEnum; + using EnumType = ValveConfigurationAndControl::StatusCodeEnum; switch (val) { - case EnumType::kNoError: - case EnumType::kUnableToStartOrResume: - case EnumType::kUnableToCompleteOperation: - case EnumType::kCommandInvalidInState: + case EnumType::kFailureDueToFault: return val; default: - return static_cast(4); + return static_cast(0); } } -static auto __attribute__((unused)) EnsureKnownEnumValue(OperationalState::OperationalStateEnum val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ValveConfigurationAndControl::ValveStateEnum val) { - using EnumType = OperationalState::OperationalStateEnum; + using EnumType = ValveConfigurationAndControl::ValveStateEnum; switch (val) { - case EnumType::kStopped: - case EnumType::kRunning: - case EnumType::kPaused: - case EnumType::kError: + case EnumType::kClosed: + case EnumType::kOpen: + case EnumType::kTransitioning: return val; default: - return static_cast(4); + return static_cast(3); } } -static auto __attribute__((unused)) EnsureKnownEnumValue(HepaFilterMonitoring::ChangeIndicationEnum val) +static auto __attribute__((unused)) EnsureKnownEnumValue(ElectricalPowerMeasurement::PowerModeEnum val) { - using EnumType = HepaFilterMonitoring::ChangeIndicationEnum; + using EnumType = ElectricalPowerMeasurement::PowerModeEnum; switch (val) { - case EnumType::kOk: - case EnumType::kWarning: - case EnumType::kCritical: + case EnumType::kUnknown: + case EnumType::kDc: + case EnumType::kAc: return val; default: return static_cast(3); } } -static auto __attribute__((unused)) EnsureKnownEnumValue(HepaFilterMonitoring::DegradationDirectionEnum val) + +static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::CriticalityLevelEnum val) { - using EnumType = HepaFilterMonitoring::DegradationDirectionEnum; + using EnumType = DemandResponseLoadControl::CriticalityLevelEnum; switch (val) { - case EnumType::kUp: - case EnumType::kDown: + case EnumType::kUnknown: + case EnumType::kGreen: + case EnumType::kLevel1: + case EnumType::kLevel2: + case EnumType::kLevel3: + case EnumType::kLevel4: + case EnumType::kLevel5: + case EnumType::kEmergency: + case EnumType::kPlannedOutage: + case EnumType::kServiceDisconnect: return val; default: - return static_cast(2); + return static_cast(10); } } -static auto __attribute__((unused)) EnsureKnownEnumValue(HepaFilterMonitoring::ProductIdentifierTypeEnum val) +static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::HeatingSourceEnum val) { - using EnumType = HepaFilterMonitoring::ProductIdentifierTypeEnum; + using EnumType = DemandResponseLoadControl::HeatingSourceEnum; switch (val) { - case EnumType::kUpc: - case EnumType::kGtin8: - case EnumType::kEan: - case EnumType::kGtin14: - case EnumType::kOem: + case EnumType::kAny: + case EnumType::kElectric: + case EnumType::kNonElectric: return val; default: - return static_cast(5); + return static_cast(3); } } - -static auto __attribute__((unused)) EnsureKnownEnumValue(ActivatedCarbonFilterMonitoring::ChangeIndicationEnum val) +static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::LoadControlEventChangeSourceEnum val) { - using EnumType = ActivatedCarbonFilterMonitoring::ChangeIndicationEnum; + using EnumType = DemandResponseLoadControl::LoadControlEventChangeSourceEnum; switch (val) { - case EnumType::kOk: - case EnumType::kWarning: - case EnumType::kCritical: + case EnumType::kAutomatic: + case EnumType::kUserAction: return val; default: - return static_cast(3); + return static_cast(2); } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ActivatedCarbonFilterMonitoring::DegradationDirectionEnum val) +static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::LoadControlEventStatusEnum val) { - using EnumType = ActivatedCarbonFilterMonitoring::DegradationDirectionEnum; + using EnumType = DemandResponseLoadControl::LoadControlEventStatusEnum; switch (val) { - case EnumType::kUp: - case EnumType::kDown: + case EnumType::kUnknown: + case EnumType::kReceived: + case EnumType::kInProgress: + case EnumType::kCompleted: + case EnumType::kOptedOut: + case EnumType::kOptedIn: + case EnumType::kCanceled: + case EnumType::kSuperseded: + case EnumType::kPartialOptedOut: + case EnumType::kPartialOptedIn: + case EnumType::kNoParticipation: + case EnumType::kUnavailable: + case EnumType::kFailed: return val; default: - return static_cast(2); + return static_cast(13); } } -static auto __attribute__((unused)) EnsureKnownEnumValue(ActivatedCarbonFilterMonitoring::ProductIdentifierTypeEnum val) + +static auto __attribute__((unused)) EnsureKnownEnumValue(Messages::FutureMessagePreferenceEnum val) { - using EnumType = ActivatedCarbonFilterMonitoring::ProductIdentifierTypeEnum; + using EnumType = Messages::FutureMessagePreferenceEnum; switch (val) { - case EnumType::kUpc: - case EnumType::kGtin8: - case EnumType::kEan: - case EnumType::kGtin14: - case EnumType::kOem: + case EnumType::kAllowed: + case EnumType::kIncreased: + case EnumType::kReduced: + case EnumType::kDisallowed: + case EnumType::kBanned: return val; default: return static_cast(5); } } - -static auto __attribute__((unused)) EnsureKnownEnumValue(ValveConfigurationAndControl::StatusCodeEnum val) +static auto __attribute__((unused)) EnsureKnownEnumValue(Messages::MessagePriorityEnum val) { - using EnumType = ValveConfigurationAndControl::StatusCodeEnum; + using EnumType = Messages::MessagePriorityEnum; switch (val) { - case EnumType::kFailureDueToFault: + case EnumType::kLow: + case EnumType::kMedium: + case EnumType::kHigh: + case EnumType::kCritical: return val; default: - return static_cast(0); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(ValveConfigurationAndControl::ValveStateEnum val) -{ - using EnumType = ValveConfigurationAndControl::ValveStateEnum; - switch (val) - { - case EnumType::kClosed: - case EnumType::kOpen: - case EnumType::kTransitioning: - return val; - default: - return static_cast(3); - } -} - -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; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kGreen: - case EnumType::kLevel1: - case EnumType::kLevel2: - case EnumType::kLevel3: - case EnumType::kLevel4: - case EnumType::kLevel5: - case EnumType::kEmergency: - case EnumType::kPlannedOutage: - case EnumType::kServiceDisconnect: - return val; - default: - return static_cast(10); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::HeatingSourceEnum val) -{ - using EnumType = DemandResponseLoadControl::HeatingSourceEnum; - switch (val) - { - case EnumType::kAny: - case EnumType::kElectric: - case EnumType::kNonElectric: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::LoadControlEventChangeSourceEnum val) -{ - using EnumType = DemandResponseLoadControl::LoadControlEventChangeSourceEnum; - switch (val) - { - case EnumType::kAutomatic: - case EnumType::kUserAction: - return val; - default: - return static_cast(2); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(DemandResponseLoadControl::LoadControlEventStatusEnum val) -{ - using EnumType = DemandResponseLoadControl::LoadControlEventStatusEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kReceived: - case EnumType::kInProgress: - case EnumType::kCompleted: - case EnumType::kOptedOut: - case EnumType::kOptedIn: - case EnumType::kCanceled: - case EnumType::kSuperseded: - case EnumType::kPartialOptedOut: - case EnumType::kPartialOptedIn: - case EnumType::kNoParticipation: - case EnumType::kUnavailable: - case EnumType::kFailed: - return val; - default: - return static_cast(13); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(Messages::FutureMessagePreferenceEnum val) -{ - using EnumType = Messages::FutureMessagePreferenceEnum; - switch (val) - { - case EnumType::kAllowed: - case EnumType::kIncreased: - case EnumType::kReduced: - case EnumType::kDisallowed: - case EnumType::kBanned: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(Messages::MessagePriorityEnum val) -{ - using EnumType = Messages::MessagePriorityEnum; - switch (val) - { - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(4); + return static_cast(4); } } @@ -2719,478 +2707,6 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(OccupancySensing::Occup } } -static auto __attribute__((unused)) EnsureKnownEnumValue(CarbonMonoxideConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = CarbonMonoxideConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(CarbonMonoxideConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = CarbonMonoxideConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(CarbonMonoxideConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = CarbonMonoxideConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(CarbonDioxideConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = CarbonDioxideConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(CarbonDioxideConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = CarbonDioxideConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(CarbonDioxideConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = CarbonDioxideConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(NitrogenDioxideConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = NitrogenDioxideConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(NitrogenDioxideConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = NitrogenDioxideConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(NitrogenDioxideConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = NitrogenDioxideConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(OzoneConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = OzoneConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(OzoneConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = OzoneConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(OzoneConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = OzoneConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(Pm25ConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = Pm25ConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(Pm25ConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = Pm25ConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(Pm25ConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = Pm25ConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(FormaldehydeConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = FormaldehydeConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(FormaldehydeConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = FormaldehydeConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(FormaldehydeConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = FormaldehydeConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(Pm1ConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = Pm1ConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(Pm1ConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = Pm1ConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(Pm1ConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = Pm1ConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(Pm10ConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = Pm10ConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(Pm10ConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = Pm10ConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(Pm10ConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = Pm10ConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(TotalVolatileOrganicCompoundsConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = TotalVolatileOrganicCompoundsConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) -EnsureKnownEnumValue(TotalVolatileOrganicCompoundsConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = TotalVolatileOrganicCompoundsConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) -EnsureKnownEnumValue(TotalVolatileOrganicCompoundsConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = TotalVolatileOrganicCompoundsConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - -static auto __attribute__((unused)) EnsureKnownEnumValue(RadonConcentrationMeasurement::LevelValueEnum val) -{ - using EnumType = RadonConcentrationMeasurement::LevelValueEnum; - switch (val) - { - case EnumType::kUnknown: - case EnumType::kLow: - case EnumType::kMedium: - case EnumType::kHigh: - case EnumType::kCritical: - return val; - default: - return static_cast(5); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(RadonConcentrationMeasurement::MeasurementMediumEnum val) -{ - using EnumType = RadonConcentrationMeasurement::MeasurementMediumEnum; - switch (val) - { - case EnumType::kAir: - case EnumType::kWater: - case EnumType::kSoil: - return val; - default: - return static_cast(3); - } -} -static auto __attribute__((unused)) EnsureKnownEnumValue(RadonConcentrationMeasurement::MeasurementUnitEnum val) -{ - using EnumType = RadonConcentrationMeasurement::MeasurementUnitEnum; - switch (val) - { - case EnumType::kPpm: - case EnumType::kPpb: - case EnumType::kPpt: - case EnumType::kMgm3: - case EnumType::kUgm3: - case EnumType::kNgm3: - case EnumType::kPm3: - case EnumType::kBqm3: - return val; - default: - return static_cast(8); - } -} - static auto __attribute__((unused)) EnsureKnownEnumValue(Channel::ChannelTypeEnum val) { using EnumType = Channel::ChannelTypeEnum; 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 585d9fe8b8f1e6..0d543de50b2744 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 @@ -25,6 +25,152 @@ namespace chip { namespace app { namespace Clusters { +namespace detail { +// Enums shared across multiple clusters. + +// Enum for ChangeIndicationEnum +enum class ChangeIndicationEnum : uint8_t +{ + kOk = 0x00, + kWarning = 0x01, + kCritical = 0x02, + // 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 = 3, +}; + +// Enum for DegradationDirectionEnum +enum class DegradationDirectionEnum : uint8_t +{ + kUp = 0x00, + kDown = 0x01, + // 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 = 2, +}; + +// Enum for ErrorStateEnum +enum class ErrorStateEnum : uint8_t +{ + kNoError = 0x00, + kUnableToStartOrResume = 0x01, + kUnableToCompleteOperation = 0x02, + kCommandInvalidInState = 0x03, + // 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 = 4, +}; + +// Enum for LevelValueEnum +enum class LevelValueEnum : uint8_t +{ + kUnknown = 0x00, + kLow = 0x01, + kMedium = 0x02, + kHigh = 0x03, + kCritical = 0x04, + // 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 = 5, +}; + +// Enum for MeasurementMediumEnum +enum class MeasurementMediumEnum : uint8_t +{ + kAir = 0x00, + kWater = 0x01, + kSoil = 0x02, + // 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 = 3, +}; + +// 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, +}; + +// Enum for MeasurementUnitEnum +enum class MeasurementUnitEnum : uint8_t +{ + kPpm = 0x00, + kPpb = 0x01, + kPpt = 0x02, + kMgm3 = 0x03, + kUgm3 = 0x04, + kNgm3 = 0x05, + kPm3 = 0x06, + kBqm3 = 0x07, + // 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 = 8, +}; + +// Enum for OperationalStateEnum +enum class OperationalStateEnum : uint8_t +{ + kStopped = 0x00, + kRunning = 0x01, + kPaused = 0x02, + kError = 0x03, + // 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 = 4, +}; + +// Enum for ProductIdentifierTypeEnum +enum class ProductIdentifierTypeEnum : uint8_t +{ + kUpc = 0x00, + kGtin8 = 0x01, + kEan = 0x02, + kGtin14 = 0x03, + kOem = 0x04, + // 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 = 5, +}; + +// Bitmaps shared across multiple clusters. + +} // namespace detail + namespace Identify { // Enum for EffectIdentifierEnum @@ -1516,33 +1662,9 @@ enum class Feature : uint32_t namespace OvenCavityOperationalState { -// Enum for ErrorStateEnum -enum class ErrorStateEnum : uint8_t -{ - kNoError = 0x00, - kUnableToStartOrResume = 0x01, - kUnableToCompleteOperation = 0x02, - kCommandInvalidInState = 0x03, - // 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 = 4, -}; +using ErrorStateEnum = Clusters::detail::ErrorStateEnum; -// Enum for OperationalStateEnum -enum class OperationalStateEnum : uint8_t -{ - kStopped = 0x00, - kRunning = 0x01, - kPaused = 0x02, - kError = 0x03, - // 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 = 4, -}; +using OperationalStateEnum = Clusters::detail::OperationalStateEnum; } // namespace OvenCavityOperationalState namespace OvenMode { @@ -1958,33 +2080,9 @@ enum class Feature : uint32_t namespace OperationalState { -// Enum for ErrorStateEnum -enum class ErrorStateEnum : uint8_t -{ - kNoError = 0x00, - kUnableToStartOrResume = 0x01, - kUnableToCompleteOperation = 0x02, - kCommandInvalidInState = 0x03, - // 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 = 4, -}; +using ErrorStateEnum = Clusters::detail::ErrorStateEnum; -// Enum for OperationalStateEnum -enum class OperationalStateEnum : uint8_t -{ - kStopped = 0x00, - kRunning = 0x01, - kPaused = 0x02, - kError = 0x03, - // 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 = 4, -}; +using OperationalStateEnum = Clusters::detail::OperationalStateEnum; } // namespace OperationalState namespace RvcOperationalState { @@ -2038,45 +2136,11 @@ enum class Feature : uint32_t namespace HepaFilterMonitoring { -// Enum for ChangeIndicationEnum -enum class ChangeIndicationEnum : uint8_t -{ - kOk = 0x00, - kWarning = 0x01, - kCritical = 0x02, - // 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 = 3, -}; +using ChangeIndicationEnum = Clusters::detail::ChangeIndicationEnum; -// Enum for DegradationDirectionEnum -enum class DegradationDirectionEnum : uint8_t -{ - kUp = 0x00, - kDown = 0x01, - // 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 = 2, -}; +using DegradationDirectionEnum = Clusters::detail::DegradationDirectionEnum; -// Enum for ProductIdentifierTypeEnum -enum class ProductIdentifierTypeEnum : uint8_t -{ - kUpc = 0x00, - kGtin8 = 0x01, - kEan = 0x02, - kGtin14 = 0x03, - kOem = 0x04, - // 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 = 5, -}; +using ProductIdentifierTypeEnum = Clusters::detail::ProductIdentifierTypeEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -2089,59 +2153,25 @@ enum class Feature : uint32_t namespace ActivatedCarbonFilterMonitoring { -// Enum for ChangeIndicationEnum -enum class ChangeIndicationEnum : uint8_t +using ChangeIndicationEnum = Clusters::detail::ChangeIndicationEnum; + +using DegradationDirectionEnum = Clusters::detail::DegradationDirectionEnum; + +using ProductIdentifierTypeEnum = Clusters::detail::ProductIdentifierTypeEnum; + +// Bitmap for Feature +enum class Feature : uint32_t { - kOk = 0x00, - kWarning = 0x01, - kCritical = 0x02, - // 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 = 3, + kCondition = 0x1, + kWarning = 0x2, + kReplacementProductList = 0x4, }; +} // namespace ActivatedCarbonFilterMonitoring -// Enum for DegradationDirectionEnum -enum class DegradationDirectionEnum : uint8_t -{ - kUp = 0x00, - kDown = 0x01, - // 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 = 2, -}; - -// Enum for ProductIdentifierTypeEnum -enum class ProductIdentifierTypeEnum : uint8_t -{ - kUpc = 0x00, - kGtin8 = 0x01, - kEan = 0x02, - kGtin14 = 0x03, - kOem = 0x04, - // 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 = 5, -}; - -// Bitmap for Feature -enum class Feature : uint32_t -{ - kCondition = 0x1, - kWarning = 0x2, - kReplacementProductList = 0x4, -}; -} // namespace ActivatedCarbonFilterMonitoring - -namespace BooleanStateConfiguration { - -// Bitmap for AlarmModeBitmap -enum class AlarmModeBitmap : uint8_t +namespace BooleanStateConfiguration { + +// Bitmap for AlarmModeBitmap +enum class AlarmModeBitmap : uint8_t { kVisual = 0x1, kAudible = 0x2, @@ -2208,33 +2238,38 @@ enum class ValveFaultBitmap : uint16_t }; } // namespace ValveConfigurationAndControl -namespace ElectricalEnergyMeasurement { +namespace ElectricalPowerMeasurement { -// Enum for MeasurementTypeEnum -enum class MeasurementTypeEnum : uint16_t +using MeasurementTypeEnum = Clusters::detail::MeasurementTypeEnum; + +// Enum for PowerModeEnum +enum class PowerModeEnum : uint8_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, + kUnknown = 0x00, + kDc = 0x01, + kAc = 0x02, // 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, + kUnknownEnumValue = 3, }; +// Bitmap for Feature +enum class Feature : uint32_t +{ + kDirectCurrent = 0x1, + kAlternatingCurrent = 0x2, + kPolyphasePower = 0x4, + kHarmonics = 0x8, + kPowerQuality = 0x10, +}; +} // namespace ElectricalPowerMeasurement + +namespace ElectricalEnergyMeasurement { + +using MeasurementTypeEnum = Clusters::detail::MeasurementTypeEnum; + // Bitmap for Feature enum class Feature : uint32_t { @@ -4058,51 +4093,11 @@ enum class OccupancySensorTypeBitmap : uint8_t namespace CarbonMonoxideConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -4118,51 +4113,11 @@ enum class Feature : uint32_t namespace CarbonDioxideConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -4178,51 +4133,11 @@ enum class Feature : uint32_t namespace NitrogenDioxideConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -4238,51 +4153,11 @@ enum class Feature : uint32_t namespace OzoneConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -4298,51 +4173,11 @@ enum class Feature : uint32_t namespace Pm25ConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -4358,51 +4193,11 @@ enum class Feature : uint32_t namespace FormaldehydeConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -4418,51 +4213,11 @@ enum class Feature : uint32_t namespace Pm1ConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -4478,51 +4233,11 @@ enum class Feature : uint32_t namespace Pm10ConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -4538,51 +4253,11 @@ enum class Feature : uint32_t namespace TotalVolatileOrganicCompoundsConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t @@ -4598,51 +4273,11 @@ enum class Feature : uint32_t namespace RadonConcentrationMeasurement { -// Enum for LevelValueEnum -enum class LevelValueEnum : uint8_t -{ - kUnknown = 0x00, - kLow = 0x01, - kMedium = 0x02, - kHigh = 0x03, - kCritical = 0x04, - // 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 = 5, -}; +using LevelValueEnum = Clusters::detail::LevelValueEnum; -// Enum for MeasurementMediumEnum -enum class MeasurementMediumEnum : uint8_t -{ - kAir = 0x00, - kWater = 0x01, - kSoil = 0x02, - // 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 = 3, -}; +using MeasurementMediumEnum = Clusters::detail::MeasurementMediumEnum; -// Enum for MeasurementUnitEnum -enum class MeasurementUnitEnum : uint8_t -{ - kPpm = 0x00, - kPpb = 0x01, - kPpt = 0x02, - kMgm3 = 0x03, - kUgm3 = 0x04, - kNgm3 = 0x05, - kPm3 = 0x06, - kBqm3 = 0x07, - // 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 = 8, -}; +using MeasurementUnitEnum = Clusters::detail::MeasurementUnitEnum; // Bitmap for Feature enum class Feature : uint32_t 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 c19ff038dfffbf..d8717b571de30c 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 @@ -167,6 +167,133 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace ModeOptionStruct +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 ApplicationStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const { @@ -13818,21 +13945,15 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace Events } // namespace ValveConfigurationAndControl -namespace ElectricalEnergyMeasurement { +namespace ElectricalPowerMeasurement { namespace Structs { -namespace MeasurementAccuracyRangeStruct { +namespace HarmonicMeasurementStruct { 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); + encoder.Encode(to_underlying(Fields::kOrder), order); + encoder.Encode(to_underlying(Fields::kMeasurement), measurement); return encoder.Finalize(); } @@ -13850,37 +13971,99 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kRangeMin)) + if (__context_tag == to_underlying(Fields::kOrder)) { - err = DataModel::Decode(reader, rangeMin); + err = DataModel::Decode(reader, order); } - else if (__context_tag == to_underlying(Fields::kRangeMax)) + else if (__context_tag == to_underlying(Fields::kMeasurement)) { - err = DataModel::Decode(reader, rangeMax); + err = DataModel::Decode(reader, measurement); } - else if (__context_tag == to_underlying(Fields::kPercentMax)) + else { - err = DataModel::Decode(reader, percentMax); } - else if (__context_tag == to_underlying(Fields::kPercentMin)) + + ReturnErrorOnFailure(err); + } +} + +} // namespace HarmonicMeasurementStruct + +namespace MeasurementRangeStruct { +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::kMin), min); + encoder.Encode(to_underlying(Fields::kMax), max); + encoder.Encode(to_underlying(Fields::kStartTimestamp), startTimestamp); + encoder.Encode(to_underlying(Fields::kEndTimestamp), endTimestamp); + encoder.Encode(to_underlying(Fields::kMinTimestamp), minTimestamp); + encoder.Encode(to_underlying(Fields::kMaxTimestamp), maxTimestamp); + encoder.Encode(to_underlying(Fields::kStartSystime), startSystime); + encoder.Encode(to_underlying(Fields::kEndSystime), endSystime); + encoder.Encode(to_underlying(Fields::kMinSystime), minSystime); + encoder.Encode(to_underlying(Fields::kMaxSystime), maxSystime); + 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)) { - err = DataModel::Decode(reader, percentMin); + return std::get(__element); } - else if (__context_tag == to_underlying(Fields::kPercentTypical)) + + 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, percentTypical); + err = DataModel::Decode(reader, measurementType); } - else if (__context_tag == to_underlying(Fields::kFixedMax)) + else if (__context_tag == to_underlying(Fields::kMin)) { - err = DataModel::Decode(reader, fixedMax); + err = DataModel::Decode(reader, min); } - else if (__context_tag == to_underlying(Fields::kFixedMin)) + else if (__context_tag == to_underlying(Fields::kMax)) { - err = DataModel::Decode(reader, fixedMin); + err = DataModel::Decode(reader, max); } - else if (__context_tag == to_underlying(Fields::kFixedTypical)) + else if (__context_tag == to_underlying(Fields::kStartTimestamp)) { - err = DataModel::Decode(reader, fixedTypical); + 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::kMinTimestamp)) + { + err = DataModel::Decode(reader, minTimestamp); + } + else if (__context_tag == to_underlying(Fields::kMaxTimestamp)) + { + err = DataModel::Decode(reader, maxTimestamp); + } + 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 if (__context_tag == to_underlying(Fields::kMinSystime)) + { + err = DataModel::Decode(reader, minSystime); + } + else if (__context_tag == to_underlying(Fields::kMaxSystime)) + { + err = DataModel::Decode(reader, maxSystime); } else { @@ -13890,18 +14073,80 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace MeasurementAccuracyRangeStruct +} // namespace MeasurementRangeStruct +} // namespace Structs -namespace MeasurementAccuracyStruct { +namespace Commands {} // namespace Commands + +namespace Attributes { +CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path) +{ + switch (path.mAttributeId) + { + case Attributes::PowerMode::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, powerMode); + case Attributes::NumberOfMeasurementTypes::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, numberOfMeasurementTypes); + case Attributes::Accuracy::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, accuracy); + case Attributes::Ranges::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, ranges); + case Attributes::Voltage::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, voltage); + case Attributes::ActiveCurrent::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, activeCurrent); + case Attributes::ReactiveCurrent::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, reactiveCurrent); + case Attributes::ApparentCurrent::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, apparentCurrent); + case Attributes::ActivePower::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, activePower); + case Attributes::ReactivePower::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, reactivePower); + case Attributes::ApparentPower::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, apparentPower); + case Attributes::RMSVoltage::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, RMSVoltage); + case Attributes::RMSCurrent::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, RMSCurrent); + case Attributes::RMSPower::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, RMSPower); + case Attributes::Frequency::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, frequency); + case Attributes::HarmonicCurrents::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, harmonicCurrents); + case Attributes::HarmonicPhases::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, harmonicPhases); + case Attributes::PowerFactor::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, powerFactor); + case Attributes::NeutralCurrent::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, neutralCurrent); + 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 MeasurementPeriodRanges { 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(); + TLV::TLVType outer; + ReturnErrorOnFailure(aWriter.StartContainer(aTag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(aWriter, TLV::ContextTag(Fields::kRanges), ranges)); + return aWriter.EndContainer(outer); } CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) @@ -13918,25 +14163,64 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) CHIP_ERROR err = CHIP_NO_ERROR; const uint8_t __context_tag = std::get(__element); - if (__context_tag == to_underlying(Fields::kMeasurementType)) + if (__context_tag == to_underlying(Fields::kRanges)) { - err = DataModel::Decode(reader, measurementType); + err = DataModel::Decode(reader, ranges); } - else if (__context_tag == to_underlying(Fields::kMeasured)) + else { - err = DataModel::Decode(reader, measured); } - else if (__context_tag == to_underlying(Fields::kMinMeasuredValue)) + + ReturnErrorOnFailure(err); + } +} +} // namespace MeasurementPeriodRanges. +} // namespace Events + +} // namespace ElectricalPowerMeasurement +namespace ElectricalEnergyMeasurement { +namespace Structs { + +namespace CumulativeEnergyResetStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const +{ + DataModel::WrappedStructEncoder encoder{ aWriter, aTag }; + encoder.Encode(to_underlying(Fields::kImportedResetTimestamp), importedResetTimestamp); + encoder.Encode(to_underlying(Fields::kExportedResetTimestamp), exportedResetTimestamp); + encoder.Encode(to_underlying(Fields::kImportedResetSystime), importedResetSystime); + encoder.Encode(to_underlying(Fields::kExportedResetSystime), exportedResetSystime); + 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)) { - err = DataModel::Decode(reader, minMeasuredValue); + return std::get(__element); } - else if (__context_tag == to_underlying(Fields::kMaxMeasuredValue)) + + CHIP_ERROR err = CHIP_NO_ERROR; + const uint8_t __context_tag = std::get(__element); + + if (__context_tag == to_underlying(Fields::kImportedResetTimestamp)) { - err = DataModel::Decode(reader, maxMeasuredValue); + err = DataModel::Decode(reader, importedResetTimestamp); } - else if (__context_tag == to_underlying(Fields::kAccuracyRanges)) + else if (__context_tag == to_underlying(Fields::kExportedResetTimestamp)) { - err = DataModel::Decode(reader, accuracyRanges); + err = DataModel::Decode(reader, exportedResetTimestamp); + } + else if (__context_tag == to_underlying(Fields::kImportedResetSystime)) + { + err = DataModel::Decode(reader, importedResetSystime); + } + else if (__context_tag == to_underlying(Fields::kExportedResetSystime)) + { + err = DataModel::Decode(reader, exportedResetSystime); } else { @@ -13946,7 +14230,7 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } -} // namespace MeasurementAccuracyStruct +} // namespace CumulativeEnergyResetStruct namespace EnergyMeasurementStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const @@ -14022,6 +14306,8 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre return DataModel::Decode(reader, periodicEnergyImported); case Attributes::PeriodicEnergyExported::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, periodicEnergyExported); + case Attributes::CumulativeEnergyReset::TypeInfo::GetAttributeId(): + return DataModel::Decode(reader, cumulativeEnergyReset); case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): return DataModel::Decode(reader, generatedCommandList); case Attributes::AcceptedCommandList::TypeInfo::GetAttributeId(): 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 84960c16a477f2..03b4650b243e5f 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 @@ -42,6 +42,7 @@ namespace Clusters { namespace detail { // Structs shared across multiple clusters. namespace Structs { + namespace ModeTagStruct { enum class Fields : uint8_t { @@ -98,6 +99,80 @@ struct DecodableType }; } // namespace ModeOptionStruct +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 ApplicationStruct { enum class Fields : uint8_t { @@ -19949,32 +20024,22 @@ struct DecodableType } // namespace ValveFault } // namespace Events } // namespace ValveConfigurationAndControl -namespace ElectricalEnergyMeasurement { +namespace ElectricalPowerMeasurement { namespace Structs { -namespace MeasurementAccuracyRangeStruct { +namespace MeasurementAccuracyRangeStruct = Clusters::detail::Structs::MeasurementAccuracyRangeStruct; +namespace MeasurementAccuracyStruct = Clusters::detail::Structs::MeasurementAccuracyStruct; +namespace HarmonicMeasurementStruct { enum class Fields : uint8_t { - kRangeMin = 0, - kRangeMax = 1, - kPercentMax = 2, - kPercentMin = 3, - kPercentTypical = 4, - kFixedMax = 5, - kFixedMin = 6, - kFixedTypical = 7, + kOrder = 0, + kMeasurement = 1, }; 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; + uint8_t order = static_cast(0); + DataModel::Nullable measurement; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -19985,46 +20050,433 @@ struct Type using DecodableType = Type; -} // namespace MeasurementAccuracyRangeStruct -namespace MeasurementAccuracyStruct { +} // namespace HarmonicMeasurementStruct +namespace MeasurementRangeStruct { enum class Fields : uint8_t { - kMeasurementType = 0, - kMeasured = 1, - kMinMeasuredValue = 2, - kMaxMeasuredValue = 3, - kAccuracyRanges = 4, + kMeasurementType = 0, + kMin = 1, + kMax = 2, + kStartTimestamp = 3, + kEndTimestamp = 4, + kMinTimestamp = 5, + kMaxTimestamp = 6, + kStartSystime = 7, + kEndSystime = 8, + kMinSystime = 9, + kMaxSystime = 10, }; 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; + int64_t min = static_cast(0); + int64_t max = static_cast(0); + Optional startTimestamp; + Optional endTimestamp; + Optional minTimestamp; + Optional maxTimestamp; + Optional startSystime; + Optional endSystime; + Optional minSystime; + Optional maxSystime; + + 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 MeasurementRangeStruct +} // namespace Structs + +namespace Attributes { + +namespace PowerMode { +struct TypeInfo +{ + using Type = chip::app::Clusters::ElectricalPowerMeasurement::PowerModeEnum; + using DecodableType = chip::app::Clusters::ElectricalPowerMeasurement::PowerModeEnum; + using DecodableArgType = chip::app::Clusters::ElectricalPowerMeasurement::PowerModeEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::PowerMode::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace PowerMode +namespace NumberOfMeasurementTypes { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NumberOfMeasurementTypes::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NumberOfMeasurementTypes +namespace Accuracy { +struct TypeInfo +{ + using Type = + chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementAccuracyStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementAccuracyStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Accuracy::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace Accuracy +namespace Ranges { +struct TypeInfo +{ + using Type = + chip::app::DataModel::List; + using DecodableType = chip::app::DataModel::DecodableList< + chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementRangeStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::DecodableList< + chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementRangeStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Ranges::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace Ranges +namespace Voltage { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Voltage::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace Voltage +namespace ActiveCurrent { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ActiveCurrent::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ActiveCurrent +namespace ReactiveCurrent { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ReactiveCurrent::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ReactiveCurrent +namespace ApparentCurrent { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ApparentCurrent::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ApparentCurrent +namespace ActivePower { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ActivePower::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ActivePower +namespace ReactivePower { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ReactivePower::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ReactivePower +namespace ApparentPower { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::ApparentPower::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace ApparentPower +namespace RMSVoltage { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::RMSVoltage::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace RMSVoltage +namespace RMSCurrent { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::RMSCurrent::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace RMSCurrent +namespace RMSPower { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::RMSPower::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace RMSPower +namespace Frequency { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Frequency::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace Frequency +namespace HarmonicCurrents { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable>; + using DecodableType = chip::app::DataModel::Nullable>; + using DecodableArgType = const chip::app::DataModel::Nullable> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::HarmonicCurrents::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace HarmonicCurrents +namespace HarmonicPhases { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable>; + using DecodableType = chip::app::DataModel::Nullable>; + using DecodableArgType = const chip::app::DataModel::Nullable> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::HarmonicPhases::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace HarmonicPhases +namespace PowerFactor { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::PowerFactor::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace PowerFactor +namespace NeutralCurrent { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NeutralCurrent::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace NeutralCurrent +namespace GeneratedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } +}; +} // namespace GeneratedCommandList +namespace AcceptedCommandList { +struct TypeInfo : public Clusters::Globals::Attributes::AcceptedCommandList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } +}; +} // namespace AcceptedCommandList +namespace EventList { +struct TypeInfo : public Clusters::Globals::Attributes::EventList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } +}; +} // namespace EventList +namespace AttributeList { +struct TypeInfo : public Clusters::Globals::Attributes::AttributeList::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } +}; +} // namespace AttributeList +namespace FeatureMap { +struct TypeInfo : public Clusters::Globals::Attributes::FeatureMap::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } +}; +} // namespace FeatureMap +namespace ClusterRevision { +struct TypeInfo : public Clusters::Globals::Attributes::ClusterRevision::TypeInfo +{ + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } +}; +} // namespace ClusterRevision + +struct TypeInfo +{ + struct DecodableType + { + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); + Attributes::PowerMode::TypeInfo::DecodableType powerMode = + static_cast(0); + Attributes::NumberOfMeasurementTypes::TypeInfo::DecodableType numberOfMeasurementTypes = static_cast(0); + Attributes::Accuracy::TypeInfo::DecodableType accuracy; + Attributes::Ranges::TypeInfo::DecodableType ranges; + Attributes::Voltage::TypeInfo::DecodableType voltage; + Attributes::ActiveCurrent::TypeInfo::DecodableType activeCurrent; + Attributes::ReactiveCurrent::TypeInfo::DecodableType reactiveCurrent; + Attributes::ApparentCurrent::TypeInfo::DecodableType apparentCurrent; + Attributes::ActivePower::TypeInfo::DecodableType activePower; + Attributes::ReactivePower::TypeInfo::DecodableType reactivePower; + Attributes::ApparentPower::TypeInfo::DecodableType apparentPower; + Attributes::RMSVoltage::TypeInfo::DecodableType RMSVoltage; + Attributes::RMSCurrent::TypeInfo::DecodableType RMSCurrent; + Attributes::RMSPower::TypeInfo::DecodableType RMSPower; + Attributes::Frequency::TypeInfo::DecodableType frequency; + Attributes::HarmonicCurrents::TypeInfo::DecodableType harmonicCurrents; + Attributes::HarmonicPhases::TypeInfo::DecodableType harmonicPhases; + Attributes::PowerFactor::TypeInfo::DecodableType powerFactor; + Attributes::NeutralCurrent::TypeInfo::DecodableType neutralCurrent; + 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 MeasurementPeriodRanges { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kRanges = 0, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::MeasurementPeriodRanges::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } static constexpr bool kIsFabricScoped = false; + DataModel::List ranges; + 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; + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::MeasurementPeriodRanges::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalPowerMeasurement::Id; } + + DataModel::DecodableList ranges; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace MeasurementPeriodRanges +} // namespace Events +} // namespace ElectricalPowerMeasurement +namespace ElectricalEnergyMeasurement { +namespace Structs { +namespace MeasurementAccuracyRangeStruct = Clusters::detail::Structs::MeasurementAccuracyRangeStruct; +namespace MeasurementAccuracyStruct = Clusters::detail::Structs::MeasurementAccuracyStruct; +namespace CumulativeEnergyResetStruct { +enum class Fields : uint8_t +{ + kImportedResetTimestamp = 0, + kExportedResetTimestamp = 1, + kImportedResetSystime = 2, + kExportedResetSystime = 3, +}; + +struct Type +{ +public: + Optional> importedResetTimestamp; + Optional> exportedResetTimestamp; + Optional> importedResetSystime; + Optional> exportedResetSystime; CHIP_ERROR Decode(TLV::TLVReader & reader); static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & aWriter, TLV::Tag aTag) const; }; -} // namespace MeasurementAccuracyStruct +using DecodableType = Type; + +} // namespace CumulativeEnergyResetStruct namespace EnergyMeasurementStruct { enum class Fields : uint8_t { @@ -20131,6 +20583,21 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace PeriodicEnergyExported +namespace CumulativeEnergyReset { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::Type>; + using DecodableType = chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::DecodableType>; + using DecodableArgType = const chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::DecodableType> &; + + static constexpr ClusterId GetClusterId() { return Clusters::ElectricalEnergyMeasurement::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CumulativeEnergyReset::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace CumulativeEnergyReset namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -20181,6 +20648,7 @@ struct TypeInfo Attributes::CumulativeEnergyExported::TypeInfo::DecodableType cumulativeEnergyExported; Attributes::PeriodicEnergyImported::TypeInfo::DecodableType periodicEnergyImported; Attributes::PeriodicEnergyExported::TypeInfo::DecodableType periodicEnergyExported; + Attributes::CumulativeEnergyReset::TypeInfo::DecodableType cumulativeEnergyReset; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; 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 10696149992bc5..868602695023c6 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 @@ -3641,6 +3641,112 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; } // namespace Attributes } // namespace ValveConfigurationAndControl +namespace ElectricalPowerMeasurement { +namespace Attributes { + +namespace PowerMode { +static constexpr AttributeId Id = 0x00000000; +} // namespace PowerMode + +namespace NumberOfMeasurementTypes { +static constexpr AttributeId Id = 0x00000001; +} // namespace NumberOfMeasurementTypes + +namespace Accuracy { +static constexpr AttributeId Id = 0x00000002; +} // namespace Accuracy + +namespace Ranges { +static constexpr AttributeId Id = 0x00000003; +} // namespace Ranges + +namespace Voltage { +static constexpr AttributeId Id = 0x00000004; +} // namespace Voltage + +namespace ActiveCurrent { +static constexpr AttributeId Id = 0x00000005; +} // namespace ActiveCurrent + +namespace ReactiveCurrent { +static constexpr AttributeId Id = 0x00000006; +} // namespace ReactiveCurrent + +namespace ApparentCurrent { +static constexpr AttributeId Id = 0x00000007; +} // namespace ApparentCurrent + +namespace ActivePower { +static constexpr AttributeId Id = 0x00000008; +} // namespace ActivePower + +namespace ReactivePower { +static constexpr AttributeId Id = 0x00000009; +} // namespace ReactivePower + +namespace ApparentPower { +static constexpr AttributeId Id = 0x0000000A; +} // namespace ApparentPower + +namespace RMSVoltage { +static constexpr AttributeId Id = 0x0000000B; +} // namespace RMSVoltage + +namespace RMSCurrent { +static constexpr AttributeId Id = 0x0000000C; +} // namespace RMSCurrent + +namespace RMSPower { +static constexpr AttributeId Id = 0x0000000D; +} // namespace RMSPower + +namespace Frequency { +static constexpr AttributeId Id = 0x0000000E; +} // namespace Frequency + +namespace HarmonicCurrents { +static constexpr AttributeId Id = 0x0000000F; +} // namespace HarmonicCurrents + +namespace HarmonicPhases { +static constexpr AttributeId Id = 0x00000010; +} // namespace HarmonicPhases + +namespace PowerFactor { +static constexpr AttributeId Id = 0x00000011; +} // namespace PowerFactor + +namespace NeutralCurrent { +static constexpr AttributeId Id = 0x00000012; +} // namespace NeutralCurrent + +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 ElectricalPowerMeasurement + namespace ElectricalEnergyMeasurement { namespace Attributes { @@ -3664,6 +3770,10 @@ namespace PeriodicEnergyExported { static constexpr AttributeId Id = 0x00000004; } // namespace PeriodicEnergyExported +namespace CumulativeEnergyReset { +static constexpr AttributeId Id = 0x00000005; +} // namespace CumulativeEnergyReset + namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; } // namespace GeneratedCommandList 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 6fabd081faaa7f..6f956f1b36a40b 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 ElectricalPowerMeasurement { +static constexpr ClusterId Id = 0x00000090; +} // namespace ElectricalPowerMeasurement namespace ElectricalEnergyMeasurement { static constexpr ClusterId Id = 0x00000091; } // namespace ElectricalEnergyMeasurement 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 ffc9326338b763..28e5799188e843 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,16 @@ static constexpr EventId Id = 0x00000001; } // namespace Events } // namespace ValveConfigurationAndControl +namespace ElectricalPowerMeasurement { +namespace Events { + +namespace MeasurementPeriodRanges { +static constexpr EventId Id = 0x00000000; +} // namespace MeasurementPeriodRanges + +} // namespace Events +} // namespace ElectricalPowerMeasurement + namespace ElectricalEnergyMeasurement { 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 56d3b193f69f35..e15b9701610a05 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,13 @@ #define CHIP_PRINTCLUSTER_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER #endif +#if defined(ZCL_USING_ELECTRICAL_POWER_MEASUREMENT_CLUSTER_SERVER) || defined(ZCL_USING_ELECTRICAL_POWER_MEASUREMENT_CLUSTER_CLIENT) +#define CHIP_PRINTCLUSTER_ELECTRICAL_POWER_MEASUREMENT_CLUSTER \ + { chip::app::Clusters::ElectricalPowerMeasurement::Id, "Electrical Power Measurement" }, +#else +#define CHIP_PRINTCLUSTER_ELECTRICAL_POWER_MEASUREMENT_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 \ @@ -851,6 +858,7 @@ CHIP_PRINTCLUSTER_ACTIVATED_CARBON_FILTER_MONITORING_CLUSTER \ CHIP_PRINTCLUSTER_BOOLEAN_STATE_CONFIGURATION_CLUSTER \ CHIP_PRINTCLUSTER_VALVE_CONFIGURATION_AND_CONTROL_CLUSTER \ + CHIP_PRINTCLUSTER_ELECTRICAL_POWER_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_ELECTRICAL_ENERGY_MEASUREMENT_CLUSTER \ CHIP_PRINTCLUSTER_DEMAND_RESPONSE_LOAD_CONTROL_CLUSTER \ CHIP_PRINTCLUSTER_MESSAGES_CLUSTER \ diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index eb333b055a0469..16600c53bf5817 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -100,6 +100,7 @@ | ActivatedCarbonFilterMonitoring | 0x0072 | | BooleanStateConfiguration | 0x0080 | | ValveConfigurationAndControl | 0x0081 | +| ElectricalPowerMeasurement | 0x0090 | | ElectricalEnergyMeasurement | 0x0091 | | DemandResponseLoadControl | 0x0096 | | Messages | 0x0097 | @@ -6464,6 +6465,42 @@ class ValveConfigurationAndControlClose : public ClusterCommand chip::app::Clusters::ValveConfigurationAndControl::Commands::Close::Type mRequest; }; +/*----------------------------------------------------------------------------*\ +| Cluster ElectricalPowerMeasurement | 0x0090 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * PowerMode | 0x0000 | +| * NumberOfMeasurementTypes | 0x0001 | +| * Accuracy | 0x0002 | +| * Ranges | 0x0003 | +| * Voltage | 0x0004 | +| * ActiveCurrent | 0x0005 | +| * ReactiveCurrent | 0x0006 | +| * ApparentCurrent | 0x0007 | +| * ActivePower | 0x0008 | +| * ReactivePower | 0x0009 | +| * ApparentPower | 0x000A | +| * RMSVoltage | 0x000B | +| * RMSCurrent | 0x000C | +| * RMSPower | 0x000D | +| * Frequency | 0x000E | +| * HarmonicCurrents | 0x000F | +| * HarmonicPhases | 0x0010 | +| * PowerFactor | 0x0011 | +| * NeutralCurrent | 0x0012 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * MeasurementPeriodRanges | 0x0000 | +\*----------------------------------------------------------------------------*/ + /*----------------------------------------------------------------------------*\ | Cluster ElectricalEnergyMeasurement | 0x0091 | |------------------------------------------------------------------------------| @@ -6475,6 +6512,7 @@ class ValveConfigurationAndControlClose : public ClusterCommand | * CumulativeEnergyExported | 0x0002 | | * PeriodicEnergyImported | 0x0003 | | * PeriodicEnergyExported | 0x0004 | +| * CumulativeEnergyReset | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -20039,6 +20077,152 @@ void registerClusterValveConfigurationAndControl(Commands & commands, Credential commands.RegisterCluster(clusterName, clusterCommands); } +void registerClusterElectricalPowerMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + using namespace chip::app::Clusters::ElectricalPowerMeasurement; + + const char * clusterName = "ElectricalPowerMeasurement"; + + commands_list clusterCommands = { + // + // Commands + // + make_unique(Id, credsIssuerConfig), // + // + // Attributes + // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "power-mode", Attributes::PowerMode::Id, credsIssuerConfig), // + make_unique(Id, "number-of-measurement-types", Attributes::NumberOfMeasurementTypes::Id, + credsIssuerConfig), // + make_unique(Id, "accuracy", Attributes::Accuracy::Id, credsIssuerConfig), // + make_unique(Id, "ranges", Attributes::Ranges::Id, credsIssuerConfig), // + make_unique(Id, "voltage", Attributes::Voltage::Id, credsIssuerConfig), // + make_unique(Id, "active-current", Attributes::ActiveCurrent::Id, credsIssuerConfig), // + make_unique(Id, "reactive-current", Attributes::ReactiveCurrent::Id, credsIssuerConfig), // + make_unique(Id, "apparent-current", Attributes::ApparentCurrent::Id, credsIssuerConfig), // + make_unique(Id, "active-power", Attributes::ActivePower::Id, credsIssuerConfig), // + make_unique(Id, "reactive-power", Attributes::ReactivePower::Id, credsIssuerConfig), // + make_unique(Id, "apparent-power", Attributes::ApparentPower::Id, credsIssuerConfig), // + make_unique(Id, "rmsvoltage", Attributes::RMSVoltage::Id, credsIssuerConfig), // + make_unique(Id, "rmscurrent", Attributes::RMSCurrent::Id, credsIssuerConfig), // + make_unique(Id, "rmspower", Attributes::RMSPower::Id, credsIssuerConfig), // + make_unique(Id, "frequency", Attributes::Frequency::Id, credsIssuerConfig), // + make_unique(Id, "harmonic-currents", Attributes::HarmonicCurrents::Id, credsIssuerConfig), // + make_unique(Id, "harmonic-phases", Attributes::HarmonicPhases::Id, credsIssuerConfig), // + make_unique(Id, "power-factor", Attributes::PowerFactor::Id, credsIssuerConfig), // + make_unique(Id, "neutral-current", Attributes::NeutralCurrent::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>( + Id, "power-mode", 0, UINT8_MAX, Attributes::PowerMode::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "number-of-measurement-types", 0, UINT8_MAX, + Attributes::NumberOfMeasurementTypes::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>>( + Id, "accuracy", Attributes::Accuracy::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "ranges", Attributes::Ranges::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "voltage", INT64_MIN, INT64_MAX, Attributes::Voltage::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "active-current", INT64_MIN, INT64_MAX, + Attributes::ActiveCurrent::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "reactive-current", INT64_MIN, INT64_MAX, + Attributes::ReactiveCurrent::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "apparent-current", INT64_MIN, INT64_MAX, + Attributes::ApparentCurrent::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "active-power", INT64_MIN, INT64_MAX, + Attributes::ActivePower::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "reactive-power", INT64_MIN, INT64_MAX, + Attributes::ReactivePower::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "apparent-power", INT64_MIN, INT64_MAX, + Attributes::ApparentPower::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "rmsvoltage", INT64_MIN, INT64_MAX, + Attributes::RMSVoltage::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "rmscurrent", INT64_MIN, INT64_MAX, + Attributes::RMSCurrent::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "rmspower", INT64_MIN, INT64_MAX, Attributes::RMSPower::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "frequency", INT64_MIN, INT64_MAX, Attributes::Frequency::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>>( + Id, "harmonic-currents", Attributes::HarmonicCurrents::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>>( + Id, "harmonic-phases", Attributes::HarmonicPhases::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "power-factor", INT64_MIN, INT64_MAX, + Attributes::PowerFactor::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>(Id, "neutral-current", INT64_MIN, INT64_MAX, + Attributes::NeutralCurrent::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, "power-mode", Attributes::PowerMode::Id, credsIssuerConfig), // + make_unique(Id, "number-of-measurement-types", Attributes::NumberOfMeasurementTypes::Id, + credsIssuerConfig), // + make_unique(Id, "accuracy", Attributes::Accuracy::Id, credsIssuerConfig), // + make_unique(Id, "ranges", Attributes::Ranges::Id, credsIssuerConfig), // + make_unique(Id, "voltage", Attributes::Voltage::Id, credsIssuerConfig), // + make_unique(Id, "active-current", Attributes::ActiveCurrent::Id, credsIssuerConfig), // + make_unique(Id, "reactive-current", Attributes::ReactiveCurrent::Id, credsIssuerConfig), // + make_unique(Id, "apparent-current", Attributes::ApparentCurrent::Id, credsIssuerConfig), // + make_unique(Id, "active-power", Attributes::ActivePower::Id, credsIssuerConfig), // + make_unique(Id, "reactive-power", Attributes::ReactivePower::Id, credsIssuerConfig), // + make_unique(Id, "apparent-power", Attributes::ApparentPower::Id, credsIssuerConfig), // + make_unique(Id, "rmsvoltage", Attributes::RMSVoltage::Id, credsIssuerConfig), // + make_unique(Id, "rmscurrent", Attributes::RMSCurrent::Id, credsIssuerConfig), // + make_unique(Id, "rmspower", Attributes::RMSPower::Id, credsIssuerConfig), // + make_unique(Id, "frequency", Attributes::Frequency::Id, credsIssuerConfig), // + make_unique(Id, "harmonic-currents", Attributes::HarmonicCurrents::Id, credsIssuerConfig), // + make_unique(Id, "harmonic-phases", Attributes::HarmonicPhases::Id, credsIssuerConfig), // + make_unique(Id, "power-factor", Attributes::PowerFactor::Id, credsIssuerConfig), // + make_unique(Id, "neutral-current", Attributes::NeutralCurrent::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, "measurement-period-ranges", Events::MeasurementPeriodRanges::Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "measurement-period-ranges", Events::MeasurementPeriodRanges::Id, credsIssuerConfig), // + }; + + commands.RegisterCluster(clusterName, clusterCommands); +} void registerClusterElectricalEnergyMeasurement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) { using namespace chip::app::Clusters::ElectricalEnergyMeasurement; @@ -20061,6 +20245,7 @@ void registerClusterElectricalEnergyMeasurement(Commands & commands, CredentialI credsIssuerConfig), // make_unique(Id, "periodic-energy-imported", Attributes::PeriodicEnergyImported::Id, credsIssuerConfig), // make_unique(Id, "periodic-energy-exported", Attributes::PeriodicEnergyExported::Id, credsIssuerConfig), // + make_unique(Id, "cumulative-energy-reset", Attributes::CumulativeEnergyReset::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), // @@ -20087,6 +20272,10 @@ void registerClusterElectricalEnergyMeasurement(Commands & commands, CredentialI chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::Type>>>( Id, "periodic-energy-exported", Attributes::PeriodicEnergyExported::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "cumulative-energy-reset", Attributes::CumulativeEnergyReset::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -20109,13 +20298,14 @@ void registerClusterElectricalEnergyMeasurement(Commands & commands, CredentialI 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), // + credsIssuerConfig), // + make_unique(Id, "cumulative-energy-reset", Attributes::CumulativeEnergyReset::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 // @@ -26515,6 +26705,7 @@ void registerClusters(Commands & commands, CredentialIssuerCommands * credsIssue registerClusterActivatedCarbonFilterMonitoring(commands, credsIssuerConfig); registerClusterBooleanStateConfiguration(commands, credsIssuerConfig); registerClusterValveConfigurationAndControl(commands, credsIssuerConfig); + registerClusterElectricalPowerMeasurement(commands, credsIssuerConfig); registerClusterElectricalEnergyMeasurement(commands, credsIssuerConfig); registerClusterDemandResponseLoadControl(commands, credsIssuerConfig); registerClusterMessages(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 5813b0e5b12105..89f34d0cee3714 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -86,6 +86,139 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::detail::Structs::ModeO ComplexArgumentParser::Finalize(request.modeTags); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::detail::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::detail::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::detail::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::detail::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::detail::Structs::ApplicationStruct::Type & request, Json::Value & value) { @@ -2223,90 +2356,146 @@ 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) +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ElectricalPowerMeasurement::Structs::HarmonicMeasurementStruct::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"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("HarmonicMeasurementStruct.order", "order", value.isMember("order"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("HarmonicMeasurementStruct.measurement", "measurement", + value.isMember("measurement"))); 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, "order"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.order, value["order"])); + valueCopy.removeMember("order"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "rangeMax"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.rangeMax, value["rangeMax"])); - valueCopy.removeMember("rangeMax"); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "measurement"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.measurement, value["measurement"])); + valueCopy.removeMember("measurement"); - if (value.isMember("percentMax")) + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::ElectricalPowerMeasurement::Structs::HarmonicMeasurementStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.order); + ComplexArgumentParser::Finalize(request.measurement); +} + +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementRangeStruct::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("MeasurementRangeStruct.measurementType", "measurementType", + value.isMember("measurementType"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("MeasurementRangeStruct.min", "min", value.isMember("min"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("MeasurementRangeStruct.max", "max", value.isMember("max"))); + + 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, "min"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.min, value["min"])); + valueCopy.removeMember("min"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "max"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.max, value["max"])); + valueCopy.removeMember("max"); + + if (value.isMember("startTimestamp")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "percentMax"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.percentMax, value["percentMax"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "startTimestamp"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.startTimestamp, value["startTimestamp"])); } - valueCopy.removeMember("percentMax"); + valueCopy.removeMember("startTimestamp"); - if (value.isMember("percentMin")) + if (value.isMember("endTimestamp")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "percentMin"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.percentMin, value["percentMin"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endTimestamp"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endTimestamp, value["endTimestamp"])); } - valueCopy.removeMember("percentMin"); + valueCopy.removeMember("endTimestamp"); - if (value.isMember("percentTypical")) + if (value.isMember("minTimestamp")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "percentTypical"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.percentTypical, value["percentTypical"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minTimestamp"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.minTimestamp, value["minTimestamp"])); } - valueCopy.removeMember("percentTypical"); + valueCopy.removeMember("minTimestamp"); - if (value.isMember("fixedMax")) + if (value.isMember("maxTimestamp")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fixedMax"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fixedMax, value["fixedMax"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxTimestamp"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.maxTimestamp, value["maxTimestamp"])); } - valueCopy.removeMember("fixedMax"); + valueCopy.removeMember("maxTimestamp"); - if (value.isMember("fixedMin")) + if (value.isMember("startSystime")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fixedMin"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fixedMin, value["fixedMin"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "startSystime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.startSystime, value["startSystime"])); } - valueCopy.removeMember("fixedMin"); + valueCopy.removeMember("startSystime"); - if (value.isMember("fixedTypical")) + if (value.isMember("endSystime")) { - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fixedTypical"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fixedTypical, value["fixedTypical"])); + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endSystime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endSystime, value["endSystime"])); } - valueCopy.removeMember("fixedTypical"); + valueCopy.removeMember("endSystime"); + + if (value.isMember("minSystime")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minSystime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.minSystime, value["minSystime"])); + } + valueCopy.removeMember("minSystime"); + + if (value.isMember("maxSystime")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxSystime"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.maxSystime, value["maxSystime"])); + } + valueCopy.removeMember("maxSystime"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } void ComplexArgumentParser::Finalize( - chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::Type & request) + chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementRangeStruct::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); + ComplexArgumentParser::Finalize(request.measurementType); + ComplexArgumentParser::Finalize(request.min); + ComplexArgumentParser::Finalize(request.max); + ComplexArgumentParser::Finalize(request.startTimestamp); + ComplexArgumentParser::Finalize(request.endTimestamp); + ComplexArgumentParser::Finalize(request.minTimestamp); + ComplexArgumentParser::Finalize(request.maxTimestamp); + ComplexArgumentParser::Finalize(request.startSystime); + ComplexArgumentParser::Finalize(request.endSystime); + ComplexArgumentParser::Finalize(request.minSystime); + ComplexArgumentParser::Finalize(request.maxSystime); } CHIP_ERROR ComplexArgumentParser::Setup(const char * label, - chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type & request, + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::Type & request, Json::Value & value) { VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); @@ -2314,49 +2503,49 @@ ComplexArgumentParser::Setup(const char * label, // 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"); + if (value.isMember("importedResetTimestamp")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "importedResetTimestamp"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.importedResetTimestamp, value["importedResetTimestamp"])); + } + valueCopy.removeMember("importedResetTimestamp"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "minMeasuredValue"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.minMeasuredValue, value["minMeasuredValue"])); - valueCopy.removeMember("minMeasuredValue"); + if (value.isMember("exportedResetTimestamp")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "exportedResetTimestamp"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.exportedResetTimestamp, value["exportedResetTimestamp"])); + } + valueCopy.removeMember("exportedResetTimestamp"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "maxMeasuredValue"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.maxMeasuredValue, value["maxMeasuredValue"])); - valueCopy.removeMember("maxMeasuredValue"); + if (value.isMember("importedResetSystime")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "importedResetSystime"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.importedResetSystime, value["importedResetSystime"])); + } + valueCopy.removeMember("importedResetSystime"); - snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "accuracyRanges"); - ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.accuracyRanges, value["accuracyRanges"])); - valueCopy.removeMember("accuracyRanges"); + if (value.isMember("exportedResetSystime")) + { + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "exportedResetSystime"); + ReturnErrorOnFailure( + ComplexArgumentParser::Setup(labelWithMember, request.exportedResetSystime, value["exportedResetSystime"])); + } + valueCopy.removeMember("exportedResetSystime"); return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); } void ComplexArgumentParser::Finalize( - chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type & request) + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::Type & request) { - ComplexArgumentParser::Finalize(request.measurementType); - ComplexArgumentParser::Finalize(request.measured); - ComplexArgumentParser::Finalize(request.minMeasuredValue); - ComplexArgumentParser::Finalize(request.maxMeasuredValue); - ComplexArgumentParser::Finalize(request.accuracyRanges); + ComplexArgumentParser::Finalize(request.importedResetTimestamp); + ComplexArgumentParser::Finalize(request.exportedResetTimestamp); + ComplexArgumentParser::Finalize(request.importedResetSystime); + ComplexArgumentParser::Finalize(request.exportedResetSystime); } CHIP_ERROR diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index 5a049d98f82048..a9ac94c6cecb77 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -32,6 +32,16 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs static void Finalize(chip::app::Clusters::detail::Structs::ModeOptionStruct::Type & request); +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::MeasurementAccuracyRangeStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::detail::Structs::MeasurementAccuracyRangeStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::MeasurementAccuracyStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::detail::Structs::MeasurementAccuracyStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::detail::Structs::ApplicationStruct::Type & request, Json::Value & value); @@ -277,16 +287,22 @@ 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, + chip::app::Clusters::ElectricalPowerMeasurement::Structs::HarmonicMeasurementStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::ElectricalPowerMeasurement::Structs::HarmonicMeasurementStruct::Type & request); + +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementRangeStruct::Type & request, Json::Value & value); -static void Finalize(chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::Type & request); +static void Finalize(chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementRangeStruct::Type & request); static CHIP_ERROR Setup(const char * label, - chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type & request, + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::Type & request, Json::Value & value); -static void Finalize(chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::Type & request); +static void Finalize(chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::Type & request); static CHIP_ERROR Setup(const char * label, chip::app::Clusters::ElectricalEnergyMeasurement::Structs::EnergyMeasurementStruct::Type & request, 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 1c88685f924640..c0734b7387be0f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -79,6 +79,129 @@ 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 chip::app::Clusters::detail::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::detail::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::detail::Structs::ApplicationStruct::DecodableType & value) { @@ -1988,70 +2111,120 @@ CHIP_ERROR DataModelLogger::LogValue( CHIP_ERROR DataModelLogger::LogValue( const char * label, size_t indent, - const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::DecodableType & value) + const chip::app::Clusters::ElectricalPowerMeasurement::Structs::HarmonicMeasurementStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("RangeMin", indent + 1, value.rangeMin); + CHIP_ERROR err = LogValue("Order", indent + 1, value.order); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'RangeMin'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Order'"); return err; } } { - CHIP_ERROR err = LogValue("RangeMax", indent + 1, value.rangeMax); + CHIP_ERROR err = LogValue("Measurement", indent + 1, value.measurement); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'RangeMax'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Measurement'"); return err; } } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementRangeStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("PercentMax", indent + 1, value.percentMax); + 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 'PercentMax'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MeasurementType'"); return err; } } { - CHIP_ERROR err = LogValue("PercentMin", indent + 1, value.percentMin); + CHIP_ERROR err = LogValue("Min", indent + 1, value.min); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PercentMin'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Min'"); return err; } } { - CHIP_ERROR err = LogValue("PercentTypical", indent + 1, value.percentTypical); + CHIP_ERROR err = LogValue("Max", indent + 1, value.max); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'PercentTypical'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Max'"); return err; } } { - CHIP_ERROR err = LogValue("FixedMax", indent + 1, value.fixedMax); + 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 'FixedMax'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'StartTimestamp'"); return err; } } { - CHIP_ERROR err = LogValue("FixedMin", indent + 1, value.fixedMin); + 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 'FixedMin'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'EndTimestamp'"); return err; } } { - CHIP_ERROR err = LogValue("FixedTypical", indent + 1, value.fixedTypical); + CHIP_ERROR err = LogValue("MinTimestamp", indent + 1, value.minTimestamp); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FixedTypical'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MinTimestamp'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("MaxTimestamp", indent + 1, value.maxTimestamp); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MaxTimestamp'"); + 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; + } + } + { + CHIP_ERROR err = LogValue("MinSystime", indent + 1, value.minSystime); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MinSystime'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("MaxSystime", indent + 1, value.maxSystime); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MaxSystime'"); return err; } } @@ -2062,46 +2235,38 @@ CHIP_ERROR DataModelLogger::LogValue( CHIP_ERROR DataModelLogger::LogValue( const char * label, size_t indent, - const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::DecodableType & value) + const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::DecodableType & value) { DataModelLogger::LogString(label, indent, "{"); { - CHIP_ERROR err = LogValue("MeasurementType", indent + 1, value.measurementType); + CHIP_ERROR err = LogValue("ImportedResetTimestamp", indent + 1, value.importedResetTimestamp); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MeasurementType'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ImportedResetTimestamp'"); return err; } } { - CHIP_ERROR err = LogValue("Measured", indent + 1, value.measured); + CHIP_ERROR err = LogValue("ExportedResetTimestamp", indent + 1, value.exportedResetTimestamp); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Measured'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ExportedResetTimestamp'"); return err; } } { - CHIP_ERROR err = LogValue("MinMeasuredValue", indent + 1, value.minMeasuredValue); + CHIP_ERROR err = LogValue("ImportedResetSystime", indent + 1, value.importedResetSystime); if (err != CHIP_NO_ERROR) { - DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'MinMeasuredValue'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ImportedResetSystime'"); return err; } } { - CHIP_ERROR err = LogValue("MaxMeasuredValue", indent + 1, value.maxMeasuredValue); + CHIP_ERROR err = LogValue("ExportedResetSystime", indent + 1, value.exportedResetSystime); 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'"); + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'ExportedResetSystime'"); return err; } } @@ -5974,6 +6139,22 @@ 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 ElectricalPowerMeasurement::Events::MeasurementPeriodRanges::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("Ranges", indent + 1, value.ranges); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Ranges'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const ElectricalEnergyMeasurement::Events::CumulativeEnergyMeasured::DecodableType & value) { @@ -12245,6 +12426,145 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP } break; } + case ElectricalPowerMeasurement::Id: { + switch (path.mAttributeId) + { + case ElectricalPowerMeasurement::Attributes::PowerMode::Id: { + chip::app::Clusters::ElectricalPowerMeasurement::PowerModeEnum value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("PowerMode", 1, value); + } + case ElectricalPowerMeasurement::Attributes::NumberOfMeasurementTypes::Id: { + uint8_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NumberOfMeasurementTypes", 1, value); + } + case ElectricalPowerMeasurement::Attributes::Accuracy::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementAccuracyStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("Accuracy", 1, value); + } + case ElectricalPowerMeasurement::Attributes::Ranges::Id: { + chip::app::DataModel::DecodableList< + chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementRangeStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("Ranges", 1, value); + } + case ElectricalPowerMeasurement::Attributes::Voltage::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("Voltage", 1, value); + } + case ElectricalPowerMeasurement::Attributes::ActiveCurrent::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ActiveCurrent", 1, value); + } + case ElectricalPowerMeasurement::Attributes::ReactiveCurrent::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ReactiveCurrent", 1, value); + } + case ElectricalPowerMeasurement::Attributes::ApparentCurrent::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ApparentCurrent", 1, value); + } + case ElectricalPowerMeasurement::Attributes::ActivePower::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ActivePower", 1, value); + } + case ElectricalPowerMeasurement::Attributes::ReactivePower::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ReactivePower", 1, value); + } + case ElectricalPowerMeasurement::Attributes::ApparentPower::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ApparentPower", 1, value); + } + case ElectricalPowerMeasurement::Attributes::RMSVoltage::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("RMSVoltage", 1, value); + } + case ElectricalPowerMeasurement::Attributes::RMSCurrent::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("RMSCurrent", 1, value); + } + case ElectricalPowerMeasurement::Attributes::RMSPower::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("RMSPower", 1, value); + } + case ElectricalPowerMeasurement::Attributes::Frequency::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("Frequency", 1, value); + } + case ElectricalPowerMeasurement::Attributes::HarmonicCurrents::Id: { + chip::app::DataModel::Nullable> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("HarmonicCurrents", 1, value); + } + case ElectricalPowerMeasurement::Attributes::HarmonicPhases::Id: { + chip::app::DataModel::Nullable> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("HarmonicPhases", 1, value); + } + case ElectricalPowerMeasurement::Attributes::PowerFactor::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("PowerFactor", 1, value); + } + case ElectricalPowerMeasurement::Attributes::NeutralCurrent::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("NeutralCurrent", 1, value); + } + case ElectricalPowerMeasurement::Attributes::GeneratedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("GeneratedCommandList", 1, value); + } + case ElectricalPowerMeasurement::Attributes::AcceptedCommandList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AcceptedCommandList", 1, value); + } + case ElectricalPowerMeasurement::Attributes::EventList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("EventList", 1, value); + } + case ElectricalPowerMeasurement::Attributes::AttributeList::Id: { + chip::app::DataModel::DecodableList value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("AttributeList", 1, value); + } + case ElectricalPowerMeasurement::Attributes::FeatureMap::Id: { + uint32_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("FeatureMap", 1, value); + } + case ElectricalPowerMeasurement::Attributes::ClusterRevision::Id: { + uint16_t value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("ClusterRevision", 1, value); + } + } + break; + } case ElectricalEnergyMeasurement::Id: { switch (path.mAttributeId) { @@ -12281,6 +12601,13 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("PeriodicEnergyExported", 1, value); } + case ElectricalEnergyMeasurement::Attributes::CumulativeEnergyReset::Id: { + chip::app::DataModel::Nullable< + chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::DecodableType> + value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("CumulativeEnergyReset", 1, value); + } case ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); @@ -18740,6 +19067,17 @@ CHIP_ERROR DataModelLogger::LogEvent(const chip::app::EventHeader & header, chip } break; } + case ElectricalPowerMeasurement::Id: { + switch (header.mPath.mEventId) + { + case ElectricalPowerMeasurement::Events::MeasurementPeriodRanges::Id: { + chip::app::Clusters::ElectricalPowerMeasurement::Events::MeasurementPeriodRanges::DecodableType value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("MeasurementPeriodRanges", 1, value); + } + } + break; + } case ElectricalEnergyMeasurement::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 fd4d6895f7ea44..f201e84ad8a572 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -26,6 +26,12 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ModeOptionStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::MeasurementAccuracyRangeStruct::DecodableType & value); + +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::detail::Structs::MeasurementAccuracyStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::detail::Structs::ApplicationStruct::DecodableType & value); @@ -175,11 +181,15 @@ LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyRangeStruct::DecodableType & value); + const chip::app::Clusters::ElectricalPowerMeasurement::Structs::HarmonicMeasurementStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, - const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::MeasurementAccuracyStruct::DecodableType & value); + const chip::app::Clusters::ElectricalPowerMeasurement::Structs::MeasurementRangeStruct::DecodableType & value); + +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::ElectricalEnergyMeasurement::Structs::CumulativeEnergyResetStruct::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, @@ -502,6 +512,9 @@ 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::ElectricalPowerMeasurement::Events::MeasurementPeriodRanges::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::ElectricalEnergyMeasurement::Events::CumulativeEnergyMeasured::DecodableType & value); static CHIP_ERROR 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 3a487ec7d0ddeb..b8761b9f618318 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 | | BooleanStateConfiguration | 0x0080 | | ValveConfigurationAndControl | 0x0081 | +| ElectricalPowerMeasurement | 0x0090 | | ElectricalEnergyMeasurement | 0x0091 | | DemandResponseLoadControl | 0x0096 | | Messages | 0x0097 | @@ -76026,6 +76027,2169 @@ class SubscribeAttributeValveConfigurationAndControlClusterRevision : public Sub } }; +#endif // MTR_ENABLE_PROVISIONAL +#endif // MTR_ENABLE_PROVISIONAL +#if MTR_ENABLE_PROVISIONAL +/*----------------------------------------------------------------------------*\ +| Cluster ElectricalPowerMeasurement | 0x0090 | +|------------------------------------------------------------------------------| +| Commands: | | +|------------------------------------------------------------------------------| +| Attributes: | | +| * PowerMode | 0x0000 | +| * NumberOfMeasurementTypes | 0x0001 | +| * Accuracy | 0x0002 | +| * Ranges | 0x0003 | +| * Voltage | 0x0004 | +| * ActiveCurrent | 0x0005 | +| * ReactiveCurrent | 0x0006 | +| * ApparentCurrent | 0x0007 | +| * ActivePower | 0x0008 | +| * ReactivePower | 0x0009 | +| * ApparentPower | 0x000A | +| * RMSVoltage | 0x000B | +| * RMSCurrent | 0x000C | +| * RMSPower | 0x000D | +| * Frequency | 0x000E | +| * HarmonicCurrents | 0x000F | +| * HarmonicPhases | 0x0010 | +| * PowerFactor | 0x0011 | +| * NeutralCurrent | 0x0012 | +| * GeneratedCommandList | 0xFFF8 | +| * AcceptedCommandList | 0xFFF9 | +| * EventList | 0xFFFA | +| * AttributeList | 0xFFFB | +| * FeatureMap | 0xFFFC | +| * ClusterRevision | 0xFFFD | +|------------------------------------------------------------------------------| +| Events: | | +| * MeasurementPeriodRanges | 0x0000 | +\*----------------------------------------------------------------------------*/ + +#if MTR_ENABLE_PROVISIONAL + +/* + * Attribute PowerMode + */ +class ReadElectricalPowerMeasurementPowerMode : public ReadAttribute { +public: + ReadElectricalPowerMeasurementPowerMode() + : ReadAttribute("power-mode") + { + } + + ~ReadElectricalPowerMeasurementPowerMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerMode::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributePowerModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.PowerMode response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement PowerMode read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementPowerMode : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementPowerMode() + : SubscribeAttribute("power-mode") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementPowerMode() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerMode::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributePowerModeWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.PowerMode 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 NumberOfMeasurementTypes + */ +class ReadElectricalPowerMeasurementNumberOfMeasurementTypes : public ReadAttribute { +public: + ReadElectricalPowerMeasurementNumberOfMeasurementTypes() + : ReadAttribute("number-of-measurement-types") + { + } + + ~ReadElectricalPowerMeasurementNumberOfMeasurementTypes() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NumberOfMeasurementTypes::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNumberOfMeasurementTypesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.NumberOfMeasurementTypes response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement NumberOfMeasurementTypes read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementNumberOfMeasurementTypes : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementNumberOfMeasurementTypes() + : SubscribeAttribute("number-of-measurement-types") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementNumberOfMeasurementTypes() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NumberOfMeasurementTypes::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeNumberOfMeasurementTypesWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.NumberOfMeasurementTypes 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 Accuracy + */ +class ReadElectricalPowerMeasurementAccuracy : public ReadAttribute { +public: + ReadElectricalPowerMeasurementAccuracy() + : ReadAttribute("accuracy") + { + } + + ~ReadElectricalPowerMeasurementAccuracy() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAccuracyWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.Accuracy response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement Accuracy read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementAccuracy : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementAccuracy() + : SubscribeAttribute("accuracy") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementAccuracy() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement 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:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.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 Ranges + */ +class ReadElectricalPowerMeasurementRanges : public ReadAttribute { +public: + ReadElectricalPowerMeasurementRanges() + : ReadAttribute("ranges") + { + } + + ~ReadElectricalPowerMeasurementRanges() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Ranges::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeRangesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.Ranges response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement Ranges read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementRanges : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementRanges() + : SubscribeAttribute("ranges") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementRanges() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Ranges::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeRangesWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.Ranges 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 Voltage + */ +class ReadElectricalPowerMeasurementVoltage : public ReadAttribute { +public: + ReadElectricalPowerMeasurementVoltage() + : ReadAttribute("voltage") + { + } + + ~ReadElectricalPowerMeasurementVoltage() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Voltage::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.Voltage response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement Voltage read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementVoltage : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementVoltage() + : SubscribeAttribute("voltage") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementVoltage() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Voltage::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeVoltageWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.Voltage 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 ActiveCurrent + */ +class ReadElectricalPowerMeasurementActiveCurrent : public ReadAttribute { +public: + ReadElectricalPowerMeasurementActiveCurrent() + : ReadAttribute("active-current") + { + } + + ~ReadElectricalPowerMeasurementActiveCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActiveCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeActiveCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ActiveCurrent response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement ActiveCurrent read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementActiveCurrent : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementActiveCurrent() + : SubscribeAttribute("active-current") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementActiveCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActiveCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeActiveCurrentWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ActiveCurrent 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 ReactiveCurrent + */ +class ReadElectricalPowerMeasurementReactiveCurrent : public ReadAttribute { +public: + ReadElectricalPowerMeasurementReactiveCurrent() + : ReadAttribute("reactive-current") + { + } + + ~ReadElectricalPowerMeasurementReactiveCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactiveCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeReactiveCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ReactiveCurrent response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement ReactiveCurrent read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementReactiveCurrent : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementReactiveCurrent() + : SubscribeAttribute("reactive-current") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementReactiveCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactiveCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeReactiveCurrentWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ReactiveCurrent 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 ApparentCurrent + */ +class ReadElectricalPowerMeasurementApparentCurrent : public ReadAttribute { +public: + ReadElectricalPowerMeasurementApparentCurrent() + : ReadAttribute("apparent-current") + { + } + + ~ReadElectricalPowerMeasurementApparentCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeApparentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ApparentCurrent response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement ApparentCurrent read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementApparentCurrent : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementApparentCurrent() + : SubscribeAttribute("apparent-current") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementApparentCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeApparentCurrentWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ApparentCurrent 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 ActivePower + */ +class ReadElectricalPowerMeasurementActivePower : public ReadAttribute { +public: + ReadElectricalPowerMeasurementActivePower() + : ReadAttribute("active-power") + { + } + + ~ReadElectricalPowerMeasurementActivePower() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActivePower::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeActivePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ActivePower response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement ActivePower read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementActivePower : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementActivePower() + : SubscribeAttribute("active-power") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementActivePower() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActivePower::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeActivePowerWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ActivePower 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 ReactivePower + */ +class ReadElectricalPowerMeasurementReactivePower : public ReadAttribute { +public: + ReadElectricalPowerMeasurementReactivePower() + : ReadAttribute("reactive-power") + { + } + + ~ReadElectricalPowerMeasurementReactivePower() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactivePower::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeReactivePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ReactivePower response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement ReactivePower read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementReactivePower : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementReactivePower() + : SubscribeAttribute("reactive-power") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementReactivePower() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactivePower::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeReactivePowerWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ReactivePower 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 ApparentPower + */ +class ReadElectricalPowerMeasurementApparentPower : public ReadAttribute { +public: + ReadElectricalPowerMeasurementApparentPower() + : ReadAttribute("apparent-power") + { + } + + ~ReadElectricalPowerMeasurementApparentPower() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentPower::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeApparentPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ApparentPower response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement ApparentPower read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementApparentPower : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementApparentPower() + : SubscribeAttribute("apparent-power") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementApparentPower() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentPower::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeApparentPowerWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ApparentPower 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 RMSVoltage + */ +class ReadElectricalPowerMeasurementRMSVoltage : public ReadAttribute { +public: + ReadElectricalPowerMeasurementRMSVoltage() + : ReadAttribute("rmsvoltage") + { + } + + ~ReadElectricalPowerMeasurementRMSVoltage() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSVoltage::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeRMSVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.RMSVoltage response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement RMSVoltage read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementRMSVoltage : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementRMSVoltage() + : SubscribeAttribute("rmsvoltage") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementRMSVoltage() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSVoltage::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeRMSVoltageWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.RMSVoltage 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 RMSCurrent + */ +class ReadElectricalPowerMeasurementRMSCurrent : public ReadAttribute { +public: + ReadElectricalPowerMeasurementRMSCurrent() + : ReadAttribute("rmscurrent") + { + } + + ~ReadElectricalPowerMeasurementRMSCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeRMSCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.RMSCurrent response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement RMSCurrent read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementRMSCurrent : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementRMSCurrent() + : SubscribeAttribute("rmscurrent") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementRMSCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeRMSCurrentWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.RMSCurrent 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 RMSPower + */ +class ReadElectricalPowerMeasurementRMSPower : public ReadAttribute { +public: + ReadElectricalPowerMeasurementRMSPower() + : ReadAttribute("rmspower") + { + } + + ~ReadElectricalPowerMeasurementRMSPower() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSPower::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeRMSPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.RMSPower response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement RMSPower read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementRMSPower : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementRMSPower() + : SubscribeAttribute("rmspower") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementRMSPower() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSPower::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeRMSPowerWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.RMSPower 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 Frequency + */ +class ReadElectricalPowerMeasurementFrequency : public ReadAttribute { +public: + ReadElectricalPowerMeasurementFrequency() + : ReadAttribute("frequency") + { + } + + ~ReadElectricalPowerMeasurementFrequency() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Frequency::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.Frequency response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement Frequency read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementFrequency : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementFrequency() + : SubscribeAttribute("frequency") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementFrequency() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Frequency::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeFrequencyWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.Frequency 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 HarmonicCurrents + */ +class ReadElectricalPowerMeasurementHarmonicCurrents : public ReadAttribute { +public: + ReadElectricalPowerMeasurementHarmonicCurrents() + : ReadAttribute("harmonic-currents") + { + } + + ~ReadElectricalPowerMeasurementHarmonicCurrents() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicCurrents::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeHarmonicCurrentsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.HarmonicCurrents response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement HarmonicCurrents read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementHarmonicCurrents : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementHarmonicCurrents() + : SubscribeAttribute("harmonic-currents") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementHarmonicCurrents() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicCurrents::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeHarmonicCurrentsWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.HarmonicCurrents 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 HarmonicPhases + */ +class ReadElectricalPowerMeasurementHarmonicPhases : public ReadAttribute { +public: + ReadElectricalPowerMeasurementHarmonicPhases() + : ReadAttribute("harmonic-phases") + { + } + + ~ReadElectricalPowerMeasurementHarmonicPhases() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicPhases::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeHarmonicPhasesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.HarmonicPhases response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement HarmonicPhases read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementHarmonicPhases : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementHarmonicPhases() + : SubscribeAttribute("harmonic-phases") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementHarmonicPhases() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicPhases::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeHarmonicPhasesWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.HarmonicPhases 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 PowerFactor + */ +class ReadElectricalPowerMeasurementPowerFactor : public ReadAttribute { +public: + ReadElectricalPowerMeasurementPowerFactor() + : ReadAttribute("power-factor") + { + } + + ~ReadElectricalPowerMeasurementPowerFactor() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerFactor::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributePowerFactorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.PowerFactor response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement PowerFactor read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementPowerFactor : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementPowerFactor() + : SubscribeAttribute("power-factor") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementPowerFactor() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerFactor::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributePowerFactorWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.PowerFactor 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 NeutralCurrent + */ +class ReadElectricalPowerMeasurementNeutralCurrent : public ReadAttribute { +public: + ReadElectricalPowerMeasurementNeutralCurrent() + : ReadAttribute("neutral-current") + { + } + + ~ReadElectricalPowerMeasurementNeutralCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NeutralCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeNeutralCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.NeutralCurrent response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement NeutralCurrent read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementNeutralCurrent : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementNeutralCurrent() + : SubscribeAttribute("neutral-current") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementNeutralCurrent() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NeutralCurrent::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 = [[MTRBaseClusterElectricalPowerMeasurement 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 subscribeAttributeNeutralCurrentWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.NeutralCurrent 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 ReadElectricalPowerMeasurementGeneratedCommandList : public ReadAttribute { +public: + ReadElectricalPowerMeasurementGeneratedCommandList() + : ReadAttribute("generated-command-list") + { + } + + ~ReadElectricalPowerMeasurementGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.GeneratedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement GeneratedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementGeneratedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementGeneratedCommandList() + : SubscribeAttribute("generated-command-list") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementGeneratedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement 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(@"ElectricalPowerMeasurement.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 ReadElectricalPowerMeasurementAcceptedCommandList : public ReadAttribute { +public: + ReadElectricalPowerMeasurementAcceptedCommandList() + : ReadAttribute("accepted-command-list") + { + } + + ~ReadElectricalPowerMeasurementAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.AcceptedCommandList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement AcceptedCommandList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementAcceptedCommandList : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementAcceptedCommandList() + : SubscribeAttribute("accepted-command-list") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementAcceptedCommandList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement 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(@"ElectricalPowerMeasurement.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 ReadElectricalPowerMeasurementEventList : public ReadAttribute { +public: + ReadElectricalPowerMeasurementEventList() + : ReadAttribute("event-list") + { + } + + ~ReadElectricalPowerMeasurementEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.EventList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement EventList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementEventList : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementEventList() + : SubscribeAttribute("event-list") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementEventList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement 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(@"ElectricalPowerMeasurement.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 ReadElectricalPowerMeasurementAttributeList : public ReadAttribute { +public: + ReadElectricalPowerMeasurementAttributeList() + : ReadAttribute("attribute-list") + { + } + + ~ReadElectricalPowerMeasurementAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.AttributeList response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement AttributeList read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementAttributeList : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementAttributeList() + : SubscribeAttribute("attribute-list") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementAttributeList() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement 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(@"ElectricalPowerMeasurement.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 ReadElectricalPowerMeasurementFeatureMap : public ReadAttribute { +public: + ReadElectricalPowerMeasurementFeatureMap() + : ReadAttribute("feature-map") + { + } + + ~ReadElectricalPowerMeasurementFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.FeatureMap response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement FeatureMap read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementFeatureMap : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementFeatureMap() + : SubscribeAttribute("feature-map") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementFeatureMap() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement 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(@"ElectricalPowerMeasurement.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 ReadElectricalPowerMeasurementClusterRevision : public ReadAttribute { +public: + ReadElectricalPowerMeasurementClusterRevision() + : ReadAttribute("cluster-revision") + { + } + + ~ReadElectricalPowerMeasurementClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalPowerMeasurement.ClusterRevision response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalPowerMeasurement ClusterRevision read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalPowerMeasurementClusterRevision : public SubscribeAttribute { +public: + SubscribeAttributeElectricalPowerMeasurementClusterRevision() + : SubscribeAttribute("cluster-revision") + { + } + + ~SubscribeAttributeElectricalPowerMeasurementClusterRevision() + { + } + + CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override + { + constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; + constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::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 = [[MTRBaseClusterElectricalPowerMeasurement 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(@"ElectricalPowerMeasurement.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 @@ -76040,6 +78204,7 @@ class SubscribeAttributeValveConfigurationAndControlClusterRevision : public Sub | * CumulativeEnergyExported | 0x0002 | | * PeriodicEnergyImported | 0x0003 | | * PeriodicEnergyExported | 0x0004 | +| * CumulativeEnergyReset | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -76479,6 +78644,91 @@ class SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyExported : publ #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL +/* + * Attribute CumulativeEnergyReset + */ +class ReadElectricalEnergyMeasurementCumulativeEnergyReset : public ReadAttribute { +public: + ReadElectricalEnergyMeasurementCumulativeEnergyReset() + : ReadAttribute("cumulative-energy-reset") + { + } + + ~ReadElectricalEnergyMeasurementCumulativeEnergyReset() + { + } + + 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::CumulativeEnergyReset::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 readAttributeCumulativeEnergyResetWithCompletion:^(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyReset response %@", [value description]); + if (error == nil) { + RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); + } else { + LogNSError("ElectricalEnergyMeasurement CumulativeEnergyReset read Error", error); + RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); + } + SetCommandExitStatus(error); + }]; + return CHIP_NO_ERROR; + } +}; + +class SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyReset : public SubscribeAttribute { +public: + SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyReset() + : SubscribeAttribute("cumulative-energy-reset") + { + } + + ~SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyReset() + { + } + + 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::CumulativeEnergyReset::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 subscribeAttributeCumulativeEnergyResetWithParams:params + subscriptionEstablished:^() { mSubscriptionEstablished = YES; } + reportHandler:^(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value, NSError * _Nullable error) { + NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyReset 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 */ @@ -183422,6 +185672,125 @@ void registerClusterValveConfigurationAndControl(Commands & commands) commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } +void registerClusterElectricalPowerMeasurement(Commands & commands) +{ +#if MTR_ENABLE_PROVISIONAL + using namespace chip::app::Clusters::ElectricalPowerMeasurement; + + const char * clusterName = "ElectricalPowerMeasurement"; + + 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 +#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 +#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 registerClusterElectricalEnergyMeasurement(Commands & commands) { #if MTR_ENABLE_PROVISIONAL @@ -183454,6 +185823,10 @@ void registerClusterElectricalEnergyMeasurement(Commands & commands) 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(), // @@ -187537,6 +189910,7 @@ void registerClusters(Commands & commands) registerClusterActivatedCarbonFilterMonitoring(commands); registerClusterBooleanStateConfiguration(commands); registerClusterValveConfigurationAndControl(commands); + registerClusterElectricalPowerMeasurement(commands); registerClusterElectricalEnergyMeasurement(commands); registerClusterDemandResponseLoadControl(commands); registerClusterMessages(commands);